Compare commits
2 Commits
4f93ec0c9a
...
4e3c3bf465
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e3c3bf465 | ||
|
|
6930e9afc3 |
@ -5,9 +5,9 @@
|
||||
"name": "default",
|
||||
"material": {
|
||||
"certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.cer",
|
||||
"storePassword": "0000001AC0C49320C84ECD6C7BA0119428C66297EAF08E5011B23EBA83794F0FA803077D0F4848203ADD",
|
||||
"storePassword": "0000001A1173A56391B52980E84237B06A106777310E419AF46EBEB63A7D126BCA0F5657D119081FE3C9",
|
||||
"keyAlias": "debugKey",
|
||||
"keyPassword": "0000001A7A1DB8B37DA86FBA8DBDDE9B6E4DC5801A351175FB4980E662677BB08D6E02D623FAD2EB993B",
|
||||
"keyPassword": "0000001A5FF060362EBE093828B7604C511B827EB8C93BAD85C9745AA07A084FBAEB8687CC941F8CC0B7",
|
||||
"profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.p7b",
|
||||
"signAlg": "SHA256withECDSA",
|
||||
"storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.p12"
|
||||
|
||||
@ -284,50 +284,57 @@ export async function takePhotoFn(context) {
|
||||
}
|
||||
|
||||
let fd
|
||||
const devPath="/dev/ttyS1"
|
||||
const devPath = "/dev/ttyS1"
|
||||
|
||||
async function openChuankouFn() {
|
||||
fd =await testNapi.SerialOpen(devPath);
|
||||
globalThis.fd=fd
|
||||
console.log('chuankoufd',globalThis.fd)
|
||||
fd = await testNapi.SerialOpen(devPath);
|
||||
globalThis.fd = fd
|
||||
console.log('chuankoufd', globalThis.fd)
|
||||
|
||||
// let parity = 0x4e; // 'N'
|
||||
let ret =await testNapi.SerialSet(fd, 115200,0, 8, 1, 0)
|
||||
console.log('daihairet',ret)
|
||||
let ret = await testNapi.SerialSet(fd, 115200, 0, 8, 1, 0)
|
||||
console.log('daihairet', ret)
|
||||
}
|
||||
|
||||
async function getChuankouFnMsg() {
|
||||
let timeout = 5000; // 2秒超时
|
||||
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
|
||||
let uint8Arr = new Uint8Array(databuff);
|
||||
console.log('daihai',globalThis.fd)
|
||||
console.log('daihai', globalThis.fd)
|
||||
let ret = await testNapi.SerialSend(globalThis.fd, uint8Arr);
|
||||
console.log('daihai SerialSend ret: ' + ret)
|
||||
|
||||
|
||||
testNapi.SerialRecv(globalThis.fd, timeout,12).then(revTestInfo=>{
|
||||
console.log('daihai',revTestInfo?.recevedBuf?.toString())
|
||||
const message = revTestInfo?.recevedBuf?.toString()
|
||||
testNapi.SerialRecv(globalThis.fd, timeout, 12).then(revTestInfo => {
|
||||
console.log('daihai', revTestInfo?.recevedBuf?.toString())
|
||||
const message = revTestInfo?.recevedBuf?.toString()
|
||||
console.log("chuankou xinxi",message)
|
||||
if (message == '') {
|
||||
return
|
||||
}
|
||||
const msg = message?.split(',')
|
||||
if(!msg?.length){
|
||||
if (!msg?.length) {
|
||||
return
|
||||
}
|
||||
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
return
|
||||
}
|
||||
globalThis.chuankoMsg=msg[9]
|
||||
}).catch((err)=>{
|
||||
console.log('daihaierror',JSON.stringify(err))
|
||||
console.log("chuankou 档位", msg[9])
|
||||
if(msg[9]==0||msg[9]==1||msg[9]==2||msg[9]==3||msg[9]==4||msg[9]==5){
|
||||
globalThis.chuankoMsg = msg[9]
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log('daihaierror', JSON.stringify(err))
|
||||
})
|
||||
}
|
||||
export async function getChuankouFn(){
|
||||
if(globalThis.fd){
|
||||
|
||||
export async function getChuankouFn() {
|
||||
if (!globalThis.fd) {
|
||||
console.log("chuankou 没有fd")
|
||||
openChuankouFn()
|
||||
return
|
||||
}
|
||||
openChuankouFn()
|
||||
setInterval(()=>{
|
||||
getChuankouFnMsg()
|
||||
},1000)
|
||||
console.log("chuankou 定时器")
|
||||
getChuankouFnMsg()
|
||||
|
||||
}
|
||||
|
||||
@ -6,13 +6,13 @@ import fs from '@ohos.file.fs'
|
||||
import photoAccessHelper from '@ohos.file.photoAccessHelper'
|
||||
import dataSharePredicates from '@ohos.data.dataSharePredicates'
|
||||
import { dateFormat, getCurrentTime } from '../utils/tools'
|
||||
import rtsp_server from '@ohos.rtsprecord';
|
||||
import record from '@ohos.rtsprecord';
|
||||
// import record from '@ohos.rtsprecord';
|
||||
import { FileHelper } from './FileHelper';
|
||||
import FileUtil from '../utils/File';
|
||||
import { GlobalConfig } from '../../config';
|
||||
|
||||
// const rtsp_server = record.createServer();
|
||||
const rtsp_server = record.createServer();
|
||||
//开始录屏
|
||||
const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
|
||||
photoAccessHelper.PhotoKeys.PHOTO_TYPE,
|
||||
@ -30,6 +30,7 @@ const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
|
||||
photoAccessHelper.PhotoKeys.POSITION,
|
||||
photoAccessHelper.PhotoKeys.DATE_TRASHED,
|
||||
photoAccessHelper.PhotoKeys.HIDDEN];
|
||||
|
||||
// const rtsp_server = record.createServer();
|
||||
|
||||
export async function saveStartRecordVideo(path) {
|
||||
@ -57,6 +58,7 @@ export async function saveStartRecordVideo(path) {
|
||||
reslove(record_handle)
|
||||
})
|
||||
}
|
||||
|
||||
async function getfilehandleCode(td, param, dir, path, index) {
|
||||
return new Promise(async (reslove, reject) => {
|
||||
console.log('pathpath1', path)
|
||||
@ -67,8 +69,9 @@ async function getfilehandleCode(td, param, dir, path, index) {
|
||||
})
|
||||
|
||||
}
|
||||
export async function startRecordVideo(param?, td?, context?, dir?,path?,index?) {
|
||||
return new Promise(async(reslove, reject) => {
|
||||
|
||||
export async function startRecordVideo(param?, td?, context?, dir?, path?, index?) {
|
||||
return new Promise(async (reslove, reject) => {
|
||||
|
||||
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
|
||||
if (rtsp_server != null) {
|
||||
@ -113,17 +116,19 @@ export async function endRecordVideo(record_handleObj) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*拍照
|
||||
* @param param
|
||||
* @param context
|
||||
* @param type=0不获取base64
|
||||
*/
|
||||
interface takePhotoParam {
|
||||
name?:string,
|
||||
base64?:string,
|
||||
fileSize?:number,
|
||||
interface takePhotoParam {
|
||||
name?: string,
|
||||
base64?: string,
|
||||
fileSize?: number,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param
|
||||
@ -134,7 +139,8 @@ interface takePhotoParam {
|
||||
* @returns
|
||||
*/
|
||||
const fileHelper = new FileHelper();
|
||||
export async function takePhoto(param, context,dir,flag=1,callback?) {
|
||||
|
||||
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`;
|
||||
@ -146,11 +152,11 @@ export async function takePhoto(param, context,dir,flag=1,callback?) {
|
||||
console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName:` + fileName);
|
||||
// @ts-ignore
|
||||
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
|
||||
if(flag==0){
|
||||
if (flag == 0) {
|
||||
// @ts-ignore
|
||||
rtsp_server.detectVideoSnapshotSize(video_uri,fileName).then((snapResult)=>{
|
||||
console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize);
|
||||
callback({fileSize:snapResult.fileSize })
|
||||
rtsp_server.detectVideoSnapshotSize(video_uri, fileName).then((snapResult) => {
|
||||
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize);
|
||||
callback({ fileSize: snapResult.fileSize })
|
||||
});
|
||||
// rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,false,(err,snapResult)=>{
|
||||
// console.log(`baoyihu getVideoSnapshot return `);
|
||||
@ -161,29 +167,26 @@ export async function takePhoto(param, context,dir,flag=1,callback?) {
|
||||
// callback({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
|
||||
// console.log('getmyLog01')
|
||||
// });
|
||||
}
|
||||
else{
|
||||
return new Promise<takePhotoParam>((resolve,reject)=>{
|
||||
} else {
|
||||
return new Promise<takePhotoParam>((resolve, reject) => {
|
||||
// @ts-ignore
|
||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(snapResult,err)=>{
|
||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName, dir, true, (err, snapResult) => {
|
||||
console.log('getPhtot')
|
||||
resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
|
||||
resolve({ base64: snapResult.dataString, name: snapResult.fileName, fileSize: snapResult.fileSize })
|
||||
});
|
||||
})
|
||||
console.log('getmyLog02')
|
||||
|
||||
}
|
||||
console.log('getmyLog03')
|
||||
|
||||
|
||||
}
|
||||
|
||||
export async function deleteAllFileByPiC(dirName) {
|
||||
// const fileHelper = new FileHelper();
|
||||
fileHelper.deleteFileOfAlbum(dirName,1);
|
||||
fileHelper.deleteFileOfAlbum(dirName, 1);
|
||||
}
|
||||
|
||||
export async function deleteAllVideos(context,type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
||||
export async function deleteAllVideos(context, type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
||||
let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = null;
|
||||
try {
|
||||
const userFileMgr = photoAccessHelper.getPhotoAccessHelper(context);
|
||||
|
||||
@ -36,6 +36,7 @@ export default class UdpClient {
|
||||
this.oppositeIp = udpOppositeIp
|
||||
this.localIpPort = udplocalIpPort
|
||||
this.oppositeIpPort = udpOppositeIpPort
|
||||
console.log("chuankou 初始化",)
|
||||
getChuankouFn()
|
||||
console.log(TAG,'newUdp')
|
||||
// this.stashFn=()=>{}
|
||||
|
||||
@ -164,7 +164,7 @@ async function xmlToJson(result, url) {
|
||||
let res = deeml(xmlArr);
|
||||
console.log("xmlToJson end",JSON.stringify(res) );
|
||||
resolve(res)
|
||||
}, 100)
|
||||
}, 10000)
|
||||
} else {
|
||||
let res = deeml(xmlArr);
|
||||
console.log("xmlToJson end",JSON.stringify(res) );
|
||||
|
||||
@ -33,6 +33,7 @@ import FileUtil from '../common/utils/File';
|
||||
import SignDisplayCom from './compontents/signDisplayCom';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import { voiceService } from '../common/service/voiceService';
|
||||
import { getChuankouFn } from '../common/service/indexService';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@ -42,6 +43,11 @@ struct Index {
|
||||
}
|
||||
|
||||
async aboutToAppear() {
|
||||
getChuankouFn()
|
||||
setInterval(() => {
|
||||
console.log("chuankou 定时器2")
|
||||
getChuankouFn()
|
||||
}, 1000)
|
||||
globalThis.windowClass.setWindowSystemBarEnable([])
|
||||
const time = await getCurrentTime()
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@ import { GPSData, SignalData } from '../../mock';
|
||||
import { SignalDataType } from '../../model';
|
||||
import FileUtil from '../../common/utils/File'
|
||||
import { GlobalConfig } from '../../config/index'
|
||||
import { getChuankouFn } from '../../common/service/indexService';
|
||||
|
||||
@Component
|
||||
export default struct SignDisplayCom {
|
||||
@State showBack: boolean = false
|
||||
@ -322,10 +324,14 @@ export default struct SignDisplayCom {
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
clearInterval(this.interval)
|
||||
// clearInterval(this.interval)
|
||||
}
|
||||
|
||||
async aboutToAppear() {
|
||||
setInterval(() => {
|
||||
console.log("chuankou 定时器2")
|
||||
getChuankouFn()
|
||||
}, 1000)
|
||||
// const fileUtil = new FileUtil(globalThis.context)
|
||||
// const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt')
|
||||
// this.udplocalIp=JSON.parse(data)?.udplocalIp||'192.168.7.170'
|
||||
@ -360,20 +366,20 @@ export default struct SignDisplayCom {
|
||||
const getSignal = this.getSignal;
|
||||
const that = this
|
||||
const showBack = this.showBack;
|
||||
if (showBack) {
|
||||
globalThis.udpClient.onMessage_1&&globalThis.udpClient.onMessage_1((msg) => {
|
||||
console.log('getUDPonMessage_1bysignDisplay2', msg)
|
||||
|
||||
getSignal(msg)
|
||||
})
|
||||
} else {
|
||||
clearInterval(globalThis.signalTimer)
|
||||
globalThis.signalTimer = setInterval(() => {
|
||||
//TODO 临时方案
|
||||
const msgStr = globalThis.msgStr
|
||||
getSignal(msgStr)
|
||||
}, 200)
|
||||
}
|
||||
// if (showBack) {
|
||||
// globalThis.udpClient.onMessage_1&&globalThis.udpClient.onMessage_1((msg) => {
|
||||
// console.log('getUDPonMessage_1bysignDisplay2', msg)
|
||||
//
|
||||
// getSignal(msg)
|
||||
// })
|
||||
// } else {
|
||||
// clearInterval(globalThis.signalTimer)
|
||||
// globalThis.signalTimer = setInterval(() => {
|
||||
// //TODO 临时方案
|
||||
// const msgStr = globalThis.msgStr
|
||||
// getSignal(msgStr)
|
||||
// }, 200)
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
//考试回放开关
|
||||
export const judgeConfig = {
|
||||
version:'2024.08.21.01',
|
||||
version: '2024.08.21.01',
|
||||
//本地目录开关
|
||||
isTrajectoryOpen: false,
|
||||
//是否开启拍照
|
||||
@ -8,22 +8,22 @@ export const judgeConfig = {
|
||||
//扣分语音是否强制开启
|
||||
kfVoiceOpen: false,
|
||||
//忽略的考试项目
|
||||
ignoreProjects:[],
|
||||
ignoreProjects: [],
|
||||
// 是否忽略考试前熄火、车门检查
|
||||
isCheckFireOpen: false,
|
||||
//轨迹回放是否开启Udp
|
||||
udpOpen:true,
|
||||
udpOpen: true,
|
||||
// 本地模型地址
|
||||
// modelPath: 'models/model_enc',
|
||||
// 济南科目三
|
||||
trajectoryPath: 'logs/2025_04_23_09_50_55_2504755332926_320924199111132926_陈静/judge_exam_data.txt',
|
||||
trajectoryPath: 'logs/2024_10_12_11_50_10_9999427676823_744299437502336256_隋统/judge_exam_data.txt',
|
||||
//四合一画面配置
|
||||
fourInOneScreen:{
|
||||
fourInOneScreen: {
|
||||
//gps位数
|
||||
gpsDigit:7
|
||||
gpsDigit: 7
|
||||
},
|
||||
// 杭州科目二
|
||||
// trajectoryPath: 'logs/2024_07_19/0000000000001_342323199501470011_测试学员1_2024_07_19_06_49_12/judge_exam_data.txt',
|
||||
//TODO 济南临时特殊配置
|
||||
systemParamConfig:{}
|
||||
systemParamConfig: {}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user