Compare commits
No commits in common. "e65c48f1ebecb9ce14b84f185882deea3cba20f7" and "b9a69d2d84d1bb421853fbbf73d679e683c4c24f" have entirely different histories.
e65c48f1eb
...
b9a69d2d84
@ -260,77 +260,46 @@ export async function takePhotoFn(context) {
|
||||
let fd
|
||||
const devPath="/dev/ttyS3"
|
||||
function openChuankouFn() {
|
||||
console.log('SerialOpen in indexservice, path=' + devPath)
|
||||
fd = testNapi.SerialOpen(devPath);
|
||||
globalThis.num=0
|
||||
globalThis.fd=fd
|
||||
console.log('fdfd1111',globalThis.fd)
|
||||
|
||||
let parity = 0x4e; // 'N'
|
||||
let ret = testNapi.SerialSet(globalThis.fd, 115200, 0, 8, 1, parity);
|
||||
}
|
||||
|
||||
function getChuankouFnMsg() {
|
||||
let timeout = 50000; // 2秒超时
|
||||
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
|
||||
console.log('fdfd',globalThis.fd)
|
||||
console.log('zzc 1 try send msg')
|
||||
testNapi.SerialSendAsync(globalThis.fd, databuff,(ret)=>{
|
||||
console.log('zzc 2 send finished')
|
||||
console.log('zzc 3 try receive msg')
|
||||
testNapi.SerialRecvAsync(globalThis.fd, timeout, (revTestInfo) => {
|
||||
console.log('zzc 4 received msg')
|
||||
let ret = testNapi.SerialSend(globalThis.fd, databuff);
|
||||
console.log('mmmm',ret)
|
||||
let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
|
||||
|
||||
console.log('revTestInfo',revTestInfo.recevedBuf.length)
|
||||
|
||||
const message = revTestInfo?.recevedBuf?.toString()
|
||||
console.log('chuankou',message)
|
||||
if (message == '') {
|
||||
console.log('zzc error msg is emptry')
|
||||
globalThis.num=1
|
||||
console.log('zzc 9 num=3 close serial')
|
||||
// clearInterval(chuankou)
|
||||
testNapi.SerialClose(globalThis.fd);
|
||||
globalThis.fd=null
|
||||
getChuankouFn()
|
||||
return
|
||||
}
|
||||
const msg = message?.split(',')
|
||||
if(!msg?.length){
|
||||
|
||||
} else if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
|
||||
} else if(msg.length<12){
|
||||
|
||||
} else {
|
||||
return
|
||||
}
|
||||
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
return
|
||||
}
|
||||
globalThis.chuankoMsg=msg[9]
|
||||
}
|
||||
|
||||
console.log('zzc 5 sleep 1s')
|
||||
setTimeout(()=>{
|
||||
console.log(`x=${globalThis.num}`)
|
||||
|
||||
console.log('zzc 7 send next msg')
|
||||
getChuankouFnMsg()
|
||||
},1000)
|
||||
|
||||
// hilog.info(0x0000, 'testTag', 'Test NAPI SerialRecvAsync callback in');
|
||||
// hilog.info(0x0000, 'testTag', 'Test NAPI SerialRecvAsync recevedLen = %{public}d', revTestInfo.recevedLen);
|
||||
// hilog.info(0x0000, 'testTag', 'Test NAPI SerialRecvAsync recevedBuf = %{public}s', revTestInfo.recevedBuf.toString());
|
||||
});
|
||||
|
||||
});
|
||||
// let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
|
||||
|
||||
}
|
||||
let chuankou
|
||||
export async function getChuankouFn(){
|
||||
if(globalThis.fd){
|
||||
return
|
||||
}
|
||||
openChuankouFn()
|
||||
// clearInterval(chuankou)
|
||||
// chuankou=setInterval(()=>{
|
||||
setInterval(()=>{
|
||||
getChuankouFnMsg()
|
||||
// },1000)
|
||||
},1000)
|
||||
|
||||
}
|
||||
@ -40,7 +40,6 @@ export async function getCarInfo() {
|
||||
// }, router.RouterMode.Single);
|
||||
}else {
|
||||
globalThis.carInfo=res.obtainCarExamInfoRsp.body
|
||||
console.log('globalThis.carInfo',JSON.stringify(globalThis.carInfo));
|
||||
// globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId
|
||||
globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo)
|
||||
}
|
||||
|
||||
@ -132,10 +132,10 @@ export async function takePhoto(param, context,dir,flag=1,callback?) {
|
||||
|
||||
|
||||
}
|
||||
//type:1 是图片 2是视频
|
||||
export async function deleteAllFileByPiC(dirName,type=1) {
|
||||
|
||||
export async function deleteAllFileByPiC(dirName) {
|
||||
// const fileHelper = new FileHelper();
|
||||
fileHelper.deleteFileOfAlbum(dirName,type);
|
||||
fileHelper.deleteFileOfAlbum(dirName,1);
|
||||
}
|
||||
|
||||
export async function deleteAllVideos(context,type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
||||
|
||||
@ -1,46 +1,27 @@
|
||||
import TcpClient from './TcpClient';
|
||||
import { getSyncData} from '../service/initable'
|
||||
import hilog from '@ohos.hilog';
|
||||
export async function getTCP(flag=false) {
|
||||
export async function getTCP() {
|
||||
|
||||
getSyncData('IpConfigTable').then(async (result:Array<any>)=>{
|
||||
console.log('result222',JSON.stringify(result))
|
||||
if(result.length){
|
||||
if(globalThis.TcpClient&&globalThis.TcpClient.closeTcp){
|
||||
if(!flag){
|
||||
return
|
||||
}
|
||||
globalThis.TcpClient.closeTcp(async ()=>{
|
||||
// const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
// globalThis.TcpClient = tcpClient
|
||||
|
||||
await globalThis.TcpClient.rebindTcp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
await globalThis.TcpClient.connectTcp()
|
||||
await globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
|
||||
await globalThis.TcpClient.sendMsg('1002')//1002
|
||||
globalThis.TcpClient.onError()
|
||||
await globalThis.TcpClient.onMessage((val)=>{
|
||||
hilog.info(0x0000, 'testTag', "valvalval1" + JSON.stringify(val));
|
||||
|
||||
// console.log('valvalval',val)
|
||||
setTimeout(()=>{
|
||||
globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
|
||||
if(val&&globalThis.udpClient&&globalThis.udpClient.sendMsg){
|
||||
// const msg=val.substring(5,val.length-1)
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
},1000)
|
||||
|
||||
})
|
||||
globalThis.TcpClient.onError(async()=>{
|
||||
await globalThis.TcpClient.rebindTcp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
await globalThis.TcpClient.connectTcp()
|
||||
await globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
|
||||
await globalThis.TcpClient.onMessage((val)=>{
|
||||
hilog.info(0x0000, 'testTag', "valvalval1" + JSON.stringify(val));
|
||||
|
||||
// console.log('valvalval',val)
|
||||
setTimeout(()=>{
|
||||
globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
|
||||
if(val&&globalThis.udpClient&&globalThis.udpClient.sendMsg){
|
||||
globalThis.TcpClient.sendMsg('1002')//1002
|
||||
if(val){
|
||||
// const msg=val.substring(5,val.length-1)
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
@ -49,10 +30,7 @@ export async function getTCP(flag=false) {
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
// prompt.showToast({
|
||||
// message:'初始化localIp'+ result[0].localIp+ result[0].localIpPort+'oppositeIp'+result[0].oppositeIp+result[0].oppositeIpPort,
|
||||
// duration: 1000
|
||||
@ -61,39 +39,23 @@ export async function getTCP(flag=false) {
|
||||
globalThis.TcpClient = tcpClient
|
||||
await globalThis.TcpClient.bindTcp()
|
||||
await globalThis.TcpClient.connectTcp()
|
||||
await globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
|
||||
|
||||
await globalThis.TcpClient.sendMsg('1002')//1002
|
||||
// setInterval(()=>{
|
||||
// globalThis.TcpClient.sendMsg('1002')//1002
|
||||
//
|
||||
// },2000)
|
||||
globalThis.TcpClient.onError()
|
||||
await globalThis.TcpClient.onMessage((val)=>{
|
||||
hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
|
||||
setTimeout(()=>{
|
||||
globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
|
||||
if(val&&globalThis.udpClient&&globalThis.udpClient.sendMsg){
|
||||
globalThis.TcpClient.sendMsg('1002')//1002
|
||||
if(val){
|
||||
// const msg=val.substring(5,val.length-1)
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
},1000)
|
||||
|
||||
})
|
||||
globalThis.TcpClient.onError(async()=>{
|
||||
const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
globalThis.TcpClient = tcpClient
|
||||
await globalThis.TcpClient.bindTcp()
|
||||
await globalThis.TcpClient.connectTcp()
|
||||
await globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
|
||||
|
||||
await globalThis.TcpClient.onMessage((val)=>{
|
||||
hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
|
||||
setTimeout(()=>{
|
||||
globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
|
||||
if(val&&globalThis.udpClient&&globalThis.udpClient.sendMsg){
|
||||
// const msg=val.substring(5,val.length-1)
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
},1000)
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
// globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort)
|
||||
|
||||
|
||||
@ -8,19 +8,14 @@ import {string2Bytes} from '../../common/utils/tools'
|
||||
export async function sendMsg(val){
|
||||
// globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val)
|
||||
}
|
||||
export async function getUDP(flag:Boolean=false) {
|
||||
export async function getUDP() {
|
||||
getSyncData('IpConfigTable').then((result:Array<any>)=>{
|
||||
if(result.length){
|
||||
if(!flag){
|
||||
return
|
||||
}
|
||||
if(globalThis.udpClient&&globalThis.udpClient.closeUdp){
|
||||
globalThis.udpClient.closeUdp(()=>{
|
||||
globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort)
|
||||
globalThis.udpClient.sendMsg('111')
|
||||
globalThis.host=`http://${result[0].centerIp}:${result[0].centerPort}`
|
||||
globalThis.udpClient.onError(globalThis.udpClient.onMessage?globalThis.udpClient.onMessage:()=>{})
|
||||
|
||||
})
|
||||
}else{
|
||||
|
||||
@ -29,8 +24,6 @@ export async function getUDP(flag:Boolean=false) {
|
||||
udpClient.sendMsg('111')
|
||||
globalThis.udpClient = udpClient
|
||||
globalThis.host=`http://${result[0].centerIp}:${result[0].centerPort}`
|
||||
globalThis.udpClient.onError(globalThis.udpClient.onMessage?globalThis.udpClient.onMessage:()=>{})
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
@ -41,18 +34,14 @@ export async function getUDP(flag:Boolean=false) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function getUDP2(flag:Boolean=false) {
|
||||
export async function getUDP2() {
|
||||
getSyncData('IpConfigTable').then(async (result:Array<any>)=>{
|
||||
if(result.length){
|
||||
if(globalThis.udpClient2&&globalThis.udpClient2.closeUdp){
|
||||
if(!flag){
|
||||
return
|
||||
}
|
||||
globalThis.udpClient2.closeUdp(async ()=>{
|
||||
globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
|
||||
globalThis.udpClient2.onMessage((val)=>{
|
||||
})
|
||||
globalThis.udpClient2.onError()
|
||||
globalThis.udpClient2.setMsgCallBack=()=>{}
|
||||
|
||||
})
|
||||
@ -60,7 +49,6 @@ export async function getUDP2(flag:Boolean=false) {
|
||||
const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
|
||||
globalThis.udpClient2 = udpClient
|
||||
globalThis.udpClient2.bindUdp()
|
||||
globalThis.udpClient2.onError()
|
||||
globalThis.udpClient2.onMessage((val)=>{
|
||||
if(val.id=='32'){
|
||||
globalThis.signNum=val.body[1]
|
||||
|
||||
@ -24,7 +24,8 @@ export default class TcpClient {
|
||||
onError(callback?){
|
||||
this.tcp.on('error', err => {
|
||||
hilog.info(0x0000, 'testTag', "on error, err:" + JSON.stringify(err));
|
||||
callback()
|
||||
this.bindTcp()
|
||||
this.connectTcp()
|
||||
// this.closeUdp(()=>{
|
||||
// this.bindUdp()
|
||||
// })
|
||||
@ -55,17 +56,13 @@ export default class TcpClient {
|
||||
|
||||
}
|
||||
bindTcp() {
|
||||
console.log('tcpoppositeIp',this.oppositeIp,'localIp',this.localIp)
|
||||
return new Promise((resolve,reject)=>{
|
||||
let promise=this.tcp.bind({ address: this.localIp, port:parseInt(this.localIpPort), family: 1 }, err => {
|
||||
if (err) {
|
||||
console.log('testTag tcp bind faile');
|
||||
|
||||
hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
|
||||
resolve(true)
|
||||
return
|
||||
}
|
||||
console.log('testTag tcp bind success');
|
||||
console.log('bind success');
|
||||
resolve(false)
|
||||
})
|
||||
})
|
||||
@ -80,13 +77,10 @@ export default class TcpClient {
|
||||
|
||||
}
|
||||
connectTcp(){
|
||||
console.log('testTagtcpoppositeIp',this.oppositeIp,'localIp',this.localIp)
|
||||
console.log('22323')
|
||||
return new Promise((resolve,reject)=>{
|
||||
let promise = this.tcp.connect({ address: {address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1} , timeout: 6000});
|
||||
promise.then(() => {
|
||||
console.log('testTagbindSuccess')
|
||||
|
||||
this.tcp.setExtraOptions({
|
||||
keepAlive: true,
|
||||
// OOBInline: true,
|
||||
@ -103,15 +97,13 @@ export default class TcpClient {
|
||||
});
|
||||
resolve(true)
|
||||
}).catch(err => {
|
||||
console.log('testTagconnect,error')
|
||||
resolve(false)
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
sendMsg(msg: string) {
|
||||
console.log('oppositeIp',this.oppositeIp)
|
||||
sendMsg(msg: string) {console.log('oppositeIp',this.oppositeIp)
|
||||
return new Promise((reslove,reject)=>{
|
||||
let promise = this.tcp.send({
|
||||
data:msg
|
||||
@ -143,19 +135,19 @@ export default class TcpClient {
|
||||
// });
|
||||
}
|
||||
|
||||
onMessage(callback?) {
|
||||
onMessage(callback) {
|
||||
this.tcp.on('message', value => {
|
||||
// console.log('messageLengt',,value.message.length))
|
||||
console.log('tcpmsg')
|
||||
|
||||
// console.log("on message, message:" + value.message+ ", remoteInfo:" )
|
||||
if (value) {
|
||||
let dataView = new DataView(value.message)
|
||||
// const Arraybuffer=buffer.from(value.message, 5, dataView?.byteLength);
|
||||
const Arraybuffer=value.message.slice(5, dataView?.byteLength);
|
||||
|
||||
callback&&callback(Arraybuffer)
|
||||
callback(Arraybuffer)
|
||||
}else{
|
||||
callback&&callback('')
|
||||
callback('')
|
||||
}
|
||||
// callback(value.message)
|
||||
});
|
||||
|
||||
@ -64,9 +64,9 @@ export default class UdpClient {
|
||||
hilog.info(0x0000, 'udpCLient', 'bind'+ this.localIp+this.localIpPort);
|
||||
|
||||
let promise = this.udp.bind({
|
||||
address: '192.168.7.170', port: 20122, family: 1
|
||||
// address: '192.168.7.170', port: 20122, family: 1
|
||||
// address: '192.168.7.170', port: 31013, family: 1
|
||||
// address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
||||
address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
||||
});
|
||||
promise.then(() => {
|
||||
console.log(`${TAG}udpCLient udp bind success`);
|
||||
@ -78,20 +78,19 @@ export default class UdpClient {
|
||||
setMsgCallBack(callback){
|
||||
// this.stashFn=callback?callback:()=>{}
|
||||
}
|
||||
sendMsg(msg) {
|
||||
sendMsg(msg: string) {
|
||||
console.log('sendsnd01')
|
||||
hilog.info(0x0000, 'udpCLient', 'send');
|
||||
console.log('udpdiushisend')
|
||||
|
||||
let promise = this.udp.send({
|
||||
data: msg,
|
||||
address: {
|
||||
// address: '192.168.7.124',
|
||||
// port: 30013,
|
||||
address: '192.168.7.124',
|
||||
port: 20022,
|
||||
// address: this.oppositeIp,
|
||||
// port: parseInt(this.oppositeIpPort),
|
||||
// address: '192.168.7.124',
|
||||
// port: 20022,
|
||||
address: this.oppositeIp,
|
||||
port: parseInt(this.oppositeIpPort),
|
||||
family: 1
|
||||
}
|
||||
});
|
||||
@ -102,25 +101,18 @@ export default class UdpClient {
|
||||
});
|
||||
}
|
||||
onError(callback?){
|
||||
this.udp.on('error',async err => {
|
||||
console.log('udpdiushierroring')
|
||||
hilog.info(0x0000, 'udpCLientonerror', 'error'+ JSON.stringify(err));
|
||||
this.udp.on('error', err => {
|
||||
hilog.info(0x0000, 'udpCLient', 'error'+ JSON.stringify(err));
|
||||
console.log("on error, err:" + JSON.stringify(err))
|
||||
await this.bindUdp()
|
||||
await this.sendMsg('111')
|
||||
await this.onMessage(callback)
|
||||
// callback&&callback()
|
||||
// this.closeUdp(()=>{
|
||||
// this.bindUdp()
|
||||
// })
|
||||
});
|
||||
}
|
||||
|
||||
onMessage(callback?) {
|
||||
onMessage(callback) {
|
||||
|
||||
this.udp.on('message', value => {
|
||||
console.log('udpdiushimsg')
|
||||
|
||||
// 收到的是ArrayBuffer 需要进行转换解析
|
||||
hilog.info(0x0000, 'udpCLient', 'onmessage');
|
||||
|
||||
@ -142,16 +134,15 @@ export default class UdpClient {
|
||||
if (strachArr[0] != '#DN_GD') {
|
||||
return
|
||||
}
|
||||
console.log(`${TAG} udp222 on message array buffer:${str}`);
|
||||
|
||||
strachArr[28]=globalThis.chuankoMsg||'0'
|
||||
strachArr[28]=globalThis.chuankoMsg
|
||||
// this.stashFn(str)
|
||||
const newArr=JSON.parse(JSON.stringify(strachArr))
|
||||
console.log('22222',strachArr[28],newArr)
|
||||
// this.stashFn=()=>{}
|
||||
callback&&callback(newArr.toString())
|
||||
callback(newArr.toString())
|
||||
|
||||
} else {
|
||||
callback&&callback('')
|
||||
callback('')
|
||||
}
|
||||
console.log('messageTimeEnd')
|
||||
|
||||
|
||||
@ -68,6 +68,7 @@ export default class UdpClientByCenter {
|
||||
});
|
||||
}
|
||||
initHeartSendMsg(param,context){
|
||||
console.log('1111param',JSON.stringify(param))
|
||||
this.initParam=param
|
||||
this.context=context
|
||||
}
|
||||
@ -198,16 +199,7 @@ export default class UdpClientByCenter {
|
||||
callback({id,length,body:list,sendId:this.sendId})
|
||||
});
|
||||
}
|
||||
onError(callback?){
|
||||
this.udp.on('error', err => {
|
||||
console.log('udpbycenterdiushierroring')
|
||||
hilog.info(0x0000, 'udpCLientBycenteronerror', 'error'+ JSON.stringify(err));
|
||||
console.log("on error, err:" + JSON.stringify(err))
|
||||
// this.closeUdp(()=>{
|
||||
// this.bindUdp()
|
||||
// })
|
||||
});
|
||||
}
|
||||
|
||||
closeUdp(callback) {
|
||||
this.udp.close(err=>{
|
||||
if(err){
|
||||
|
||||
@ -223,8 +223,6 @@ export default struct Index {
|
||||
}
|
||||
|
||||
openChuankouFn() {
|
||||
console.log('SerialOpen in carcheck, path=' + this.devPath)
|
||||
|
||||
this.fd = testNapi.SerialOpen(this.devPath);
|
||||
let parity = 0x4e; // 'N'
|
||||
let ret = testNapi.SerialSet(this.fd, 115200, 0, 8, 1, parity);
|
||||
|
||||
@ -256,7 +256,7 @@ struct Index {
|
||||
getliushuiNum()
|
||||
this.heartMsg()
|
||||
}, 1000)
|
||||
// takePhotoFn(this.context)
|
||||
takePhotoFn(this.context)
|
||||
|
||||
//
|
||||
getTCP()
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import UdpClient from '../common/utils/UdpClient';
|
||||
import FileLog from './judgeSDK/utils/file-log';
|
||||
import signDisplayCom from './compontents/signDisplayCom';
|
||||
|
||||
@Entry
|
||||
@ -5,54 +7,50 @@ import signDisplayCom from './compontents/signDisplayCom';
|
||||
export default struct Index {
|
||||
@State signArr: Array<any> = []
|
||||
@State sjxhColum: Array<any> = [
|
||||
{ key: '左方向灯', value: '0' },
|
||||
{ key: '右方向灯', value: '0' },
|
||||
{ key: '喇叭', value: '0' },
|
||||
{ key: '点火1', value: '0' },
|
||||
{ key: '点火2', value: '0' },
|
||||
{ key: '近光灯', value: '0' },
|
||||
{ key: '远光灯', value: '0' },
|
||||
{ key: '示廓灯', value: '0' },
|
||||
{ key: '雾灯', value: '0' },
|
||||
{ key: '雨刮器', value: '0' },
|
||||
{ key: '脚刹', value: '0' },
|
||||
{ key: '手刹', value: '0' },
|
||||
{ key: '主驾驶门', value: '0' },
|
||||
{ key: '离合', value: '0' },
|
||||
{ key: '副刹车', value: '0' },
|
||||
{ key: '安全带', value: '0' },
|
||||
{ key: '双跳灯', value: '0' },
|
||||
{ key: '车速', value: '0' },
|
||||
{ key: '档位', value: '0' },
|
||||
{ key: '超声波1', value: '0' },
|
||||
{ key: '超声波2', value: '0' },
|
||||
{ key: 'NC', value: '0' },
|
||||
{ key: 'SA15', value: '0' },
|
||||
{ key: '其他门', value: '0' },
|
||||
{ key: '转速过高', value: '0' },
|
||||
{ key: '累计脉冲', value: '0' },
|
||||
{ key: '熄火次数', value: '0' },
|
||||
{ key: '发动机转速', value: '0' },
|
||||
{ key: '方向盘角度', value: '0' },
|
||||
{ key: '超声波3', value: '0' },
|
||||
{ key: '超声波4', value: '0' },
|
||||
{ key: '触摸1', value: '0' },
|
||||
{ key: '触摸2', value: '0' },
|
||||
{ key: '触摸3', value: '0' },
|
||||
{ key: 'SCIO', value: '0' },
|
||||
{ key: 'SC1A_C', value: '0' },
|
||||
{ key: 'SC1B_C', value: '0' },
|
||||
{ key: 'SC2A_C', value: '0' },
|
||||
{ key: 'SC2B_C', value: '0' },
|
||||
{ key: 'SC3A_C', value: '0' },
|
||||
{ key: 'SC3B_C', value: '0' },
|
||||
{ key: 'SC4A_C', value: '0' },
|
||||
{ key: 'SC4B_C', value: '0' },
|
||||
{ key: 'SC5A_C', value: '0' },
|
||||
{ key: 'SC5B_C', value: '0' },
|
||||
{ key: 'SC6A_C', value: '0' },
|
||||
{ key: 'SC6B_C', value: '0' }
|
||||
];
|
||||
{ key: '左方向灯', value: '0' }, { key: '右方向灯', value: '0' }, {
|
||||
key: '喇叭',
|
||||
value: '0'
|
||||
}, { key: '点火1', value: '0' }, { key: '点火2', value: '0' }, { key: '近光灯', value: '0' }, {
|
||||
key: '远光灯',
|
||||
value: '0'
|
||||
}, { key: '示廓灯', value: '0' }, { key: '雾灯', value: '0' }, { key: '雨刮器', value: '0' }, {
|
||||
key: '脚刹',
|
||||
value: '0'
|
||||
}, { key: '手刹', value: '0' }, { key: '主驾驶门', value: '0' }, { key: '离合', value: '0' }, {
|
||||
key: '副刹车',
|
||||
value: '0'
|
||||
}, {
|
||||
key: '安全带',
|
||||
value: '0'
|
||||
}, { key: '双跳灯', value: '0' }, { key: '车速', value: '0' }, { key: '档位', value: '0' }, {
|
||||
key: '超声波1',
|
||||
value: '0'
|
||||
}, {
|
||||
key: '超声波2',
|
||||
value: '0'
|
||||
}, {
|
||||
key: 'NC',
|
||||
value: '0'
|
||||
}, { key: 'SA15', value: '0' }, { key: '其他门', value: '0' }, { key: '转速过高', value: '0' }, {
|
||||
key: '累计脉冲',
|
||||
value: '0'
|
||||
}, { key: '熄火次数', value: '0' }, { key: '发动机转速', value: '0' }, { key: '方向盘角度', value: '0' }, {
|
||||
key: '超声波3',
|
||||
value: '0'
|
||||
}, { key: '超声波4', value: '0' }, { key: '触摸1', value: '0' }, { key: '触摸2', value: '0' }, {
|
||||
key: '触摸3',
|
||||
value: '0'
|
||||
}, { key: 'SCIO', value: '0' }
|
||||
, { key: 'SC1A_C', value: '0' }, { key: 'SC1B_C', value: '0' }, { key: 'SC2A_C', value: '0' }, {
|
||||
key: 'SC2B_C',
|
||||
value: '0'
|
||||
}, { key: 'SC3A_C', value: '0' }, { key: 'SC3B_C', value: '0' }, { key: 'SC4A_C', value: '0' }, {
|
||||
key: 'SC4B_C',
|
||||
value: '0'
|
||||
}, { key: 'SC5A_C', value: '0' }, { key: 'SC5B_C', value: '0' }, { key: 'SC6A_C', value: '0' }, {
|
||||
key: 'SC6B_C',
|
||||
value: '0'
|
||||
}]
|
||||
@State GPSColum: Array<any> = [
|
||||
{ key: '状态', value: '0' },
|
||||
{ key: '收星数', value: '0' },
|
||||
@ -76,6 +74,10 @@ export default struct Index {
|
||||
@State msg: string = ''
|
||||
@State @Watch('outClick') outFlag: boolean = false;
|
||||
@State url: string = ''
|
||||
private timer = null
|
||||
private udpClient: UdpClient = null
|
||||
private FileLog: FileLog
|
||||
private vocObj = null;
|
||||
|
||||
// @State gpsList: Array<any> = []
|
||||
build() {
|
||||
|
||||
@ -2,12 +2,10 @@ import TopLogo from './compontents/topLogo';
|
||||
import ethernet from '@ohos.net.ethernet';
|
||||
import prompt from '@ohos.prompt';
|
||||
import { getSyncData, upDateTableByArray } from '../common/service/initable';
|
||||
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
|
||||
import { getTCP } from '../common/utils/GlobalTcp';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
export default struct Index {
|
||||
@State textList1: string[] = ['差分服务器Ip', '响应端口', '中心服务器IP', '响应端口', '子网掩码', '默认网关', 'dns', '后置机IP ', '响应端口', '前置机IP', '本地端口', '平台服务器Ip', '响应端口']
|
||||
// @State textList2: string[] = []
|
||||
@State ratio: number = 1700 / 960
|
||||
@ -116,9 +114,6 @@ struct Index {
|
||||
});
|
||||
}
|
||||
});
|
||||
getUDP(true)
|
||||
getUDP2(true)
|
||||
getTCP(true)
|
||||
})
|
||||
}
|
||||
.backgroundColor('#CCC4B8')
|
||||
|
||||
@ -7,6 +7,7 @@ import USER from '../common/constants/USER';
|
||||
import { dateFormat, getCurrentTime, string2Bytes } from '../common/utils/tools';
|
||||
import MA_SYSSET from '../common//constants/MA_SYSSET';
|
||||
import FaceCompare from './compontents/FaceCompareByhaikang';
|
||||
// import { initJudgeUdp } from '../common/utils/UdpJudge'
|
||||
import { writeObjectOut } from '../api/judge';
|
||||
import testNapi from '@ohos.idcard';
|
||||
import common from '@ohos.app.ability.common';
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
import TopLogo from './compontents/topLogo'
|
||||
import FileUtil from '../common/utils/File'
|
||||
import { VideoConfig } from './interfaces'
|
||||
import TopLogo from './compontents/topLogo';
|
||||
import FileUtil from '../common/utils/File';
|
||||
import { VideoConfig } from './interfaces';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import promptAction from '@ohos.promptAction'
|
||||
import { startRecordVideo, endRecordVideo,takePhoto } from '../common/service/videoService'
|
||||
import { GlobalConfig } from '../config/index'
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import { endRecordVideo, startRecordVideo, takePhoto } from '../common/service/videoService';
|
||||
import { GlobalConfig } from '../config/index';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
export default struct Index {
|
||||
@State ratio: number = 1700 / 960
|
||||
@State videoSrc: string = 'rtsp://admin12345qwe@192.168.36.94:554/h264/ch3/main/av_stream'
|
||||
@State previewUri: Resource = $r('app.media.2_nor')
|
||||
@ -21,9 +22,7 @@ struct Index {
|
||||
}
|
||||
@State isAutoPlay: boolean = true
|
||||
@State showFlag: boolean = false
|
||||
private vocObj = null;
|
||||
@State showControls: boolean = false
|
||||
private fileUtil: FileUtil
|
||||
@State @Watch('outClick') outFlag: boolean = false;
|
||||
@State oldParam: VideoConfig = {
|
||||
videoNum: '1',
|
||||
@ -96,7 +95,8 @@ struct Index {
|
||||
{ key: '第三路' },
|
||||
{ key: '第四路' },
|
||||
]
|
||||
|
||||
private vocObj = null;
|
||||
private fileUtil: FileUtil
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
private controller1: VideoController = new VideoController()
|
||||
private controller2: VideoController = new VideoController()
|
||||
@ -172,6 +172,7 @@ struct Index {
|
||||
for (let i = 1; i <= 4; i++) {
|
||||
console.log('rocord_handle', i, JSON.stringify(this.rocordHandleObj))
|
||||
if (this.rocordHandleObj['rocord_handle'+i]) {
|
||||
console.log('ttttt', i)
|
||||
endRecordVideo(this.rocordHandleObj['rocord_handle'+i])
|
||||
this.rocordHandleObj['rocord_handle'+i] = 0
|
||||
}
|
||||
@ -319,7 +320,8 @@ struct Index {
|
||||
.width(34 * this.ratio)
|
||||
.height(26 * this.ratio)
|
||||
.fontSize(this.inputFontSize * this.ratio)
|
||||
.margin({ left: 10 * this.ratio, right: 15 * this.ratio }).onChange((value: string) => {
|
||||
.margin({ left: 10 * this.ratio, right: 15 * this.ratio })
|
||||
.onChange((value: string) => {
|
||||
this.param.zdyz = value
|
||||
})
|
||||
// Text('k').fontColor('#333333').fontSize(16 * this.ratio)
|
||||
@ -339,6 +341,7 @@ struct Index {
|
||||
Row() {
|
||||
Row() {
|
||||
}.width(70 * this.ratio)
|
||||
|
||||
Text('IP地址')
|
||||
.width(158 * this.ratio)
|
||||
.fontSize(16 * this.ratio)
|
||||
@ -620,14 +623,18 @@ struct Index {
|
||||
this.fileUtil = fileUtil
|
||||
this.getVideoConfig()
|
||||
}
|
||||
|
||||
async getfilehandleCode(td) {
|
||||
const record_handle = await startRecordVideo(this.param, td, this.context, 'lp')
|
||||
this.rocordHandleObj['rocord_handle'+td] = record_handle
|
||||
}
|
||||
|
||||
outClick() {
|
||||
this.openFlag = false
|
||||
}
|
||||
|
||||
sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
|
||||
|
||||
async onPageShow() {
|
||||
}
|
||||
|
||||
|
||||
@ -1,64 +1,64 @@
|
||||
import router from '@ohos.router'
|
||||
import router from '@ohos.router';
|
||||
import UdpClient from '../../common/utils/UdpClient';
|
||||
import FileLog from '../judgeSDK/utils/file-log'
|
||||
import { voiceService } from '../../common/service/voiceService'
|
||||
import prompt from '@ohos.prompt'
|
||||
import RealTime from '../compontents/judge/real-time'
|
||||
@Component
|
||||
struct SignDisplayCom {
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
import FileLog from '../judgeSDK/utils/file-log';
|
||||
import SerialPortClient from '../../common/utils/SerialPortClient';
|
||||
import RealTime from '../compontents/judge/real-time';
|
||||
|
||||
@Component
|
||||
export default struct SignDisplayCom {
|
||||
@State showBack: boolean = false
|
||||
@State scaleNum: number = 1
|
||||
@State msg: string = ''
|
||||
@State signArr: Array<any> = []
|
||||
@State sjxhColum: Array<any> = [
|
||||
{ key: '左方向灯', value: '0' }, { key: '右方向灯', value: '0' }, {
|
||||
key: '喇叭',
|
||||
value: '0'
|
||||
}, { key: '点火1', value: '0' }, { key: '点火2', value: '0' }, { key: '近光灯', value: '0' }, {
|
||||
key: '远光灯',
|
||||
value: '0'
|
||||
}, { key: '示廓灯', value: '0' }, { key: '雾灯', value: '0' }, { key: '雨刮器', value: '0' }, {
|
||||
key: '脚刹',
|
||||
value: '0'
|
||||
}, { key: '手刹', value: '0' }, { key: '主驾驶门', value: '0' }, { key: '离合', value: '0' }, {
|
||||
key: '副刹车',
|
||||
value: '0'
|
||||
}, {
|
||||
key: '安全带',
|
||||
value: '0'
|
||||
}, { key: '双跳灯', value: '0' }, { key: '车速', value: '0' }, { key: '档位', value: '0' }, {
|
||||
key: '超声波1',
|
||||
value: '0'
|
||||
}, {
|
||||
key: '超声波2',
|
||||
value: '0'
|
||||
}, {
|
||||
key: 'NC',
|
||||
value: '0'
|
||||
}, { key: 'SA15', value: '0' }, { key: '其他门', value: '0' }, { key: '转速过高', value: '0' }, {
|
||||
key: '累计脉冲',
|
||||
value: '0'
|
||||
}, { key: '熄火次数', value: '0' }, { key: '发动机转速', value: '0' }, { key: '方向盘角度', value: '0' }, {
|
||||
key: '超声波3',
|
||||
value: '0'
|
||||
}, { key: '超声波4', value: '0' }, { key: '触摸1', value: '0' }, { key: '触摸2', value: '0' }, {
|
||||
key: '触摸3',
|
||||
value: '0'
|
||||
}, { key: 'SCIO', value: '0' }
|
||||
, { key: 'SC1A_C', value: '0' }, { key: 'SC1B_C', value: '0' }, { key: 'SC2A_C', value: '0' }, {
|
||||
key: 'SC2B_C',
|
||||
value: '0'
|
||||
}, { key: 'SC3A_C', value: '0' }, { key: 'SC3B_C', value: '0' }, { key: 'SC4A_C', value: '0' }, {
|
||||
key: 'SC4B_C',
|
||||
value: '0'
|
||||
}, { key: 'SC5A_C', value: '0' }, { key: 'SC5B_C', value: '0' }, { key: 'SC6A_C', value: '0' }, {
|
||||
key: 'SC6B_C',
|
||||
value: '0'
|
||||
}]
|
||||
{ key: "左方向灯", value: "0" },
|
||||
{ key: "右方向灯", value: "0" },
|
||||
{ key: "喇叭", value: "0" },
|
||||
{ key: "点火1", value: "0" },
|
||||
{ key: "点火2", value: "0" },
|
||||
{ key: "近光灯", value: "0" },
|
||||
{ key: "远光灯", value: "0" },
|
||||
{ key: "示廓灯", value: "0" },
|
||||
{ key: "雾灯", value: "0" },
|
||||
{ key: "雨刮器", value: "0" },
|
||||
{ key: "脚刹", value: "0" },
|
||||
{ key: "手刹", value: "0" },
|
||||
{ key: "主驾驶门", value: "0" },
|
||||
{ key: "离合", value: "0" },
|
||||
{ key: "副刹车", value: "0" },
|
||||
{ key: "安全带", value: "0" },
|
||||
{ key: "双跳灯", value: "0" },
|
||||
{ key: "车速", value: "0" },
|
||||
{ key: "档位", value: "0" },
|
||||
{ key: "超声波1", value: "0" },
|
||||
{ key: "超声波2", value: "0" },
|
||||
{ key: "NC", value: "0" },
|
||||
{ key: "SA15", value: "0" },
|
||||
{ key: "其他门", value: "0" },
|
||||
{ key: "转速过高", value: "0" },
|
||||
{ key: "累计脉冲", value: "0" },
|
||||
{ key: "熄火次数", value: "0" },
|
||||
{ key: "发动机转速", value: "0" },
|
||||
{ key: "方向盘角度", value: "0" },
|
||||
{ key: "超声波3", value: "0" },
|
||||
{ key: "超声波4", value: "0" },
|
||||
{ key: "触摸1", value: "0" },
|
||||
{ key: "触摸2", value: "0" },
|
||||
{ key: "触摸3", value: "0" },
|
||||
{ key: "SCIO", value: "0" },
|
||||
{ key: "SC1A_C", value: "0" },
|
||||
{ key: "SC1B_C", value: "0" },
|
||||
{ key: "SC2A_C", value: "0" },
|
||||
{ key: "SC2B_C", value: "0" },
|
||||
{ key: "SC3A_C", value: "0" },
|
||||
{ key: "SC3B_C", value: "0" },
|
||||
{ key: "SC4A_C", value: "0" },
|
||||
{ key: "SC4B_C", value: "0" },
|
||||
{ key: "SC5A_C", value: "0" },
|
||||
{ key: "SC5B_C", value: "0" },
|
||||
{ key: "SC6A_C", value: "0" },
|
||||
{ key: "SC6B_C", value: "0" },
|
||||
]
|
||||
@State GPSColum: Array<any> = [
|
||||
{ key: '状态', value: '0' },
|
||||
{ key: '收星数', value: '0' },
|
||||
@ -81,13 +81,17 @@ struct SignDisplayCom {
|
||||
@Prop active: number = 0
|
||||
@State msgStr: string = ''
|
||||
@State interval: any = ''
|
||||
|
||||
@State @Watch('outClick') outFlag: boolean = false;
|
||||
@State url: string = ''
|
||||
private timer = null
|
||||
private udpClient: UdpClient = null
|
||||
private FileLog: FileLog
|
||||
private vocObj = null;
|
||||
@State url: string = ''
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
|
||||
// @State gpsList: Array<any> = []
|
||||
build() {
|
||||
Column() {
|
||||
@ -288,8 +292,14 @@ struct SignDisplayCom {
|
||||
Text('海拔高:' + this.signArr[85]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||
Text('高度差:' + this.signArr[86]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||
Text('龄期:' + this.signArr[87]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||
Text('维度因子:' + this.signArr[88]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||
Text('经度因子:' + this.signArr[89]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||
Text('维度因子:' + this.signArr[88])
|
||||
.fontColor('#FFB433')
|
||||
.fontSize(14 * this.ratio)
|
||||
.height(18 * this.ratio)
|
||||
Text('经度因子:' + this.signArr[89])
|
||||
.fontColor('#FFB433')
|
||||
.fontSize(14 * this.ratio)
|
||||
.height(18 * this.ratio)
|
||||
Text('航向角:' + this.signArr[90]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||
Text('俯仰角:' + this.signArr[91]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
|
||||
Text('航向角状态-收星数:' + this.signArr[92])
|
||||
@ -342,6 +352,7 @@ struct SignDisplayCom {
|
||||
// this.gpsActive = 1
|
||||
// })
|
||||
}.margin({ top: 10 * this.ratio })
|
||||
|
||||
Flex({ direction: FlexDirection.Column }) {
|
||||
ForEach(this.GPSColum, (item) => {
|
||||
Column() {
|
||||
@ -391,12 +402,26 @@ struct SignDisplayCom {
|
||||
aboutToDisappear() {
|
||||
clearInterval(this.interval)
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
this.ratio = this.ratio * (this.scaleNum || 1);
|
||||
const that = this
|
||||
const {showBack,getSignal} = this
|
||||
|
||||
|
||||
const serialPortClient = new SerialPortClient()
|
||||
serialPortClient.openSerial()
|
||||
serialPortClient.SerialSet()
|
||||
this.interval = setInterval(() => {
|
||||
serialPortClient.SerialSend()
|
||||
const data = serialPortClient.SerialRecv()
|
||||
// if (data?.recevedLen) {
|
||||
// const msg = data.msg.split(',')
|
||||
// if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
// return
|
||||
// }
|
||||
// this.sjxhColum[18].value = msg[9]
|
||||
// }
|
||||
}, 1000)
|
||||
if (showBack) {
|
||||
globalThis.udpClient.onMessage((msg) => {
|
||||
console.log('msgmsg', msg)
|
||||
@ -427,8 +452,21 @@ struct SignDisplayCom {
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
const serialPortClient = new SerialPortClient()
|
||||
serialPortClient.openSerial()
|
||||
serialPortClient.SerialSet()
|
||||
const getSignal = this.getSignal;
|
||||
this.interval = setInterval(() => {
|
||||
serialPortClient.SerialSend()
|
||||
const data = serialPortClient.SerialRecv()
|
||||
// if (data.recevedLen) {
|
||||
// const msg = data.msg.split(',')
|
||||
// if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
// return
|
||||
// }
|
||||
// this.sjxhColum[18].value = msg[9]
|
||||
// }
|
||||
}, 1000)
|
||||
const that = this
|
||||
const showBack = this.showBack;
|
||||
if (showBack) {
|
||||
@ -497,6 +535,7 @@ struct SignDisplayCom {
|
||||
that.signArr = JSON.parse(JSON.stringify((this.signArr)))
|
||||
that.GPSColum = JSON.parse(JSON.stringify((this.GPSColum)))
|
||||
}
|
||||
|
||||
outClick() {
|
||||
}
|
||||
|
||||
@ -504,6 +543,7 @@ struct SignDisplayCom {
|
||||
// this.FileLog.initFileLogo('d .0ateLog')
|
||||
// this.FileLog.createFile('123')
|
||||
}
|
||||
|
||||
// getDeviceNo() {
|
||||
// globalThis.deviceNo = 'FE-FC-FE-7C-5C-72'; //设备号
|
||||
// }
|
||||
@ -521,4 +561,3 @@ struct SignDisplayCom {
|
||||
// }
|
||||
}
|
||||
|
||||
export default SignDisplayCom
|
||||
Loading…
x
Reference in New Issue
Block a user