Compare commits
	
		
			3 Commits
		
	
	
		
			c912d437dd
			...
			8f6f1b2a77
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					8f6f1b2a77 | ||
| 
						 | 
					a86a2a675f | ||
| 
						 | 
					3d114bc468 | 
							
								
								
									
										23
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
TOOLCHAIN_PATH := /Users/wangzhongjie/Library/OpenHarmony/Sdk/9/toolchains
 | 
			
		||||
 | 
			
		||||
logs:
 | 
			
		||||
    cd $(TOOLCHAIN_PATH) && \
 | 
			
		||||
    ./hdc file recv /mnt/hmdfs/100/account/device_view/local/files/duolun/logs /Users/wangzhongjie/Desktop/log
 | 
			
		||||
 | 
			
		||||
hilog:
 | 
			
		||||
    cd $(TOOLCHAIN_PATH) && \
 | 
			
		||||
    ./hdc kill && \
 | 
			
		||||
    ./hdc shell "tar -czvf /data/log.tar.gz /data/log/" && \
 | 
			
		||||
    ./hdc file recv /data/log.tar.gz /Users/wangzhongjie/Desktop/log && \
 | 
			
		||||
    ./hdc shell "rm -rf /data/log.tar.gz"
 | 
			
		||||
 | 
			
		||||
open:
 | 
			
		||||
    cd $(TOOLCHAIN_PATH) && \
 | 
			
		||||
    ./hdc kill && \
 | 
			
		||||
    ./hdc shell hilog -w stop && \
 | 
			
		||||
    ./hdc shell hilog -r && \
 | 
			
		||||
    ./hdc shell hilog -w start -l 100M -m none && \
 | 
			
		||||
    ./hdc shell hilog -Q pidoff && \
 | 
			
		||||
    ./hdc shell hilog -p off && \
 | 
			
		||||
    ./hdc shell hilog -b D && \
 | 
			
		||||
    ./hdc shell hilog -w start -t kmsg -m none
 | 
			
		||||
