Merge branch 'main' into wangzhongjie
# Conflicts: # entry/src/main/ets/pages/TerminalInfos.ets # entry/src/main/ets/pages/VideoConfig.ets # entry/src/main/ets/pages/compontents/SignDisplayCom.ets
This commit is contained in:
		
						commit
						da6a85f02a
					
				@ -260,46 +260,77 @@ export async function takePhotoFn(context) {
 | 
				
			|||||||
let fd
 | 
					let fd
 | 
				
			||||||
const devPath="/dev/ttyS3"
 | 
					const devPath="/dev/ttyS3"
 | 
				
			||||||
function openChuankouFn() {
 | 
					function openChuankouFn() {
 | 
				
			||||||
 | 
					  console.log('SerialOpen in indexservice, path=' + devPath)
 | 
				
			||||||
  fd = testNapi.SerialOpen(devPath);
 | 
					  fd = testNapi.SerialOpen(devPath);
 | 
				
			||||||
 | 
					  globalThis.num=0
 | 
				
			||||||
  globalThis.fd=fd
 | 
					  globalThis.fd=fd
 | 
				
			||||||
  console.log('fdfd1111',globalThis.fd)
 | 
					  console.log('fdfd1111',globalThis.fd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let parity = 0x4e; // 'N'
 | 
					  let parity = 0x4e; // 'N'
 | 
				
			||||||
  let ret = testNapi.SerialSet(globalThis.fd, 115200, 0, 8, 1, parity);
 | 
					  let ret = testNapi.SerialSet(globalThis.fd, 115200, 0, 8, 1, parity);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getChuankouFnMsg() {
 | 
					function getChuankouFnMsg() {
 | 
				
			||||||
  let timeout = 50000; // 2秒超时
 | 
					  let timeout = 50000; // 2秒超时
 | 
				
			||||||
  let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
 | 
					  let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
 | 
				
			||||||
  console.log('fdfd',globalThis.fd)
 | 
					  console.log('fdfd',globalThis.fd)
 | 
				
			||||||
  let ret = testNapi.SerialSend(globalThis.fd, databuff);
 | 
					  console.log('zzc 1 try send msg')
 | 
				
			||||||
  console.log('mmmm',ret)
 | 
					  testNapi.SerialSendAsync(globalThis.fd, databuff,(ret)=>{
 | 
				
			||||||
  let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
 | 
					    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()
 | 
					      } else if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
 | 
				
			||||||
  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.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(){
 | 
					export async function getChuankouFn(){
 | 
				
			||||||
  if(globalThis.fd){
 | 
					  if(globalThis.fd){
 | 
				
			||||||
    return
 | 
					    return
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  openChuankouFn()
 | 
					  openChuankouFn()
 | 
				
			||||||
  setInterval(()=>{
 | 
					  // clearInterval(chuankou)
 | 
				
			||||||
    getChuankouFnMsg()
 | 
					  // chuankou=setInterval(()=>{
 | 
				
			||||||
  },1000)
 | 
					  getChuankouFnMsg()
 | 
				
			||||||
 | 
					  // },1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -40,6 +40,7 @@ export async function getCarInfo() {
 | 
				
			|||||||
          // }, router.RouterMode.Single);
 | 
					          // }, router.RouterMode.Single);
 | 
				
			||||||
    }else {
 | 
					    }else {
 | 
				
			||||||
        globalThis.carInfo=res.obtainCarExamInfoRsp.body
 | 
					        globalThis.carInfo=res.obtainCarExamInfoRsp.body
 | 
				
			||||||
 | 
					        console.log('globalThis.carInfo',JSON.stringify(globalThis.carInfo));
 | 
				
			||||||
        // globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId
 | 
					        // globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId
 | 
				
			||||||
        globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo)
 | 
					        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) {
 | 
					export async function deleteAllFileByPiC(dirName,type=1) {
 | 
				
			||||||
  // const fileHelper = new FileHelper();
 | 
					  // 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> {
 | 
					export async function deleteAllVideos(context,type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,36 +1,58 @@
 | 
				
			|||||||
import TcpClient from './TcpClient';
 | 
					import TcpClient from './TcpClient';
 | 
				
			||||||
import { getSyncData} from '../service/initable'
 | 
					import { getSyncData} from '../service/initable'
 | 
				
			||||||
import hilog from '@ohos.hilog';
 | 
					import hilog from '@ohos.hilog';
 | 
				
			||||||
export async function getTCP() {
 | 
					export async function getTCP(flag=false) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getSyncData('IpConfigTable').then(async (result:Array<any>)=>{
 | 
					  getSyncData('IpConfigTable').then(async (result:Array<any>)=>{
 | 
				
			||||||
    console.log('result222',JSON.stringify(result))
 | 
					    console.log('result222',JSON.stringify(result))
 | 
				
			||||||
    if(result.length){
 | 
					    if(result.length){
 | 
				
			||||||
      if(globalThis.TcpClient&&globalThis.TcpClient.closeTcp){
 | 
					      if(globalThis.TcpClient&&globalThis.TcpClient.closeTcp){
 | 
				
			||||||
 | 
					        if(!flag){
 | 
				
			||||||
 | 
					          return
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        globalThis.TcpClient.closeTcp(async ()=>{
 | 
					        globalThis.TcpClient.closeTcp(async ()=>{
 | 
				
			||||||
          // const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | 
					          // const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | 
				
			||||||
          // globalThis.TcpClient = tcpClient
 | 
					          // globalThis.TcpClient = tcpClient
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          await globalThis.TcpClient.rebindTcp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | 
					          await globalThis.TcpClient.rebindTcp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
 | 
				
			||||||
          await globalThis.TcpClient.connectTcp()
 | 
					          await globalThis.TcpClient.connectTcp()
 | 
				
			||||||
          await globalThis.TcpClient.sendMsg('1002')//1002
 | 
					          await globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
 | 
				
			||||||
          globalThis.TcpClient.onError()
 | 
					 | 
				
			||||||
          await globalThis.TcpClient.onMessage((val)=>{
 | 
					          await globalThis.TcpClient.onMessage((val)=>{
 | 
				
			||||||
            hilog.info(0x0000, 'testTag', "valvalval1" + JSON.stringify(val));
 | 
					            hilog.info(0x0000, 'testTag', "valvalval1" + JSON.stringify(val));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // console.log('valvalval',val)
 | 
					            // console.log('valvalval',val)
 | 
				
			||||||
            setTimeout(()=>{
 | 
					            setTimeout(()=>{
 | 
				
			||||||
              globalThis.TcpClient.sendMsg('1002')//1002
 | 
					              globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
 | 
				
			||||||
              if(val){
 | 
					              if(val&&globalThis.udpClient&&globalThis.udpClient.sendMsg){
 | 
				
			||||||
                // const msg=val.substring(5,val.length-1)
 | 
					                // const msg=val.substring(5,val.length-1)
 | 
				
			||||||
                globalThis.udpClient?.sendMsg(val)
 | 
					                globalThis.udpClient?.sendMsg(val)
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            },1000)
 | 
					            },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({
 | 
					        // prompt.showToast({
 | 
				
			||||||
        //   message:'初始化localIp'+ result[0].localIp+ result[0].localIpPort+'oppositeIp'+result[0].oppositeIp+result[0].oppositeIpPort,
 | 
					        //   message:'初始化localIp'+ result[0].localIp+ result[0].localIpPort+'oppositeIp'+result[0].oppositeIp+result[0].oppositeIpPort,
 | 
				
			||||||
        //   duration: 1000
 | 
					        //   duration: 1000
 | 
				
			||||||
@ -39,23 +61,39 @@ export async function getTCP() {
 | 
				
			|||||||
        globalThis.TcpClient = tcpClient
 | 
					        globalThis.TcpClient = tcpClient
 | 
				
			||||||
        await globalThis.TcpClient.bindTcp()
 | 
					        await globalThis.TcpClient.bindTcp()
 | 
				
			||||||
        await globalThis.TcpClient.connectTcp()
 | 
					        await globalThis.TcpClient.connectTcp()
 | 
				
			||||||
        await globalThis.TcpClient.sendMsg('1002')//1002
 | 
					        await globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
 | 
				
			||||||
        // setInterval(()=>{
 | 
					
 | 
				
			||||||
        //   globalThis.TcpClient.sendMsg('1002')//1002
 | 
					 | 
				
			||||||
        //
 | 
					 | 
				
			||||||
        // },2000)
 | 
					 | 
				
			||||||
        globalThis.TcpClient.onError()
 | 
					 | 
				
			||||||
        await globalThis.TcpClient.onMessage((val)=>{
 | 
					        await globalThis.TcpClient.onMessage((val)=>{
 | 
				
			||||||
          hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
 | 
					          hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
 | 
				
			||||||
          setTimeout(()=>{
 | 
					          setTimeout(()=>{
 | 
				
			||||||
            globalThis.TcpClient.sendMsg('1002')//1002
 | 
					            globalThis.TcpClient.sendMsg(globalThis.carInfo?.carNo||'402')//1002
 | 
				
			||||||
            if(val){
 | 
					            if(val&&globalThis.udpClient&&globalThis.udpClient.sendMsg){
 | 
				
			||||||
              // const msg=val.substring(5,val.length-1)
 | 
					              // const msg=val.substring(5,val.length-1)
 | 
				
			||||||
              globalThis.udpClient?.sendMsg(val)
 | 
					              globalThis.udpClient?.sendMsg(val)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          },1000)
 | 
					          },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)
 | 
					      // 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){
 | 
					export async function sendMsg(val){
 | 
				
			||||||
  // globalThis.udpClient1&&globalThis.udpClient1.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>)=>{
 | 
					  getSyncData('IpConfigTable').then((result:Array<any>)=>{
 | 
				
			||||||
    if(result.length){
 | 
					    if(result.length){
 | 
				
			||||||
 | 
					      if(!flag){
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      if(globalThis.udpClient&&globalThis.udpClient.closeUdp){
 | 
					      if(globalThis.udpClient&&globalThis.udpClient.closeUdp){
 | 
				
			||||||
        globalThis.udpClient.closeUdp(()=>{
 | 
					        globalThis.udpClient.closeUdp(()=>{
 | 
				
			||||||
          globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort)
 | 
					          globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort)
 | 
				
			||||||
          globalThis.udpClient.sendMsg('111')
 | 
					          globalThis.udpClient.sendMsg('111')
 | 
				
			||||||
          globalThis.host=`http://${result[0].centerIp}:${result[0].centerPort}`
 | 
					          globalThis.host=`http://${result[0].centerIp}:${result[0].centerPort}`
 | 
				
			||||||
 | 
					          globalThis.udpClient.onError(globalThis.udpClient.onMessage?globalThis.udpClient.onMessage:()=>{})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      }else{
 | 
					      }else{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -24,6 +29,8 @@ export async function getUDP() {
 | 
				
			|||||||
        udpClient.sendMsg('111')
 | 
					        udpClient.sendMsg('111')
 | 
				
			||||||
        globalThis.udpClient = udpClient
 | 
					        globalThis.udpClient = udpClient
 | 
				
			||||||
        globalThis.host=`http://${result[0].centerIp}:${result[0].centerPort}`
 | 
					        globalThis.host=`http://${result[0].centerIp}:${result[0].centerPort}`
 | 
				
			||||||
 | 
					        globalThis.udpClient.onError(globalThis.udpClient.onMessage?globalThis.udpClient.onMessage:()=>{})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }else{
 | 
					    }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>)=>{
 | 
					  getSyncData('IpConfigTable').then(async (result:Array<any>)=>{
 | 
				
			||||||
    if(result.length){
 | 
					    if(result.length){
 | 
				
			||||||
      if(globalThis.udpClient2&&globalThis.udpClient2.closeUdp){
 | 
					      if(globalThis.udpClient2&&globalThis.udpClient2.closeUdp){
 | 
				
			||||||
 | 
					        if(!flag){
 | 
				
			||||||
 | 
					          return
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        globalThis.udpClient2.closeUdp(async ()=>{
 | 
					        globalThis.udpClient2.closeUdp(async ()=>{
 | 
				
			||||||
          globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
 | 
					          globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
 | 
				
			||||||
          globalThis.udpClient2.onMessage((val)=>{
 | 
					          globalThis.udpClient2.onMessage((val)=>{
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
 | 
					          globalThis.udpClient2.onError()
 | 
				
			||||||
          globalThis.udpClient2.setMsgCallBack=()=>{}
 | 
					          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)
 | 
					        const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort)
 | 
				
			||||||
        globalThis.udpClient2 = udpClient
 | 
					        globalThis.udpClient2 = udpClient
 | 
				
			||||||
        globalThis.udpClient2.bindUdp()
 | 
					        globalThis.udpClient2.bindUdp()
 | 
				
			||||||
 | 
					        globalThis.udpClient2.onError()
 | 
				
			||||||
        globalThis.udpClient2.onMessage((val)=>{
 | 
					        globalThis.udpClient2.onMessage((val)=>{
 | 
				
			||||||
          if(val.id=='32'){
 | 
					          if(val.id=='32'){
 | 
				
			||||||
            globalThis.signNum=val.body[1]
 | 
					            globalThis.signNum=val.body[1]
 | 
				
			||||||
 | 
				
			|||||||
@ -24,8 +24,7 @@ export default class TcpClient {
 | 
				
			|||||||
    onError(callback?){
 | 
					    onError(callback?){
 | 
				
			||||||
        this.tcp.on('error', err => {
 | 
					        this.tcp.on('error', err => {
 | 
				
			||||||
            hilog.info(0x0000, 'testTag', "on error, err:" + JSON.stringify(err));
 | 
					            hilog.info(0x0000, 'testTag', "on error, err:" + JSON.stringify(err));
 | 
				
			||||||
            this.bindTcp()
 | 
					            callback()
 | 
				
			||||||
            this.connectTcp()
 | 
					 | 
				
			||||||
            // this.closeUdp(()=>{
 | 
					            // this.closeUdp(()=>{
 | 
				
			||||||
            //   this.bindUdp()
 | 
					            //   this.bindUdp()
 | 
				
			||||||
            // })
 | 
					            // })
 | 
				
			||||||
@ -56,13 +55,17 @@ export default class TcpClient {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    bindTcp() {
 | 
					    bindTcp() {
 | 
				
			||||||
 | 
					        console.log('tcpoppositeIp',this.oppositeIp,'localIp',this.localIp)
 | 
				
			||||||
        return new Promise((resolve,reject)=>{
 | 
					        return new Promise((resolve,reject)=>{
 | 
				
			||||||
            let promise=this.tcp.bind({ address:  this.localIp, port:parseInt(this.localIpPort), family: 1 }, err => {
 | 
					            let promise=this.tcp.bind({ address:  this.localIp, port:parseInt(this.localIpPort), family: 1 }, err => {
 | 
				
			||||||
                if (err) {
 | 
					                if (err) {
 | 
				
			||||||
 | 
					                    console.log('testTag tcp bind faile');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
 | 
					                    hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
 | 
				
			||||||
                    resolve(true)
 | 
					                    resolve(true)
 | 
				
			||||||
 | 
					                    return
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                console.log('bind success');
 | 
					                console.log('testTag tcp bind success');
 | 
				
			||||||
                resolve(false)
 | 
					                resolve(false)
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
@ -77,10 +80,13 @@ export default class TcpClient {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    connectTcp(){
 | 
					    connectTcp(){
 | 
				
			||||||
 | 
					        console.log('testTagtcpoppositeIp',this.oppositeIp,'localIp',this.localIp)
 | 
				
			||||||
        console.log('22323')
 | 
					        console.log('22323')
 | 
				
			||||||
        return new Promise((resolve,reject)=>{
 | 
					        return new Promise((resolve,reject)=>{
 | 
				
			||||||
            let promise = this.tcp.connect({ address: {address: this.oppositeIp, port:  parseInt(this.oppositeIpPort), family: 1} , timeout: 6000});
 | 
					            let promise = this.tcp.connect({ address: {address: this.oppositeIp, port:  parseInt(this.oppositeIpPort), family: 1} , timeout: 6000});
 | 
				
			||||||
            promise.then(() => {
 | 
					            promise.then(() => {
 | 
				
			||||||
 | 
					                console.log('testTagbindSuccess')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                this.tcp.setExtraOptions({
 | 
					                this.tcp.setExtraOptions({
 | 
				
			||||||
                    keepAlive: true,
 | 
					                    keepAlive: true,
 | 
				
			||||||
                    // OOBInline: true,
 | 
					                    // OOBInline: true,
 | 
				
			||||||
@ -97,13 +103,15 @@ export default class TcpClient {
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
                resolve(true)
 | 
					                resolve(true)
 | 
				
			||||||
            }).catch(err => {
 | 
					            }).catch(err => {
 | 
				
			||||||
 | 
					                console.log('testTagconnect,error')
 | 
				
			||||||
                resolve(false)
 | 
					                resolve(false)
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sendMsg(msg: string) {console.log('oppositeIp',this.oppositeIp)
 | 
					    sendMsg(msg: string) {
 | 
				
			||||||
 | 
					        console.log('oppositeIp',this.oppositeIp)
 | 
				
			||||||
        return new Promise((reslove,reject)=>{
 | 
					        return new Promise((reslove,reject)=>{
 | 
				
			||||||
            let promise = this.tcp.send({
 | 
					            let promise = this.tcp.send({
 | 
				
			||||||
                data:msg
 | 
					                data:msg
 | 
				
			||||||
@ -135,19 +143,19 @@ export default class TcpClient {
 | 
				
			|||||||
        // });
 | 
					        // });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    onMessage(callback) {
 | 
					    onMessage(callback?) {
 | 
				
			||||||
        this.tcp.on('message', value => {
 | 
					        this.tcp.on('message', value => {
 | 
				
			||||||
            // console.log('messageLengt',,value.message.length))
 | 
					            // console.log('messageLengt',,value.message.length))
 | 
				
			||||||
 | 
					            console.log('tcpmsg')
 | 
				
			||||||
            // console.log("on message, message:" + value.message+ ", remoteInfo:" )
 | 
					            // console.log("on message, message:" + value.message+ ", remoteInfo:" )
 | 
				
			||||||
            if (value) {
 | 
					            if (value) {
 | 
				
			||||||
                let dataView = new DataView(value.message)
 | 
					                let dataView = new DataView(value.message)
 | 
				
			||||||
                // const Arraybuffer=buffer.from(value.message, 5, dataView?.byteLength);
 | 
					                // const Arraybuffer=buffer.from(value.message, 5, dataView?.byteLength);
 | 
				
			||||||
                const Arraybuffer=value.message.slice(5, dataView?.byteLength);
 | 
					                const Arraybuffer=value.message.slice(5, dataView?.byteLength);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                callback(Arraybuffer)
 | 
					                callback&&callback(Arraybuffer)
 | 
				
			||||||
            }else{
 | 
					            }else{
 | 
				
			||||||
                callback('')
 | 
					                callback&&callback('')
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // callback(value.message)
 | 
					            // callback(value.message)
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
				
			|||||||
@ -64,9 +64,9 @@ export default class UdpClient {
 | 
				
			|||||||
    hilog.info(0x0000, 'udpCLient', 'bind'+ this.localIp+this.localIpPort);
 | 
					    hilog.info(0x0000, 'udpCLient', 'bind'+ this.localIp+this.localIpPort);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let promise = this.udp.bind({
 | 
					    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: '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(() => {
 | 
					    promise.then(() => {
 | 
				
			||||||
      console.log(`${TAG}udpCLient udp bind success`);
 | 
					      console.log(`${TAG}udpCLient udp bind success`);
 | 
				
			||||||
@ -78,19 +78,20 @@ export default class UdpClient {
 | 
				
			|||||||
  setMsgCallBack(callback){
 | 
					  setMsgCallBack(callback){
 | 
				
			||||||
    // this.stashFn=callback?callback:()=>{}
 | 
					    // this.stashFn=callback?callback:()=>{}
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  sendMsg(msg: string) {
 | 
					  sendMsg(msg) {
 | 
				
			||||||
    console.log('sendsnd01')
 | 
					    console.log('sendsnd01')
 | 
				
			||||||
    hilog.info(0x0000, 'udpCLient', 'send');
 | 
					    hilog.info(0x0000, 'udpCLient', 'send');
 | 
				
			||||||
 | 
					    console.log('udpdiushisend')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let promise = this.udp.send({
 | 
					    let promise = this.udp.send({
 | 
				
			||||||
      data: msg,
 | 
					      data: msg,
 | 
				
			||||||
      address: {
 | 
					      address: {
 | 
				
			||||||
        // address: '192.168.7.124',
 | 
					        // address: '192.168.7.124',
 | 
				
			||||||
        // port: 30013,
 | 
					        // port: 30013,
 | 
				
			||||||
        // address: '192.168.7.124',
 | 
					        address: '192.168.7.124',
 | 
				
			||||||
        // port: 20022,
 | 
					        port: 20022,
 | 
				
			||||||
        address: this.oppositeIp,
 | 
					        // address: this.oppositeIp,
 | 
				
			||||||
        port: parseInt(this.oppositeIpPort),
 | 
					        // port: parseInt(this.oppositeIpPort),
 | 
				
			||||||
        family: 1
 | 
					        family: 1
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
@ -101,18 +102,25 @@ export default class UdpClient {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  onError(callback?){
 | 
					  onError(callback?){
 | 
				
			||||||
   this.udp.on('error', err => {
 | 
					   this.udp.on('error',async err => {
 | 
				
			||||||
     hilog.info(0x0000, 'udpCLient', 'error'+ JSON.stringify(err));
 | 
					     console.log('udpdiushierroring')
 | 
				
			||||||
 | 
					     hilog.info(0x0000, 'udpCLientonerror', 'error'+ JSON.stringify(err));
 | 
				
			||||||
     console.log("on error, err:" + 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.closeUdp(()=>{
 | 
				
			||||||
     //   this.bindUdp()
 | 
					     //   this.bindUdp()
 | 
				
			||||||
     // })
 | 
					     // })
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onMessage(callback) {
 | 
					  onMessage(callback?) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.udp.on('message', value => {
 | 
					    this.udp.on('message', value => {
 | 
				
			||||||
 | 
					      console.log('udpdiushimsg')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // 收到的是ArrayBuffer 需要进行转换解析
 | 
					      // 收到的是ArrayBuffer 需要进行转换解析
 | 
				
			||||||
      hilog.info(0x0000, 'udpCLient', 'onmessage');
 | 
					      hilog.info(0x0000, 'udpCLient', 'onmessage');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -134,15 +142,16 @@ export default class UdpClient {
 | 
				
			|||||||
        if (strachArr[0] != '#DN_GD') {
 | 
					        if (strachArr[0] != '#DN_GD') {
 | 
				
			||||||
          return
 | 
					          return
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        strachArr[28]=globalThis.chuankoMsg
 | 
					        console.log(`${TAG} udp222 on message array buffer:${str}`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        strachArr[28]=globalThis.chuankoMsg||'0'
 | 
				
			||||||
        // this.stashFn(str)
 | 
					        // this.stashFn(str)
 | 
				
			||||||
        const newArr=JSON.parse(JSON.stringify(strachArr))
 | 
					        const newArr=JSON.parse(JSON.stringify(strachArr))
 | 
				
			||||||
        console.log('22222',strachArr[28],newArr)
 | 
					 | 
				
			||||||
        // this.stashFn=()=>{}
 | 
					        // this.stashFn=()=>{}
 | 
				
			||||||
        callback(newArr.toString())
 | 
					        callback&&callback(newArr.toString())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        callback('')
 | 
					        callback&&callback('')
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      console.log('messageTimeEnd')
 | 
					      console.log('messageTimeEnd')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -68,7 +68,6 @@ export default class UdpClientByCenter {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    initHeartSendMsg(param,context){
 | 
					    initHeartSendMsg(param,context){
 | 
				
			||||||
        console.log('1111param',JSON.stringify(param))
 | 
					 | 
				
			||||||
        this.initParam=param
 | 
					        this.initParam=param
 | 
				
			||||||
        this.context=context
 | 
					        this.context=context
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -199,7 +198,16 @@ export default class UdpClientByCenter {
 | 
				
			|||||||
            callback({id,length,body:list,sendId:this.sendId})
 | 
					            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) {
 | 
					    closeUdp(callback) {
 | 
				
			||||||
        this.udp.close(err=>{
 | 
					        this.udp.close(err=>{
 | 
				
			||||||
            if(err){
 | 
					            if(err){
 | 
				
			||||||
 | 
				
			|||||||
@ -223,6 +223,8 @@ export default struct Index {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  openChuankouFn() {
 | 
					  openChuankouFn() {
 | 
				
			||||||
 | 
					    console.log('SerialOpen in carcheck, path=' + this.devPath)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.fd = testNapi.SerialOpen(this.devPath);
 | 
					    this.fd = testNapi.SerialOpen(this.devPath);
 | 
				
			||||||
    let parity = 0x4e; // 'N'
 | 
					    let parity = 0x4e; // 'N'
 | 
				
			||||||
    let ret = testNapi.SerialSet(this.fd, 115200, 0, 8, 1, parity);
 | 
					    let ret = testNapi.SerialSet(this.fd, 115200, 0, 8, 1, parity);
 | 
				
			||||||
 | 
				
			|||||||
@ -256,7 +256,7 @@ struct Index {
 | 
				
			|||||||
      getliushuiNum()
 | 
					      getliushuiNum()
 | 
				
			||||||
      this.heartMsg()
 | 
					      this.heartMsg()
 | 
				
			||||||
    }, 1000)
 | 
					    }, 1000)
 | 
				
			||||||
    takePhotoFn(this.context)
 | 
					    // takePhotoFn(this.context)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    getTCP()
 | 
					    getTCP()
 | 
				
			||||||
 | 
				
			|||||||
@ -1,64 +1,70 @@
 | 
				
			|||||||
import TopLogo from './compontents/topLogo';
 | 
					 | 
				
			||||||
import ethernet from '@ohos.net.ethernet';
 | 
					 | 
				
			||||||
import prompt from '@ohos.prompt';
 | 
					 | 
				
			||||||
import { getSyncData, upDateTableByArray } from '../common/service/initable';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import router from '@ohos.router'
 | 
				
			||||||
 | 
					import TopLogo from './compontents/topLogo'
 | 
				
			||||||
 | 
					import ethernet from '@ohos.net.ethernet';
 | 
				
			||||||
 | 
					import prompt from '@ohos.prompt'
 | 
				
			||||||
 | 
					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
 | 
					@Entry
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
export default struct Index {
 | 
					struct Index {
 | 
				
			||||||
  @State textList1: string[] = ['差分服务器Ip', '响应端口', '中心服务器IP', '响应端口', '子网掩码', '默认网关', 'dns', '后置机IP ', '响应端口', '前置机IP', '本地端口', '平台服务器Ip', '响应端口']
 | 
					  @State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口','平台服务器Ip','响应端口']
 | 
				
			||||||
  // @State textList2: string[] = []
 | 
					  // @State textList2: string[] = []
 | 
				
			||||||
  @State ratio: number = 1700 / 960
 | 
					  @State ratio: number = 1700 / 960
 | 
				
			||||||
  @State inputFontSize: number = 12 //12
 | 
					  @State inputFontSize:number=12  //12
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // @State inputTextList1: string[] = ['192.168.7.170','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11055' +
 | 
					  // @State inputTextList1: string[] = ['192.168.7.170','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11055' +
 | 
				
			||||||
  // '',]
 | 
					  // '',]
 | 
				
			||||||
  // @State inputTextList2: string[] = ['192.168.7.124','20022']
 | 
					  // @State inputTextList2: string[] = ['192.168.7.124','20022']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @State inputTextList1: string[] = ['112.80.35.83', '11055', '112.80.35.83', '11052', '255.255.255.0', '192.168.7.1', '114.114.114.114', '192.168.7.124', '20022', '192.168.7.170', '20122', '112.80.35.83', '11050']
 | 
					  @State inputTextList1: string[] = ['112.80.35.83','11055','112.80.35.83','11052','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122','112.80.35.83','11050']
 | 
				
			||||||
  // @State inputTextList2: string[] = []
 | 
					  // @State inputTextList2: string[] = []
 | 
				
			||||||
  // 112.80.35.83 11052
 | 
					  // 112.80.35.83 11052
 | 
				
			||||||
  // @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
 | 
					  // @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
 | 
				
			||||||
  // @State inputTextList2: string[] = ['192.168.36.139','20022']
 | 
					  // @State inputTextList2: string[] = ['192.168.36.139','20022']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @State @Watch('outClick') outFlag: boolean = false;
 | 
					 | 
				
			||||||
  scroller: Scroller = new Scroller()
 | 
					 | 
				
			||||||
  private vocObj = null;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @State @Watch('outClick') outFlag: boolean = false;
 | 
				
			||||||
 | 
					  private vocObj = null;
 | 
				
			||||||
 | 
					  scroller: Scroller = new Scroller()
 | 
				
			||||||
  build() {
 | 
					  build() {
 | 
				
			||||||
    Column() {
 | 
					    Column() {
 | 
				
			||||||
      TopLogo({ outFlag: $outFlag })
 | 
					      TopLogo({outFlag:$outFlag})
 | 
				
			||||||
      Column() {
 | 
					      Column() {
 | 
				
			||||||
        Column() {
 | 
					        Column() {
 | 
				
			||||||
          Scroll(this.scroller) {
 | 
					          Scroll(this.scroller){
 | 
				
			||||||
            Flex({ 'wrap': FlexWrap.Wrap }) {
 | 
					            Flex({'wrap':FlexWrap.Wrap}) {
 | 
				
			||||||
              ForEach(this.textList1, (item: string, index: number) => {
 | 
					              ForEach(this.textList1, (item:string, index:number) => {
 | 
				
			||||||
                Row() {
 | 
					                Row() {
 | 
				
			||||||
                  Text(item)
 | 
					                  Text(item)
 | 
				
			||||||
                    .width('40%')
 | 
					                    .width('40%')
 | 
				
			||||||
                    .height('100%')
 | 
					                    .height('100%')
 | 
				
			||||||
                    .fontColor('#E5CBA1')
 | 
					                    .fontColor('#E5CBA1')
 | 
				
			||||||
                    .padding({ 'left': '35px' })
 | 
					                    .padding({'left': '35px'})
 | 
				
			||||||
                    .fontSize(this.inputFontSize * this.ratio)
 | 
					                    .fontSize(this.inputFontSize*this.ratio)
 | 
				
			||||||
                  TextInput({ 'text': this.inputTextList1[index] ? this.inputTextList1[index] : '' })
 | 
					                  TextInput({'text':this.inputTextList1[index]?this.inputTextList1[index]: ''})
 | 
				
			||||||
                    .width('50%')
 | 
					                    .width('50%')
 | 
				
			||||||
                    .height('60%')
 | 
					                    .height('60%')
 | 
				
			||||||
                    .fontColor('#fff')
 | 
					                    .fontColor('#fff')
 | 
				
			||||||
                    .borderColor('#E6E0D8')
 | 
					                    .borderColor('#E6E0D8')
 | 
				
			||||||
                    .borderRadius('10px')
 | 
					                    .borderRadius('10px')
 | 
				
			||||||
                    .borderWidth('2px')
 | 
					                    .borderWidth('2px')
 | 
				
			||||||
                    .fontSize(this.inputFontSize * this.ratio)
 | 
					                    .fontSize(this.inputFontSize*this.ratio)
 | 
				
			||||||
                    .padding({ top: 0, bottom: 0 })
 | 
					                    .padding({top:0,bottom:0})
 | 
				
			||||||
                    .linearGradient({
 | 
					                    .linearGradient({
 | 
				
			||||||
                      angle: 0,
 | 
					                      angle: 0,
 | 
				
			||||||
                      colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
 | 
					                      colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
 | 
				
			||||||
                    })
 | 
					                    }).onChange((value: string) => {
 | 
				
			||||||
                    .onChange((value: string) => {
 | 
					                    this.inputTextList1[index]=value
 | 
				
			||||||
                      this.inputTextList1[index] = value
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    })
 | 
					                  })
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                .width('50%')
 | 
					                .width('50%')
 | 
				
			||||||
                .height('16.7%')
 | 
					                .height('16.7%')
 | 
				
			||||||
@ -68,43 +74,28 @@ export default struct Index {
 | 
				
			|||||||
          }
 | 
					          }
 | 
				
			||||||
          .width('95%')
 | 
					          .width('95%')
 | 
				
			||||||
          .height('90%')
 | 
					          .height('90%')
 | 
				
			||||||
          .margin({ 'top': '2%' })
 | 
					          .margin({'top': '2%'})
 | 
				
			||||||
          .backgroundColor('#282828')
 | 
					          .backgroundColor('#282828')
 | 
				
			||||||
          .borderRadius('15px')
 | 
					          .borderRadius('15px')
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        .width('100%')
 | 
					        .width('100%')
 | 
				
			||||||
        .height('80%')
 | 
					        .height('80%')
 | 
				
			||||||
        .borderRadius('25px')
 | 
					        .borderRadius('25px')
 | 
				
			||||||
 | 
					 | 
				
			||||||
        Column() {
 | 
					        Column() {
 | 
				
			||||||
          Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(() => {
 | 
					          Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{
 | 
				
			||||||
            upDateTableByArray('IpConfigTable', [{
 | 
					            upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]}])
 | 
				
			||||||
              udplocalIp: this.inputTextList1[9],
 | 
					 | 
				
			||||||
              udplocalIpPort: this.inputTextList1[10],
 | 
					 | 
				
			||||||
              udpOppositeIp: this.inputTextList1[7],
 | 
					 | 
				
			||||||
              udpOppositeIpPort: this.inputTextList1[8],
 | 
					 | 
				
			||||||
              tcplocalIp: this.inputTextList1[9],
 | 
					 | 
				
			||||||
              tcplocalIpPort: '8088',
 | 
					 | 
				
			||||||
              tcpOppositeIp: this.inputTextList1[0],
 | 
					 | 
				
			||||||
              tcpOppositePort: this.inputTextList1[1],
 | 
					 | 
				
			||||||
              netMask: this.inputTextList1[4],
 | 
					 | 
				
			||||||
              gateway: this.inputTextList1[5],
 | 
					 | 
				
			||||||
              dnsServers: this.inputTextList1[6],
 | 
					 | 
				
			||||||
              centerIp: this.inputTextList1[2],
 | 
					 | 
				
			||||||
              centerPort: this.inputTextList1[3]
 | 
					 | 
				
			||||||
            }])
 | 
					 | 
				
			||||||
            ethernet.setIfaceConfig("eth0", {
 | 
					            ethernet.setIfaceConfig("eth0", {
 | 
				
			||||||
              mode: 0,
 | 
					              mode: 0,
 | 
				
			||||||
              ipAddr: this.inputTextList1[9],
 | 
					              ipAddr:this.inputTextList1[9],
 | 
				
			||||||
              route: "0.0.0.0",
 | 
					              route: "0.0.0.0",
 | 
				
			||||||
              gateway: this.inputTextList1[5], //value.gateway网关
 | 
					              gateway: this.inputTextList1[5],//value.gateway网关
 | 
				
			||||||
              netMask: this.inputTextList1[4], //value.netMask网络掩码
 | 
					              netMask: this.inputTextList1[4],//value.netMask网络掩码
 | 
				
			||||||
              dnsServers: this.inputTextList1[6],
 | 
					              dnsServers: this.inputTextList1[6],
 | 
				
			||||||
              // domain: ""
 | 
					              // domain: ""
 | 
				
			||||||
            }, (error) => {
 | 
					            }, (error) => {
 | 
				
			||||||
              if (error) {
 | 
					              if (error) {
 | 
				
			||||||
                prompt.showToast({
 | 
					                prompt.showToast({
 | 
				
			||||||
                  message: '设置失败' + JSON.stringify(error),
 | 
					                  message: '设置失败'+JSON.stringify(error),
 | 
				
			||||||
                  duration: 3000
 | 
					                  duration: 3000
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
              } else {
 | 
					              } else {
 | 
				
			||||||
@ -114,48 +105,50 @@ export default struct Index {
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					            getUDP(true)
 | 
				
			||||||
 | 
					            getUDP2(true)
 | 
				
			||||||
 | 
					            getTCP(true)
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        .backgroundColor('#CCC4B8')
 | 
					        .backgroundColor('#CCC4B8')
 | 
				
			||||||
        .width('100%')
 | 
					        .width('100%')
 | 
				
			||||||
        .height('20%')
 | 
					        .height('20%')
 | 
				
			||||||
        .borderRadius({ 'bottomLeft': '25px', 'bottomRight': '25px' })
 | 
					        .borderRadius({'bottomLeft':'25px','bottomRight':'25px'})
 | 
				
			||||||
        .justifyContent(FlexAlign.SpaceAround)
 | 
					        .justifyContent(FlexAlign.SpaceAround)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      .width('75%')
 | 
					      .width('75%')
 | 
				
			||||||
      .height('69.4%')
 | 
					      .height('69.4%')
 | 
				
			||||||
      .backgroundColor('#E6E3DF')
 | 
					      .backgroundColor('#E6E3DF')
 | 
				
			||||||
      .borderRadius('25px')
 | 
					      .borderRadius('25px')
 | 
				
			||||||
      .margin({ 'top': '7%' })
 | 
					      .margin({'top':'7%'})
 | 
				
			||||||
      .justifyContent(FlexAlign.SpaceAround)
 | 
					      .justifyContent(FlexAlign.SpaceAround)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    .width('100%')
 | 
					    .width('100%')
 | 
				
			||||||
    .height('100%')
 | 
					    .height('100%')
 | 
				
			||||||
    .backgroundImagePosition({ x: 0, y: 0 })
 | 
					    .backgroundImagePosition({x: 0, y: 0})
 | 
				
			||||||
    .backgroundImage($r('app.media.index_bg'))
 | 
					    .backgroundImage($r('app.media.index_bg'))
 | 
				
			||||||
    .backgroundImageSize({ width: '100%', height: '100%' })
 | 
					    .backgroundImageSize({ width: '100%', height: '100%' })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  aboutToAppear() {
 | 
					  aboutToAppear() {
 | 
				
			||||||
    getSyncData('IpConfigTable').then((result: Array<any>) => {
 | 
					    getSyncData('IpConfigTable').then((result:Array<any>)=>{
 | 
				
			||||||
      console.log('result222', JSON.stringify(result))
 | 
					      console.log('result222',JSON.stringify(result))
 | 
				
			||||||
      if (result.length) {
 | 
					      if(result.length){
 | 
				
			||||||
        console.log('tagtag', JSON.stringify(result))
 | 
					        console.log('tagtag',JSON.stringify(result))
 | 
				
			||||||
        this.inputTextList1[9] = result[0].udplocalIp
 | 
					        this.inputTextList1[9]=result[0].udplocalIp
 | 
				
			||||||
        this.inputTextList1[10] = result[0].udplocalIpPort
 | 
					        this.inputTextList1[10]=result[0].udplocalIpPort
 | 
				
			||||||
        this.inputTextList1[7] = result[0].udpOppositeIp
 | 
					        this.inputTextList1[7]=result[0].udpOppositeIp
 | 
				
			||||||
        this.inputTextList1[8] = result[0].udpOppositeIpPort
 | 
					        this.inputTextList1[8]=result[0].udpOppositeIpPort
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // this.inputTextList1[0]=result[0].tcplocalIp
 | 
					        // this.inputTextList1[0]=result[0].tcplocalIp
 | 
				
			||||||
        // this.inputTextList1[13]=result[0].tcplocalIpPort
 | 
					        // this.inputTextList1[13]=result[0].tcplocalIpPort
 | 
				
			||||||
        this.inputTextList1[0] = result[0].tcpOppositeIp
 | 
					        this.inputTextList1[0]=result[0].tcpOppositeIp
 | 
				
			||||||
        this.inputTextList1[1] = result[0].tcpOppositePort
 | 
					        this.inputTextList1[1]=result[0].tcpOppositePort
 | 
				
			||||||
        this.inputTextList1[5] = result[0].gateway
 | 
					        this.inputTextList1[5]=result[0].gateway
 | 
				
			||||||
        this.inputTextList1[4] = result[0].netMask
 | 
					        this.inputTextList1[4]=result[0].netMask
 | 
				
			||||||
        this.inputTextList1[6] = result[0].dnsServers
 | 
					        this.inputTextList1[6]=result[0].dnsServers
 | 
				
			||||||
        this.inputTextList1[2] = result[0].centerIp
 | 
					        this.inputTextList1[2]=result[0].centerIp
 | 
				
			||||||
        this.inputTextList1[3] = result[0].centerPort
 | 
					        this.inputTextList1[3]=result[0].centerPort
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    ethernet.getIfaceConfig("eth0", (error, value) => {
 | 
					    ethernet.getIfaceConfig("eth0", (error, value) => {
 | 
				
			||||||
@ -173,12 +166,10 @@ export default struct Index {
 | 
				
			|||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  onPageShow() {
 | 
					  onPageShow() {
 | 
				
			||||||
    console.info('Index onPageShow');
 | 
					    console.info('Index onPageShow');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  outClick(){
 | 
				
			||||||
  outClick() {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,31 +1,32 @@
 | 
				
			|||||||
import TopLogo from './compontents/topLogo';
 | 
					import TopLogo from './compontents/topLogo'
 | 
				
			||||||
import FileUtil from '../common/utils/File';
 | 
					import FileUtil from '../common/utils/File'
 | 
				
			||||||
import { VideoConfig } from './interfaces';
 | 
					import { VideoConfig } from './interfaces'
 | 
				
			||||||
import common from '@ohos.app.ability.common';
 | 
					import common from '@ohos.app.ability.common';
 | 
				
			||||||
import promptAction from '@ohos.promptAction';
 | 
					import promptAction from '@ohos.promptAction'
 | 
				
			||||||
import { endRecordVideo, startRecordVideo, takePhoto } from '../common/service/videoService';
 | 
					import { startRecordVideo, endRecordVideo,takePhoto } from '../common/service/videoService'
 | 
				
			||||||
import { GlobalConfig } from '../config/index';
 | 
					import { GlobalConfig } from '../config/index'
 | 
				
			||||||
 | 
					 | 
				
			||||||
@Entry
 | 
					@Entry
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
export default struct Index {
 | 
					struct Index {
 | 
				
			||||||
  @State ratio: number = 1700 / 960
 | 
					  @State ratio: number = 1700 / 960
 | 
				
			||||||
  @State videoSrc: string = 'rtsp://admin12345qwe@192.168.36.94:554/h264/ch3/main/av_stream'
 | 
					  @State videoSrc: string = 'rtsp://admin12345qwe@192.168.36.94:554/h264/ch3/main/av_stream'
 | 
				
			||||||
  @State previewUri: Resource = $r('app.media.2_nor')
 | 
					  @State previewUri: Resource = $r('app.media.2_nor')
 | 
				
			||||||
  @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
 | 
					  @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
 | 
				
			||||||
  @State inputFontSize: number = 10 //12
 | 
					  @State inputFontSize: number = 10 //12
 | 
				
			||||||
  @State rocordHandleObj: any = {
 | 
					  @State rocordHandleObj:any = {
 | 
				
			||||||
    rocord_handle1: 0,
 | 
					    rocord_handle1:0,
 | 
				
			||||||
    rocord_handle2: 0,
 | 
					    rocord_handle2:0,
 | 
				
			||||||
    rocord_handle3: 0,
 | 
					    rocord_handle3:0,
 | 
				
			||||||
    rocord_handle4: 0
 | 
					    rocord_handle4:0
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  @State isAutoPlay: boolean = true
 | 
					  @State isAutoPlay: boolean = true
 | 
				
			||||||
  @State showFlag: boolean = false
 | 
					  @State showFlag: boolean = false
 | 
				
			||||||
 | 
					  private vocObj = null;
 | 
				
			||||||
  @State showControls: boolean = false
 | 
					  @State showControls: boolean = false
 | 
				
			||||||
 | 
					  private fileUtil: FileUtil
 | 
				
			||||||
  @State @Watch('outClick') outFlag: boolean = false;
 | 
					  @State @Watch('outClick') outFlag: boolean = false;
 | 
				
			||||||
  @State oldParam: VideoConfig = {
 | 
					  @State oldParam: VideoConfig = {
 | 
				
			||||||
    videoNum: '1',
 | 
					    videoNum:'1',
 | 
				
			||||||
    spls: '1',
 | 
					    spls: '1',
 | 
				
			||||||
    wz: '0,0',
 | 
					    wz: '0,0',
 | 
				
			||||||
    faceFlag: false,
 | 
					    faceFlag: false,
 | 
				
			||||||
@ -50,14 +51,14 @@ export default struct Index {
 | 
				
			|||||||
    dolt: '',
 | 
					    dolt: '',
 | 
				
			||||||
    fontSize: '',
 | 
					    fontSize: '',
 | 
				
			||||||
    rlls: '1',
 | 
					    rlls: '1',
 | 
				
			||||||
    spzd4: false,
 | 
					    spzd4:false,
 | 
				
			||||||
    spzd3: false,
 | 
					    spzd3:false,
 | 
				
			||||||
    spzd2: false,
 | 
					    spzd2:false,
 | 
				
			||||||
    spzd1: false,
 | 
					    spzd1:false,
 | 
				
			||||||
    zdyz: '5',
 | 
					    zdyz:'5',
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  @State param: VideoConfig = {
 | 
					  @State param: VideoConfig = {
 | 
				
			||||||
    videoNum: '1',
 | 
					    videoNum:'1',
 | 
				
			||||||
    spls: '1',
 | 
					    spls: '1',
 | 
				
			||||||
    wz: '0,0',
 | 
					    wz: '0,0',
 | 
				
			||||||
    faceFlag: false,
 | 
					    faceFlag: false,
 | 
				
			||||||
@ -82,31 +83,30 @@ export default struct Index {
 | 
				
			|||||||
    dolt: '',
 | 
					    dolt: '',
 | 
				
			||||||
    fontSize: '',
 | 
					    fontSize: '',
 | 
				
			||||||
    rlls: '1',
 | 
					    rlls: '1',
 | 
				
			||||||
    spzd4: false,
 | 
					    spzd4:false,
 | 
				
			||||||
    spzd3: false,
 | 
					    spzd3:false,
 | 
				
			||||||
    spzd2: false,
 | 
					    spzd2:false,
 | 
				
			||||||
    spzd1: false,
 | 
					    spzd1:false,
 | 
				
			||||||
    zdyz: '5',
 | 
					    zdyz:'5',
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  @State openFlag: boolean = true
 | 
					  @State openFlag: boolean = true
 | 
				
			||||||
  @State lsArr: Array<any> = [
 | 
					  @State lsArr: Array<any> = [
 | 
				
			||||||
    { key: '第一路' },
 | 
					    {key:'第一路'},
 | 
				
			||||||
    { key: '第二路' },
 | 
					    {key:'第二路'},
 | 
				
			||||||
    { key: '第三路' },
 | 
					    {key:'第三路'},
 | 
				
			||||||
    { key: '第四路' },
 | 
					    {key:'第四路'},
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
  private vocObj = null;
 | 
					
 | 
				
			||||||
  private fileUtil: FileUtil
 | 
					 | 
				
			||||||
  private context = getContext(this) as common.UIAbilityContext;
 | 
					  private context = getContext(this) as common.UIAbilityContext;
 | 
				
			||||||
  private controller1: VideoController = new VideoController()
 | 
					  private controller1: VideoController = new VideoController()
 | 
				
			||||||
  private controller2: VideoController = new VideoController()
 | 
					  private controller2: VideoController = new VideoController()
 | 
				
			||||||
  private controller3: VideoController = new VideoController()
 | 
					  private controller3: VideoController = new VideoController()
 | 
				
			||||||
  private controller4: VideoController = new VideoController()
 | 
					  private controller4: VideoController = new VideoController()
 | 
				
			||||||
  @State videoArr: Array<any> = [
 | 
					  @State videoArr: Array<any> = [
 | 
				
			||||||
    { td: 'td1', controller: this.controller1, src: '' },
 | 
					    {td:'td1',controller:this.controller1,src:''},
 | 
				
			||||||
    { td: 'td2', controller: this.controller2, src: '' },
 | 
					    {td:'td2',controller:this.controller2,src:''},
 | 
				
			||||||
    { td: 'td3', controller: this.controller3, src: '' },
 | 
					    {td:'td3',controller:this.controller3,src:''},
 | 
				
			||||||
    { td: 'td4', controller: this.controller4, src: '' },
 | 
					    {td:'td4',controller:this.controller4,src:''},
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
  private inputController: TextInputController = new TextInputController()
 | 
					  private inputController: TextInputController = new TextInputController()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -114,8 +114,8 @@ export default struct Index {
 | 
				
			|||||||
    Column() {
 | 
					    Column() {
 | 
				
			||||||
      TopLogo({ outFlag: $outFlag })
 | 
					      TopLogo({ outFlag: $outFlag })
 | 
				
			||||||
      Flex({ justifyContent: FlexAlign.SpaceBetween }) {
 | 
					      Flex({ justifyContent: FlexAlign.SpaceBetween }) {
 | 
				
			||||||
        Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row }) {
 | 
					        Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row}) {
 | 
				
			||||||
          ForEach(this.videoArr, (item, index) => {
 | 
					          ForEach(this.videoArr,(item,index)=>{
 | 
				
			||||||
            Video({
 | 
					            Video({
 | 
				
			||||||
              src: this.openFlag ? `rtsp://${this.param.userName}:${this.param.pwd}@${this.param.ip}:${this.param.port}/h264/ch${this.param[item.td]}/main/av_stream` : '',
 | 
					              src: this.openFlag ? `rtsp://${this.param.userName}:${this.param.pwd}@${this.param.ip}:${this.param.port}/h264/ch${this.param[item.td]}/main/av_stream` : '',
 | 
				
			||||||
              currentProgressRate: this.curRate,
 | 
					              currentProgressRate: this.curRate,
 | 
				
			||||||
@ -128,7 +128,7 @@ export default struct Index {
 | 
				
			|||||||
              .controls(this.showControls)
 | 
					              .controls(this.showControls)
 | 
				
			||||||
              .margin(10 * this.ratio)
 | 
					              .margin(10 * this.ratio)
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
        }.margin({ top: 37 * this.ratio, left: 30 * this.ratio }).width(600 * this.ratio).height(600 * this.ratio)
 | 
					        }.margin({ top: 37 * this.ratio, left: 30 * this.ratio }).width(600*this.ratio).height(600*this.ratio)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Column() {
 | 
					        Column() {
 | 
				
			||||||
          Image($r('app.media.shezhi'))
 | 
					          Image($r('app.media.shezhi'))
 | 
				
			||||||
@ -170,9 +170,8 @@ export default struct Index {
 | 
				
			|||||||
            .margin({ bottom: 10 * this.ratio })
 | 
					            .margin({ bottom: 10 * this.ratio })
 | 
				
			||||||
            .onClick(() => {
 | 
					            .onClick(() => {
 | 
				
			||||||
              for (let i = 1; i <= 4; i++) {
 | 
					              for (let i = 1; i <= 4; i++) {
 | 
				
			||||||
                console.log('rocord_handle', i, JSON.stringify(this.rocordHandleObj))
 | 
					                console.log('rocord_handle',i,JSON.stringify(this.rocordHandleObj))
 | 
				
			||||||
                if (this.rocordHandleObj['rocord_handle'+i]) {
 | 
					                if (this.rocordHandleObj['rocord_handle'+i]) {
 | 
				
			||||||
                  console.log('ttttt', i)
 | 
					 | 
				
			||||||
                  endRecordVideo(this.rocordHandleObj['rocord_handle'+i])
 | 
					                  endRecordVideo(this.rocordHandleObj['rocord_handle'+i])
 | 
				
			||||||
                  this.rocordHandleObj['rocord_handle'+i] = 0
 | 
					                  this.rocordHandleObj['rocord_handle'+i] = 0
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -186,16 +185,16 @@ export default struct Index {
 | 
				
			|||||||
            .width(215 * this.ratio)
 | 
					            .width(215 * this.ratio)
 | 
				
			||||||
            .height(64 * this.ratio)
 | 
					            .height(64 * this.ratio)
 | 
				
			||||||
            .onClick(async () => {
 | 
					            .onClick(async () => {
 | 
				
			||||||
              const arr = ['1', '2', '3', '4']
 | 
					              const arr=['1','2','3','4']
 | 
				
			||||||
              if (!arr.includes(this.param.pztd)) {
 | 
					              if(!arr.includes(this.param.pztd)){
 | 
				
			||||||
                promptAction.showToast({
 | 
					                promptAction.showToast({
 | 
				
			||||||
                  message: '请填写正确的拍照通道',
 | 
					                  message: '请填写正确的拍照通道',
 | 
				
			||||||
                  duration: 3000
 | 
					                  duration: 3000
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
                return
 | 
					                return
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
              try {
 | 
					              try{
 | 
				
			||||||
                await takePhoto(this.param, this.context, 'pz/')
 | 
					                await takePhoto(this.param,this.context,'pz/')
 | 
				
			||||||
                promptAction.showToast({
 | 
					                promptAction.showToast({
 | 
				
			||||||
                  message: '抓图完成',
 | 
					                  message: '抓图完成',
 | 
				
			||||||
                  duration: 3000
 | 
					                  duration: 3000
 | 
				
			||||||
@ -204,8 +203,8 @@ export default struct Index {
 | 
				
			|||||||
                //   console.log('daihai err: ' + err)
 | 
					                //   console.log('daihai err: ' + err)
 | 
				
			||||||
                // })
 | 
					                // })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              } catch (error) {
 | 
					              }catch (error){
 | 
				
			||||||
                console.log('daihai', error)
 | 
					                console.log('daihai',error)
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
@ -320,10 +319,9 @@ export default struct Index {
 | 
				
			|||||||
                .width(34 * this.ratio)
 | 
					                .width(34 * this.ratio)
 | 
				
			||||||
                .height(26 * this.ratio)
 | 
					                .height(26 * this.ratio)
 | 
				
			||||||
                .fontSize(this.inputFontSize * this.ratio)
 | 
					                .fontSize(this.inputFontSize * this.ratio)
 | 
				
			||||||
                .margin({ left: 10 * this.ratio, right: 15 * this.ratio })
 | 
					                .margin({ left: 10 * this.ratio, right: 15 * this.ratio }).onChange((value: string) => {
 | 
				
			||||||
                .onChange((value: string) => {
 | 
					                this.param.zdyz = value
 | 
				
			||||||
                  this.param.zdyz = value
 | 
					              })
 | 
				
			||||||
                })
 | 
					 | 
				
			||||||
              // Text('k').fontColor('#333333').fontSize(16 * this.ratio)
 | 
					              // Text('k').fontColor('#333333').fontSize(16 * this.ratio)
 | 
				
			||||||
              // Text('链接类型').fontColor('#333333').fontSize(16 * this.ratio)
 | 
					              // Text('链接类型').fontColor('#333333').fontSize(16 * this.ratio)
 | 
				
			||||||
              // TextInput({ text: this.param.ljlx, controller: this.inputController })
 | 
					              // TextInput({ text: this.param.ljlx, controller: this.inputController })
 | 
				
			||||||
@ -341,7 +339,6 @@ export default struct Index {
 | 
				
			|||||||
                Row() {
 | 
					                Row() {
 | 
				
			||||||
                  Row() {
 | 
					                  Row() {
 | 
				
			||||||
                  }.width(70 * this.ratio)
 | 
					                  }.width(70 * this.ratio)
 | 
				
			||||||
 | 
					 | 
				
			||||||
                  Text('IP地址')
 | 
					                  Text('IP地址')
 | 
				
			||||||
                    .width(158 * this.ratio)
 | 
					                    .width(158 * this.ratio)
 | 
				
			||||||
                    .fontSize(16 * this.ratio)
 | 
					                    .fontSize(16 * this.ratio)
 | 
				
			||||||
@ -374,7 +371,7 @@ export default struct Index {
 | 
				
			|||||||
                    .textAlign(TextAlign.Center)
 | 
					                    .textAlign(TextAlign.Center)
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                ForEach(this.lsArr, (item, index) => {
 | 
					                ForEach(this.lsArr,(item,index)=>{
 | 
				
			||||||
                  Row() {
 | 
					                  Row() {
 | 
				
			||||||
                    Text(item.key)
 | 
					                    Text(item.key)
 | 
				
			||||||
                      .width(70 * this.ratio)
 | 
					                      .width(70 * this.ratio)
 | 
				
			||||||
@ -392,7 +389,7 @@ export default struct Index {
 | 
				
			|||||||
                      .onChange((value: string) => {
 | 
					                      .onChange((value: string) => {
 | 
				
			||||||
                        this.param.ip = value
 | 
					                        this.param.ip = value
 | 
				
			||||||
                      })
 | 
					                      })
 | 
				
			||||||
                    TextInput({ text: this.param['td'+(Number(index) + 1)], controller: this.inputController })
 | 
					                    TextInput({ text: this.param['td'+(Number(index)+1)], controller: this.inputController })
 | 
				
			||||||
                      .type(InputType.Normal)
 | 
					                      .type(InputType.Normal)
 | 
				
			||||||
                      .borderRadius(2)
 | 
					                      .borderRadius(2)
 | 
				
			||||||
                      .width(96 * this.ratio)
 | 
					                      .width(96 * this.ratio)
 | 
				
			||||||
@ -401,7 +398,7 @@ export default struct Index {
 | 
				
			|||||||
                      .margin({ right: 10 * this.ratio })
 | 
					                      .margin({ right: 10 * this.ratio })
 | 
				
			||||||
                      .fontSize(this.inputFontSize * this.ratio)
 | 
					                      .fontSize(this.inputFontSize * this.ratio)
 | 
				
			||||||
                      .onChange((value: string) => {
 | 
					                      .onChange((value: string) => {
 | 
				
			||||||
                        this.param['td'+(Number(index) + 1)] = value
 | 
					                        this.param['td'+(Number(index)+1)] = value
 | 
				
			||||||
                      })
 | 
					                      })
 | 
				
			||||||
                    TextInput({ text: this.param.userName, controller: this.inputController })
 | 
					                    TextInput({ text: this.param.userName, controller: this.inputController })
 | 
				
			||||||
                      .type(InputType.Normal)
 | 
					                      .type(InputType.Normal)
 | 
				
			||||||
@ -501,7 +498,7 @@ export default struct Index {
 | 
				
			|||||||
                          .width(22 * this.ratio)
 | 
					                          .width(22 * this.ratio)
 | 
				
			||||||
                          .height(22 * this.ratio)
 | 
					                          .height(22 * this.ratio)
 | 
				
			||||||
                          .onChange((value: boolean) => {
 | 
					                          .onChange((value: boolean) => {
 | 
				
			||||||
                            this.param.spzd1 = value
 | 
					                            this.param.spzd1=value
 | 
				
			||||||
                          })
 | 
					                          })
 | 
				
			||||||
                        Text('一路').fontSize(16 * this.ratio).fontColor('#333333')
 | 
					                        Text('一路').fontSize(16 * this.ratio).fontColor('#333333')
 | 
				
			||||||
                        Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
 | 
					                        Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
 | 
				
			||||||
@ -509,7 +506,7 @@ export default struct Index {
 | 
				
			|||||||
                          .width(22 * this.ratio)
 | 
					                          .width(22 * this.ratio)
 | 
				
			||||||
                          .height(22 * this.ratio)
 | 
					                          .height(22 * this.ratio)
 | 
				
			||||||
                          .onChange((value: boolean) => {
 | 
					                          .onChange((value: boolean) => {
 | 
				
			||||||
                            this.param.spzd2 = value
 | 
					                            this.param.spzd2=value
 | 
				
			||||||
                          })
 | 
					                          })
 | 
				
			||||||
                        Text('二路').fontSize(16 * this.ratio).fontColor('#333333')
 | 
					                        Text('二路').fontSize(16 * this.ratio).fontColor('#333333')
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
@ -520,7 +517,7 @@ export default struct Index {
 | 
				
			|||||||
                          .width(22 * this.ratio)
 | 
					                          .width(22 * this.ratio)
 | 
				
			||||||
                          .height(22 * this.ratio)
 | 
					                          .height(22 * this.ratio)
 | 
				
			||||||
                          .onChange((value: boolean) => {
 | 
					                          .onChange((value: boolean) => {
 | 
				
			||||||
                            this.param.spzd3 = value
 | 
					                            this.param.spzd3=value
 | 
				
			||||||
                          })
 | 
					                          })
 | 
				
			||||||
                        Text('三路').fontSize(16 * this.ratio).fontColor('#333333')
 | 
					                        Text('三路').fontSize(16 * this.ratio).fontColor('#333333')
 | 
				
			||||||
                        Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
 | 
					                        Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
 | 
				
			||||||
@ -528,7 +525,7 @@ export default struct Index {
 | 
				
			|||||||
                          .width(22 * this.ratio)
 | 
					                          .width(22 * this.ratio)
 | 
				
			||||||
                          .height(22 * this.ratio)
 | 
					                          .height(22 * this.ratio)
 | 
				
			||||||
                          .onChange((value: boolean) => {
 | 
					                          .onChange((value: boolean) => {
 | 
				
			||||||
                            this.param.spzd4 = value
 | 
					                            this.param.spzd4=value
 | 
				
			||||||
                          })
 | 
					                          })
 | 
				
			||||||
                        Text('四路').fontSize(16 * this.ratio).fontColor('#333333')
 | 
					                        Text('四路').fontSize(16 * this.ratio).fontColor('#333333')
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
@ -623,31 +620,27 @@ export default struct Index {
 | 
				
			|||||||
    this.fileUtil = fileUtil
 | 
					    this.fileUtil = fileUtil
 | 
				
			||||||
    this.getVideoConfig()
 | 
					    this.getVideoConfig()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  async getfilehandleCode(td){
 | 
				
			||||||
  async getfilehandleCode(td) {
 | 
					    const record_handle = await startRecordVideo(this.param,td,this.context,'lp')
 | 
				
			||||||
    const record_handle = await startRecordVideo(this.param, td, this.context, 'lp')
 | 
					    this.rocordHandleObj['rocord_handle'+td]=record_handle
 | 
				
			||||||
    this.rocordHandleObj['rocord_handle'+td] = record_handle
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  outClick() {
 | 
					  outClick() {
 | 
				
			||||||
    this.openFlag = false
 | 
					    this.openFlag = false
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
 | 
					  sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
 | 
				
			||||||
 | 
					 | 
				
			||||||
  async onPageShow() {
 | 
					  async onPageShow() {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async getVideoConfig() {
 | 
					  async getVideoConfig() {
 | 
				
			||||||
    const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
 | 
					    const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress+'/config/config3.txt');
 | 
				
			||||||
    this.oldParam = JSON.parse(data)
 | 
					    this.oldParam = JSON.parse(data)
 | 
				
			||||||
    this.param = JSON.parse(data)
 | 
					    this.param = JSON.parse(data)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async writeConfig() {
 | 
					  async writeConfig() {
 | 
				
			||||||
    this.oldParam = JSON.parse(JSON.stringify(this.param))
 | 
					    this.oldParam = JSON.parse(JSON.stringify(this.param))
 | 
				
			||||||
    this.videoArr = JSON.parse(JSON.stringify(this.videoArr))
 | 
					    this.videoArr=JSON.parse(JSON.stringify(this.videoArr))
 | 
				
			||||||
    console.log('kkkk', JSON.stringify(this.param))
 | 
					    console.log('kkkk',JSON.stringify(this.param))
 | 
				
			||||||
    const folderPath = await this.fileUtil.initFolder(`/config`);
 | 
					    const folderPath = await this.fileUtil.initFolder(`/config`);
 | 
				
			||||||
    this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.param), 'overWrite')
 | 
					    this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.param), 'overWrite')
 | 
				
			||||||
    this.showFlag = false
 | 
					    this.showFlag = false
 | 
				
			||||||
 | 
				
			|||||||
@ -1,65 +1,65 @@
 | 
				
			|||||||
import router from '@ohos.router';
 | 
					import router from '@ohos.router'
 | 
				
			||||||
import UdpClient from '../../common/utils/UdpClient';
 | 
					import UdpClient from '../../common/utils/UdpClient';
 | 
				
			||||||
import FileLog from '../judgeSDK/utils/file-log';
 | 
					import FileLog from '../judgeSDK/utils/file-log'
 | 
				
			||||||
import SerialPortClient from '../../common/utils/SerialPortClient';
 | 
					import { voiceService } from '../../common/service/voiceService'
 | 
				
			||||||
import RealTime from '../compontents/judge/real-time';
 | 
					import prompt from '@ohos.prompt'
 | 
				
			||||||
 | 
					import RealTime from '../compontents/judge/real-time'
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
export default struct SignDisplayCom {
 | 
					struct SignDisplayCom {
 | 
				
			||||||
 | 
					  constructor() {
 | 
				
			||||||
 | 
					    super()
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @State showBack: boolean = false
 | 
					  @State showBack: boolean = false
 | 
				
			||||||
  @State scaleNum: number = 1
 | 
					  @State scaleNum: number = 1
 | 
				
			||||||
  @State msg: string = ''
 | 
					  @State msg: string = ''
 | 
				
			||||||
  @State signArr: Array<any> = []
 | 
					  @State signArr: Array<any> = []
 | 
				
			||||||
  @State sjxhColum: Array<any> = [
 | 
					  @State sjxhColum: Array<any> = [
 | 
				
			||||||
    { key: "左方向灯", value: "0" },
 | 
					    { key: '左方向灯', value: '0' }, { key: '右方向灯', value: '0' }, {
 | 
				
			||||||
    { key: "右方向灯", value: "0" },
 | 
					    key: '喇叭',
 | 
				
			||||||
    { key: "喇叭", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "点火1", value: "0" },
 | 
					  }, { key: '点火1', value: '0' }, { key: '点火2', value: '0' }, { key: '近光灯', value: '0' }, {
 | 
				
			||||||
    { key: "点火2", value: "0" },
 | 
					    key: '远光灯',
 | 
				
			||||||
    { key: "近光灯", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "远光灯", value: "0" },
 | 
					  }, { key: '示廓灯', value: '0' }, { key: '雾灯', value: '0' }, { key: '雨刮器', value: '0' }, {
 | 
				
			||||||
    { key: "示廓灯", value: "0" },
 | 
					    key: '脚刹',
 | 
				
			||||||
    { key: "雾灯", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "雨刮器", value: "0" },
 | 
					  }, { key: '手刹', value: '0' }, { key: '主驾驶门', value: '0' }, { key: '离合', value: '0' }, {
 | 
				
			||||||
    { key: "脚刹", value: "0" },
 | 
					    key: '副刹车',
 | 
				
			||||||
    { key: "手刹", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "主驾驶门", value: "0" },
 | 
					  }, {
 | 
				
			||||||
    { key: "离合", value: "0" },
 | 
					    key: '安全带',
 | 
				
			||||||
    { key: "副刹车", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "安全带", value: "0" },
 | 
					  }, { key: '双跳灯', value: '0' }, { key: '车速', value: '0' }, { key: '档位', value: '0' }, {
 | 
				
			||||||
    { key: "双跳灯", value: "0" },
 | 
					    key: '超声波1',
 | 
				
			||||||
    { key: "车速", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "档位", value: "0" },
 | 
					  }, {
 | 
				
			||||||
    { key: "超声波1", value: "0" },
 | 
					    key: '超声波2',
 | 
				
			||||||
    { key: "超声波2", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "NC", value: "0" },
 | 
					  }, {
 | 
				
			||||||
    { key: "SA15", value: "0" },
 | 
					    key: 'NC',
 | 
				
			||||||
    { key: "其他门", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "转速过高", value: "0" },
 | 
					  }, { key: 'SA15', value: '0' }, { key: '其他门', value: '0' }, { key: '转速过高', value: '0' }, {
 | 
				
			||||||
    { key: "累计脉冲", value: "0" },
 | 
					    key: '累计脉冲',
 | 
				
			||||||
    { key: "熄火次数", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "发动机转速", value: "0" },
 | 
					  }, { key: '熄火次数', value: '0' }, { key: '发动机转速', value: '0' }, { key: '方向盘角度', value: '0' }, {
 | 
				
			||||||
    { key: "方向盘角度", value: "0" },
 | 
					    key: '超声波3',
 | 
				
			||||||
    { key: "超声波3", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "超声波4", value: "0" },
 | 
					  }, { key: '超声波4', value: '0' }, { key: '触摸1', value: '0' }, { key: '触摸2', value: '0' }, {
 | 
				
			||||||
    { key: "触摸1", value: "0" },
 | 
					    key: '触摸3',
 | 
				
			||||||
    { key: "触摸2", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "触摸3", value: "0" },
 | 
					  }, { key: 'SCIO', value: '0' }
 | 
				
			||||||
    { key: "SCIO", value: "0" },
 | 
					    , { key: 'SC1A_C', value: '0' }, { key: 'SC1B_C', value: '0' }, { key: 'SC2A_C', value: '0' }, {
 | 
				
			||||||
    { key: "SC1A_C", value: "0" },
 | 
					    key: 'SC2B_C',
 | 
				
			||||||
    { key: "SC1B_C", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "SC2A_C", value: "0" },
 | 
					  }, { key: 'SC3A_C', value: '0' }, { key: 'SC3B_C', value: '0' }, { key: 'SC4A_C', value: '0' }, {
 | 
				
			||||||
    { key: "SC2B_C", value: "0" },
 | 
					    key: 'SC4B_C',
 | 
				
			||||||
    { key: "SC3A_C", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "SC3B_C", value: "0" },
 | 
					  }, { key: 'SC5A_C', value: '0' }, { key: 'SC5B_C', value: '0' }, { key: 'SC6A_C', value: '0' }, {
 | 
				
			||||||
    { key: "SC4A_C", value: "0" },
 | 
					    key: 'SC6B_C',
 | 
				
			||||||
    { key: "SC4B_C", value: "0" },
 | 
					    value: '0'
 | 
				
			||||||
    { key: "SC5A_C", value: "0" },
 | 
					  }]
 | 
				
			||||||
    { key: "SC5B_C", value: "0" },
 | 
					  @State GPSColum:Array<any>=[
 | 
				
			||||||
    { key: "SC6A_C", value: "0" },
 | 
					 | 
				
			||||||
    { key: "SC6B_C", value: "0" },
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
  @State GPSColum: Array<any> = [
 | 
					 | 
				
			||||||
    { key: '状态', value: '0' },
 | 
					    { key: '状态', value: '0' },
 | 
				
			||||||
    { key: '收星数', value: '0' },
 | 
					    { key: '收星数', value: '0' },
 | 
				
			||||||
    { key: '海拔高', value: '0' },
 | 
					    { key: '海拔高', value: '0' },
 | 
				
			||||||
@ -80,21 +80,17 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
  @State gpsActive: number = 1
 | 
					  @State gpsActive: number = 1
 | 
				
			||||||
  @Prop active: number = 0
 | 
					  @Prop active: number = 0
 | 
				
			||||||
  @State msgStr: string = ''
 | 
					  @State msgStr: string = ''
 | 
				
			||||||
  @State interval: any = ''
 | 
					  @State interval: any=''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @State @Watch('outClick') outFlag: boolean = false;
 | 
					  @State @Watch('outClick') outFlag: boolean = false;
 | 
				
			||||||
  @State url: string = ''
 | 
					 | 
				
			||||||
  private timer = null
 | 
					  private timer = null
 | 
				
			||||||
  private udpClient: UdpClient = null
 | 
					  private udpClient: UdpClient = null
 | 
				
			||||||
  private FileLog: FileLog
 | 
					  private FileLog: FileLog
 | 
				
			||||||
  private vocObj = null;
 | 
					  private vocObj = null;
 | 
				
			||||||
 | 
					  @State url: string = ''
 | 
				
			||||||
  constructor() {
 | 
					 | 
				
			||||||
    super()
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //  @State gpsList: Array<any> = []
 | 
					  //  @State gpsList: Array<any> = []
 | 
				
			||||||
  build() {
 | 
					  build() {
 | 
				
			||||||
    Column() {
 | 
					    Column(){
 | 
				
			||||||
      Column() {
 | 
					      Column() {
 | 
				
			||||||
        // TopLogo({outFlag:$outFlag})
 | 
					        // TopLogo({outFlag:$outFlag})
 | 
				
			||||||
        Flex({ justifyContent: FlexAlign.SpaceBetween }) {
 | 
					        Flex({ justifyContent: FlexAlign.SpaceBetween }) {
 | 
				
			||||||
@ -150,7 +146,7 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          Row() {
 | 
					          Row() {
 | 
				
			||||||
            if (this.showBack) {
 | 
					            if(this.showBack){
 | 
				
			||||||
              Image($r('app.media.topB_back')).width('16.7%').height('12.2%')
 | 
					              Image($r('app.media.topB_back')).width('16.7%').height('12.2%')
 | 
				
			||||||
                .onClick(() => {
 | 
					                .onClick(() => {
 | 
				
			||||||
                  router.back()
 | 
					                  router.back()
 | 
				
			||||||
@ -292,14 +288,8 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
              Text('海拔高:' + this.signArr[85]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
 | 
					              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[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[87]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
 | 
				
			||||||
              Text('维度因子:' + this.signArr[88])
 | 
					              Text('维度因子:' + this.signArr[88]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
 | 
				
			||||||
                .fontColor('#FFB433')
 | 
					              Text('经度因子:' + this.signArr[89]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
 | 
				
			||||||
                .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[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[91]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
 | 
				
			||||||
              Text('航向角状态-收星数:' + this.signArr[92])
 | 
					              Text('航向角状态-收星数:' + this.signArr[92])
 | 
				
			||||||
@ -332,10 +322,10 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
              Row() {
 | 
					              Row() {
 | 
				
			||||||
                Text('GPS').fontColor(this.gpsActive == 0 ? '#2D3C5A' : '#fff')
 | 
					                Text('GPS').fontColor(this.gpsActive == 0 ? '#2D3C5A' : '#fff')
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
              .width(316 * this.ratio)
 | 
					              .width(316*this.ratio)
 | 
				
			||||||
              .height(24 * this.ratio)
 | 
					              .height(24*this.ratio)
 | 
				
			||||||
              .backgroundColor(this.gpsActive == 0 ? '#fff' : '#1A1A1A')
 | 
					              .backgroundColor(this.gpsActive == 0 ? '#fff' : '#1A1A1A')
 | 
				
			||||||
              .margin({ left: 10 * this.ratio, right: 10 * this.ratio })
 | 
					              .margin({ left: 10*this.ratio, right: 10*this.ratio })
 | 
				
			||||||
              .justifyContent(FlexAlign.Center)
 | 
					              .justifyContent(FlexAlign.Center)
 | 
				
			||||||
              .onClick(() => {
 | 
					              .onClick(() => {
 | 
				
			||||||
                this.gpsActive = 0
 | 
					                this.gpsActive = 0
 | 
				
			||||||
@ -351,8 +341,7 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
              // .onClick(() => {
 | 
					              // .onClick(() => {
 | 
				
			||||||
              //   this.gpsActive = 1
 | 
					              //   this.gpsActive = 1
 | 
				
			||||||
              // })
 | 
					              // })
 | 
				
			||||||
            }.margin({ top: 10 * this.ratio })
 | 
					            }.margin({ top: 10*this.ratio })
 | 
				
			||||||
 | 
					 | 
				
			||||||
            Flex({ direction: FlexDirection.Column }) {
 | 
					            Flex({ direction: FlexDirection.Column }) {
 | 
				
			||||||
              ForEach(this.GPSColum, (item) => {
 | 
					              ForEach(this.GPSColum, (item) => {
 | 
				
			||||||
                Column() {
 | 
					                Column() {
 | 
				
			||||||
@ -364,7 +353,7 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
              })
 | 
					              })
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          .width(168 * 2 * this.ratio)
 | 
					          .width(168 *2* this.ratio)
 | 
				
			||||||
          .height(380 * this.ratio)
 | 
					          .height(380 * this.ratio)
 | 
				
			||||||
          .backgroundColor('#282828')
 | 
					          .backgroundColor('#282828')
 | 
				
			||||||
          .margin({ top: 6 * this.ratio, left: 10 * this.ratio })
 | 
					          .margin({ top: 6 * this.ratio, left: 10 * this.ratio })
 | 
				
			||||||
@ -375,8 +364,8 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
          Row() {
 | 
					          Row() {
 | 
				
			||||||
            RealTime({
 | 
					            RealTime({
 | 
				
			||||||
              width: Math.floor(550 * this.ratio),
 | 
					              width:Math.floor(550 * this.ratio),
 | 
				
			||||||
              height: Math.floor(380 * this.ratio),
 | 
					              height:Math.floor(380 * this.ratio),
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          .width(550 * this.ratio)
 | 
					          .width(550 * this.ratio)
 | 
				
			||||||
@ -402,47 +391,33 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
  aboutToDisappear() {
 | 
					  aboutToDisappear() {
 | 
				
			||||||
    clearInterval(this.interval)
 | 
					    clearInterval(this.interval)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  aboutToAppear(){
 | 
				
			||||||
  aboutToAppear() {
 | 
					 | 
				
			||||||
    this.ratio = this.ratio * (this.scaleNum || 1);
 | 
					    this.ratio = this.ratio * (this.scaleNum || 1);
 | 
				
			||||||
    const that = this
 | 
					    const that = this
 | 
				
			||||||
    const {showBack,getSignal} = this
 | 
					    const {showBack,getSignal} = this
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const serialPortClient = new SerialPortClient()
 | 
					
 | 
				
			||||||
    serialPortClient.openSerial()
 | 
					    if(showBack){
 | 
				
			||||||
    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) => {
 | 
					      globalThis.udpClient.onMessage((msg) => {
 | 
				
			||||||
        console.log('msgmsg', msg)
 | 
					        console.log('msgmsg',msg)
 | 
				
			||||||
        if (msg) {
 | 
					        if(msg){
 | 
				
			||||||
          getSignal(msg)
 | 
					          getSignal(msg)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    } else {
 | 
					    }else{
 | 
				
			||||||
      clearInterval(globalThis.signalTimer)
 | 
					      clearInterval(globalThis.signalTimer)
 | 
				
			||||||
      globalThis.signalTimer = setInterval(() => {
 | 
					      globalThis.signalTimer = setInterval(()=>{
 | 
				
			||||||
        const msgStr = globalThis.msgStr
 | 
					        const msgStr = globalThis.msgStr
 | 
				
			||||||
        if (msgStr) {
 | 
					        if(msgStr){
 | 
				
			||||||
          getSignal(msgStr)
 | 
					          getSignal(msgStr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }, 200)
 | 
					      },200)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onPageShow() {
 | 
					  onPageShow() {
 | 
				
			||||||
    console.info('SURENJUN', 123)
 | 
					    console.info('SURENJUN',123)
 | 
				
			||||||
    // this.vocObj = new voiceService(async (status, val) => {
 | 
					    // this.vocObj = new voiceService(async (status, val) => {
 | 
				
			||||||
    //   if (status == 'idle') {
 | 
					    //   if (status == 'idle') {
 | 
				
			||||||
    //     if (this.url == 'back') {
 | 
					    //     if (this.url == 'back') {
 | 
				
			||||||
@ -452,34 +427,21 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
    //     }
 | 
					    //     }
 | 
				
			||||||
    //   }
 | 
					    //   }
 | 
				
			||||||
    // });
 | 
					    // });
 | 
				
			||||||
    const serialPortClient = new SerialPortClient()
 | 
					
 | 
				
			||||||
    serialPortClient.openSerial()
 | 
					 | 
				
			||||||
    serialPortClient.SerialSet()
 | 
					 | 
				
			||||||
    const getSignal = this.getSignal;
 | 
					    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 that = this
 | 
				
			||||||
    const showBack = this.showBack;
 | 
					    const showBack = this.showBack;
 | 
				
			||||||
    if (showBack) {
 | 
					    if(showBack){
 | 
				
			||||||
      globalThis.udpClient.onMessage((msg) => {
 | 
					      globalThis.udpClient.onMessage((msg) => {
 | 
				
			||||||
        getSignal(msg)
 | 
					        getSignal(msg)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    } else {
 | 
					    }else{
 | 
				
			||||||
      clearInterval(globalThis.signalTimer)
 | 
					      clearInterval(globalThis.signalTimer)
 | 
				
			||||||
      globalThis.signalTimer = setInterval(() => {
 | 
					      globalThis.signalTimer = setInterval(()=>{
 | 
				
			||||||
        //TODO 临时方案
 | 
					        //TODO 临时方案
 | 
				
			||||||
        const msgStr = globalThis.msgStr
 | 
					        const msgStr = globalThis.msgStr
 | 
				
			||||||
        getSignal(msgStr)
 | 
					        getSignal(msgStr)
 | 
				
			||||||
      }, 200)
 | 
					      },200)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // this.getDeviceNo();
 | 
					    // this.getDeviceNo();
 | 
				
			||||||
    // this.initTime();
 | 
					    // this.initTime();
 | 
				
			||||||
@ -488,17 +450,17 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
    // globalThis.isRegist = false; //是否已经注册
 | 
					    // globalThis.isRegist = false; //是否已经注册
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getSignal = (msg) => {
 | 
					  getSignal= (msg)=> {
 | 
				
			||||||
    console.log('msgmsgmsg', msg)
 | 
					    console.log('msgmsgmsg',msg)
 | 
				
			||||||
    const that = this;
 | 
					    const that = this;
 | 
				
			||||||
    that.msg = msg
 | 
					    that.msg = msg
 | 
				
			||||||
    const strachArr = msg.split(',')
 | 
					    const strachArr=msg.split(',')
 | 
				
			||||||
    if (strachArr[0] != '#DN_GD') {
 | 
					    if (strachArr[0] != '#DN_GD') {
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this.signArr = strachArr
 | 
					    this.signArr = strachArr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (let i = 0; i <= 12; i++) {
 | 
					    for (let i = 0;i <= 12; i++) {
 | 
				
			||||||
      this.sjxhColum[i].value = this.signArr[i+2]
 | 
					      this.sjxhColum[i].value = this.signArr[i+2]
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -507,7 +469,7 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
    this.sjxhColum[15].value = this.signArr[19]
 | 
					    this.sjxhColum[15].value = this.signArr[19]
 | 
				
			||||||
    this.sjxhColum[16].value = this.signArr[20]
 | 
					    this.sjxhColum[16].value = this.signArr[20]
 | 
				
			||||||
    this.sjxhColum[17].value = this.signArr[23] //车速
 | 
					    this.sjxhColum[17].value = this.signArr[23] //车速
 | 
				
			||||||
    this.sjxhColum[18].value = this.signArr[28]
 | 
					    this.sjxhColum[18].value=this.signArr[28]
 | 
				
			||||||
    this.sjxhColum[19].value = this.signArr[29]
 | 
					    this.sjxhColum[19].value = this.signArr[29]
 | 
				
			||||||
    this.sjxhColum[20].value = this.signArr[30]
 | 
					    this.sjxhColum[20].value = this.signArr[30]
 | 
				
			||||||
    this.sjxhColum[21].value = this.signArr[15] //NC
 | 
					    this.sjxhColum[21].value = this.signArr[15] //NC
 | 
				
			||||||
@ -523,11 +485,11 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
    this.sjxhColum[31].value = this.signArr[33]
 | 
					    this.sjxhColum[31].value = this.signArr[33]
 | 
				
			||||||
    this.sjxhColum[32].value = this.signArr[34]
 | 
					    this.sjxhColum[32].value = this.signArr[34]
 | 
				
			||||||
    this.sjxhColum[33].value = this.signArr[35]
 | 
					    this.sjxhColum[33].value = this.signArr[35]
 | 
				
			||||||
    for (let i = 34; i <= 46; i++) {
 | 
					    for (let i = 34;i <= 46; i++) {
 | 
				
			||||||
      this.sjxhColum[i].value = this.signArr[i+2]
 | 
					      this.sjxhColum[i].value = this.signArr[i+2]
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    let t = 0
 | 
					    let t=0
 | 
				
			||||||
    for (let i = 83; i <= 97; i++) {
 | 
					    for (let i = 83;i <= 97; i++) {
 | 
				
			||||||
      this.GPSColum[t].value = this.signArr[i]
 | 
					      this.GPSColum[t].value = this.signArr[i]
 | 
				
			||||||
      t++
 | 
					      t++
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -535,7 +497,6 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
    that.signArr = JSON.parse(JSON.stringify((this.signArr)))
 | 
					    that.signArr = JSON.parse(JSON.stringify((this.signArr)))
 | 
				
			||||||
    that.GPSColum = JSON.parse(JSON.stringify((this.GPSColum)))
 | 
					    that.GPSColum = JSON.parse(JSON.stringify((this.GPSColum)))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  outClick() {
 | 
					  outClick() {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -543,7 +504,6 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
    // this.FileLog.initFileLogo('d          .0ateLog')
 | 
					    // this.FileLog.initFileLogo('d          .0ateLog')
 | 
				
			||||||
    // this.FileLog.createFile('123')
 | 
					    // this.FileLog.createFile('123')
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  // getDeviceNo() {
 | 
					  // getDeviceNo() {
 | 
				
			||||||
  //   globalThis.deviceNo = 'FE-FC-FE-7C-5C-72'; //设备号
 | 
					  //   globalThis.deviceNo = 'FE-FC-FE-7C-5C-72'; //设备号
 | 
				
			||||||
  // }
 | 
					  // }
 | 
				
			||||||
@ -561,3 +521,4 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
  // }
 | 
					  // }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default SignDisplayCom
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user