lv #9
@ -260,46 +260,77 @@ 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)
|
||||
let ret = testNapi.SerialSend(globalThis.fd, databuff);
|
||||
console.log('mmmm',ret)
|
||||
let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
|
||||
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')
|
||||
console.log('revTestInfo',revTestInfo.recevedBuf.length)
|
||||
|
||||
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){
|
||||
|
||||
const message = revTestInfo?.recevedBuf?.toString()
|
||||
console.log('chuankou',message)
|
||||
if (message == '') {
|
||||
return
|
||||
}
|
||||
const msg = message?.split(',')
|
||||
if(!msg?.length){
|
||||
return
|
||||
}
|
||||
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
return
|
||||
}
|
||||
globalThis.chuankoMsg=msg[9]
|
||||
} else if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
|
||||
} else if(msg.length<12){
|
||||
|
||||
} else {
|
||||
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()
|
||||
setInterval(()=>{
|
||||
getChuankouFnMsg()
|
||||
},1000)
|
||||
// clearInterval(chuankou)
|
||||
// chuankou=setInterval(()=>{
|
||||
getChuankouFnMsg()
|
||||
// },1000)
|
||||
|
||||
}
|
||||
@ -40,6 +40,7 @@ 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?) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
export async function deleteAllFileByPiC(dirName) {
|
||||
//type:1 是图片 2是视频
|
||||
export async function deleteAllFileByPiC(dirName,type=1) {
|
||||
// const fileHelper = new FileHelper();
|
||||
fileHelper.deleteFileOfAlbum(dirName,1);
|
||||
fileHelper.deleteFileOfAlbum(dirName,type);
|
||||
}
|
||||
|
||||
export async function deleteAllVideos(context,type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
||||
|
||||
@ -1,36 +1,58 @@
|
||||
import TcpClient from './TcpClient';
|
||||
import { getSyncData} from '../service/initable'
|
||||
import hilog from '@ohos.hilog';
|
||||
export async function getTCP() {
|
||||
export async function getTCP(flag=false) {
|
||||
|
||||
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('1002')//1002
|
||||
globalThis.TcpClient.onError()
|
||||
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('1002')//1002
|
||||
if(val){
|
||||
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){
|
||||
// const msg=val.substring(5,val.length-1)
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
},1000)
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
// prompt.showToast({
|
||||
// message:'初始化localIp'+ result[0].localIp+ result[0].localIpPort+'oppositeIp'+result[0].oppositeIp+result[0].oppositeIpPort,
|
||||
// duration: 1000
|
||||
@ -39,23 +61,39 @@ export async function getTCP() {
|
||||
globalThis.TcpClient = tcpClient
|
||||
await globalThis.TcpClient.bindTcp()
|
||||
await globalThis.TcpClient.connectTcp()
|
||||
await globalThis.TcpClient.sendMsg('1002')//1002
|
||||
// setInterval(()=>{
|
||||
// globalThis.TcpClient.sendMsg('1002')//1002
|
||||
//
|
||||
// },2000)
|
||||
globalThis.TcpClient.onError()
|
||||
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('1002')//1002
|
||||
if(val){
|
||||
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()=>{
|
||||
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,14 +8,19 @@ import {string2Bytes} from '../../common/utils/tools'
|
||||
export async function sendMsg(val){
|
||||
// globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val)
|
||||
}
|
||||
export async function getUDP() {
|
||||
export async function getUDP(flag:Boolean=false) {
|
||||
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{
|
||||
|
||||
@ -24,6 +29,8 @@ export async function getUDP() {
|
||||
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{
|
||||
@ -34,14 +41,18 @@ export async function getUDP() {
|
||||
})
|
||||
}
|
||||
|
||||
export async function getUDP2() {
|
||||
export async function getUDP2(flag:Boolean=false) {
|
||||
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=()=>{}
|
||||
|
||||
})
|
||||
@ -49,6 +60,7 @@ export async function getUDP2() {
|
||||
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,8 +24,7 @@ export default class TcpClient {
|
||||
onError(callback?){
|
||||
this.tcp.on('error', err => {
|
||||
hilog.info(0x0000, 'testTag', "on error, err:" + JSON.stringify(err));
|
||||
this.bindTcp()
|
||||
this.connectTcp()
|
||||
callback()
|
||||
// this.closeUdp(()=>{
|
||||
// this.bindUdp()
|
||||
// })
|
||||
@ -56,13 +55,17 @@ 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('bind success');
|
||||
console.log('testTag tcp bind success');
|
||||
resolve(false)
|
||||
})
|
||||
})
|
||||
@ -77,10 +80,13 @@ 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,
|
||||
@ -97,13 +103,15 @@ 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
|
||||
@ -135,19 +143,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(Arraybuffer)
|
||||
callback&&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,19 +78,20 @@ export default class UdpClient {
|
||||
setMsgCallBack(callback){
|
||||
// this.stashFn=callback?callback:()=>{}
|
||||
}
|
||||
sendMsg(msg: string) {
|
||||
sendMsg(msg) {
|
||||
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
|
||||
}
|
||||
});
|
||||
@ -101,18 +102,25 @@ export default class UdpClient {
|
||||
});
|
||||
}
|
||||
onError(callback?){
|
||||
this.udp.on('error', err => {
|
||||
hilog.info(0x0000, 'udpCLient', 'error'+ JSON.stringify(err));
|
||||
this.udp.on('error',async err => {
|
||||
console.log('udpdiushierroring')
|
||||
hilog.info(0x0000, 'udpCLientonerror', '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');
|
||||
|
||||
@ -134,15 +142,16 @@ export default class UdpClient {
|
||||
if (strachArr[0] != '#DN_GD') {
|
||||
return
|
||||
}
|
||||
strachArr[28]=globalThis.chuankoMsg
|
||||
console.log(`${TAG} udp222 on message array buffer:${str}`);
|
||||
|
||||
strachArr[28]=globalThis.chuankoMsg||'0'
|
||||
// this.stashFn(str)
|
||||
const newArr=JSON.parse(JSON.stringify(strachArr))
|
||||
console.log('22222',strachArr[28],newArr)
|
||||
// this.stashFn=()=>{}
|
||||
callback(newArr.toString())
|
||||
callback&&callback(newArr.toString())
|
||||
|
||||
} else {
|
||||
callback('')
|
||||
callback&&callback('')
|
||||
}
|
||||
console.log('messageTimeEnd')
|
||||
|
||||
|
||||
@ -68,7 +68,6 @@ export default class UdpClientByCenter {
|
||||
});
|
||||
}
|
||||
initHeartSendMsg(param,context){
|
||||
console.log('1111param',JSON.stringify(param))
|
||||
this.initParam=param
|
||||
this.context=context
|
||||
}
|
||||
@ -199,7 +198,16 @@ 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){
|
||||
|
||||
@ -226,6 +226,8 @@ 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);
|
||||
|
||||
@ -249,7 +249,7 @@ struct Index {
|
||||
getliushuiNum()
|
||||
this.heartMsg()
|
||||
}, 1000)
|
||||
takePhotoFn(this.context)
|
||||
// takePhotoFn(this.context)
|
||||
|
||||
//
|
||||
getTCP()
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import router from '@ohos.router'
|
||||
import TopLogo from './compontents/topLogo'
|
||||
import ethernet from '@ohos.net.ethernet';
|
||||
@ -6,6 +7,8 @@ import { upDateTableByArray} from '../common/service/initable'
|
||||
import { getSyncData} from '../common/service/initable'
|
||||
import { voiceService } from '../common/service/voiceService'
|
||||
import { GlobalConfig } from '../config/index'
|
||||
import { getUDP, getUDP2 } from '../common/utils/GlobleUdp';
|
||||
import { getTCP } from '../common/utils/GlobleTcp';
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@ -102,6 +105,9 @@ struct Index {
|
||||
});
|
||||
}
|
||||
});
|
||||
getUDP(true)
|
||||
getUDP2(true)
|
||||
getTCP(true)
|
||||
})
|
||||
}
|
||||
.backgroundColor('#CCC4B8')
|
||||
|
||||
@ -172,7 +172,6 @@ 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
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ 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 SerialPortClient from '../../common/utils/SerialPortClient'
|
||||
import RealTime from '../compontents/judge/real-time'
|
||||
@Component
|
||||
struct SignDisplayCom {
|
||||
@ -397,20 +396,7 @@ struct SignDisplayCom {
|
||||
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)
|
||||
@ -441,21 +427,8 @@ 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){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user