1
This commit is contained in:
parent
2de46a9d1a
commit
c1363263b2
@ -287,7 +287,10 @@ export async function takePhotoFn(context) {
|
||||
console.log('拍照失败')
|
||||
return
|
||||
}
|
||||
console.log('takePhototakePhoto',JSON.stringify(data))
|
||||
const zdyz=globalThis.param854Str?Number(globalThis.param854Str):Number(param.zdyz)
|
||||
console.log('takePhototakePhoto',JSON.stringify(zdyz),)
|
||||
|
||||
if (Number(data.fileSize) <= (zdyz * 1000)) {
|
||||
map[key1] = true
|
||||
promptAction.showToast({
|
||||
|
||||
@ -33,7 +33,7 @@ const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
|
||||
|
||||
// const rtsp_server = record.createServer();
|
||||
|
||||
export async function startRecordVideo(param, td, context, dir, path?,index?) {
|
||||
export async function startRecordVideo(param, td, context, dir, path?, index?) {
|
||||
return new Promise(async (reslove, reject) => {
|
||||
// const fileUtil = new FileUtil(globalThis.context)
|
||||
// const date=dateFormat(new Date).split(' ')[0]
|
||||
@ -47,7 +47,7 @@ export async function startRecordVideo(param, td, context, dir, path?,index?) {
|
||||
if (!path) {
|
||||
fileName = `movie_record${num}.mp4`
|
||||
} else {
|
||||
fileName = `${path}_${index||num}.mp4`
|
||||
fileName = `${path}_${index || num}.mp4`
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
@ -99,20 +99,20 @@ export async function saveStartRecordVideo(path) {
|
||||
}
|
||||
for (let i = 1; i <= 4; i++) {
|
||||
if (param['videoRecord'+i]) {
|
||||
console.log('pathpath0',path)
|
||||
console.log('pathpath0', path)
|
||||
|
||||
record_handle[i] = await getfilehandleCode(i, param, date, path,i)
|
||||
record_handle[i] = await getfilehandleCode(i, param, date, path, i)
|
||||
}
|
||||
}
|
||||
reslove(record_handle)
|
||||
})
|
||||
}
|
||||
|
||||
async function getfilehandleCode(td, param, dir, path,index) {
|
||||
async function getfilehandleCode(td, param, dir, path, index) {
|
||||
return new Promise(async (reslove, reject) => {
|
||||
console.log('pathpath1',path)
|
||||
console.log('pathpath1', path)
|
||||
|
||||
const record_handle = await startRecordVideo(param, td, globalThis.context, dir, path,index)
|
||||
const record_handle = await startRecordVideo(param, td, globalThis.context, dir, path, index)
|
||||
// this.rocordHandleObj['rocord_handle'+td] = record_handle
|
||||
reslove(record_handle)
|
||||
})
|
||||
@ -120,7 +120,7 @@ async function getfilehandleCode(td, param, dir, path,index) {
|
||||
}
|
||||
|
||||
|
||||
export async function getUserAlbumItemByDisplayName(displayName: string,day?,type?): Promise<photoAccessHelper.Album> {
|
||||
export async function getUserAlbumItemByDisplayName(displayName: string, day?, type?): Promise<photoAccessHelper.Album> {
|
||||
let fetchResult = null
|
||||
let album: photoAccessHelper.Album = null
|
||||
try {
|
||||
@ -137,10 +137,10 @@ export async function getUserAlbumItemByDisplayName(displayName: string,day?,typ
|
||||
console.log('get getUserAlbumItemByDisplayName, count: ' + JSON.stringify(fetchResult));
|
||||
if (fetchResult.getCount() > 0) {
|
||||
const albums = await fetchResult.getLastObject();
|
||||
console.log('get getUserAlbumItemByDisplayName album111',albums.albumName)
|
||||
console.log('get getUserAlbumItemByDisplayName album111', albums.albumName)
|
||||
|
||||
if(isSevenDaysAgo(albums.albumName,day)){
|
||||
deleteAllFileByPiC(albums.albumName,type)
|
||||
if (isSevenDaysAgo(albums.albumName, day)) {
|
||||
deleteAllFileByPiC(albums.albumName, type)
|
||||
}
|
||||
console.log('get getUserAlbumItemByDisplayName album',)
|
||||
}
|
||||
@ -178,8 +178,33 @@ interface takePhotoParam {
|
||||
*/
|
||||
const fileHelper = new FileHelper();
|
||||
|
||||
export async function takePhoto(param, context, dir, flag = 1, callback?) {
|
||||
export async function delPic(day,type) {
|
||||
let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(globalThis.context);
|
||||
console.info('albumGetAssetsDemoCallback');
|
||||
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
||||
let albumFetchOptions: photoAccessHelper.FetchOptions = {
|
||||
fetchColumns: [],
|
||||
predicates: predicates
|
||||
};
|
||||
let fetchOption: photoAccessHelper.FetchOptions = {
|
||||
fetchColumns: [],
|
||||
predicates: predicates
|
||||
};
|
||||
let albumList: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions);
|
||||
let albums = await albumList.getAllObjects();
|
||||
for(let i=0;i<=albums.length;i++){
|
||||
let albumName=albums[i].albumName
|
||||
console.log('albumNamealbumName',albumName)
|
||||
if (isSevenDaysAgo(albumName, day)&&albumName!='jt'&&albumName!='pz') {
|
||||
deleteAllFileByPiC(albums.albumName, type)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
export async function takePhoto(param, context, dir, flag = 1, callback?) {
|
||||
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
|
||||
// var video_uri = `rtsp://admin:openharmony1@192.168.1.66:554/Streaming/Channels/3`;
|
||||
|
||||
@ -195,26 +220,31 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
|
||||
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize);
|
||||
callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode })
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
console.log('baoyihubaoyihu1', video_uri, flag)
|
||||
return new Promise<takePhotoParam>(async (resolve, reject) => {
|
||||
const time = await getCurrentTime()
|
||||
const date = time.split(' ')[0]
|
||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName, date, true, (err, snapResult) => {
|
||||
await fileHelper.createAlbum(date)
|
||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName, '/jt', true, (err, snapResult) => {
|
||||
console.log('baoyihubaoyihu', video_uri, flag, JSON.stringify(snapResult))
|
||||
console.log('getPhtot', JSON.stringify(snapResult))
|
||||
resolve({
|
||||
base64: snapResult.dataString,
|
||||
name: snapResult.fileName,
|
||||
fileSize: snapResult.fileSize,
|
||||
errorCode: snapResult.errorCode
|
||||
})
|
||||
if(snapResult.result&&snapResult.errorCode==0){
|
||||
resolve({
|
||||
base64: snapResult.dataString,
|
||||
name: snapResult.fileName,
|
||||
fileSize: snapResult.fileSize,
|
||||
errorCode: snapResult.errorCode
|
||||
})
|
||||
}else{
|
||||
takePhoto(param, context, dir, flag, callback)
|
||||
|
||||
// reject()
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
console.log('getmyLog02')
|
||||
|
||||
}
|
||||
console.log('getmyLog03')
|
||||
|
||||
|
||||
@ -78,19 +78,24 @@ export default class FileUtil{
|
||||
* @desc 创建或者编辑文件
|
||||
*
|
||||
*/
|
||||
public openFileSync=async(filePath)=>{
|
||||
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode
|
||||
let file = fs.openSync(filePath, READ_WRITE | APPEND |CREATE);
|
||||
return file
|
||||
}
|
||||
|
||||
public editFileWidthOutOpen(file,content){
|
||||
const newStr = content + '\n'
|
||||
fs.writeSync(file.fd,newStr)
|
||||
fs.closeSync(file)
|
||||
console.error(LOGTAG,'写入文件成功')
|
||||
}
|
||||
|
||||
|
||||
public editFile = async (filePath:string,content:string,type?:string)=>{
|
||||
const { READ_WRITE,CREATE,APPEND }= fs.OpenMode
|
||||
try {
|
||||
let file = fs.openSync(filePath, READ_WRITE | APPEND |CREATE);
|
||||
let index
|
||||
// if(type=='overWrite'){
|
||||
// //文件覆蓋
|
||||
// index=0
|
||||
// }else{
|
||||
// //文件追加
|
||||
// const str = fs.readTextSync(filePath);
|
||||
// index= str.length
|
||||
// }
|
||||
const newStr = content + '\n'
|
||||
//追加写入文件
|
||||
fs.writeSync(file.fd,newStr)
|
||||
|
||||
@ -61,6 +61,7 @@ export default class GetDistance {
|
||||
setInterval(()=>{
|
||||
const { carId } = globalThis.carInfo;
|
||||
const {date,timeStr,totalDistance}= this;
|
||||
return
|
||||
//"carid":"1001","startTime":"2024-08-24 08:09:01","time":"111233", "mileage":"1222"
|
||||
uploadHarmonyLiCheng({
|
||||
carid:carId,
|
||||
|
||||
@ -3,7 +3,7 @@ import { getSyncData } from '../service/initable';
|
||||
import hilog from '@ohos.hilog';
|
||||
import FileUtil from '../../common/utils/File'
|
||||
import { GlobalConfig } from '../../config/index'
|
||||
export async function getTCP() {
|
||||
export async function getTCP(flag=false) {
|
||||
const fileUtil = new FileUtil(globalThis.context)
|
||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
||||
if (data === '' || data === undefined) {
|
||||
@ -12,7 +12,7 @@ export async function getTCP() {
|
||||
}
|
||||
}else{
|
||||
const result=JSON.parse(data)
|
||||
if (globalThis.TcpClient && globalThis.TcpClient.closeTcp) {
|
||||
if (globalThis.TcpClient && globalThis.TcpClient.closeTcp&&!flag) {
|
||||
globalThis.TcpClient.closeTcp(async () => {
|
||||
// const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
// globalThis.TcpClient = tcpClient
|
||||
|
||||
@ -33,6 +33,8 @@ export default class TcpClient {
|
||||
// time:dateFormat(new Date()),
|
||||
// PLC:`${TAG} tcpOnerror ${JSON.stringify(err)}`,
|
||||
// })
|
||||
globalThis.getCloseTcp = true
|
||||
|
||||
this.writeLog({
|
||||
time:dateFormat(new Date()),
|
||||
message: `${TAG} tcponerror localIp${JSON.stringify(err)}`,
|
||||
@ -62,6 +64,9 @@ export default class TcpClient {
|
||||
time:dateFormat(new Date()),
|
||||
message: `${TAG} tcprebind tcpreBinderror${JSON.stringify(err)}`,
|
||||
})
|
||||
setTimeout(async () => {
|
||||
getTCP()
|
||||
}, 2000)
|
||||
// globalThis.getCloseTcp = true
|
||||
hilog.info(0x0000, 'testTag', "tcpreBinderror:" + JSON.stringify(err));
|
||||
resolve(true)
|
||||
@ -104,13 +109,14 @@ export default class TcpClient {
|
||||
time:dateFormat(new Date()),
|
||||
message: `${TAG} tcpbind error ${JSON.stringify(err)}`,
|
||||
})
|
||||
setTimeout(async () => {
|
||||
getTCP()
|
||||
}, 2000)
|
||||
console.log('testTag tcp bind faile');
|
||||
// globalThis.getCloseTcp = true
|
||||
hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
|
||||
resolve(true)
|
||||
return
|
||||
}
|
||||
// globalThis.getCloseTcp = false
|
||||
console.log('testTag tcp bind success');
|
||||
// this.writeLog({
|
||||
// time:dateFormat(new Date()),
|
||||
@ -152,13 +158,12 @@ export default class TcpClient {
|
||||
time:dateFormat(new Date()),
|
||||
message: `${TAG} TCPconnect error ${JSON.stringify(err)}`,
|
||||
})
|
||||
|
||||
// this.writeLog({
|
||||
// time:dateFormat(new Date()),
|
||||
// PLC:`${TAG} tcp connect rebind success`,
|
||||
// })
|
||||
if(this.num>3){
|
||||
return
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.writeLog({
|
||||
time:dateFormat(new Date()),
|
||||
@ -166,7 +171,7 @@ export default class TcpClient {
|
||||
})
|
||||
getTCP()
|
||||
resolve(false)
|
||||
}, 2000)
|
||||
}, 9000)
|
||||
return;
|
||||
}
|
||||
});
|
||||
@ -180,14 +185,11 @@ export default class TcpClient {
|
||||
message: `${TAG} TCPconnect error2 ${JSON.stringify(err)}`,
|
||||
})
|
||||
// globalThis.getCloseTcp = true
|
||||
this.num++
|
||||
if(this.num>3){
|
||||
return
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
getTCP()
|
||||
resolve(false)
|
||||
}, 2000)
|
||||
}, 9000)
|
||||
// this.writeLog({
|
||||
// time:dateFormat(new Date()),
|
||||
// PLC:`${TAG} tcp connect error`,
|
||||
@ -205,10 +207,11 @@ export default class TcpClient {
|
||||
promise.then(() => {
|
||||
reslove(true)
|
||||
}).catch(err => {
|
||||
this.writeLog({
|
||||
time:dateFormat(new Date()),
|
||||
message: `${TAG} TCPsend error ${JSON.stringify(err)}`,
|
||||
})
|
||||
console.log(`${TAG} TCPsend error ${JSON.stringify(err)}`)
|
||||
// this.writeLog({
|
||||
// time:dateFormat(new Date()),
|
||||
// message: `${TAG} TCPsend error ${JSON.stringify(err)}`,
|
||||
// })
|
||||
reslove(false)
|
||||
});
|
||||
})
|
||||
@ -222,10 +225,7 @@ export default class TcpClient {
|
||||
// })
|
||||
console.log(TAG, 'Tcponmessage', value)
|
||||
globalThis.tcpUdpError = false
|
||||
this.writeLog({
|
||||
time:dateFormat(new Date()),
|
||||
message: `${TAG} Tcponmessage ,${value}`,
|
||||
})
|
||||
|
||||
// console.log('messageLengt',,value.message.length))
|
||||
console.log('testTagtcpmsg')
|
||||
// console.log("on message, message:" + value.message+ ", remoteInfo:" )
|
||||
@ -275,7 +275,6 @@ export default class TcpClient {
|
||||
}
|
||||
|
||||
closeTcp(callback) {
|
||||
|
||||
return new Promise((reslove, reject) => {
|
||||
console.log(TAG, 'tcpClose')
|
||||
let promise = this.tcp.close();
|
||||
@ -289,6 +288,9 @@ export default class TcpClient {
|
||||
callback()
|
||||
reslove(true)
|
||||
}).catch(err => {
|
||||
setTimeout(async () => {
|
||||
getTCP(true)
|
||||
}, 9000)
|
||||
this.writeLog({
|
||||
time:dateFormat(new Date()),
|
||||
message: `${TAG} tcpclose error ${JSON.stringify(err)}`,
|
||||
|
||||
@ -30,6 +30,8 @@ export default class EntryAbility extends UIAbility {
|
||||
globalThis.deviceNo = '';
|
||||
globalThis.hasAuth = false
|
||||
|
||||
// globalThis.judgeVersion ='2024.08.24.1'
|
||||
// globalThis.version ='2023.12.13.01';
|
||||
globalThis.version = GlobalConfig.version.jn.km3[0];
|
||||
globalThis.judgeVersion = GlobalConfig.version.jn.km3[1];
|
||||
|
||||
|
||||
@ -313,8 +313,26 @@ export default struct Index {
|
||||
this.getCheckList()
|
||||
return
|
||||
}
|
||||
|
||||
console.log('this.index',index,)
|
||||
that.passArray[index]=true
|
||||
that.warnFlag[index]='2'
|
||||
if(index==2){
|
||||
let flag=false
|
||||
console.log('globalThis.spzd[key]',globalThis.spzd)
|
||||
|
||||
for(let key in globalThis.spzd){
|
||||
console.log('globalThis.spzd[key]',globalThis.spzd[key])
|
||||
if(globalThis.spzd[key]){
|
||||
that.warnFlag[index]='1'
|
||||
flag=true
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
that.warnFlag[index]='2'
|
||||
}
|
||||
}else{
|
||||
that.warnFlag[index]='2'
|
||||
}
|
||||
that.passArray=JSON.parse(JSON.stringify(that.passArray))
|
||||
that.warnFlag=JSON.parse(JSON.stringify(that.warnFlag))
|
||||
index++
|
||||
|
||||
@ -23,8 +23,7 @@ import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||
import { initJudgeUdp } from '../common/utils/UdpJudge';
|
||||
import errorMsgDialog from './compontents/errorMsgDialog'
|
||||
import { delHilog } from '../common/service/indexService';
|
||||
import { deleteAllFileByPiC, getUserAlbumItemByDisplayName } from '../common/service/videoService';
|
||||
import { delPic } from '../common/service/videoService';
|
||||
import { getCurrentHourTime } from '../common/utils/tools';
|
||||
@Entry
|
||||
@Component
|
||||
@ -489,8 +488,8 @@ struct UserInfo {
|
||||
}
|
||||
console.log('Param305Str',that.systemParam.Param305Str)
|
||||
// delHilog(this.Param305Str)
|
||||
getUserAlbumItemByDisplayName('', that.systemParam.Param305Str,1)
|
||||
getUserAlbumItemByDisplayName('',that.systemParam.Param305Str,2)
|
||||
delPic(that.systemParam.Param305Str,1)
|
||||
delPic(that.systemParam.Param305Str,2)
|
||||
}
|
||||
})
|
||||
|
||||
@ -879,6 +878,11 @@ struct UserInfo {
|
||||
const date = new Date()
|
||||
globalThis.startHourTime = await getCurrentHourTime()
|
||||
const photoBase64 = await this.getPhoto();
|
||||
if(photoBase64==''){
|
||||
this.ksksLimit=false
|
||||
this.isLoadingPopupVisible=false
|
||||
return
|
||||
}
|
||||
const drvexam = {
|
||||
lsh: this.currentUser.lsh || '',
|
||||
kskm: examSubject,
|
||||
|
||||
@ -44,7 +44,7 @@ export default class FilePhoto{
|
||||
return res.base64
|
||||
} catch (e) {
|
||||
promptAction.showToast({
|
||||
message: '拍照异常' + JSON.stringify(e),
|
||||
message: '拍照异常,请重新' + JSON.stringify(e),
|
||||
duration: 2000
|
||||
});
|
||||
return ''
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
//考试回放开关
|
||||
export const judgeConfig = {
|
||||
//本地目录开关
|
||||
@ -9,7 +8,6 @@ export const judgeConfig = {
|
||||
kfVoiceOpen: false,
|
||||
//忽略的考试项目
|
||||
ignoreProjects:[],
|
||||
|
||||
// 是否忽略考试前熄火、车门检查
|
||||
isCheckFireOpen: true,
|
||||
//轨迹回放是否开启Udp
|
||||
@ -17,14 +15,12 @@ export const judgeConfig = {
|
||||
// 本地模型地址
|
||||
modelPath: 'models/model_enc',
|
||||
// 济南科目三
|
||||
trajectoryPath: 'logs/2024_12_05/2024_12_05_14_35_24_0000000000000_342323199501470011_测试学员1/judge_exam_data.txt',
|
||||
trajectoryPath: 'logs/2024_12_20/2024_12_20_15_10_30_9999920215968_355757250887519616_段士婕/judge_exam_data.txt',
|
||||
//四合一画面配置
|
||||
fourInOneScreen:{
|
||||
//gps位数
|
||||
gpsDigit:6
|
||||
},
|
||||
//后置机类型 0=>三代机 1=>一体机 2=>二代机
|
||||
rearEndUnitsType:0,
|
||||
// 杭州科目二
|
||||
// trajectoryPath: 'logs/2024_07_19/0000000000001_342323199501470011_测试学员1_2024_07_19_06_49_12/judge_exam_data.txt',
|
||||
//TODO 济南临时特殊配置
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user