Compare commits
No commits in common. "8f6f1b2a779829d023079120c6e4364347d230c7" and "c912d437ddbf358da1804e60c5b17bc838450c3a" have entirely different histories.
8f6f1b2a77
...
c912d437dd
23
Makefile
23
Makefile
@ -1,23 +0,0 @@
|
|||||||
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,15 +1,13 @@
|
|||||||
{
|
{
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 1,
|
||||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||||
"specifiers": {
|
"specifiers": {
|
||||||
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
|
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
|
||||||
},
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"@ohos/hypium@1.0.6": {
|
"@ohos/hypium@1.0.6": {
|
||||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
|
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
|
||||||
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==",
|
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
|
||||||
"registryType": "ohpm",
|
|
||||||
"shasum": "3f5fed65372633233264b3447705b0831dfe7ea1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,41 +1,41 @@
|
|||||||
//import UdpClient from './UdpClient';
|
//import UdpClient from './UdpClient';
|
||||||
import UdpClientByCenter from './UdpClientByCenter';
|
import UdpClientByCenter from './UdpClientByCenter';
|
||||||
import { getSyncData } from '../service/initable';
|
import { getSyncData } from '../service/initable'
|
||||||
import { getChuankouFn } from '../../common/service/indexService';
|
import { getChuankouFn } from '../../common/service/indexService'
|
||||||
import FileUtil from '../../common/utils/File';
|
import FileUtil from '../../common/utils/File'
|
||||||
import { GlobalConfig } from '../../config/index';
|
import { GlobalConfig } from '../../config/index'
|
||||||
import { Array2Byte, string2Bytes } from './tools';
|
import {Array2Byte,fillZero,string2Bytes}from './tools'
|
||||||
|
import emitter from '@ohos.events.emitter';
|
||||||
|
|
||||||
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(context, errorFlag?) {
|
export async function getUDP(context,errorFlag?) {
|
||||||
return new Promise(async (reslove, reject) => {
|
return new Promise(async (reslove,reject)=>{
|
||||||
const fileUtil = new FileUtil(context)
|
const fileUtil = new FileUtil(context)
|
||||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
||||||
console.log('ttttt', data)
|
console.log('ttttt',data)
|
||||||
if (data === '' || data === undefined) {
|
if (data === '' || data === undefined) {
|
||||||
console.log(` getUDP has no IPConfigTable `);
|
console.log(` getUDP has no IPConfigTable `);
|
||||||
globalThis.udpClient = {}
|
globalThis.udpClient = {}
|
||||||
globalThis.host = ''
|
globalThis.host = ''
|
||||||
reslove('')
|
reslove('')
|
||||||
} else {
|
} else {
|
||||||
const result = JSON.parse(data)
|
const result=JSON.parse(data)
|
||||||
console.log(` getUDP has IPConfigTable `);
|
console.log(` getUDP has IPConfigTable `);
|
||||||
if (globalThis.udpClient && globalThis.udpClient.closeUdp) {
|
if (globalThis.udpClient && globalThis.udpClient.closeUdp) {
|
||||||
console.log(` getUDP has udclent close and rebind `);
|
console.log(` getUDP has udclent close and rebind `);
|
||||||
globalThis.udpClient.closeUdp(() => {
|
globalThis.udpClient.closeUdp(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
globalThis.udpClient.rebindUdp(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp,
|
globalThis.udpClient.rebindUdp(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort)
|
||||||
result.udpOppositeIpPort)
|
|
||||||
globalThis.udpClient.sendMsg('111', null)
|
globalThis.udpClient.sendMsg('111', null)
|
||||||
globalThis.host = `http://${result.centerIp}:${result.centerPort}`
|
globalThis.host = `http://${result.centerIp}:${result.centerPort}`
|
||||||
globalThis.udpClient.onError_Callback(() => {
|
globalThis.udpClient.onError_Callback(()=>{
|
||||||
console.log('getUDPgetUDPgetUDP')
|
console.log('getUDPgetUDPgetUDP')
|
||||||
getUDP(context, true)
|
getUDP(context,true)
|
||||||
if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) {
|
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
|
||||||
globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1
|
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
reslove(`http://${result.centerIp}:${result.centerPort}`)
|
reslove(`http://${result.centerIp}:${result.centerPort}`)
|
||||||
@ -44,23 +44,25 @@ export async function getUDP(context, errorFlag?) {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// 未绑定
|
// 未绑定
|
||||||
console.log(` getUDP has no udclent and bind `);
|
console.log(` getUDP has no udclent and bind `);
|
||||||
console.log('ttttttdata', JSON.stringify(result))
|
console.log('ttttttdata',JSON.stringify(result))
|
||||||
const udpClient: UdpClientByCenter =
|
const udpClient: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort)
|
||||||
new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp,
|
|
||||||
result.udpOppositeIpPort)
|
|
||||||
udpClient.bindUdp()
|
udpClient.bindUdp()
|
||||||
udpClient.sendMsg('111')
|
udpClient.sendMsg('111')
|
||||||
globalThis.host = `http://${result.centerIp}:${result.centerPort}`
|
globalThis.host = `http://${result.centerIp}:${result.centerPort}`
|
||||||
globalThis.udpClient = udpClient
|
globalThis.udpClient = udpClient
|
||||||
|
|
||||||
|
globalThis.udpClient.onMessage_1(()=>{
|
||||||
|
console.log('getUDPonMessage_1msgmsgByGloalUdp')
|
||||||
|
|
||||||
globalThis.udpClient.onError_Callback(() => {
|
})
|
||||||
getUDP(context, true)
|
globalThis.udpClient.onError_Callback(()=>{
|
||||||
if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) {
|
getUDP(context,true)
|
||||||
globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1
|
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
|
||||||
|
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
getChuankouFn()
|
getChuankouFn()
|
||||||
@ -77,15 +79,14 @@ export async function getUDP(context, errorFlag?) {
|
|||||||
console.log(` getUDP has udclent close and rebind `);
|
console.log(` getUDP has udclent close and rebind `);
|
||||||
globalThis.udpClient.closeUdp(() => {
|
globalThis.udpClient.closeUdp(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp,
|
globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort)
|
||||||
result[0].udpOppositeIpPort)
|
|
||||||
globalThis.udpClient.sendMsg('111', null)
|
globalThis.udpClient.sendMsg('111', null)
|
||||||
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
|
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
|
||||||
globalThis.udpClient.onError_Callback(() => {
|
globalThis.udpClient.onError_Callback(()=>{
|
||||||
console.log('getUDPgetUDPgetUDP')
|
console.log('getUDPgetUDPgetUDP')
|
||||||
getUDP(true, context)
|
getUDP(true,context)
|
||||||
if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) {
|
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
|
||||||
globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1
|
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
reslove(`http://${result[0].centerIp}:${result[0].centerPort}`)
|
reslove(`http://${result[0].centerIp}:${result[0].centerPort}`)
|
||||||
@ -94,25 +95,24 @@ export async function getUDP(context, errorFlag?) {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// 未绑定
|
// 未绑定
|
||||||
console.log(` getUDP has no udclent and bind `);
|
console.log(` getUDP has no udclent and bind `);
|
||||||
const udpClient: UdpClientByCenter =
|
const udpClient: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort)
|
||||||
new UdpClientByCenter(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp,
|
|
||||||
result[0].udpOppositeIpPort)
|
|
||||||
udpClient.bindUdp()
|
udpClient.bindUdp()
|
||||||
udpClient.sendMsg('111')
|
udpClient.sendMsg('111')
|
||||||
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
|
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
|
||||||
globalThis.udpClient = udpClient
|
globalThis.udpClient = udpClient
|
||||||
|
|
||||||
globalThis.udpClient.onMessage_1(() => {
|
globalThis.udpClient.onMessage_1(()=>{
|
||||||
console.log('getUDPonMessage_1msgmsgByGloalUdp')
|
console.log('getUDPonMessage_1msgmsgByGloalUdp')
|
||||||
|
|
||||||
})
|
})
|
||||||
globalThis.udpClient.onError_Callback(() => {
|
globalThis.udpClient.onError_Callback(()=>{
|
||||||
getUDP(true, context)
|
getUDP(true,context)
|
||||||
if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) {
|
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
|
||||||
globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1
|
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
|
// udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
|
||||||
@ -140,64 +140,61 @@ export async function getUDP(context, errorFlag?) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUDP2(context, errorFlag?) {
|
export async function getUDP2(context,errorFlag?) {
|
||||||
const fileUtil = new FileUtil(context)
|
const fileUtil = new FileUtil(context)
|
||||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
||||||
if (data === '' || data === undefined) {
|
if (data === '' || data === undefined) {
|
||||||
globalThis.udpClient2 = {}
|
globalThis.udpClient2 = {}
|
||||||
globalThis.udpClient2.setMsgCallBack = () => {
|
globalThis.udpClient2.setMsgCallBack = () => {
|
||||||
}
|
}
|
||||||
} else {
|
}else{
|
||||||
const result = JSON.parse(data)
|
const result=JSON.parse(data)
|
||||||
console.log(` getUDP2 has IPConfigTable `);
|
console.log(` getUDP2 has IPConfigTable `);
|
||||||
if (globalThis.udpClient2 && globalThis.udpClient2.closeUdp) {
|
if (globalThis.udpClient2 && globalThis.udpClient2.closeUdp) {
|
||||||
console.log(` getUDP2 has udclent ,close and rebind `);
|
console.log(` getUDP2 has udclent ,close and rebind `);
|
||||||
globalThis.udpClient2.closeUdp(async () => {
|
globalThis.udpClient2.closeUdp(async () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
globalThis.udpClient2.rebindUdp(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress,
|
globalThis.udpClient2.rebindUdp(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
|
||||||
globalThis.carInfo?.messagePort)
|
globalThis.udpClient2.onError_Callback(()=>{
|
||||||
globalThis.udpClient2.onError_Callback(() => {
|
getUDP2(context,true);
|
||||||
getUDP2(context, true);
|
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
|
||||||
if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) {
|
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
|
||||||
globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// 未绑定
|
// 未绑定
|
||||||
console.log(` getUDP2 has no udclent and bind `);
|
console.log(` getUDP2 has no udclent and bind `);
|
||||||
const udpClient2: UdpClientByCenter =
|
const udpClient2: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
|
||||||
new UdpClientByCenter(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress,
|
|
||||||
globalThis.carInfo?.messagePort)
|
|
||||||
console.info('surenjun udp2=> ', globalThis.carInfo?.messagePort)
|
console.info('surenjun udp2=> ', globalThis.carInfo?.messagePort)
|
||||||
udpClient2.bindUdp()
|
await udpClient2.bindUdp()
|
||||||
udpClient2.onError_Callback(() => {
|
await udpClient2.onError_Callback(()=>{
|
||||||
getUDP2(context, true);
|
getUDP2(context,true);
|
||||||
if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) {
|
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
|
||||||
globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2
|
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!errorFlag) {
|
if(!errorFlag){
|
||||||
udpClient2.onMessage_2((val) => {
|
await udpClient2.onMessage_2((val) => {
|
||||||
if (val.id == '32') {
|
if (val.id == '32') {
|
||||||
globalThis.signNum = val.body[1]
|
globalThis.signNum = val.body[1]
|
||||||
if (val.body[0] == 5) {
|
if(val.body[0] == 5){
|
||||||
console.info('surenjun', `接收到平台扣分请求,请求指令为:${val.body[1]}`)
|
console.info('surenjun', `接收到平台扣分请求,请求指令为:${val.body[1]}`)
|
||||||
globalThis.udpEvent.sendOnKf(val.body[1])
|
globalThis.udpEvent.sendOnKf(val.body[1])
|
||||||
}
|
}
|
||||||
if (val.body[0] == 11) {
|
if(val.body[0] == 11){
|
||||||
console.info('surenjun', 'GlobalUdp收到beginExam事件')
|
console.info('surenjun','GlobalUdp收到beginExam事件')
|
||||||
globalThis.udpEvent.sendBeginExam(val.body[1])
|
globalThis.udpEvent.sendBeginExam(val.body[1])
|
||||||
}
|
}
|
||||||
if (val.body[0] == 12) {
|
if(val.body[0] == 12){
|
||||||
console.info('surenjun', 'GlobalUdp收到endExam事件')
|
console.info('surenjun','GlobalUdp收到endExam事件')
|
||||||
globalThis.udpEvent.sendEndExam(val.body[1])
|
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])
|
globalThis.udpEvent.sendKfContent(val.body[0])
|
||||||
} else if (val.id == '46') {
|
} else if (val.id == '46') {
|
||||||
let tmpList = []
|
let tmpList = []
|
||||||
@ -228,30 +225,28 @@ export async function getUDP2(context, errorFlag?) {
|
|||||||
console.log(` getUDP2 has udclent ,close and rebind `);
|
console.log(` getUDP2 has udclent ,close and rebind `);
|
||||||
globalThis.udpClient2.closeUdp(async () => {
|
globalThis.udpClient2.closeUdp(async () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress,
|
globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
|
||||||
globalThis.carInfo?.messagePort)
|
globalThis.udpClient2.onError_Callback(()=>{
|
||||||
globalThis.udpClient2.onError_Callback(() => {
|
|
||||||
getUDP2(true);
|
getUDP2(true);
|
||||||
if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) {
|
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
|
||||||
globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2
|
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// 未绑定
|
// 未绑定
|
||||||
console.log(` getUDP2 has no udclent and bind `);
|
console.log(` getUDP2 has no udclent and bind `);
|
||||||
const udpClient2: UdpClientByCenter =
|
const udpClient2: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
|
||||||
new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress,
|
|
||||||
globalThis.carInfo?.messagePort)
|
|
||||||
await udpClient2.bindUdp()
|
await udpClient2.bindUdp()
|
||||||
await udpClient2.onError_Callback(() => {
|
await udpClient2.onError_Callback(()=>{
|
||||||
getUDP2(true);
|
getUDP2(true);
|
||||||
if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) {
|
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
|
||||||
globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2
|
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!errorFlag) {
|
if(!errorFlag){
|
||||||
await udpClient2.onMessage_2((val) => {
|
await udpClient2.onMessage_2((val) => {
|
||||||
if (val.id == '32') {
|
if (val.id == '32') {
|
||||||
globalThis.signNum = val.body[1]
|
globalThis.signNum = val.body[1]
|
||||||
@ -290,7 +285,7 @@ export async function setTopLineUdp() {
|
|||||||
|
|
||||||
// const config = await getSyncData('IpConfigTable');
|
// const config = await getSyncData('IpConfigTable');
|
||||||
if (config && config.udplocalIp) {
|
if (config && config.udplocalIp) {
|
||||||
const { udplocalIp, udpOppositeIp, udpOppositeIpPort } = config;
|
const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config;
|
||||||
const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509', udpOppositeIp, udpOppositeIpPort)
|
const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509', udpOppositeIp, udpOppositeIpPort)
|
||||||
udpClient.bindUdp()
|
udpClient.bindUdp()
|
||||||
|
|
||||||
@ -319,19 +314,17 @@ export async function setJudgeUdp() {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
if (config && config.udplocalIp) {
|
if (config && config.udplocalIp) {
|
||||||
const { udplocalIp } = config;
|
const {udplocalIp} = config;
|
||||||
const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(
|
const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(
|
||||||
udplocalIp, '8080',
|
udplocalIp, '8080',
|
||||||
globalThis.carInfo?.udpAddress,
|
globalThis.carInfo?.udpAddress,
|
||||||
globalThis.carInfo?.hintPort
|
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.bindUdp()
|
||||||
await udpClientbyCenter.onMessage_2((val) => {
|
await udpClientbyCenter.onMessage_2((val) => {})
|
||||||
})
|
|
||||||
|
|
||||||
//远程监听开始考试、结束考试、扣分指令
|
//远程监听开始考试、结束考试、扣分指令
|
||||||
|
|
||||||
@ -350,7 +343,7 @@ export async function setJudgeUdp() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//申请远程扣分查询
|
//申请远程扣分查询
|
||||||
askKf(directives) {
|
askKf(directives){
|
||||||
globalThis.udpClient2.sendMsgExt({
|
globalThis.udpClient2.sendMsgExt({
|
||||||
id: 35,
|
id: 35,
|
||||||
list: [directives],
|
list: [directives],
|
||||||
@ -361,10 +354,10 @@ export async function setJudgeUdp() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//确定远程扣分
|
//确定远程扣分
|
||||||
confirmKf(directives, code) {
|
confirmKf(directives,code){
|
||||||
globalThis.udpClient2.sendMsgExt({
|
globalThis.udpClient2.sendMsgExt({
|
||||||
id: 37,
|
id: 37,
|
||||||
list: Array2Byte([string2Bytes(directives, 8), string2Bytes(code, 8)]),
|
list: Array2Byte([string2Bytes(directives,8),string2Bytes(code,8)]),
|
||||||
carNo: globalThis.carInfo.carNo,
|
carNo: globalThis.carInfo.carNo,
|
||||||
placeId: globalThis.carInfo.examinationRoomId
|
placeId: globalThis.carInfo.examinationRoomId
|
||||||
})
|
})
|
||||||
@ -374,5 +367,4 @@ export async function setJudgeUdp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// globalThis.udpClient.bindUdp()
|
// globalThis.udpClient.bindUdp()
|
||||||
|
|||||||
@ -1,236 +0,0 @@
|
|||||||
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,19 +13,22 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
import socket, { UDPSocket } from '@ohos.net.socket';
|
import socket, { UDPSocket } from '@ohos.net.socket';
|
||||||
import { Array2Byte, dateFormat, fillZero, string2Bytes } from '../utils/tools';
|
import { Array2Byte } from '../utils/tools'
|
||||||
import FileUtil from '../../common/utils/File';
|
import FileUtil from '../../common/utils/File'
|
||||||
import prompt from '@ohos.prompt';
|
import { fillZero, string2Bytes } from '../utils/tools'
|
||||||
import promptAction from '@ohos.promptAction';
|
|
||||||
import { getUDP } from './GlobalUdp';
|
|
||||||
import UdpByOne from './UdpByOne';
|
|
||||||
|
|
||||||
const TAG = '[UdpDemo.UdpClient]'
|
const TAG = '[UdpDemo.UdpClient]'
|
||||||
|
import hilog from '@ohos.hilog';
|
||||||
|
import prompt from '@ohos.prompt'
|
||||||
|
import promptAction from '@ohos.promptAction';
|
||||||
|
import { getUDP } from './GlobalUdp';
|
||||||
|
import { dateFormat } from '../utils/tools'
|
||||||
|
import { getSyncData } from '../service/initable';
|
||||||
|
|
||||||
|
|
||||||
export default class UdpClientByCenter {
|
export default class UdpClientByCenter {
|
||||||
public currentValue: string = ''
|
|
||||||
private localIp: string = ''
|
private localIp: string = ''
|
||||||
private localIpPort: string = ''
|
private localIpPort: string = ''
|
||||||
private oppositeIp: string = ''
|
private oppositeIp: string = ''
|
||||||
@ -40,14 +43,15 @@ export default class UdpClientByCenter {
|
|||||||
private context
|
private context
|
||||||
private folderPath
|
private folderPath
|
||||||
private stashFn: StashFunction
|
private stashFn: StashFunction
|
||||||
private errorStep: number = 0
|
private errorStep: number=0
|
||||||
private interval
|
private interval
|
||||||
private headLenth: number = 9
|
private headLenth: number = 9
|
||||||
//消息头长度
|
//消息头长度
|
||||||
private isWorking: Boolean = false
|
private isWorking: Boolean = false
|
||||||
private plcUdpError = false;
|
private plcUdpError = false;
|
||||||
private initParam
|
private initParam
|
||||||
private UPDOne: any
|
private onMessage_1Callback:Function = ()=>{}
|
||||||
|
public currentValue:string = ''
|
||||||
|
|
||||||
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
||||||
this.localIp = udplocalIp
|
this.localIp = udplocalIp
|
||||||
@ -58,14 +62,14 @@ export default class UdpClientByCenter {
|
|||||||
}
|
}
|
||||||
this.udp = socket.constructUDPSocketInstance();
|
this.udp = socket.constructUDPSocketInstance();
|
||||||
this.initPath()
|
this.initPath()
|
||||||
this.UPDOne = new UdpByOne()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatus() {
|
getStatus() {
|
||||||
return this.isWorking
|
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.localIp = localIp
|
||||||
this.oppositeIp = oppositeIp
|
this.oppositeIp = oppositeIp
|
||||||
this.localIpPort = localIpPort
|
this.localIpPort = localIpPort
|
||||||
@ -86,10 +90,10 @@ export default class UdpClientByCenter {
|
|||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
//globalThis.closeHeartSocket=true
|
//globalThis.closeHeartSocket=true
|
||||||
this.isWorking = false
|
this.isWorking = false
|
||||||
// this.writeLog({
|
// this.writeLog({
|
||||||
// time:dateFormat(new Date()),
|
// time:dateFormat(new Date()),
|
||||||
// PLC:`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`,
|
// PLC:`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`,
|
||||||
// })
|
// })
|
||||||
console.log(`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`);
|
console.log(`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -131,6 +135,9 @@ export default class UdpClientByCenter {
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//length消息体bufferlength id消息类型id bodyStr消息体string
|
||||||
|
// setMsyBody(id,bodyByte){
|
||||||
|
|
||||||
// {id: 31,list:[0,1,'0000000000000'],carNo:489,placeId:62}
|
// {id: 31,list:[0,1,'0000000000000'],carNo:489,placeId:62}
|
||||||
setWholeMsg(params) {
|
setWholeMsg(params) {
|
||||||
let head = this.setMsgHead(params);
|
let head = this.setMsgHead(params);
|
||||||
@ -143,17 +150,14 @@ export default class UdpClientByCenter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//length消息体bufferlength id消息类型id bodyStr消息体string
|
setMsgHead({id, list, placeId=62, carNo=489}) {
|
||||||
// setMsyBody(id,bodyByte){
|
|
||||||
|
|
||||||
setMsgHead({ id, list, placeId=62, carNo=489 }) {
|
|
||||||
let a = string2Bytes(`${id}${fillZero(placeId, 3)}`, 2 * 8);
|
let a = string2Bytes(`${id}${fillZero(placeId, 3)}`, 2 * 8);
|
||||||
let b = string2Bytes(`${fillZero(carNo, 4)}${globalThis.lshNo}`, 4 * 8);
|
let b = string2Bytes(`${fillZero(carNo, 4)}${globalThis.lshNo}`, 4 * 8);
|
||||||
let c = string2Bytes(list.length, 2 * 8);
|
let c = string2Bytes(list.length, 2 * 8);
|
||||||
return [...a, ...b, ...c];
|
return [...a, ...b, ...c];
|
||||||
}
|
}
|
||||||
|
|
||||||
setMsgBody({ id, list }) {
|
setMsgBody({id,list}) {
|
||||||
let tmpList = []
|
let tmpList = []
|
||||||
tmpList = list
|
tmpList = list
|
||||||
|
|
||||||
@ -167,14 +171,15 @@ export default class UdpClientByCenter {
|
|||||||
console.log('getUDPsendHeadMsg exit')
|
console.log('getUDPsendHeadMsg exit')
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMsg(msg, sendCallback?) {
|
sendMsg(msg, sendCallback?)
|
||||||
if (!this.isWorking) {
|
{
|
||||||
|
if (!this.isWorking ) {
|
||||||
// console.log(`${TAG}getUDPudpCLient sendMsg is closed return `);
|
// console.log(`${TAG}getUDPudpCLient sendMsg is closed return `);
|
||||||
// this.writeLog({
|
// this.writeLog({
|
||||||
// time:dateFormat(new Date()),
|
// time:dateFormat(new Date()),
|
||||||
// PLC:`${TAG}getUDPudpCLient sendMsg is closed return oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`,
|
// PLC:`${TAG}getUDPudpCLient sendMsg is closed return oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`,
|
||||||
// })
|
// })
|
||||||
if (sendCallback) {
|
if(sendCallback) {
|
||||||
sendCallback()
|
sendCallback()
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -200,8 +205,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)}`,
|
// PLC:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}${JSON.stringify(err)}`,
|
||||||
// })
|
// })
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
message: `${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`,
|
message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`,
|
||||||
duration: 4000
|
duration:4000
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -238,7 +243,6 @@ export default class UdpClientByCenter {
|
|||||||
this.stashFn = callback ? callback : () => {
|
this.stashFn = callback ? callback : () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//中心udp回执
|
//中心udp回执
|
||||||
onMessage_2(callback, type?) {
|
onMessage_2(callback, type?) {
|
||||||
this.udp.on('message', (value, remoteInfo) => {
|
this.udp.on('message', (value, remoteInfo) => {
|
||||||
@ -257,19 +261,14 @@ export default class UdpClientByCenter {
|
|||||||
list.push(arr[i])
|
list.push(arr[i])
|
||||||
}
|
}
|
||||||
this.stashFn({
|
this.stashFn({
|
||||||
id,
|
id, length, body: list, sendId: this.sendId
|
||||||
length,
|
|
||||||
body: list,
|
|
||||||
sendId: this.sendId
|
|
||||||
})
|
})
|
||||||
callback({
|
callback({
|
||||||
id,
|
id, length, body: list, sendId: this.sendId
|
||||||
length,
|
|
||||||
body: list,
|
|
||||||
sendId: this.sendId
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this.interval=setInterval(()=>{
|
// this.interval=setInterval(()=>{
|
||||||
//
|
//
|
||||||
// },3000)
|
// },3000)
|
||||||
@ -298,22 +297,19 @@ export default class UdpClientByCenter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 赋值onMessage_1
|
|
||||||
//plc
|
//plc
|
||||||
onMessage_1(callback?) {
|
onMessage_1(callback?) {
|
||||||
this.onMessage_1Callback = callback;
|
this.onMessage_1Callback = callback;
|
||||||
this.UPDOne.receiveMsg(callback);
|
this.udp&&this.udp.on('message', this.message_1Fn);
|
||||||
this.udp && this.udp.on('message', this.message_1Fn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeMessage_1(){
|
||||||
closeMessage_1() {
|
|
||||||
console.info('surenjun', 'getUDP关闭udp message监听事件')
|
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监听事件 成功')
|
console.info('surenjun', 'getUDP关闭udp message监听事件 成功')
|
||||||
}
|
}
|
||||||
|
|
||||||
message_1Fn = (value) => {
|
message_1Fn = (value)=>{
|
||||||
let callback = this.onMessage_1Callback
|
let callback = this.onMessage_1Callback
|
||||||
// 收到的是ArrayBuffer 需要进行转换解析
|
// 收到的是ArrayBuffer 需要进行转换解析
|
||||||
this.plcUdpError = false
|
this.plcUdpError = false
|
||||||
@ -340,15 +336,15 @@ export default class UdpClientByCenter {
|
|||||||
// time:dateFormat(new Date()),
|
// time:dateFormat(new Date()),
|
||||||
// PLC: JSON.stringify(newArr.toString()),
|
// PLC: JSON.stringify(newArr.toString()),
|
||||||
// })
|
// })
|
||||||
if (strachArr[83] != '4') {
|
if(strachArr[83]!='4'){
|
||||||
console.log('差分状态异常', strachArr[83], strachArr[92])
|
console.log('差分状态异常',strachArr[83],strachArr[92])
|
||||||
this.writeLog({
|
this.writeLog({
|
||||||
time: dateFormat(new Date()),
|
time:dateFormat(new Date()),
|
||||||
PLC: `${TAG}差分状态异常,${strachArr[83]},${strachArr[92]}`,
|
PLC: `${TAG}差分状态异常,${strachArr[83]},${strachArr[92]}`,
|
||||||
})
|
})
|
||||||
} else {
|
}else{
|
||||||
globalThis.dialogOpen = false
|
globalThis.dialogOpen=false
|
||||||
this.chafenFlag = 0
|
this.chafenFlag=0
|
||||||
}
|
}
|
||||||
callback && callback(newArr.toString())
|
callback && callback(newArr.toString())
|
||||||
this.currentValue = newArr.toString();
|
this.currentValue = newArr.toString();
|
||||||
@ -358,18 +354,15 @@ export default class UdpClientByCenter {
|
|||||||
|
|
||||||
this.testIfUdpConnetced(callback)
|
this.testIfUdpConnetced(callback)
|
||||||
}
|
}
|
||||||
|
async writeLog(param){
|
||||||
async writeLog(param) {
|
|
||||||
// const fileUtil = new FileUtil(globalThis.context)
|
// const fileUtil = new FileUtil(globalThis.context)
|
||||||
// fileUtil.editFile(`${this.folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
|
// fileUtil.editFile(`${this.folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
|
||||||
}
|
}
|
||||||
|
async initPath(){
|
||||||
async initPath() {
|
|
||||||
// const fileUtil = new FileUtil(globalThis.context)
|
// const fileUtil = new FileUtil(globalThis.context)
|
||||||
// const date=dateFormat(new Date).split(' ')[0]
|
// const date=dateFormat(new Date).split(' ')[0]
|
||||||
// this.folderPath = await fileUtil.initFolder(`/PLC/${date}`);
|
// this.folderPath = await fileUtil.initFolder(`/PLC/${date}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取当前UDP信号
|
//获取当前UDP信号
|
||||||
getCurrentMessage = () => {
|
getCurrentMessage = () => {
|
||||||
return this.currentValue
|
return this.currentValue
|
||||||
@ -383,7 +376,7 @@ export default class UdpClientByCenter {
|
|||||||
const arrRedBuffer = Array2Byte(arrRed).buffer
|
const arrRedBuffer = Array2Byte(arrRed).buffer
|
||||||
const arrGreenBugger = Array2Byte(arrGreen).buffer
|
const arrGreenBugger = Array2Byte(arrGreen).buffer
|
||||||
let num = 0
|
let num = 0
|
||||||
globalThis.dialogOpen = false
|
globalThis.dialogOpen=false
|
||||||
|
|
||||||
//监听udp是否断开
|
//监听udp是否断开
|
||||||
clearInterval(globalThis.messageTimer)
|
clearInterval(globalThis.messageTimer)
|
||||||
@ -396,15 +389,15 @@ export default class UdpClientByCenter {
|
|||||||
if (this.plcUdpError) {
|
if (this.plcUdpError) {
|
||||||
num++
|
num++
|
||||||
this.writeLog({
|
this.writeLog({
|
||||||
time: dateFormat(new Date()),
|
time:dateFormat(new Date()),
|
||||||
PLC: 'plc udp信号丢失',
|
PLC: 'plc udp信号丢失',
|
||||||
})
|
})
|
||||||
console.log(TAG, 'plc udp信号丢失')
|
console.log(TAG, 'plc udp信号丢失')
|
||||||
if (num == 3) {
|
if (num == 3) {
|
||||||
getUDP(globalThis.context, true)
|
getUDP(globalThis.context,true)
|
||||||
globalThis.title = 'plc udp信号丢失'
|
globalThis.title='plc udp信号丢失'
|
||||||
globalThis.type = '3'
|
globalThis.type='3'
|
||||||
if (!globalThis.dialogOpen) {
|
if(!globalThis.dialogOpen){
|
||||||
// AppStorage.SetOrCreate('errorCode', 1);
|
// AppStorage.SetOrCreate('errorCode', 1);
|
||||||
// if(this.errorStep!=1){
|
// if(this.errorStep!=1){
|
||||||
// console.log('sys.v_valuesys.v_valuesys.v_value11221')
|
// console.log('sys.v_valuesys.v_valuesys.v_value11221')
|
||||||
@ -444,9 +437,6 @@ export default class UdpClientByCenter {
|
|||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
private onMessage_1Callback: Function = () => {
|
|
||||||
}
|
|
||||||
|
|
||||||
// initHeartSendMsg(param,context){
|
// initHeartSendMsg(param,context){
|
||||||
// console.log('1111param',JSON.stringify(param))
|
// console.log('1111param',JSON.stringify(param))
|
||||||
// this.initParam=param
|
// this.initParam=param
|
||||||
|
|||||||
@ -1,126 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
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",
|
|
||||||
];
|
|
||||||
9
entry/src/main/ets/mock/index.ets
Normal file
9
entry/src/main/ets/mock/index.ets
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export * from "./CandidateData"
|
||||||
|
|
||||||
|
export * from "./VideoData"
|
||||||
|
|
||||||
|
export * from "./Judge"
|
||||||
|
|
||||||
|
export * from "./SignDisplay"
|
||||||
|
|
||||||
|
export * from "./CarCheck"
|
||||||
@ -6,6 +6,4 @@ export * from "./Judge"
|
|||||||
|
|
||||||
export * from "./SignDisplay"
|
export * from "./SignDisplay"
|
||||||
|
|
||||||
export * from "./CarCheck"
|
export * from "./CarCheck"
|
||||||
|
|
||||||
export * from "./PLCGPSData"
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"hvigorVersion": "3.2.4",
|
"hvigorVersion": "3.0.9",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ohos/hvigor-ohos-plugin": "3.2.4"
|
"@ohos/hvigor-ohos-plugin": "3.0.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,13 @@
|
|||||||
{
|
{
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 1,
|
||||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||||
"specifiers": {
|
"specifiers": {
|
||||||
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
|
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
|
||||||
},
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"@ohos/hypium@1.0.6": {
|
"@ohos/hypium@1.0.6": {
|
||||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
|
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
|
||||||
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==",
|
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
|
||||||
"registryType": "ohpm",
|
|
||||||
"shasum": "3f5fed65372633233264b3447705b0831dfe7ea1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
27
script.bat
27
script.bat
@ -1,27 +0,0 @@
|
|||||||
@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