@ -1,13 +1,15 @@
 | 
			
		||||
{
 | 
			
		||||
  "lockfileVersion": 1,
 | 
			
		||||
  "lockfileVersion": 2,
 | 
			
		||||
  "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
 | 
			
		||||
  "specifiers": {
 | 
			
		||||
    "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
 | 
			
		||||
  },
 | 
			
		||||
  "packages": {
 | 
			
		||||
    "@ohos/hypium@1.0.6": {
 | 
			
		||||
      "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
 | 
			
		||||
      "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
 | 
			
		||||
      "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
 | 
			
		||||
      "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==",
 | 
			
		||||
      "registryType": "ohpm",
 | 
			
		||||
      "shasum": "3f5fed65372633233264b3447705b0831dfe7ea1"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -1,41 +1,41 @@
 | 
			
		||||
//import UdpClient from './UdpClient';
 | 
			
		||||
import UdpClientByCenter from './UdpClientByCenter';
 | 
			
		||||
import { getSyncData } from '../service/initable'
 | 
			
		||||
import { getChuankouFn } from '../../common/service/indexService'
 | 
			
		||||
import FileUtil from '../../common/utils/File'
 | 
			
		||||
import { GlobalConfig } from '../../config/index'
 | 
			
		||||
import {Array2Byte,fillZero,string2Bytes}from './tools'
 | 
			
		||||
import emitter from '@ohos.events.emitter';
 | 
			
		||||
import { getSyncData } from '../service/initable';
 | 
			
		||||
import { getChuankouFn } from '../../common/service/indexService';
 | 
			
		||||
import FileUtil from '../../common/utils/File';
 | 
			
		||||
import { GlobalConfig } from '../../config/index';
 | 
			
		||||
import { Array2Byte, string2Bytes } from './tools';
 | 
			
		||||
 | 
			
		||||
export async function sendMsg(val) {
 | 
			
		||||
  // globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getUDP(context,errorFlag?) {
 | 
			
		||||
  return new Promise(async (reslove,reject)=>{
 | 
			
		||||
export async function getUDP(context, errorFlag?) {
 | 
			
		||||
  return new Promise(async (reslove, reject) => {
 | 
			
		||||
    const fileUtil = new FileUtil(context)
 | 
			
		||||
    const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
 | 
			
		||||
    console.log('ttttt',data)
 | 
			
		||||
    console.log('ttttt', data)
 | 
			
		||||
    if (data === '' || data === undefined) {
 | 
			
		||||
      console.log(` getUDP  has no IPConfigTable `);
 | 
			
		||||
      globalThis.udpClient = {}
 | 
			
		||||
      globalThis.host = ''
 | 
			
		||||
      reslove('')
 | 
			
		||||
    } else {
 | 
			
		||||
      const result=JSON.parse(data)
 | 
			
		||||
      const result = JSON.parse(data)
 | 
			
		||||
      console.log(` getUDP  has IPConfigTable `);
 | 
			
		||||
      if (globalThis.udpClient && globalThis.udpClient.closeUdp) {
 | 
			
		||||
        console.log(` getUDP  has udclent close and rebind `);
 | 
			
		||||
        globalThis.udpClient.closeUdp(() => {
 | 
			
		||||
          setTimeout(() => {
 | 
			
		||||
            globalThis.udpClient.rebindUdp(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort)
 | 
			
		||||
            globalThis.udpClient.rebindUdp(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp,
 | 
			
		||||
              result.udpOppositeIpPort)
 | 
			
		||||
            globalThis.udpClient.sendMsg('111', null)
 | 
			
		||||
            globalThis.host = `http://${result.centerIp}:${result.centerPort}`
 | 
			
		||||
            globalThis.udpClient.onError_Callback(()=>{
 | 
			
		||||
            globalThis.udpClient.onError_Callback(() => {
 | 
			
		||||
              console.log('getUDPgetUDPgetUDP')
 | 
			
		||||
              getUDP(context,true)
 | 
			
		||||
              if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
 | 
			
		||||
                globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
 | 
			
		||||
              getUDP(context, true)
 | 
			
		||||
              if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) {
 | 
			
		||||
                globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
            reslove(`http://${result.centerIp}:${result.centerPort}`)
 | 
			
		||||
@ -44,25 +44,23 @@ export async function getUDP(context,errorFlag?) {
 | 
			
		||||
          }, 1000)
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
      } else {
 | 
			
		||||
        // 未绑定
 | 
			
		||||
        console.log(` getUDP  has no  udclent and  bind `);
 | 
			
		||||
        console.log('ttttttdata',JSON.stringify(result))
 | 
			
		||||
        const udpClient: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort)
 | 
			
		||||
        console.log('ttttttdata', JSON.stringify(result))
 | 
			
		||||
        const udpClient: UdpClientByCenter =
 | 
			
		||||
          new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp,
 | 
			
		||||
            result.udpOppositeIpPort)
 | 
			
		||||
        udpClient.bindUdp()
 | 
			
		||||
        udpClient.sendMsg('111')
 | 
			
		||||
        globalThis.host = `http://${result.centerIp}:${result.centerPort}`
 | 
			
		||||
        globalThis.udpClient = udpClient
 | 
			
		||||
 | 
			
		||||
        globalThis.udpClient.onMessage_1(()=>{
 | 
			
		||||
          console.log('getUDPonMessage_1msgmsgByGloalUdp')
 | 
			
		||||
 | 
			
		||||
        })
 | 
			
		||||
        globalThis.udpClient.onError_Callback(()=>{
 | 
			
		||||
          getUDP(context,true)
 | 
			
		||||
          if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
 | 
			
		||||
            globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
 | 
			
		||||
        globalThis.udpClient.onError_Callback(() => {
 | 
			
		||||
          getUDP(context, true)
 | 
			
		||||
          if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) {
 | 
			
		||||
            globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        getChuankouFn()
 | 
			
		||||
@ -79,14 +77,15 @@ export async function getUDP(context,errorFlag?) {
 | 
			
		||||
          console.log(` getUDP  has udclent close and rebind `);
 | 
			
		||||
          globalThis.udpClient.closeUdp(() => {
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
              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', null)
 | 
			
		||||
              globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
 | 
			
		||||
              globalThis.udpClient.onError_Callback(()=>{
 | 
			
		||||
              globalThis.udpClient.onError_Callback(() => {
 | 
			
		||||
                console.log('getUDPgetUDPgetUDP')
 | 
			
		||||
                getUDP(true,context)
 | 
			
		||||
                if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
 | 
			
		||||
                  globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
 | 
			
		||||
                getUDP(true, context)
 | 
			
		||||
                if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) {
 | 
			
		||||
                  globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1
 | 
			
		||||
                }
 | 
			
		||||
              })
 | 
			
		||||
              reslove(`http://${result[0].centerIp}:${result[0].centerPort}`)
 | 
			
		||||
@ -95,24 +94,25 @@ export async function getUDP(context,errorFlag?) {
 | 
			
		||||
            }, 1000)
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
        } else {
 | 
			
		||||
          // 未绑定
 | 
			
		||||
          console.log(` getUDP  has no  udclent and  bind `);
 | 
			
		||||
          const udpClient: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort)
 | 
			
		||||
          const udpClient: UdpClientByCenter =
 | 
			
		||||
            new UdpClientByCenter(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp,
 | 
			
		||||
              result[0].udpOppositeIpPort)
 | 
			
		||||
          udpClient.bindUdp()
 | 
			
		||||
          udpClient.sendMsg('111')
 | 
			
		||||
          globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
 | 
			
		||||
          globalThis.udpClient = udpClient
 | 
			
		||||
 | 
			
		||||
          globalThis.udpClient.onMessage_1(()=>{
 | 
			
		||||
          globalThis.udpClient.onMessage_1(() => {
 | 
			
		||||
            console.log('getUDPonMessage_1msgmsgByGloalUdp')
 | 
			
		||||
 | 
			
		||||
          })
 | 
			
		||||
          globalThis.udpClient.onError_Callback(()=>{
 | 
			
		||||
            getUDP(true,context)
 | 
			
		||||
            if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
 | 
			
		||||
              globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
 | 
			
		||||
          globalThis.udpClient.onError_Callback(() => {
 | 
			
		||||
            getUDP(true, context)
 | 
			
		||||
            if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) {
 | 
			
		||||
              globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
          // udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
 | 
			
		||||
@ -140,61 +140,64 @@ export async function getUDP(context,errorFlag?) {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getUDP2(context,errorFlag?) {
 | 
			
		||||
export async function getUDP2(context, errorFlag?) {
 | 
			
		||||
  const fileUtil = new FileUtil(context)
 | 
			
		||||
  const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
 | 
			
		||||
  if (data === '' || data === undefined) {
 | 
			
		||||
    globalThis.udpClient2 = {}
 | 
			
		||||
    globalThis.udpClient2.setMsgCallBack = () => {
 | 
			
		||||
    }
 | 
			
		||||
  }else{
 | 
			
		||||
    const result=JSON.parse(data)
 | 
			
		||||
  } else {
 | 
			
		||||
    const result = JSON.parse(data)
 | 
			
		||||
    console.log(` getUDP2  has IPConfigTable `);
 | 
			
		||||
    if (globalThis.udpClient2 && globalThis.udpClient2.closeUdp) {
 | 
			
		||||
      console.log(` getUDP2  has udclent ,close and rebind `);
 | 
			
		||||
      globalThis.udpClient2.closeUdp(async () => {
 | 
			
		||||
        setTimeout(() => {
 | 
			
		||||
          globalThis.udpClient2.rebindUdp(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
 | 
			
		||||
          globalThis.udpClient2.onError_Callback(()=>{
 | 
			
		||||
            getUDP2(context,true);
 | 
			
		||||
            if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
 | 
			
		||||
              globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
 | 
			
		||||
          globalThis.udpClient2.rebindUdp(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress,
 | 
			
		||||
            globalThis.carInfo?.messagePort)
 | 
			
		||||
          globalThis.udpClient2.onError_Callback(() => {
 | 
			
		||||
            getUDP2(context, true);
 | 
			
		||||
            if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) {
 | 
			
		||||
              globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
        }, 1000)
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
    } else {
 | 
			
		||||
      // 未绑定
 | 
			
		||||
      console.log(` getUDP2  has no  udclent and  bind `);
 | 
			
		||||
      const udpClient2: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
 | 
			
		||||
      const udpClient2: UdpClientByCenter =
 | 
			
		||||
        new UdpClientByCenter(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress,
 | 
			
		||||
          globalThis.carInfo?.messagePort)
 | 
			
		||||
      console.info('surenjun udp2=> ', globalThis.carInfo?.messagePort)
 | 
			
		||||
      await udpClient2.bindUdp()
 | 
			
		||||
      await udpClient2.onError_Callback(()=>{
 | 
			
		||||
        getUDP2(context,true);
 | 
			
		||||
        if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
 | 
			
		||||
          globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
 | 
			
		||||
      udpClient2.bindUdp()
 | 
			
		||||
      udpClient2.onError_Callback(() => {
 | 
			
		||||
        getUDP2(context, true);
 | 
			
		||||
        if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) {
 | 
			
		||||
          globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      if(!errorFlag){
 | 
			
		||||
        await udpClient2.onMessage_2((val) => {
 | 
			
		||||
      if (!errorFlag) {
 | 
			
		||||
        udpClient2.onMessage_2((val) => {
 | 
			
		||||
          if (val.id == '32') {
 | 
			
		||||
            globalThis.signNum = val.body[1]
 | 
			
		||||
            if(val.body[0] == 5){
 | 
			
		||||
            if (val.body[0] == 5) {
 | 
			
		||||
              console.info('surenjun', `接收到平台扣分请求,请求指令为:${val.body[1]}`)
 | 
			
		||||
              globalThis.udpEvent.sendOnKf(val.body[1])
 | 
			
		||||
            }
 | 
			
		||||
            if(val.body[0] == 11){
 | 
			
		||||
              console.info('surenjun','GlobalUdp收到beginExam事件')
 | 
			
		||||
            if (val.body[0] == 11) {
 | 
			
		||||
              console.info('surenjun', 'GlobalUdp收到beginExam事件')
 | 
			
		||||
              globalThis.udpEvent.sendBeginExam(val.body[1])
 | 
			
		||||
            }
 | 
			
		||||
            if(val.body[0] == 12){
 | 
			
		||||
              console.info('surenjun','GlobalUdp收到endExam事件')
 | 
			
		||||
            if (val.body[0] == 12) {
 | 
			
		||||
              console.info('surenjun', 'GlobalUdp收到endExam事件')
 | 
			
		||||
              globalThis.udpEvent.sendEndExam(val.body[1])
 | 
			
		||||
            }
 | 
			
		||||
          }if (val.id == '36'){
 | 
			
		||||
          }
 | 
			
		||||
          if (val.id == '36') {
 | 
			
		||||
            //获取远程扣分内容
 | 
			
		||||
            console.info('surenjun','考车收到远程扣分项目内容,扣分代码:' + val.body[0])
 | 
			
		||||
            console.info('surenjun', '考车收到远程扣分项目内容,扣分代码:' + val.body[0])
 | 
			
		||||
            globalThis.udpEvent.sendKfContent(val.body[0])
 | 
			
		||||
          } else if (val.id == '46') {
 | 
			
		||||
            let tmpList = []
 | 
			
		||||
@ -225,28 +228,30 @@ export async function getUDP2(context,errorFlag?) {
 | 
			
		||||
        console.log(` getUDP2  has udclent ,close and rebind `);
 | 
			
		||||
        globalThis.udpClient2.closeUdp(async () => {
 | 
			
		||||
          setTimeout(() => {
 | 
			
		||||
            globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
 | 
			
		||||
            globalThis.udpClient2.onError_Callback(()=>{
 | 
			
		||||
            globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress,
 | 
			
		||||
              globalThis.carInfo?.messagePort)
 | 
			
		||||
            globalThis.udpClient2.onError_Callback(() => {
 | 
			
		||||
              getUDP2(true);
 | 
			
		||||
              if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
 | 
			
		||||
                globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
 | 
			
		||||
              if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) {
 | 
			
		||||
                globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          }, 1000)
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
      } else {
 | 
			
		||||
        // 未绑定
 | 
			
		||||
        console.log(` getUDP2  has no  udclent and  bind `);
 | 
			
		||||
        const udpClient2: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
 | 
			
		||||
        const udpClient2: UdpClientByCenter =
 | 
			
		||||
          new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress,
 | 
			
		||||
            globalThis.carInfo?.messagePort)
 | 
			
		||||
        await udpClient2.bindUdp()
 | 
			
		||||
        await udpClient2.onError_Callback(()=>{
 | 
			
		||||
        await udpClient2.onError_Callback(() => {
 | 
			
		||||
          getUDP2(true);
 | 
			
		||||
          if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
 | 
			
		||||
            globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
 | 
			
		||||
          if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) {
 | 
			
		||||
            globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        if(!errorFlag){
 | 
			
		||||
        if (!errorFlag) {
 | 
			
		||||
          await udpClient2.onMessage_2((val) => {
 | 
			
		||||
            if (val.id == '32') {
 | 
			
		||||
              globalThis.signNum = val.body[1]
 | 
			
		||||
@ -285,7 +290,7 @@ export async function setTopLineUdp() {
 | 
			
		||||
 | 
			
		||||
  // const config = await getSyncData('IpConfigTable');
 | 
			
		||||
  if (config && config.udplocalIp) {
 | 
			
		||||
    const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config;
 | 
			
		||||
    const { udplocalIp, udpOppositeIp, udpOppositeIpPort } = config;
 | 
			
		||||
    const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509', udpOppositeIp, udpOppositeIpPort)
 | 
			
		||||
    udpClient.bindUdp()
 | 
			
		||||
 | 
			
		||||
@ -314,17 +319,19 @@ export async function setJudgeUdp() {
 | 
			
		||||
  }, 1000);
 | 
			
		||||
 | 
			
		||||
  if (config && config.udplocalIp) {
 | 
			
		||||
    const {udplocalIp} = config;
 | 
			
		||||
    const { udplocalIp } = config;
 | 
			
		||||
    const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(
 | 
			
		||||
      udplocalIp, '8080',
 | 
			
		||||
      globalThis.carInfo?.udpAddress,
 | 
			
		||||
      globalThis.carInfo?.hintPort
 | 
			
		||||
    )
 | 
			
		||||
    console.info('surenjun hintPort=> ',globalThis.carInfo?.hintPort)
 | 
			
		||||
    console.info('surenjun hintPort=> ', globalThis.carInfo?.hintPort)
 | 
			
		||||
 | 
			
		||||
    await udpClientbyCenter.onError_Callback(()=>{})
 | 
			
		||||
    await udpClientbyCenter.onError_Callback(() => {
 | 
			
		||||
    })
 | 
			
		||||
    await udpClientbyCenter.bindUdp()
 | 
			
		||||
    await udpClientbyCenter.onMessage_2((val) => {})
 | 
			
		||||
    await udpClientbyCenter.onMessage_2((val) => {
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    //远程监听开始考试、结束考试、扣分指令
 | 
			
		||||
 | 
			
		||||
@ -343,7 +350,7 @@ export async function setJudgeUdp() {
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
      //申请远程扣分查询
 | 
			
		||||
      askKf(directives){
 | 
			
		||||
      askKf(directives) {
 | 
			
		||||
        globalThis.udpClient2.sendMsgExt({
 | 
			
		||||
          id: 35,
 | 
			
		||||
          list: [directives],
 | 
			
		||||
@ -354,10 +361,10 @@ export async function setJudgeUdp() {
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
      //确定远程扣分
 | 
			
		||||
      confirmKf(directives,code){
 | 
			
		||||
      confirmKf(directives, code) {
 | 
			
		||||
        globalThis.udpClient2.sendMsgExt({
 | 
			
		||||
          id: 37,
 | 
			
		||||
          list: Array2Byte([string2Bytes(directives,8),string2Bytes(code,8)]),
 | 
			
		||||
          list: Array2Byte([string2Bytes(directives, 8), string2Bytes(code, 8)]),
 | 
			
		||||
          carNo: globalThis.carInfo.carNo,
 | 
			
		||||
          placeId: globalThis.carInfo.examinationRoomId
 | 
			
		||||
        })
 | 
			
		||||
@ -367,4 +374,5 @@ export async function setJudgeUdp() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// globalThis.udpClient.bindUdp()
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										236
									
								
								entry/src/main/ets/common/utils/UdpByOne.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										236
									
								
								entry/src/main/ets/common/utils/UdpByOne.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,236 @@
 | 
			
		||||
import socket from '@ohos.net.socket';
 | 
			
		||||
import { PLCGPSData } from '../../mock';
 | 
			
		||||
 | 
			
		||||
export default class UdpByOne {
 | 
			
		||||
  //   PLC udp
 | 
			
		||||
  private PLCUDP: any;
 | 
			
		||||
  // PLC localIp
 | 
			
		||||
  private PLCLocalIp: string;
 | 
			
		||||
  // PLC localIpPort
 | 
			
		||||
  private PLCLocalIpPort: string;
 | 
			
		||||
  // PLC oppositeIpPort
 | 
			
		||||
  private PLCOppositeIpPort: string;
 | 
			
		||||
  // PLC消息
 | 
			
		||||
  private PLCMsg: number[];
 | 
			
		||||
  //   GPS udp
 | 
			
		||||
  private GPSUDP: any;
 | 
			
		||||
  // GPS localIp
 | 
			
		||||
  private GPSLocalIp: string;
 | 
			
		||||
  // GPS localIpPort
 | 
			
		||||
  private GPSLocalIpPort: string;
 | 
			
		||||
  // GPS oppositeIpPort
 | 
			
		||||
  private GPSOppositeIpPort: string;
 | 
			
		||||
  // GPS消息
 | 
			
		||||
  private GPSMsg: string;
 | 
			
		||||
 | 
			
		||||
  constructor() {
 | 
			
		||||
    //   初始化UDP
 | 
			
		||||
    this.PLCUDP = socket.constructUDPSocketInstance();
 | 
			
		||||
    this.PLCUDP.bind(this.PLCLocalIp, this.PLCLocalIpPort);
 | 
			
		||||
    this.GPSUDP = socket.constructUDPSocketInstance();
 | 
			
		||||
    this.GPSUDP.bind(this.GPSLocalIp, this.GPSLocalIpPort);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //   重新绑定
 | 
			
		||||
  public rebind() {
 | 
			
		||||
    this.PLCUDP.bind(this.PLCLocalIp, this.PLCLocalIpPort);
 | 
			
		||||
    this.GPSUDP.bind(this.GPSLocalIp, this.GPSLocalIpPort);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //   PLC发送消息
 | 
			
		||||
  public sendPLCMsg(msg: string) {
 | 
			
		||||
    this.PLCUDP.sendTo(msg, this.PLCOppositeIpPort);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //   GPS发送消息
 | 
			
		||||
  public sendGPSMsg(msg: string) {
 | 
			
		||||
    this.GPSUDP.sendTo(msg, this.GPSOppositeIpPort);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 接受消息
 | 
			
		||||
  public receiveMsg(callback) {
 | 
			
		||||
    this.GPSUDP.on("message", (message1, remoteInfo) => {
 | 
			
		||||
      this.GPSMsg = message1;
 | 
			
		||||
      this.PLCUDP.on("message", (message2, remoteInfo) => {
 | 
			
		||||
        this.PLCMsg = message2;
 | 
			
		||||
        //   组合数据
 | 
			
		||||
        let newMessage = this.handleMsg()
 | 
			
		||||
        callback(newMessage)
 | 
			
		||||
      })
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 处理消息
 | 
			
		||||
  public handleMsg() {
 | 
			
		||||
    this.GPSMsg = `$GPGGA,021126.00,2955.5885178,N,11953.8931034,E,5,12,0.8,13.191,M,6.838,M,2.000,0000*49
 | 
			
		||||
$GPRMC,021126.00,A,2955.5885178,N,11953.8931034,E,4.881,318.3,170623,0.0,E,F*37
 | 
			
		||||
$GPGST,021126.00,3.30,1.77,3.30,0.0000,1.77,1.25,3.30*67
 | 
			
		||||
$PTNL,AVR,021126.00,+47.3119,Yaw,+0.4832,Tilt,,,0.817,3,1.7,25*09`
 | 
			
		||||
    let newMessage = PLCGPSData;
 | 
			
		||||
    //   海拔高度
 | 
			
		||||
    // 原始GPS消息字符串
 | 
			
		||||
    this.GPSMsg = `$GPGGA,021126.00,2955.5885178,N,11953.8931034,E,5,12,0.8,13.191,M,6.838,M,2.000,0000*49$GPRMC,021126.00,A,2955.5885178,N,11953.8931034,E,4.881,318.3,170623,0.0,E,F*37$GPGST,021126.00,3.30,1.77,3.30,0.0000,1.77,1.25,3.30*67$PTNL,AVR,021126.00,+47.3119,Yaw,+0.4832,Tilt,,,0.817,3,1.7,25*09`;
 | 
			
		||||
    // 使用正则表达式提取$GPGGA消息
 | 
			
		||||
    let GPGGAMsg = this.GPSMsg.match(/\$GPGGA[^$]*/)[0];
 | 
			
		||||
    let GPGGAMsgArr = GPGGAMsg.split(",").slice(0, 15);
 | 
			
		||||
    //   使用正则提取$GPRMC消息
 | 
			
		||||
    let GPRMCMsg = this.GPSMsg.match(/\$GPRMC[^$]*/)[0];
 | 
			
		||||
    let GPRMCMsgArr = GPRMCMsg.split(",").slice(0, 14);
 | 
			
		||||
    //   使用正则表达式提取$GPGST消息]
 | 
			
		||||
    let GPGSTMsg = this.GPSMsg.match(/\$GPGST[^$]*/)[0];
 | 
			
		||||
    let GPGSTMsgArr = GPGSTMsg.split(",").slice(0, 9);
 | 
			
		||||
    //   使用正则提取$PTNL消息
 | 
			
		||||
    let PTNLMsg = this.GPSMsg.match(/\$PTNL[^$]*/)[0];
 | 
			
		||||
    let PTNLMsgArr = PTNLMsg.split(",").slice(0, 14);
 | 
			
		||||
    //   组合GPS数据
 | 
			
		||||
    // 状态83
 | 
			
		||||
    newMessage[83] = GPRMCMsgArr[6];
 | 
			
		||||
    // 收星数84
 | 
			
		||||
    newMessage[84] = PTNLMsgArr[10];
 | 
			
		||||
    // 海拔高85
 | 
			
		||||
    newMessage[80] = GPGGAMsgArr[9];
 | 
			
		||||
    // 高度差86
 | 
			
		||||
    // 龄期87
 | 
			
		||||
    newMessage[87] = GPGSTMsgArr[11];
 | 
			
		||||
    // 维度因子88
 | 
			
		||||
    // 经度因子89
 | 
			
		||||
    // 航向角90
 | 
			
		||||
    newMessage[90] = PTNLMsgArr[3];
 | 
			
		||||
    // 俯仰角91
 | 
			
		||||
    newMessage[91] = PTNLMsgArr[5];
 | 
			
		||||
    // 航向角状态-收星数92
 | 
			
		||||
    newMessage[92] = PTNLMsgArr[8];
 | 
			
		||||
    //  年月日93 RMCMsgArr[9]为ddmmyy 日月年 转换为年月日
 | 
			
		||||
    newMessage[93] =
 | 
			
		||||
      GPRMCMsgArr[9].slice(4, 6) +
 | 
			
		||||
      GPRMCMsgArr[9].slice(2, 4) +
 | 
			
		||||
      GPRMCMsgArr[9].slice(0, 2);
 | 
			
		||||
    // 时分秒94 GPGGAMsgArr[1]为021126.00去掉小数点后的时间
 | 
			
		||||
    newMessage[94] = GPGGAMsgArr[1].replace(".", "");
 | 
			
		||||
    // 经度95
 | 
			
		||||
    newMessage[95] = GPGGAMsgArr[4];
 | 
			
		||||
    // 纬度96
 | 
			
		||||
    newMessage[96] = GPGGAMsgArr[2];
 | 
			
		||||
    // 速度97
 | 
			
		||||
    newMessage[97] = GPRMCMsgArr[7];
 | 
			
		||||
 | 
			
		||||
    let PLCByteArr = this.PLCMsg.map((num) => num.toString(2).padStart(8, "0"));
 | 
			
		||||
    console.log(PLCByteArr[1][2]);
 | 
			
		||||
    // 左方向灯 2
 | 
			
		||||
    newMessage[2] = PLCByteArr[6][2];
 | 
			
		||||
    // 右方向灯 3
 | 
			
		||||
    newMessage[3] = PLCByteArr[6][3];
 | 
			
		||||
    // 喇叭 4
 | 
			
		||||
    newMessage[4] = PLCByteArr[8][2];
 | 
			
		||||
    // 点火1 5
 | 
			
		||||
    newMessage[5] = PLCByteArr[8][0];
 | 
			
		||||
    // 点火2 6
 | 
			
		||||
    newMessage[6] = PLCByteArr[8][1];
 | 
			
		||||
    // 近光灯 7
 | 
			
		||||
    newMessage[7] = PLCByteArr[6][0];
 | 
			
		||||
    // 远光灯 8
 | 
			
		||||
    newMessage[8] = PLCByteArr[6][1];
 | 
			
		||||
    // 示廓灯 9
 | 
			
		||||
    newMessage[9] = PLCByteArr[6][5];
 | 
			
		||||
    // 雾灯 10
 | 
			
		||||
    // 雨刮器 11
 | 
			
		||||
    newMessage[11] = PLCByteArr[8][2];
 | 
			
		||||
    // 脚刹 12
 | 
			
		||||
    newMessage[12] = PLCByteArr[7][2];
 | 
			
		||||
    // 手刹 13
 | 
			
		||||
    newMessage[13] = PLCByteArr[7][3];
 | 
			
		||||
    // 主驾驶门 14
 | 
			
		||||
    newMessage[14] = PLCByteArr[7][0];
 | 
			
		||||
    // NC 15
 | 
			
		||||
    // TODO
 | 
			
		||||
    // SA15 16
 | 
			
		||||
    // TODO
 | 
			
		||||
    // 离合 17
 | 
			
		||||
    newMessage[17] = PLCByteArr[7][1];
 | 
			
		||||
    // 副刹车 18
 | 
			
		||||
    newMessage[18] = PLCByteArr[7][4];
 | 
			
		||||
    // 安全带 19
 | 
			
		||||
    newMessage[19] = PLCByteArr[7][7];
 | 
			
		||||
    // 双跳灯 20
 | 
			
		||||
    newMessage[20] = PLCByteArr[6][4];
 | 
			
		||||
    // 其他门 21
 | 
			
		||||
    // TODO
 | 
			
		||||
    // 转速过高 22
 | 
			
		||||
    newMessage[22] = PLCByteArr[9][7];
 | 
			
		||||
    // 车速 23
 | 
			
		||||
    newMessage[23] = PLCByteArr[11];
 | 
			
		||||
    // 累计脉冲 24
 | 
			
		||||
    let Data25 = parseInt(PLCByteArr[25], 2);
 | 
			
		||||
    let Data26 = parseInt(PLCByteArr[26], 2);
 | 
			
		||||
    let Data27 = parseInt(PLCByteArr[27], 2);
 | 
			
		||||
    let Data28 = parseInt(PLCByteArr[28], 2);
 | 
			
		||||
    newMessage[24] = ((Data25 << 24) + (Data26 << 16) + (Data27 << 8) + Data28).toString();
 | 
			
		||||
    // 发动机转速 25
 | 
			
		||||
    let Data29 = parseInt(PLCByteArr[29], 2);
 | 
			
		||||
    let Data30 = parseInt(PLCByteArr[30], 2);
 | 
			
		||||
    let Data31 = parseInt(PLCByteArr[31], 2);
 | 
			
		||||
    let Data32 = parseInt(PLCByteArr[32], 2);
 | 
			
		||||
    newMessage[25] = ((Data29 << 24) + (Data30 << 16) + (Data31 << 8) + Data32).toString();
 | 
			
		||||
    // 熄火次数 26
 | 
			
		||||
    newMessage[26] = PLCByteArr[33];
 | 
			
		||||
    // 方向盘角度 27
 | 
			
		||||
    // 档位 28
 | 
			
		||||
    newMessage[27] = PLCByteArr[15];
 | 
			
		||||
    // 超声波1 29
 | 
			
		||||
    let Data52 = parseInt(PLCByteArr[52], 2);
 | 
			
		||||
    let Data53 = parseInt(PLCByteArr[53], 2);
 | 
			
		||||
    newMessage[29] = ((Data52 << 8) + Data53).toString();
 | 
			
		||||
    // 超声波2 30
 | 
			
		||||
    let Data54 = parseInt(PLCByteArr[54], 2);
 | 
			
		||||
    let Data55 = parseInt(PLCByteArr[55], 2);
 | 
			
		||||
    newMessage[30] = ((Data54 << 8) + Data55).toString();
 | 
			
		||||
    // 超声波3 31
 | 
			
		||||
    // 超声波4 32
 | 
			
		||||
    // 触摸1 33
 | 
			
		||||
    // 触摸2 34
 | 
			
		||||
    // 触摸3 35
 | 
			
		||||
    // SCIO 36
 | 
			
		||||
    // SC1A_C 37
 | 
			
		||||
    // SC1B_C 38
 | 
			
		||||
    // SC2A_C 39
 | 
			
		||||
    // SC2B_C 40
 | 
			
		||||
    // SC3A_C 41
 | 
			
		||||
    // SC3B_C 42
 | 
			
		||||
    // SC4A_C 43
 | 
			
		||||
    // SC4B_C 44
 | 
			
		||||
    // SC5A_C 45
 | 
			
		||||
    // SC5B_C 46
 | 
			
		||||
    // SC6A_C 47
 | 
			
		||||
    // SC6B_C 48
 | 
			
		||||
    // 发送次数 49
 | 
			
		||||
    // 方向盘类型 50
 | 
			
		||||
    // 汽车类型 51
 | 
			
		||||
    // 接口心跳 52
 | 
			
		||||
    // 本机IP 53
 | 
			
		||||
    // 固件版本 54
 | 
			
		||||
    // 按键数值 55
 | 
			
		||||
    // GPS板卡类型 56
 | 
			
		||||
    // GPS板卡软件版本 57
 | 
			
		||||
    // 改正数次数/改正数大小 58
 | 
			
		||||
    // GPS数据次数/数据长度 59
 | 
			
		||||
    // GPS错误次数 60
 | 
			
		||||
    // 已工作时长/设定的工作时长 61
 | 
			
		||||
    // 改正数数据长度*数据长度-基准站RTCM改正数类型 62
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //   PLC接收消息
 | 
			
		||||
  public receivePLCMsg() {
 | 
			
		||||
    this.PLCUDP.on("message", (message, remoteInfo) => {
 | 
			
		||||
      console.log(`PLC receive message from ${remoteInfo.address}:${remoteInfo.port} : ${message}`);
 | 
			
		||||
      this.PLCMsg = message;
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //   GPS接收消息
 | 
			
		||||
  public receiveGPSMsg() {
 | 
			
		||||
    this.GPSUDP.on("message", (message, remoteInfo) => {
 | 
			
		||||
      console.log(`GPS receive message from ${remoteInfo.address}:${remoteInfo.port} : ${message}`);
 | 
			
		||||
      this.GPSMsg = message;
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -13,22 +13,19 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// @ts-ignore
 | 
			
		||||
import socket, { UDPSocket } from '@ohos.net.socket';
 | 
			
		||||
import { Array2Byte } from '../utils/tools'
 | 
			
		||||
import FileUtil from '../../common/utils/File'
 | 
			
		||||
import { fillZero, string2Bytes } from '../utils/tools'
 | 
			
		||||
 | 
			
		||||
const TAG = '[UdpDemo.UdpClient]'
 | 
			
		||||
import hilog from '@ohos.hilog';
 | 
			
		||||
import prompt from '@ohos.prompt'
 | 
			
		||||
import { Array2Byte, dateFormat, fillZero, string2Bytes } from '../utils/tools';
 | 
			
		||||
import FileUtil from '../../common/utils/File';
 | 
			
		||||
import prompt from '@ohos.prompt';
 | 
			
		||||
import promptAction from '@ohos.promptAction';
 | 
			
		||||
import { getUDP } from './GlobalUdp';
 | 
			
		||||
import { dateFormat } from '../utils/tools'
 | 
			
		||||
import { getSyncData } from '../service/initable';
 | 
			
		||||
import UdpByOne from './UdpByOne';
 | 
			
		||||
 | 
			
		||||
const TAG = '[UdpDemo.UdpClient]'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export default class UdpClientByCenter {
 | 
			
		||||
  public currentValue: string = ''
 | 
			
		||||
  private localIp: string = ''
 | 
			
		||||
  private localIpPort: string = ''
 | 
			
		||||
  private oppositeIp: string = ''
 | 
			
		||||
@ -43,15 +40,14 @@ export default class UdpClientByCenter {
 | 
			
		||||
  private context
 | 
			
		||||
  private folderPath
 | 
			
		||||
  private stashFn: StashFunction
 | 
			
		||||
  private errorStep: number=0
 | 
			
		||||
  private errorStep: number = 0
 | 
			
		||||
  private interval
 | 
			
		||||
  private headLenth: number = 9
 | 
			
		||||
  //消息头长度
 | 
			
		||||
  private isWorking: Boolean = false
 | 
			
		||||
  private plcUdpError = false;
 | 
			
		||||
  private initParam
 | 
			
		||||
  private onMessage_1Callback:Function = ()=>{}
 | 
			
		||||
  public  currentValue:string = ''
 | 
			
		||||
  private UPDOne: any
 | 
			
		||||
 | 
			
		||||
  constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
 | 
			
		||||
    this.localIp = udplocalIp
 | 
			
		||||
@ -62,14 +58,14 @@ export default class UdpClientByCenter {
 | 
			
		||||
    }
 | 
			
		||||
    this.udp = socket.constructUDPSocketInstance();
 | 
			
		||||
    this.initPath()
 | 
			
		||||
    this.UPDOne = new UdpByOne()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getStatus() {
 | 
			
		||||
    return this.isWorking
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  rebindUdp(localIp: string, localIpPort: string, oppositeIp: string, oppositeIpPort: string)
 | 
			
		||||
  {
 | 
			
		||||
  rebindUdp(localIp: string, localIpPort: string, oppositeIp: string, oppositeIpPort: string) {
 | 
			
		||||
    this.localIp = localIp
 | 
			
		||||
    this.oppositeIp = oppositeIp
 | 
			
		||||
    this.localIpPort = localIpPort
 | 
			
		||||
@ -135,9 +131,6 @@ export default class UdpClientByCenter {
 | 
			
		||||
    return view;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //length消息体bufferlength   id消息类型id  bodyStr消息体string
 | 
			
		||||
  // setMsyBody(id,bodyByte){
 | 
			
		||||
 | 
			
		||||
  // {id: 31,list:[0,1,'0000000000000'],carNo:489,placeId:62}
 | 
			
		||||
  setWholeMsg(params) {
 | 
			
		||||
    let head = this.setMsgHead(params);
 | 
			
		||||
@ -150,14 +143,17 @@ export default class UdpClientByCenter {
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setMsgHead({id, list, placeId=62, carNo=489}) {
 | 
			
		||||
  //length消息体bufferlength   id消息类型id  bodyStr消息体string
 | 
			
		||||
  // setMsyBody(id,bodyByte){
 | 
			
		||||
 | 
			
		||||
  setMsgHead({ id, list, placeId=62, carNo=489 }) {
 | 
			
		||||
    let a = string2Bytes(`${id}${fillZero(placeId, 3)}`, 2 * 8);
 | 
			
		||||
    let b = string2Bytes(`${fillZero(carNo, 4)}${globalThis.lshNo}`, 4 * 8);
 | 
			
		||||
    let c = string2Bytes(list.length, 2 * 8);
 | 
			
		||||
    return [...a, ...b, ...c];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setMsgBody({id,list}) {
 | 
			
		||||
  setMsgBody({ id, list }) {
 | 
			
		||||
    let tmpList = []
 | 
			
		||||
    tmpList = list
 | 
			
		||||
 | 
			
		||||
@ -171,15 +167,14 @@ export default class UdpClientByCenter {
 | 
			
		||||
    console.log('getUDPsendHeadMsg exit')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  sendMsg(msg, sendCallback?)
 | 
			
		||||
  {
 | 
			
		||||
    if (!this.isWorking ) {
 | 
			
		||||
  sendMsg(msg, sendCallback?) {
 | 
			
		||||
    if (!this.isWorking) {
 | 
			
		||||
      // console.log(`${TAG}getUDPudpCLient sendMsg  is closed return `);
 | 
			
		||||
      // this.writeLog({
 | 
			
		||||
      //   time:dateFormat(new Date()),
 | 
			
		||||
      //   PLC:`${TAG}getUDPudpCLient  sendMsg  is closed return oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`,
 | 
			
		||||
      // })
 | 
			
		||||
      if(sendCallback) {
 | 
			
		||||
      if (sendCallback) {
 | 
			
		||||
        sendCallback()
 | 
			
		||||
      }
 | 
			
		||||
      return;
 | 
			
		||||
@ -205,8 +200,8 @@ export default class UdpClientByCenter {
 | 
			
		||||
      //   PLC:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}${JSON.stringify(err)}`,
 | 
			
		||||
      // })
 | 
			
		||||
      promptAction.showToast({
 | 
			
		||||
        message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`,
 | 
			
		||||
        duration:4000
 | 
			
		||||
        message: `${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`,
 | 
			
		||||
        duration: 4000
 | 
			
		||||
      })
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
@ -243,6 +238,7 @@ export default class UdpClientByCenter {
 | 
			
		||||
    this.stashFn = callback ? callback : () => {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //中心udp回执
 | 
			
		||||
  onMessage_2(callback, type?) {
 | 
			
		||||
    this.udp.on('message', (value, remoteInfo) => {
 | 
			
		||||
@ -261,14 +257,19 @@ export default class UdpClientByCenter {
 | 
			
		||||
        list.push(arr[i])
 | 
			
		||||
      }
 | 
			
		||||
      this.stashFn({
 | 
			
		||||
        id, length, body: list, sendId: this.sendId
 | 
			
		||||
        id,
 | 
			
		||||
        length,
 | 
			
		||||
        body: list,
 | 
			
		||||
        sendId: this.sendId
 | 
			
		||||
      })
 | 
			
		||||
      callback({
 | 
			
		||||
        id, length, body: list, sendId: this.sendId
 | 
			
		||||
        id,
 | 
			
		||||
        length,
 | 
			
		||||
        body: list,
 | 
			
		||||
        sendId: this.sendId
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      // this.interval=setInterval(()=>{
 | 
			
		||||
      //
 | 
			
		||||
      // },3000)
 | 
			
		||||
@ -297,19 +298,22 @@ export default class UdpClientByCenter {
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // TODO 赋值onMessage_1
 | 
			
		||||
  //plc
 | 
			
		||||
  onMessage_1(callback?) {
 | 
			
		||||
    this.onMessage_1Callback = callback;
 | 
			
		||||
    this.udp&&this.udp.on('message', this.message_1Fn);
 | 
			
		||||
    this.UPDOne.receiveMsg(callback);
 | 
			
		||||
    this.udp && this.udp.on('message', this.message_1Fn);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  closeMessage_1(){
 | 
			
		||||
 | 
			
		||||
  closeMessage_1() {
 | 
			
		||||
    console.info('surenjun', 'getUDP关闭udp message监听事件')
 | 
			
		||||
    this.udp.off('message',this.message_1Fn);
 | 
			
		||||
    this.udp.off('message', this.message_1Fn);
 | 
			
		||||
    console.info('surenjun', 'getUDP关闭udp message监听事件 成功')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  message_1Fn = (value)=>{
 | 
			
		||||
  message_1Fn = (value) => {
 | 
			
		||||
    let callback = this.onMessage_1Callback
 | 
			
		||||
    // 收到的是ArrayBuffer 需要进行转换解析
 | 
			
		||||
    this.plcUdpError = false
 | 
			
		||||
@ -336,15 +340,15 @@ export default class UdpClientByCenter {
 | 
			
		||||
      //   time:dateFormat(new Date()),
 | 
			
		||||
      //   PLC: JSON.stringify(newArr.toString()),
 | 
			
		||||
      // })
 | 
			
		||||
      if(strachArr[83]!='4'){
 | 
			
		||||
        console.log('差分状态异常',strachArr[83],strachArr[92])
 | 
			
		||||
      if (strachArr[83] != '4') {
 | 
			
		||||
        console.log('差分状态异常', strachArr[83], strachArr[92])
 | 
			
		||||
        this.writeLog({
 | 
			
		||||
          time:dateFormat(new Date()),
 | 
			
		||||
          time: dateFormat(new Date()),
 | 
			
		||||
          PLC: `${TAG}差分状态异常,${strachArr[83]},${strachArr[92]}`,
 | 
			
		||||
        })
 | 
			
		||||
      }else{
 | 
			
		||||
        globalThis.dialogOpen=false
 | 
			
		||||
        this.chafenFlag=0
 | 
			
		||||
      } else {
 | 
			
		||||
        globalThis.dialogOpen = false
 | 
			
		||||
        this.chafenFlag = 0
 | 
			
		||||
      }
 | 
			
		||||
      callback && callback(newArr.toString())
 | 
			
		||||
      this.currentValue = newArr.toString();
 | 
			
		||||
@ -354,15 +358,18 @@ export default class UdpClientByCenter {
 | 
			
		||||
 | 
			
		||||
    this.testIfUdpConnetced(callback)
 | 
			
		||||
  }
 | 
			
		||||
  async  writeLog(param){
 | 
			
		||||
 | 
			
		||||
  async writeLog(param) {
 | 
			
		||||
    // const fileUtil = new FileUtil(globalThis.context)
 | 
			
		||||
    // fileUtil.editFile(`${this.folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
 | 
			
		||||
  }
 | 
			
		||||
  async initPath(){
 | 
			
		||||
 | 
			
		||||
  async initPath() {
 | 
			
		||||
    // const fileUtil = new FileUtil(globalThis.context)
 | 
			
		||||
    // const date=dateFormat(new Date).split(' ')[0]
 | 
			
		||||
    // this.folderPath = await fileUtil.initFolder(`/PLC/${date}`);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //获取当前UDP信号
 | 
			
		||||
  getCurrentMessage = () => {
 | 
			
		||||
    return this.currentValue
 | 
			
		||||
@ -376,7 +383,7 @@ export default class UdpClientByCenter {
 | 
			
		||||
    const arrRedBuffer = Array2Byte(arrRed).buffer
 | 
			
		||||
    const arrGreenBugger = Array2Byte(arrGreen).buffer
 | 
			
		||||
    let num = 0
 | 
			
		||||
    globalThis.dialogOpen=false
 | 
			
		||||
    globalThis.dialogOpen = false
 | 
			
		||||
 | 
			
		||||
    //监听udp是否断开
 | 
			
		||||
    clearInterval(globalThis.messageTimer)
 | 
			
		||||
@ -389,15 +396,15 @@ export default class UdpClientByCenter {
 | 
			
		||||
        if (this.plcUdpError) {
 | 
			
		||||
          num++
 | 
			
		||||
          this.writeLog({
 | 
			
		||||
            time:dateFormat(new Date()),
 | 
			
		||||
            time: dateFormat(new Date()),
 | 
			
		||||
            PLC: 'plc udp信号丢失',
 | 
			
		||||
          })
 | 
			
		||||
          console.log(TAG, 'plc udp信号丢失')
 | 
			
		||||
          if (num == 3) {
 | 
			
		||||
            getUDP(globalThis.context,true)
 | 
			
		||||
            globalThis.title='plc udp信号丢失'
 | 
			
		||||
            globalThis.type='3'
 | 
			
		||||
            if(!globalThis.dialogOpen){
 | 
			
		||||
            getUDP(globalThis.context, true)
 | 
			
		||||
            globalThis.title = 'plc udp信号丢失'
 | 
			
		||||
            globalThis.type = '3'
 | 
			
		||||
            if (!globalThis.dialogOpen) {
 | 
			
		||||
              // AppStorage.SetOrCreate('errorCode', 1);
 | 
			
		||||
              // if(this.errorStep!=1){
 | 
			
		||||
              //   console.log('sys.v_valuesys.v_valuesys.v_value11221')
 | 
			
		||||
@ -437,6 +444,9 @@ export default class UdpClientByCenter {
 | 
			
		||||
    }, 2000)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private onMessage_1Callback: Function = () => {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // initHeartSendMsg(param,context){
 | 
			
		||||
  //     console.log('1111param',JSON.stringify(param))
 | 
			
		||||
  //     this.initParam=param
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										0
									
								
								entry/src/main/ets/common/utils/UdpUtils.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								entry/src/main/ets/common/utils/UdpUtils.ets
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										126
									
								
								entry/src/main/ets/common/utils/new/udp.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								entry/src/main/ets/common/utils/new/udp.ets
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,126 @@
 | 
			
		||||
import socket from '@ohos.net.socket';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * UDP工具类
 | 
			
		||||
 * 功能:创建UDP Socket、发送消息、接收消息、广播控制、关闭连接
 | 
			
		||||
 */
 | 
			
		||||
export class UdpTool {
 | 
			
		||||
  private udpSocket: socket.UDPSocket | null = null;
 | 
			
		||||
  private receiveCallback: ((data: string, remoteInfo: RemoteInfo) => void) | null = null;
 | 
			
		||||
  private errorCallback: ((error: Error) => void) | null = null;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 初始化UDP Socket
 | 
			
		||||
   * @param port 绑定端口号
 | 
			
		||||
   * @param callback 接收消息回调
 | 
			
		||||
   */
 | 
			
		||||
  async initialize(port: number, callback?: (data: string, remoteInfo: RemoteInfo) => void): Promise<void> {
 | 
			
		||||
    try {
 | 
			
		||||
      // 1. 创建UDP Socket实例
 | 
			
		||||
      this.udpSocket = socket.constructUDPSocketInstance();
 | 
			
		||||
 | 
			
		||||
      // 2. 绑定本地端口
 | 
			
		||||
      await this.udpSocket.bind({ address: '0.0.0.0', port: port, family: 1 });
 | 
			
		||||
 | 
			
		||||
      // 3. 注册消息监听
 | 
			
		||||
      this.udpSocket.on('message', (payload: {
 | 
			
		||||
        message: ArrayBuffer,
 | 
			
		||||
        remoteInfo
 | 
			
		||||
      }) => {
 | 
			
		||||
        const msg = this.arrayBufferToString(payload.message);
 | 
			
		||||
        this.receiveCallback?.(msg, payload.remoteInfo);
 | 
			
		||||
      });
 | 
			
		||||
      // 4. 注册错误监听
 | 
			
		||||
      this.udpSocket.on('error', (err) => {
 | 
			
		||||
        this.errorCallback?.(new Error(`Socket error: ${err.code} - ${err.message}`));
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      if (callback) {
 | 
			
		||||
        this.receiveCallback = callback;
 | 
			
		||||
      }
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
      throw new Error(`UDP初始化失败: ${error.message}`);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 发送UDP消息
 | 
			
		||||
   * @param message 发送内容
 | 
			
		||||
   * @param address 目标地址
 | 
			
		||||
   * @param port 目标端口
 | 
			
		||||
   */
 | 
			
		||||
  async send(message: string, address: string, port: number): Promise<void> {
 | 
			
		||||
    if (!this.udpSocket) {
 | 
			
		||||
      throw new Error('Socket未初始化');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      const data = this.stringToArrayBuffer(message);
 | 
			
		||||
      await this.udpSocket.send({
 | 
			
		||||
        data: data,
 | 
			
		||||
        address: { address: address, port: port, family: 1 }
 | 
			
		||||
      });
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
      throw new Error(`消息发送失败: ${error.message}`);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 设置广播模式
 | 
			
		||||
   * @param enable 是否启用广播
 | 
			
		||||
   */
 | 
			
		||||
  setBroadcast(enable: boolean): void {
 | 
			
		||||
    if (!this.udpSocket) {
 | 
			
		||||
      throw new Error('Socket未初始化');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      this.udpSocket.setExtraOptions({ broadcast: enable });
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
      throw new Error(`广播设置失败: ${error.message}`);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 关闭Socket连接
 | 
			
		||||
   */
 | 
			
		||||
  close(): void {
 | 
			
		||||
    if (this.udpSocket) {
 | 
			
		||||
      this.udpSocket.off('message');
 | 
			
		||||
      this.udpSocket.off('error');
 | 
			
		||||
      this.udpSocket.close();
 | 
			
		||||
      this.udpSocket = null;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 设置错误回调
 | 
			
		||||
   */
 | 
			
		||||
  onError(callback: (error: Error) => void): void {
 | 
			
		||||
    this.errorCallback = callback;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 工具方法:ArrayBuffer转String
 | 
			
		||||
  private arrayBufferToString(buffer: ArrayBuffer): string {
 | 
			
		||||
    return String.fromCharCode(...new Uint8Array(buffer));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 工具方法:String转ArrayBuffer
 | 
			
		||||
  private stringToArrayBuffer(str: string): ArrayBuffer {
 | 
			
		||||
    const buffer = new ArrayBuffer(str.length);
 | 
			
		||||
    const view = new Uint8Array(buffer);
 | 
			
		||||
    for (let i = 0; i < str.length; i++) {
 | 
			
		||||
      view[i] = str.charCodeAt(i);
 | 
			
		||||
    }
 | 
			
		||||
    return buffer;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 远程设备信息类型
 | 
			
		||||
 */
 | 
			
		||||
interface RemoteInfo {
 | 
			
		||||
  address: string;
 | 
			
		||||
  port: number;
 | 
			
		||||
  family: number;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										101
									
								
								entry/src/main/ets/mock/PLCGPSData.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								entry/src/main/ets/mock/PLCGPSData.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,101 @@
 | 
			
		||||
export const PLCGPSData = [
 | 
			
		||||
  "#DN_GD",
 | 
			
		||||
  "$PLC",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0_0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0_0_0_0",
 | 
			
		||||
  "0.0.0.0",
 | 
			
		||||
  "V9.1_V2.1_1",
 | 
			
		||||
  "65535",
 | 
			
		||||
  "1",
 | 
			
		||||
  "V7.8",
 | 
			
		||||
  "0/0",
 | 
			
		||||
  "0/0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0/0",
 | 
			
		||||
  "100*200-2-2-。。",
 | 
			
		||||
  "1",
 | 
			
		||||
  "2",
 | 
			
		||||
  "3",
 | 
			
		||||
  "4",
 | 
			
		||||
  "5",
 | 
			
		||||
  "6",
 | 
			
		||||
  "7",
 | 
			
		||||
  "8",
 | 
			
		||||
  "9",
 | 
			
		||||
  "A",
 | 
			
		||||
  "B",
 | 
			
		||||
  "C",
 | 
			
		||||
  "D",
 | 
			
		||||
  "E",
 | 
			
		||||
  "F",
 | 
			
		||||
  "G",
 | 
			
		||||
  "H",
 | 
			
		||||
  "I",
 | 
			
		||||
  "J",
 | 
			
		||||
  "#END$GPS",
 | 
			
		||||
  "1",
 | 
			
		||||
  "16",
 | 
			
		||||
  "6.068",
 | 
			
		||||
  "1.301",
 | 
			
		||||
  "0",
 | 
			
		||||
  "1.07",
 | 
			
		||||
  "0.64",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0",
 | 
			
		||||
  "0-12",
 | 
			
		||||
  "91022",
 | 
			
		||||
  "80109.2",
 | 
			
		||||
  "3155.6715075",
 | 
			
		||||
  "11851.9196718",
 | 
			
		||||
  "0.012",
 | 
			
		||||
  "#END",
 | 
			
		||||
];
 | 
			
		||||
@ -1,9 +0,0 @@
 | 
			
		||||
export * from "./CandidateData"
 | 
			
		||||
 | 
			
		||||
export * from "./VideoData"
 | 
			
		||||
 | 
			
		||||
export * from "./Judge"
 | 
			
		||||
 | 
			
		||||
export * from "./SignDisplay"
 | 
			
		||||
 | 
			
		||||
export * from "./CarCheck"
 | 
			
		||||
@ -7,3 +7,5 @@ export * from "./Judge"
 | 
			
		||||
export * from "./SignDisplay"
 | 
			
		||||
 | 
			
		||||
export * from "./CarCheck"
 | 
			
		||||
 | 
			
		||||
export * from "./PLCGPSData"
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "hvigorVersion": "3.0.9",
 | 
			
		||||
  "hvigorVersion": "3.2.4",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@ohos/hvigor-ohos-plugin": "3.0.9"
 | 
			
		||||
    "@ohos/hvigor-ohos-plugin": "3.2.4"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -1,13 +1,15 @@
 | 
			
		||||
{
 | 
			
		||||
  "lockfileVersion": 1,
 | 
			
		||||
  "lockfileVersion": 2,
 | 
			
		||||
  "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
 | 
			
		||||
  "specifiers": {
 | 
			
		||||
    "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
 | 
			
		||||
  },
 | 
			
		||||
  "packages": {
 | 
			
		||||
    "@ohos/hypium@1.0.6": {
 | 
			
		||||
      "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
 | 
			
		||||
      "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
 | 
			
		||||
      "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
 | 
			
		||||
      "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==",
 | 
			
		||||
      "registryType": "ohpm",
 | 
			
		||||
      "shasum": "3f5fed65372633233264b3447705b0831dfe7ea1"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								script.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								script.bat
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
			
		||||
@echo off
 | 
			
		||||
set TOOLCHAIN_DIR=C:\Users\wangzhongjie\Library\OpenHarmony\Sdk\9\toolchains
 | 
			
		||||
 | 
			
		||||
:logs
 | 
			
		||||
cd %TOOLCHAIN_DIR%
 | 
			
		||||
hdc.exe file recv /mnt/hmdfs/100/account/device_view/local/files/duolun/logs C:\Users\wangzhongjie\Desktop\log
 | 
			
		||||
goto :eof
 | 
			
		||||
 | 
			
		||||
:hilog
 | 
			
		||||
cd %TOOLCHAIN_DIR%
 | 
			
		||||
hdc.exe kill
 | 
			
		||||
hdc.exe shell "tar -czvf /data/log.tar.gz /data/log/"
 | 
			
		||||
hdc.exe file recv /data/log.tar.gz C:\Users\wangzhongjie\Desktop\log
 | 
			
		||||
hdc.exe shell "rm -rf /data/log.tar.gz"
 | 
			
		||||
goto :eof
 | 
			
		||||
 | 
			
		||||
:open
 | 
			
		||||
cd %TOOLCHAIN_DIR%
 | 
			
		||||
hdc.exe kill
 | 
			
		||||
hdc.exe shell hilog -w stop
 | 
			
		||||
hdc.exe shell hilog -r
 | 
			
		||||
hdc.exe shell hilog -w start -l 100M -m none
 | 
			
		||||
hdc.exe shell hilog -Q pidoff
 | 
			
		||||
hdc.exe shell hilog -p off
 | 
			
		||||
hdc.exe shell hilog -b D
 | 
			
		||||
hdc.exe shell hilog -w start -t kmsg -m none
 | 
			
		||||
goto :eof
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user