拉取SVN
This commit is contained in:
parent
70a5e3a0a0
commit
4fe8bc2a39
@ -15,6 +15,8 @@ import {
|
||||
upDataZhongxinginitialization
|
||||
} from '../../common/service/initable'
|
||||
import { GlobalConfig } from '../../config/index'
|
||||
import testNapi from '@ohos.hiserialsdk'
|
||||
|
||||
export async function getliushuiNum(){
|
||||
console.log('getLiushuihao')
|
||||
this.fileUtil = new FileUtil(this.context)
|
||||
@ -153,13 +155,16 @@ export async function getSingleCenterTable() {
|
||||
],
|
||||
})
|
||||
.then(data => {
|
||||
reslove(false)
|
||||
})
|
||||
.catch(err => {
|
||||
reslove(false)
|
||||
})
|
||||
|
||||
reslove(false)
|
||||
}
|
||||
}).catch((error) => {
|
||||
reslove(false)
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
@ -216,7 +221,7 @@ export async function takePhotoFn(context) {
|
||||
param = JSON.parse(fileData)
|
||||
console.log('paramparam')
|
||||
clearInterval(interval)
|
||||
interval = setInterval(async () => {
|
||||
interval = setTimeout(async () => {
|
||||
const arr = ['spzd1', 'spzd2', 'spzd3', 'spzd4']
|
||||
|
||||
for (let key in map) {
|
||||
@ -239,13 +244,62 @@ export async function takePhotoFn(context) {
|
||||
map[key] = false
|
||||
globalThis.spzd[key] = false
|
||||
}
|
||||
setTimeout(()=>{
|
||||
takePhotoFn()
|
||||
},3000)
|
||||
})
|
||||
}
|
||||
}
|
||||
globalThis.takePhotoNum++
|
||||
if (globalThis.takePhotoNum >= 2) {
|
||||
if (globalThis.takePhotoNum >= 20) {
|
||||
globalThis.takePhotoNum = 0
|
||||
deleteAllFileByPiC('jt')
|
||||
// deleteAllFileByPiC('jt')
|
||||
}
|
||||
}, 3000)
|
||||
}
|
||||
let fd
|
||||
const devPath="/dev/ttyS3"
|
||||
function openChuankouFn() {
|
||||
fd = testNapi.SerialOpen(devPath);
|
||||
globalThis.fd=fd
|
||||
console.log('fdfd1111',globalThis.fd)
|
||||
|
||||
let parity = 0x4e; // 'N'
|
||||
let ret = testNapi.SerialSet(globalThis.fd, 115200, 0, 8, 1, parity);
|
||||
}
|
||||
function getChuankouFnMsg() {
|
||||
let timeout = 50000; // 2秒超时
|
||||
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
|
||||
console.log('fdfd',globalThis.fd)
|
||||
let ret = testNapi.SerialSend(globalThis.fd, databuff);
|
||||
console.log('mmmm',ret)
|
||||
let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
|
||||
|
||||
console.log('revTestInfo',revTestInfo.recevedBuf.length)
|
||||
|
||||
const message = revTestInfo?.recevedBuf?.toString()
|
||||
console.log('chuankou',message)
|
||||
if (message == '') {
|
||||
return
|
||||
}
|
||||
const msg = message?.split(',')
|
||||
if(!msg?.length){
|
||||
return
|
||||
}
|
||||
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
return
|
||||
}
|
||||
globalThis.chuankoMsg=msg[9]
|
||||
|
||||
|
||||
}
|
||||
export async function getChuankouFn(){
|
||||
if(globalThis.fd){
|
||||
return
|
||||
}
|
||||
openChuankouFn()
|
||||
setInterval(()=>{
|
||||
getChuankouFnMsg()
|
||||
},1000)
|
||||
|
||||
}
|
||||
@ -368,6 +368,8 @@ export async function upDataZhongxinginitialization(){
|
||||
}
|
||||
}
|
||||
resolve(true)
|
||||
}).catch((Error)=>{
|
||||
resolve(false)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@ -28,10 +28,10 @@ photoAccessHelper.PhotoKeys.TITLE,
|
||||
photoAccessHelper.PhotoKeys.POSITION,
|
||||
photoAccessHelper.PhotoKeys.DATE_TRASHED,
|
||||
photoAccessHelper.PhotoKeys.HIDDEN];
|
||||
const rtsp_server = record.createServer();
|
||||
|
||||
export async function startRecordVideo(param, td, context, dir) {
|
||||
return new Promise((reslove, reject) => {
|
||||
const rtsp_server = record.createServer();
|
||||
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
|
||||
if (rtsp_server != null) {
|
||||
console.log(`Rtsprecord startRecordVideo begin,video_uri`, video_uri);
|
||||
@ -56,7 +56,6 @@ export async function startRecordVideo(param, td, context, dir) {
|
||||
|
||||
//结束录屏
|
||||
export async function endRecordVideo(record_handle) {
|
||||
const rtsp_server = record.createServer();
|
||||
if (rtsp_server != null && record_handle > 0) {
|
||||
console.log(`Rtsprecord endRecordVideo begin`);
|
||||
// @ts-ignore
|
||||
@ -91,37 +90,51 @@ interface takePhotoParam {
|
||||
* @param callback
|
||||
* @returns
|
||||
*/
|
||||
const fileHelper = new FileHelper();
|
||||
export async function takePhoto(param, context,dir,flag=1,callback?) {
|
||||
|
||||
const rtsp_server = record.createServer();
|
||||
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
|
||||
// var video_uri = `rtsp://admin:openharmony1@192.168.1.66:554/Streaming/Channels/3`;
|
||||
|
||||
const num = Math.floor(Math.random() * 10000)
|
||||
const fileName = `picture_record${num}.jpg`
|
||||
|
||||
|
||||
console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName:` + fileName);
|
||||
// @ts-ignore
|
||||
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
|
||||
if(flag==0){
|
||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,false,(err,snapResult)=>{
|
||||
console.log(`baoyihu getVideoSnapshot return `);
|
||||
console.log(`baoyihu getVideoSnapshot file_name:` + snapResult.fileName);
|
||||
console.log(`baoyihu getVideoSnapshot file_path:` + snapResult.filePath);
|
||||
console.log(`baoyihu getVideoSnapshot fileSize:` + snapResult.fileSize);
|
||||
callback({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
|
||||
rtsp_server.detectVideoSnapshotSize(video_uri,fileName,(err,snapResult)=>{
|
||||
console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize);
|
||||
callback({fileSize:snapResult.fileSize })
|
||||
});
|
||||
}else{
|
||||
// rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,false,(err,snapResult)=>{
|
||||
// console.log(`baoyihu getVideoSnapshot return `);
|
||||
// console.log(`baoyihu getVideoSnapshot file_name:` + snapResult.fileName);
|
||||
// console.log(`baoyihu getVideoSnapshot file_path:` + snapResult.filePath);
|
||||
// console.log(`baoyihu getVideoSnapshot fileSize:` + snapResult.fileSize);
|
||||
// fileHelper.addFile(fileName,1)
|
||||
// callback({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
|
||||
// console.log('getmyLog01')
|
||||
// });
|
||||
}
|
||||
else{
|
||||
return new Promise<takePhotoParam>((resolve,reject)=>{
|
||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{
|
||||
console.log('getPhtot')
|
||||
resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
|
||||
});
|
||||
})
|
||||
console.log('getmyLog02')
|
||||
|
||||
}
|
||||
console.log('getmyLog03')
|
||||
|
||||
|
||||
}
|
||||
|
||||
export async function deleteAllFileByPiC(dirName) {
|
||||
const fileHelper = new FileHelper();
|
||||
// const fileHelper = new FileHelper();
|
||||
fileHelper.deleteFileOfAlbum(dirName,1);
|
||||
}
|
||||
|
||||
|
||||
@ -1,34 +1,35 @@
|
||||
import TcpClient from './TcpClient';
|
||||
import UdpClient from './UdpClient';
|
||||
import {sendMsg} from './GlobleUdp'
|
||||
import { getSyncData} from '../service/initable'
|
||||
import prompt from '@ohos.prompt'
|
||||
import hilog from '@ohos.hilog';
|
||||
export async function getTCP() {
|
||||
|
||||
getSyncData('IpConfigTable').then(async (result:Array<any>)=>{
|
||||
console.log('result222',JSON.stringify(result))
|
||||
if(result.length){
|
||||
if(globalThis.TcpClient&&globalThis.TcpClient.closeTcp){
|
||||
const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
globalThis.TcpClient = tcpClient
|
||||
await globalThis.TcpClient.bindTcp()
|
||||
globalThis.TcpClient.closeTcp(async ()=>{
|
||||
// const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
// globalThis.TcpClient = tcpClient
|
||||
|
||||
await globalThis.TcpClient.rebindTcp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
await globalThis.TcpClient.connectTcp()
|
||||
await globalThis.TcpClient.sendMsg('1002')//1002
|
||||
// setInterval(()=>{
|
||||
// globalThis.TcpClient.sendMsg('1002')//1002
|
||||
//
|
||||
// },2000)
|
||||
globalThis.TcpClient.onError()
|
||||
await globalThis.TcpClient.onMessage((val)=>{
|
||||
console.log('valvalval',val)
|
||||
hilog.info(0x0000, 'testTag', "valvalval1" + JSON.stringify(val));
|
||||
|
||||
// console.log('valvalval',val)
|
||||
setTimeout(()=>{
|
||||
globalThis.TcpClient.sendMsg('1002')//1002
|
||||
if(val){
|
||||
// const msg=val.substring(5,val.length-1)
|
||||
globalThis.udpClient.sendMsg(val)
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
},1000)
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
}else{
|
||||
// prompt.showToast({
|
||||
// message:'初始化localIp'+ result[0].localIp+ result[0].localIpPort+'oppositeIp'+result[0].oppositeIp+result[0].oppositeIpPort,
|
||||
@ -43,13 +44,14 @@ export async function getTCP() {
|
||||
// globalThis.TcpClient.sendMsg('1002')//1002
|
||||
//
|
||||
// },2000)
|
||||
globalThis.TcpClient.onError()
|
||||
await globalThis.TcpClient.onMessage((val)=>{
|
||||
console.log('valvalval',val)
|
||||
hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
|
||||
setTimeout(()=>{
|
||||
globalThis.TcpClient.sendMsg('1002')//1002
|
||||
if(val){
|
||||
// const msg=val.substring(5,val.length-1)
|
||||
globalThis.udpClient.sendMsg(val)
|
||||
globalThis.udpClient?.sendMsg(val)
|
||||
}
|
||||
},1000)
|
||||
|
||||
|
||||
@ -6,11 +6,10 @@ import prompt from '@ohos.prompt'
|
||||
import TcpClient from './TcpClient';
|
||||
import {string2Bytes} from '../../common/utils/tools'
|
||||
export async function sendMsg(val){
|
||||
globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val)
|
||||
// globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val)
|
||||
}
|
||||
export async function getUDP() {
|
||||
getSyncData('IpConfigTable').then((result:Array<any>)=>{
|
||||
console.log('result222',JSON.stringify(result))
|
||||
if(result.length){
|
||||
if(globalThis.udpClient&&globalThis.udpClient.closeUdp){
|
||||
globalThis.udpClient.closeUdp(()=>{
|
||||
@ -51,13 +50,11 @@ export async function getUDP2() {
|
||||
globalThis.udpClient2 = udpClient
|
||||
globalThis.udpClient2.bindUdp()
|
||||
globalThis.udpClient2.onMessage((val)=>{
|
||||
console.log('valval',JSON.stringify(val))
|
||||
if(val.id=='32'){
|
||||
globalThis.signNum=val.body[1]
|
||||
|
||||
}else if(val.id=='46'){
|
||||
let tmpList = []
|
||||
console.log('lsh',globalThis.lsh)
|
||||
const str = globalThis.lsh
|
||||
for (let i = 0;i < str.length; i++) {
|
||||
tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
|
||||
|
||||
@ -3,7 +3,7 @@ import buffer from '@ohos.buffer';
|
||||
|
||||
const TAG = '[TcpDemo.TcpClient]'
|
||||
import prompt from '@ohos.prompt'
|
||||
|
||||
import hilog from '@ohos.hilog';
|
||||
|
||||
export default class TcpClient {
|
||||
private localIp: string = ''
|
||||
@ -18,9 +18,19 @@ export default class TcpClient {
|
||||
this.oppositeIp = tcpOppositeIp
|
||||
this.localIpPort = tcplocalIpPort
|
||||
this.oppositeIpPort = tcpOppositePort
|
||||
|
||||
console.log('tcp1111',this.localIp,this.localIpPort,this.oppositeIp,this.oppositeIpPort)
|
||||
this.tcp = socket.constructTCPSocketInstance();
|
||||
}
|
||||
onError(callback?){
|
||||
this.tcp.on('error', err => {
|
||||
hilog.info(0x0000, 'testTag', "on error, err:" + JSON.stringify(err));
|
||||
this.bindTcp()
|
||||
this.connectTcp()
|
||||
// this.closeUdp(()=>{
|
||||
// this.bindUdp()
|
||||
// })
|
||||
});
|
||||
}
|
||||
rebindTcp(localIp: string, localIpPort:string,oppositeIp: string,oppositeIpPort:string){
|
||||
return new Promise((resolve, reject)=>{
|
||||
|
||||
@ -30,12 +40,11 @@ export default class TcpClient {
|
||||
this.oppositeIpPort = oppositeIpPort
|
||||
let promise=this.tcp.bind({ address: this.localIp, port:parseInt(this.localIpPort), family: 1 }, err => {
|
||||
if (err) {
|
||||
console.log('bind fail');
|
||||
hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
|
||||
resolve(true)
|
||||
}
|
||||
resolve(false)
|
||||
|
||||
console.log('bind success');
|
||||
})
|
||||
})
|
||||
|
||||
@ -50,7 +59,7 @@ export default class TcpClient {
|
||||
return new Promise((resolve,reject)=>{
|
||||
let promise=this.tcp.bind({ address: this.localIp, port:parseInt(this.localIpPort), family: 1 }, err => {
|
||||
if (err) {
|
||||
console.log('bind fail');
|
||||
hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
|
||||
resolve(true)
|
||||
}
|
||||
console.log('bind success');
|
||||
@ -83,15 +92,11 @@ export default class TcpClient {
|
||||
// socketTimeout: 3000,
|
||||
},err => {
|
||||
if (err) {
|
||||
console.log('setExtraOptions fail');
|
||||
return;
|
||||
}
|
||||
console.log('setExtraOptions success');
|
||||
});
|
||||
console.log('connect success')
|
||||
resolve(true)
|
||||
}).catch(err => {
|
||||
console.log('connect fail');
|
||||
resolve(false)
|
||||
});
|
||||
})
|
||||
@ -104,15 +109,12 @@ export default class TcpClient {
|
||||
data:msg
|
||||
});
|
||||
promise.then(() => {
|
||||
console.log('send success');
|
||||
reslove(true)
|
||||
}).catch(err => {
|
||||
console.log('send fail');
|
||||
reslove(false)
|
||||
});
|
||||
})
|
||||
|
||||
console.log('oppositeIpPort',this.oppositeIpPort)
|
||||
// let promise = this.udp.send({
|
||||
// data: msg,
|
||||
// address: {
|
||||
@ -178,6 +180,7 @@ export default class TcpClient {
|
||||
let promise = this.tcp.close();
|
||||
promise.then(() => {
|
||||
console.log('close success');
|
||||
callback()
|
||||
reslove(true)
|
||||
}).catch(err => {
|
||||
console.log('close fail');
|
||||
|
||||
@ -15,11 +15,12 @@
|
||||
|
||||
import socket from '@ohos.net.socket';
|
||||
import { Array2Byte } from '../utils/tools'
|
||||
import {getChuankouFn} from '../../common/service/indexService'
|
||||
|
||||
const TAG = '[PLC.UdpClient]'
|
||||
import prompt from '@ohos.prompt'
|
||||
|
||||
|
||||
import hilog from '@ohos.hilog';
|
||||
export default class UdpClient {
|
||||
private localIp: string = ''
|
||||
private localIpPort: string = ''
|
||||
@ -34,6 +35,7 @@ export default class UdpClient {
|
||||
this.oppositeIp = udpOppositeIp
|
||||
this.localIpPort = udplocalIpPort
|
||||
this.oppositeIpPort = udpOppositeIpPort
|
||||
getChuankouFn()
|
||||
// this.stashFn=()=>{}
|
||||
this.udp = socket.constructUDPSocketInstance();
|
||||
}
|
||||
@ -44,31 +46,33 @@ export default class UdpClient {
|
||||
this.oppositeIp = oppositeIp
|
||||
this.localIpPort = localIpPort
|
||||
this.oppositeIpPort = oppositeIpPort
|
||||
|
||||
hilog.info(0x0000, 'udpCLient', 'rebind'+this.localIp+this.localIpPort);
|
||||
let promise = this.udp.bind({
|
||||
address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
||||
});
|
||||
promise.then(() => {
|
||||
console.log(`${TAG} udp bind success`);
|
||||
console.log(`${TAG}udpCLient udp rebind success`);
|
||||
}).catch(err => {
|
||||
|
||||
console.log(`${TAG} udp bind failed:${JSON.stringify(err)}`);
|
||||
console.log(`${TAG}udpCLient udp rebind failed:${JSON.stringify(err)}`);
|
||||
});
|
||||
}
|
||||
|
||||
bindUdp() {
|
||||
console.log('localIp', this.localIp)
|
||||
console.log('localIpPort', this.localIpPort)
|
||||
hilog.info(0x0000, 'udpCLient', 'bind'+ this.localIp+this.localIpPort);
|
||||
|
||||
let promise = this.udp.bind({
|
||||
// address: '192.168.7.170', port: 20122, family: 1
|
||||
address: '192.168.7.170', port: 20122, family: 1
|
||||
// address: '192.168.7.170', port: 31013, family: 1
|
||||
address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
||||
// address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
||||
});
|
||||
promise.then(() => {
|
||||
console.log(`${TAG} udp bind success`);
|
||||
console.log(`${TAG}udpCLient udp bind success`);
|
||||
}).catch(err => {
|
||||
|
||||
console.log(`${TAG} udp bind failed:${JSON.stringify(err)}`);
|
||||
console.log(`${TAG}udpCLient udp bind failed:${JSON.stringify(err)}`);
|
||||
});
|
||||
}
|
||||
setMsgCallBack(callback){
|
||||
@ -76,27 +80,29 @@ export default class UdpClient {
|
||||
}
|
||||
sendMsg(msg: string) {
|
||||
console.log('sendsnd01')
|
||||
hilog.info(0x0000, 'udpCLient', 'send');
|
||||
|
||||
let promise = this.udp.send({
|
||||
data: msg,
|
||||
address: {
|
||||
// address: '192.168.7.124',
|
||||
// port: 30013,
|
||||
// address: '192.168.7.124',
|
||||
// port: 20022,
|
||||
address: this.oppositeIp,
|
||||
port: parseInt(this.oppositeIpPort),
|
||||
address: '192.168.7.124',
|
||||
port: 20022,
|
||||
// address: this.oppositeIp,
|
||||
// port: parseInt(this.oppositeIpPort),
|
||||
family: 1
|
||||
}
|
||||
});
|
||||
promise.then(() => {
|
||||
console.log(`${TAG} ${this.oppositeIpPort} udp send success:${msg}`);
|
||||
console.log(`${TAG}udpCLient udp send success:${msg}`);
|
||||
}).catch(err => {
|
||||
console.log(`${TAG} udp send fail:${JSON.stringify(err)}`);
|
||||
console.log(`${TAG}udpCLient udp send fail:${JSON.stringify(err)}`);
|
||||
});
|
||||
}
|
||||
onError(callback?){
|
||||
this.udp.on('error', err => {
|
||||
hilog.info(0x0000, 'udpCLient', 'error'+ JSON.stringify(err));
|
||||
console.log("on error, err:" + JSON.stringify(err))
|
||||
// this.closeUdp(()=>{
|
||||
// this.bindUdp()
|
||||
@ -108,7 +114,8 @@ export default class UdpClient {
|
||||
|
||||
this.udp.on('message', value => {
|
||||
// 收到的是ArrayBuffer 需要进行转换解析
|
||||
console.log('messageTimeStart')
|
||||
hilog.info(0x0000, 'udpCLient', 'onmessage');
|
||||
|
||||
globalThis.plcUdpError = false
|
||||
if (value) {
|
||||
|
||||
@ -121,15 +128,18 @@ export default class UdpClient {
|
||||
str += c
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`${TAG} udp on message array buffer:${str}`);
|
||||
const strachArr = str.split(',')
|
||||
let strachArr = str.split(',')
|
||||
if (strachArr[0] != '#DN_GD') {
|
||||
return
|
||||
}
|
||||
|
||||
strachArr[28]=globalThis.chuankoMsg
|
||||
// this.stashFn(str)
|
||||
const newArr=JSON.parse(JSON.stringify(strachArr))
|
||||
console.log('22222',strachArr[28],newArr)
|
||||
// this.stashFn=()=>{}
|
||||
callback(str)
|
||||
callback(newArr.toString())
|
||||
|
||||
} else {
|
||||
callback('')
|
||||
@ -167,7 +177,10 @@ export default class UdpClient {
|
||||
closeUdp(callback) {
|
||||
|
||||
this.udp.close(err => {
|
||||
hilog.info(0x0000, 'udpCLient', 'close');
|
||||
|
||||
if (err) {
|
||||
hilog.info(0x0000, 'udpCLient', 'closeonerror');
|
||||
|
||||
} else {
|
||||
this.udp.getState((err, data) => {
|
||||
|
||||
@ -21,7 +21,7 @@ import {fillZero,string2Bytes} from '../utils/tools'
|
||||
import { GlobalConfig } from '../../config/index'
|
||||
const TAG = '[UdpDemo.UdpClient]'
|
||||
// import common from '@ohos.app.ability.common';
|
||||
|
||||
import hilog from '@ohos.hilog';
|
||||
import prompt from '@ohos.prompt'
|
||||
import call from '@ohos.telephony.call';
|
||||
|
||||
@ -180,7 +180,6 @@ export default class UdpClientByCenter {
|
||||
}
|
||||
onMessage(callback,type?) {
|
||||
this.udp.on('message', value => {
|
||||
console.log('tttttt')
|
||||
let arr=[]
|
||||
let dataView = new DataView(value.message)
|
||||
for (let i = 0;i < dataView?.byteLength; ++i) {
|
||||
@ -188,7 +187,7 @@ export default class UdpClientByCenter {
|
||||
}
|
||||
let idNum = '0x' + fillZero(arr[1].toString(16),2) + fillZero(arr[0].toString(16),2) ;
|
||||
let id = Math.floor(+idNum/1000)
|
||||
console.log('bitbit',arr)
|
||||
hilog.info(0x0000, 'bitbit', JSON.stringify(arr));
|
||||
|
||||
let lengthNum = '0x' + fillZero(arr[7].toString(16),2) + fillZero(arr[6].toString(16),2) ;
|
||||
let length= +lengthNum;
|
||||
@ -208,7 +207,6 @@ export default class UdpClientByCenter {
|
||||
}else{
|
||||
this.udp.getState((err, data) => {
|
||||
if (err) {
|
||||
console.log('getState fail');
|
||||
return;
|
||||
}else{
|
||||
if(!data.isisClose){
|
||||
@ -217,7 +215,6 @@ export default class UdpClientByCenter {
|
||||
},1000)
|
||||
}
|
||||
}
|
||||
console.log('getState success:' + JSON.stringify(data));
|
||||
})
|
||||
// let promise = this.udp.getState({});
|
||||
// promise.then(data => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import systemTime from '@ohos.systemDateTime';
|
||||
import {deepClone,getCurrentTime,stringToASC,string2Bytes,fillZero,Array2Byte} from '../../common/utils/tools'
|
||||
import {testMarkRules,testAllitems,testRealExam,testUIAllitems,testKm2Items} from '../../pages/judgeSDK/dataTest/index'
|
||||
import {testMarkRules,testAllitems,testRealExam,testUIAllitems,testKmItems} from '../../pages/judgeSDK/dataTest/index'
|
||||
import {setJudgeUdp,setTopLineUdp} from './GlobleUdp'
|
||||
import {convertGpsCoord2} from '../utils/tools'
|
||||
|
||||
@ -34,7 +34,6 @@ export const initJudgeUdp = async () => {
|
||||
}
|
||||
globalThis.udpIndex+=1
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
export const getMessageHeartbeat = async (msg) => {
|
||||
@ -112,13 +111,13 @@ const getTranslateSignals = (tempItems) => {
|
||||
|
||||
// 中心所有项目转换
|
||||
const getTranslateProject = () => {
|
||||
const allKm2ItemsObj = {};
|
||||
testKm2Items.forEach(item => {
|
||||
allKm2ItemsObj[item.code] = item;
|
||||
const allKmItemsObj = {};
|
||||
testKmItems.forEach(item => {
|
||||
allKmItemsObj[item.code] = item;
|
||||
})
|
||||
|
||||
const tempItems = testKm2Items.map(item=>{
|
||||
const current = allKm2ItemsObj[item.code];
|
||||
const tempItems = testKmItems.map(item=>{
|
||||
const current = allKmItemsObj[item.code];
|
||||
return {
|
||||
code:item.code,
|
||||
status:getCenterProjectStatus(current.status)
|
||||
|
||||
@ -10,7 +10,7 @@ import { dateFormat } from '../common/utils/tools';
|
||||
@Component
|
||||
struct Index {
|
||||
@State angle: number = 0
|
||||
@State ratio: number = 1280 / 960
|
||||
@State ratio: number = 1700 / 960
|
||||
@State index: number = -1
|
||||
@State time: string = ''
|
||||
@State msg: string = ''
|
||||
@ -189,8 +189,9 @@ struct Index {
|
||||
}
|
||||
@State len: any = ''
|
||||
@State fd: number = -1;
|
||||
@State devPath: string = "/dev/ttyS5"
|
||||
@State devPath: string = "/dev/ttyS3"
|
||||
@State interval: any=""
|
||||
@State chuankouFlag: any=""
|
||||
@State stopFlag: boolean=false
|
||||
// private AccountTable = new AccountTable(()=>{},CommonConstants);
|
||||
onPageShow() {
|
||||
@ -211,15 +212,17 @@ struct Index {
|
||||
});
|
||||
|
||||
this.carConfigurationInfoFn()
|
||||
//todo串口
|
||||
this.openChuankouFn()
|
||||
this.interval=setInterval(()=>{
|
||||
const dwArr=[14,15,16,17,18,19,20]
|
||||
if(dwArr.indexOf(this.index)>=0&&!this.stopFlag){
|
||||
this.getChuankouFn()
|
||||
return
|
||||
}
|
||||
},1000)
|
||||
// //todo串口
|
||||
// this.openChuankouFn()
|
||||
// // this.getChuankouFn()
|
||||
//
|
||||
// this.interval=setInterval(()=>{
|
||||
// const dwArr=[14,15,16,17,18,19,20]
|
||||
// // if(dwArr.indexOf(this.index)>=0&&!this.stopFlag){
|
||||
// this.getChuankouFn()
|
||||
// return
|
||||
// // }
|
||||
// },1000)
|
||||
}
|
||||
|
||||
openChuankouFn() {
|
||||
@ -229,11 +232,17 @@ struct Index {
|
||||
}
|
||||
|
||||
getChuankouFn() {
|
||||
let timeout = 2000000; // 2秒超时
|
||||
let timeout = 50000; // 2秒超时
|
||||
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
|
||||
|
||||
let ret = testNapi.SerialSend(this.fd, databuff);
|
||||
console.log('mmmm',ret)
|
||||
let revTestInfo = testNapi?.SerialRecv(this.fd, timeout);
|
||||
|
||||
console.log('revTestInfo',revTestInfo.recevedBuf.length)
|
||||
|
||||
const message = revTestInfo?.recevedBuf?.toString()
|
||||
console.log('chuankou',this.index,message)
|
||||
if (message == '') {
|
||||
this.stopFlag=true
|
||||
return
|
||||
@ -245,25 +254,28 @@ struct Index {
|
||||
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
return
|
||||
}
|
||||
globalThis.chuankoMsg=msg[9]
|
||||
if (msg[9] == this.dwMap[this.index]) {
|
||||
this.warnFlag[this.index] = '2'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async xhxs() {
|
||||
this.vocObj.avPlayerStop()
|
||||
this.vocObj.releasePlayer()
|
||||
router.pushUrl({
|
||||
url: 'pages/SignDisplay',
|
||||
}, router.RouterMode.Single);
|
||||
clearInterval(this.interval)
|
||||
// clearInterval(this.interval)
|
||||
|
||||
}
|
||||
//
|
||||
carConfigurationInfoFn() {
|
||||
if (globalThis.singlePlay) {
|
||||
const str = "1:5;2:5;3:5;4:5;5:5;6:5;7:5;8:5;9:5;10:2;11:2;12:2;13:2;14:2;15:2;16:5;17:5;18:2;19:2;20:2;21:2;22:2;23:2;24:2"
|
||||
// 1:5;2:5;3:5;4:5;5:5;6:5;7:5;8:5;9:5;
|
||||
const str = "10:5;11:5;12:5;13:5;14:5;15:2;16:5;17:5;18:2;19:2;20:2;21:2;22:2;23:2;24:2"
|
||||
const data = str.split(';')
|
||||
this.checkList = []
|
||||
const list = data
|
||||
@ -418,9 +430,13 @@ struct Index {
|
||||
this.signArr = stachArr
|
||||
const dw = [14, 15, 16, 17, 18, 19, 20];
|
||||
const dwArr = [14, 15, 16, 17, 18, 19, 20]
|
||||
if (dwArr.indexOf(this.index) >= 0) {
|
||||
return
|
||||
|
||||
if(dwArr.indexOf(this.index)>=0){
|
||||
if (stachArr[28] == this.dwMap[this.index]) {
|
||||
this.warnFlag[this.index] = '2'
|
||||
}
|
||||
}
|
||||
|
||||
if (this.subFlag) {
|
||||
//进项目
|
||||
that.stachValue[that.index] = that.signArr[that.realNum[that.index]]
|
||||
@ -546,7 +562,7 @@ struct Index {
|
||||
outClick() {
|
||||
this.vocObj&& this.vocObj.releasePlayer()
|
||||
this.breakFlag = false
|
||||
clearInterval(this.interval)
|
||||
// clearInterval(this.interval)
|
||||
}
|
||||
|
||||
build() {
|
||||
@ -735,7 +751,7 @@ struct Index {
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
.margin({ bottom: 10 * this.ratio })
|
||||
.onClick(() => {
|
||||
|
||||
console.log('xhsx')
|
||||
this.xhxs()
|
||||
})
|
||||
.zIndex(11)
|
||||
|
||||
@ -7,7 +7,7 @@ import promptAction from '@ohos.promptAction'
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State ratio: number = 850 / 960
|
||||
@State ratio: number = 1700 / 960
|
||||
@State url: string = ''
|
||||
@State inputPlaceholderArr: string[] = ['用户账户','密码'];
|
||||
@State inputTextArr: string[] = ['',''];
|
||||
|
||||
@ -29,7 +29,7 @@ struct Index {
|
||||
@State deviceId: string = '';
|
||||
private interval = null;
|
||||
@State angle: number = 0
|
||||
@State ratio: number = 1280 / 960
|
||||
@State ratio: number = 1700 / 960
|
||||
@State loading: boolean = true
|
||||
@State fd: number = -1;
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
@ -106,11 +106,18 @@ struct Index {
|
||||
this.angle = 360
|
||||
}, 1000)
|
||||
this.angle = 0
|
||||
|
||||
//mode为3双中心下载表
|
||||
if(globalThis.timeInfo.mode=='3'){
|
||||
if(globalThis.timeInfo?.mode=='3'){
|
||||
await getDoubleCeneterTable()
|
||||
}else{
|
||||
}else if(globalThis.timeInfo?.mode=='1'){
|
||||
await getSingleCenterTable()
|
||||
}else{
|
||||
promptAction.showToast({
|
||||
message: `网络连接失败`,
|
||||
duration: 3000
|
||||
});
|
||||
this.loading=false
|
||||
}
|
||||
this.loading=false
|
||||
|
||||
@ -121,10 +128,13 @@ struct Index {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
|
||||
router.pushUrl({
|
||||
url: 'pages/UserInfo',
|
||||
params: { judge: true }
|
||||
}, router.RouterMode.Single);
|
||||
// router.pushUrl({
|
||||
// url: 'pages/UserInfo',
|
||||
// }, router.RouterMode.Single);
|
||||
})
|
||||
}
|
||||
Image($r('app.media.index_zj')).width('30.5%').height('74%').onClick(() => {
|
||||
@ -235,14 +245,14 @@ struct Index {
|
||||
getUDP2()
|
||||
clearInterval(this.interval)
|
||||
this.interval=setInterval(() => {
|
||||
setliushuiNum()
|
||||
// setliushuiNum()
|
||||
getliushuiNum()
|
||||
this.heartMsg()
|
||||
}, 1000)
|
||||
takePhotoFn(this.context)
|
||||
|
||||
|
||||
// getTCP()
|
||||
//
|
||||
getTCP()
|
||||
// const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
|
||||
if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) {
|
||||
|
||||
@ -15,7 +15,7 @@ import MA_SYSSET from '../common/constants/MA_SYSSET';
|
||||
import MA_CDSBINFO from '../common/constants/MA_CDSBINFO'
|
||||
import ES_CARINFO from '../common/constants/ES_CARINFO'
|
||||
import {getCurrentTime,formatTime,chunkArr,getCurrentHourTime} from '../common/utils/tools'
|
||||
|
||||
import {testUIAllitems,testMarkRules} from './judgeSDK//dataTest/index'
|
||||
import {
|
||||
examJudgeEndExam
|
||||
} from './judgeSDK/api/index'
|
||||
@ -52,12 +52,13 @@ struct Index {
|
||||
this.time = await getCurrentTime();
|
||||
this.examTime += 1;
|
||||
},1000);
|
||||
|
||||
await this.initStudent();
|
||||
await this.initCar();
|
||||
// await this.initCar();
|
||||
await this.initSystemParam();
|
||||
await this.initMarkRules();
|
||||
await this.initSysset();
|
||||
await this.initCDSBInfo()
|
||||
// await this.initSysset();
|
||||
// await this.initCDSBInfo()
|
||||
|
||||
const {name,idCard,lsh,kszp} = this;
|
||||
|
||||
@ -101,13 +102,17 @@ struct Index {
|
||||
async initMarkRules(){
|
||||
const markRuleParams = await getSyncData('MA_MARKRULE')
|
||||
//@ts-ignore
|
||||
markRuleParams.forEach(mark=>{
|
||||
testMarkRules.forEach(mark=>{
|
||||
this.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = {
|
||||
//@ts-ignore
|
||||
itemno:mark.itemno*1,
|
||||
markcatalog:mark.markcatalog,
|
||||
markshow:decodeURI(mark.markshow),
|
||||
//@ts-ignore
|
||||
markreal:mark.markreal*1,
|
||||
//@ts-ignore
|
||||
markserial:mark.markserial,
|
||||
//@ts-ignore
|
||||
kfxh:mark.kfxh
|
||||
};
|
||||
})
|
||||
@ -141,41 +146,20 @@ struct Index {
|
||||
|
||||
//初始化systemParam表
|
||||
async initSystemParam(){
|
||||
const db = new AccountTable(()=>{},MA_SYSTEMPARM);
|
||||
const systemParms:any = await getSyncData('MA_SYSTEMPARM')
|
||||
const carName = this.carName;
|
||||
|
||||
let carNo2 = '',allItems = [];
|
||||
systemParms.forEach((systemParm)=>{
|
||||
const {no1,no2,no3} = systemParm;
|
||||
testUIAllitems.forEach((systemParm)=>{
|
||||
|
||||
//获取当前考车的no2
|
||||
if(no1 == 3 && no3 == 1){
|
||||
const txt1 = decodeURI(systemParm.txt1)
|
||||
if(txt1 === carName){
|
||||
carNo2 = no2;
|
||||
}
|
||||
}
|
||||
|
||||
//获取当前考车的考试项目
|
||||
if(carNo2 !== '' && no2 == carNo2 && no3 == 10){
|
||||
allItems = decodeURIComponent(systemParm.txt1).split(',')
|
||||
}
|
||||
|
||||
// 存储当前考车考试项目
|
||||
if(allItems.length && no1 == 6 && allItems.includes(no2)){
|
||||
const txt2 = decodeURIComponent(systemParm.txt2)
|
||||
const currentProject = {
|
||||
name:decodeURI(systemParm.txt1),
|
||||
abbreviation:decodeURI(systemParm.txt3),
|
||||
projectCode:no2,
|
||||
projectCodeCenter:txt2
|
||||
// sbxh:project.type
|
||||
name:systemParm.name,
|
||||
abbreviation:systemParm.abbreviation,
|
||||
projectCode:systemParm.projectCode,
|
||||
projectCodeCenter:systemParm.projectCodeCenter
|
||||
}
|
||||
this.projectsObj[no2] = currentProject
|
||||
this.projectsCenterObj[txt2] = currentProject
|
||||
|
||||
this.projectsObj[systemParm.projectCode] = currentProject
|
||||
this.projectsCenterObj[systemParm.projectCodeCenter] = currentProject
|
||||
this.projects.push(currentProject)
|
||||
}
|
||||
})
|
||||
|
||||
const projects = this.projects;
|
||||
@ -375,11 +359,10 @@ struct Index {
|
||||
this.endPopupVisible = false;
|
||||
},
|
||||
confirmFn:async ()=>{
|
||||
globalThis.udpClient.onMessage(()=>{});
|
||||
examJudgeEndExam();
|
||||
this.endPopupVisible = false;
|
||||
this.loadingPopupVisible = true
|
||||
globalThis.isJudge = false
|
||||
examJudgeEndExam();
|
||||
clearInterval(this.timer);
|
||||
clearInterval(globalThis.judgeTimer)
|
||||
globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
||||
@ -399,9 +382,9 @@ struct Index {
|
||||
Column() {
|
||||
SignDisplayCom({
|
||||
showBack:false,
|
||||
scaleNum:0.95,
|
||||
scaleNum:1.2,
|
||||
msgStr:this.judge.plcStr || ''
|
||||
}).margin({top:50})
|
||||
}).margin({top:100})
|
||||
|
||||
Row(){}
|
||||
.width(60).height(60).position({x:'80%',y:80}).backgroundImage($rawfile('judge/close.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'33.33%',height:'33.33%'})
|
||||
|
||||
@ -9,9 +9,9 @@ import { GlobalConfig } from '../config/index'
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State textList1: string[] = ['中心服务器IP:','中心响应端口','前置机IP','响应端口', '子网掩码','默认网关','用户名:', '密码:','dns','差分服务器IP: ', '响应端口:','后置机IP','响应端口','tcp客户端端口']
|
||||
@State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口','平台服务器Ip','响应端口']
|
||||
// @State textList2: string[] = []
|
||||
@State ratio: number = 1280 / 960
|
||||
@State ratio: number = 1700 / 960
|
||||
@State inputFontSize:number=12 //12
|
||||
//
|
||||
// @State inputTextList1: string[] = ['192.168.7.170','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11055' +
|
||||
@ -19,7 +19,7 @@ struct Index {
|
||||
// @State inputTextList2: string[] = ['192.168.7.124','20022']
|
||||
|
||||
|
||||
@State inputTextList1: string[] = ['192.168.36.2','8083','192.168.36.92','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.2','8000','192.168.36.91','20022','8083']
|
||||
@State inputTextList1: string[] = ['112.80.35.83','11055','112.80.35.83','11052','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122','112.80.35.83','11050']
|
||||
// @State inputTextList2: string[] = []
|
||||
// 112.80.35.83 11052
|
||||
// @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
|
||||
@ -80,14 +80,14 @@ struct Index {
|
||||
.borderRadius('25px')
|
||||
Column() {
|
||||
Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{
|
||||
upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[2],udplocalIpPort:this.inputTextList1[3],udpOppositeIp:this.inputTextList1[11],udpOppositeIpPort:this.inputTextList1[12],tcplocalIp:this.inputTextList1[0],tcplocalIpPort:this.inputTextList1[13],tcpOppositeIp:this.inputTextList1[9],tcpOppositePort:this.inputTextList1[10],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[8],centerIp:this.inputTextList1[0],centerPort:this.inputTextList1[1]}])
|
||||
upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]}])
|
||||
ethernet.setIfaceConfig("eth0", {
|
||||
mode: 0,
|
||||
ipAddr:this.inputTextList1[2],
|
||||
ipAddr:this.inputTextList1[9],
|
||||
route: "0.0.0.0",
|
||||
gateway: this.inputTextList1[5],//value.gateway网关
|
||||
netMask: this.inputTextList1[4],//value.netMask网络掩码
|
||||
dnsServers: this.inputTextList1[8],
|
||||
dnsServers: this.inputTextList1[6],
|
||||
// domain: ""
|
||||
}, (error) => {
|
||||
if (error) {
|
||||
@ -129,20 +129,20 @@ struct Index {
|
||||
console.log('result222',JSON.stringify(result))
|
||||
if(result.length){
|
||||
console.log('tagtag',JSON.stringify(result))
|
||||
this.inputTextList1[2]=result[0].udplocalIp
|
||||
this.inputTextList1[3]=result[0].udplocalIpPort
|
||||
this.inputTextList1[11]=result[0].udpOppositeIp
|
||||
this.inputTextList1[12]=result[0].udpOppositeIpPort
|
||||
this.inputTextList1[9]=result[0].udplocalIp
|
||||
this.inputTextList1[10]=result[0].udplocalIpPort
|
||||
this.inputTextList1[7]=result[0].udpOppositeIp
|
||||
this.inputTextList1[8]=result[0].udpOppositeIpPort
|
||||
|
||||
// this.inputTextList1[0]=result[0].tcplocalIp
|
||||
this.inputTextList1[13]=result[0].tcplocalIpPort
|
||||
this.inputTextList1[9]=result[0].tcpOppositeIp
|
||||
this.inputTextList1[10]=result[0].tcpOppositePort
|
||||
// this.inputTextList1[13]=result[0].tcplocalIpPort
|
||||
this.inputTextList1[0]=result[0].tcpOppositeIp
|
||||
this.inputTextList1[1]=result[0].tcpOppositePort
|
||||
this.inputTextList1[5]=result[0].gateway
|
||||
this.inputTextList1[4]=result[0].netMask
|
||||
this.inputTextList1[8]=result[0].dnsServers
|
||||
this.inputTextList1[0]=result[0].centerIp
|
||||
this.inputTextList1[1]=result[0].centerPort
|
||||
this.inputTextList1[6]=result[0].dnsServers
|
||||
this.inputTextList1[2]=result[0].centerIp
|
||||
this.inputTextList1[3]=result[0].centerPort
|
||||
}
|
||||
})
|
||||
ethernet.getIfaceConfig("eth0", (error, value) => {
|
||||
|
||||
@ -9,23 +9,23 @@ import { GlobalConfig } from '../config/index'
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State textList1: string[] = ['ftp服务器IP:','响应端口','前置机IP','响应端口', '子网掩码','默认网关','用户名:', '密码:','dns','差分服务器IP: ', '响应端口:',]
|
||||
@State textList2: string[] = ['后置机IP','响应端口']
|
||||
@State ratio: number = 1280 / 960
|
||||
@State textList1: string[] = ['中心服务器IP:','中心响应端口','前置机IP','响应端口', '子网掩码','默认网关','用户名:', '密码:','dns','差分服务器IP: ', '响应端口:','后置机IP','响应端口','tcp客户端端口']
|
||||
// @State textList2: string[] = []
|
||||
@State ratio: number = 1700 / 960
|
||||
@State inputFontSize:number=12 //12
|
||||
//
|
||||
|
||||
@State inputTextList1: string[] = ['192.168.7.170','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11055' +
|
||||
'',]
|
||||
@State inputTextList2: string[] = ['192.168.7.124','20022']
|
||||
|
||||
// @State inputTextList1: string[] = ['192.168.36.2','8083','192.168.36.92','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.2','8000',]
|
||||
// @State inputTextList2: string[] = ['192.168.36.91','20022']
|
||||
// 112.80.35.83 11052
|
||||
// @State inputTextList1: string[] = ['192.168.7.254','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11052']
|
||||
// @State inputTextList1: string[] = ['192.168.7.170','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11055' +
|
||||
// '',]
|
||||
// @State inputTextList2: string[] = ['192.168.7.124','20022']
|
||||
|
||||
|
||||
@State inputTextList1: string[] = ['122.80.35.83','8083','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','192.168.7.1','8000','192.168.7.124','20022','8083']
|
||||
// @State inputTextList2: string[] = []
|
||||
// 112.80.35.83 11052
|
||||
// @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
|
||||
// @State inputTextList2: string[] = ['192.168.36.139','20022']
|
||||
|
||||
|
||||
|
||||
|
||||
@State @Watch('outClick') outFlag: boolean = false;
|
||||
@ -66,35 +66,7 @@ struct Index {
|
||||
.width('50%')
|
||||
.height('16.7%')
|
||||
})
|
||||
ForEach(this.textList2, (item:string, index:number) => {
|
||||
Row() {
|
||||
Text(item)
|
||||
.width('40%')
|
||||
.height('100%')
|
||||
.fontColor('#E5CBA1')
|
||||
.fontSize(this.inputFontSize*this.ratio)
|
||||
.padding({'left': '35px'})
|
||||
TextInput({'text':this.inputTextList2[index]?this.inputTextList2[index]: ''})
|
||||
.width('60%')
|
||||
.height('60%')
|
||||
.fontColor('#fff')
|
||||
.borderColor('#E6E0D8')
|
||||
.borderRadius('10px')
|
||||
.borderWidth('2px')
|
||||
.padding({top:0,bottom:0})
|
||||
.fontSize(this.inputFontSize*this.ratio)
|
||||
.linearGradient({
|
||||
angle: 0,
|
||||
colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
|
||||
})
|
||||
.onChange((value: string) => {
|
||||
this.inputTextList2[index]=value
|
||||
|
||||
})
|
||||
}
|
||||
.width('32.5%')
|
||||
.height('16.7%')
|
||||
})
|
||||
}
|
||||
}
|
||||
.width('95%')
|
||||
@ -108,8 +80,7 @@ struct Index {
|
||||
.borderRadius('25px')
|
||||
Column() {
|
||||
Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{
|
||||
upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[2],udplocalIpPort:this.inputTextList1[3],udpOppositeIp:this.inputTextList2[0],udpOppositeIpPort:this.inputTextList2[1],tcplocalIp:this.inputTextList1[0],tcplocalIpPort:this.inputTextList1[1],tcpOppositeIp:this.inputTextList1[9],tcpOppositePort:this.inputTextList1[10],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[8]}])
|
||||
GlobalConfig.host=this.inputTextList1[9]
|
||||
upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[2],udplocalIpPort:this.inputTextList1[3],udpOppositeIp:this.inputTextList1[0],udpOppositeIpPort:this.inputTextList1[1],tcplocalIp:this.inputTextList1[2],tcplocalIpPort:this.inputTextList1[1],tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[10],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[8]}])
|
||||
ethernet.setIfaceConfig("eth0", {
|
||||
mode: 0,
|
||||
ipAddr:this.inputTextList1[2],
|
||||
@ -160,19 +131,18 @@ struct Index {
|
||||
console.log('tagtag',JSON.stringify(result))
|
||||
this.inputTextList1[2]=result[0].udplocalIp
|
||||
this.inputTextList1[3]=result[0].udplocalIpPort
|
||||
this.inputTextList2[0]=result[0].udpOppositeIp
|
||||
this.inputTextList2[1]=result[0].udpOppositeIpPort
|
||||
this.inputTextList1[11]=result[0].udpOppositeIp
|
||||
this.inputTextList1[12]=result[0].udpOppositeIpPort
|
||||
|
||||
this.inputTextList1[0]=result[0].tcplocalIp
|
||||
this.inputTextList1[1]=result[0].tcplocalIpPort
|
||||
// this.inputTextList1[0]=result[0].tcplocalIp
|
||||
this.inputTextList1[13]=result[0].tcplocalIpPort
|
||||
this.inputTextList1[9]=result[0].tcpOppositeIp
|
||||
this.inputTextList1[10]=result[0].tcpOppositePort
|
||||
this.inputTextList1[5]=result[0].gateway
|
||||
this.inputTextList1[4]=result[0].netMask
|
||||
this.inputTextList1[8]=result[0].dnsServers
|
||||
this.inputTextList1[11]=result[0].centerIp
|
||||
this.inputTextList1[12]=result[0].heartPort
|
||||
this.inputTextList1[13]=result[0].gpsPort
|
||||
this.inputTextList1[0]=result[0].centerIp
|
||||
this.inputTextList1[1]=result[0].centerPort
|
||||
}
|
||||
})
|
||||
ethernet.getIfaceConfig("eth0", (error, value) => {
|
||||
|
||||
@ -21,7 +21,7 @@ import { getSyncData } from '../common/service/initable'
|
||||
@Component
|
||||
struct UserInfo {
|
||||
@State pageIndex: number = 0
|
||||
@State ratio: number = 1280 / 960
|
||||
@State ratio: number = 1700 / 960
|
||||
@State index: number = 0
|
||||
@State stepFlag: boolean = false;
|
||||
@State errorMsg: string = ''
|
||||
@ -86,6 +86,7 @@ struct UserInfo {
|
||||
@State faceCatchImg: string = ''
|
||||
|
||||
async onPageShow() {
|
||||
|
||||
//语音功能
|
||||
const systemParms:any = await getSyncData('MA_SYSTEMPARM')
|
||||
console.log('systemParms',systemParms.length)
|
||||
@ -227,7 +228,6 @@ struct UserInfo {
|
||||
this.lsh = this.currentUser.lsh
|
||||
globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm
|
||||
globalThis.lsh = this.lsh
|
||||
return
|
||||
} else {
|
||||
// this.getExaminationStudentInfoFn()
|
||||
}
|
||||
|
||||
@ -8,8 +8,8 @@ import { GlobalConfig } from '../config/index'
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State ratio: number = 1280 / 960
|
||||
@State videoSrc: string = 'rtsp://admin:12345qwe@192.168.36.94:554/h264/ch3/main/av_stream'
|
||||
@State ratio: number = 1700 / 960
|
||||
@State videoSrc: string = 'rtsp://admin12345qwe@192.168.36.94:554/h264/ch3/main/av_stream'
|
||||
@State previewUri: Resource = $r('app.media.2_nor')
|
||||
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
|
||||
@State inputFontSize: number = 10 //12
|
||||
@ -117,7 +117,6 @@ struct Index {
|
||||
Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row}) {
|
||||
ForEach(this.videoArr,(item,index)=>{
|
||||
Video({
|
||||
// src: this.openFlag ? item.src: '',
|
||||
src: this.openFlag ? `rtsp://${this.param.userName}:${this.param.pwd}@${this.param.ip}:${this.param.port}/h264/ch${this.param[item.td]}/main/av_stream` : '',
|
||||
currentProgressRate: this.curRate,
|
||||
controller: item.controller
|
||||
|
||||
@ -79,7 +79,7 @@ struct SignDisplayCom {
|
||||
]
|
||||
@State ratio: number = 850 / 960
|
||||
@State gpsActive: number = 1
|
||||
@State active: number = 0
|
||||
@Prop active: number = 0
|
||||
@State msgStr: string = ''
|
||||
@State interval: any=''
|
||||
|
||||
@ -394,7 +394,6 @@ struct SignDisplayCom {
|
||||
}
|
||||
aboutToAppear(){
|
||||
this.ratio = this.ratio * (this.scaleNum || 1);
|
||||
|
||||
const that = this
|
||||
const {showBack,getSignal} = this
|
||||
|
||||
@ -404,27 +403,29 @@ struct SignDisplayCom {
|
||||
this.interval=setInterval(() => {
|
||||
serialPortClient.SerialSend()
|
||||
const data = serialPortClient.SerialRecv()
|
||||
if (data?.recevedLen) {
|
||||
const msg = data.msg.split(',')
|
||||
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
return
|
||||
}
|
||||
this.sjxhColum[18].value = msg[9]
|
||||
}
|
||||
// if (data?.recevedLen) {
|
||||
// const msg = data.msg.split(',')
|
||||
// if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
// return
|
||||
// }
|
||||
// this.sjxhColum[18].value = msg[9]
|
||||
// }
|
||||
}, 1000)
|
||||
if(showBack){
|
||||
globalThis.udpClient.onMessage((msg) => {
|
||||
console.log('msgmsg',msg)
|
||||
if(msg){
|
||||
getSignal(msg)
|
||||
}
|
||||
})
|
||||
}else{
|
||||
clearInterval(globalThis.signalTimer)
|
||||
globalThis.signalTimer = setInterval(()=>{
|
||||
//TODO 临时方案
|
||||
console.log('msgmsgq',globalThis.msgStr)
|
||||
|
||||
const msgStr = globalThis.msgStr
|
||||
if(msgStr){
|
||||
getSignal(msgStr)
|
||||
|
||||
}
|
||||
},200)
|
||||
}
|
||||
}
|
||||
@ -447,13 +448,13 @@ struct SignDisplayCom {
|
||||
this.interval=setInterval(() => {
|
||||
serialPortClient.SerialSend()
|
||||
const data = serialPortClient.SerialRecv()
|
||||
if (data.recevedLen) {
|
||||
const msg = data.msg.split(',')
|
||||
if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
return
|
||||
}
|
||||
this.sjxhColum[18].value = msg[9]
|
||||
}
|
||||
// if (data.recevedLen) {
|
||||
// const msg = data.msg.split(',')
|
||||
// if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
|
||||
// return
|
||||
// }
|
||||
// this.sjxhColum[18].value = msg[9]
|
||||
// }
|
||||
}, 1000)
|
||||
const that = this
|
||||
const showBack = this.showBack;
|
||||
@ -495,7 +496,7 @@ struct SignDisplayCom {
|
||||
this.sjxhColum[15].value = this.signArr[19]
|
||||
this.sjxhColum[16].value = this.signArr[20]
|
||||
this.sjxhColum[17].value = this.signArr[23] //车速
|
||||
// this.sjxhColum[18].value=this.signArr[18]
|
||||
this.sjxhColum[18].value=this.signArr[28]//档位
|
||||
this.sjxhColum[19].value = this.signArr[29]
|
||||
this.sjxhColum[20].value = this.signArr[30]
|
||||
this.sjxhColum[21].value = this.signArr[15] //NC
|
||||
|
||||
@ -13,7 +13,6 @@ import {writeObjectOut,uploadExamProgressData} from '../../api/judge'
|
||||
import {deepClone,getCurrentTime,stringToASC,string2Bytes,fillZero,Array2Byte,convertGpsCoord2} from '../../common/utils/tools'
|
||||
import {getTranslateSignals,getCarStatus,getCarStatusType,getCenterProjectStatus,plcStrToJson,plcStrToWXJson,promptWxCode} from './utils//judge-common'
|
||||
import {examJudgeSetLogCallback,examJudgeBeginExam,examJudgeInit,examJudgeRealExam,examJudgeSetRealExamCallback,examJudgeSetPerformCallback,examJudgeEndExam} from './api/index'
|
||||
|
||||
const judgeTag = 'SURENJUN_JUDGE'
|
||||
|
||||
export default class Judge{
|
||||
@ -92,7 +91,6 @@ export default class Judge{
|
||||
}
|
||||
|
||||
globalThis.isJudge = true
|
||||
|
||||
// 2.评判过程回调
|
||||
await examJudgeSetRealExamCallback(async (strData,len)=>{
|
||||
await fileLog.setExamJudgeCallbackData(strData)
|
||||
@ -122,7 +120,7 @@ export default class Judge{
|
||||
let num = 2;
|
||||
const judgeTimer = setInterval(async ()=>{
|
||||
const msg = JSON.parse(strArr[num]);
|
||||
await fileLog.setExamJudgeData(msg)
|
||||
// await fileLog.setExamJudgeData(msg)
|
||||
if(!msg){
|
||||
console.info(judgeTag,'模拟数据考试结束')
|
||||
examJudgeEndExam();
|
||||
@ -136,7 +134,7 @@ export default class Judge{
|
||||
globalThis.msgStr= ''
|
||||
await examJudgeRealExam(msg)
|
||||
num++
|
||||
},100)
|
||||
},200)
|
||||
globalThis.judgeTimer = judgeTimer;
|
||||
return
|
||||
}
|
||||
@ -157,7 +155,6 @@ export default class Judge{
|
||||
const judgeUdp = globalThis.judgeUdp
|
||||
//平台实时轨迹心跳
|
||||
const bytes= await this.getMessageHeartbeat();
|
||||
globalThis.udpIndex = 0
|
||||
judgeUdp.send(bytes)
|
||||
}
|
||||
globalThis.udpIndex+=1
|
||||
@ -247,7 +244,7 @@ export default class Judge{
|
||||
//更改考试状态
|
||||
goVoiceAnnounce = async (event,xmdm,kf,xmjs) => {
|
||||
const projectsObj = this.judgeUI.projectsObj;
|
||||
const {beginProject,pointsDedute,endProject,avPlayer,uploadProgressPhoto,judgeTask,handEndExam,isExam} = this;
|
||||
const {beginProject,pointsDedute,endProject,avPlayer,uploadProgressPhoto,judgeTask,handEndExam} = this;
|
||||
const xmhg = xmjs.xmhg
|
||||
const kfLen = kf.length
|
||||
switch (event){
|
||||
@ -275,9 +272,7 @@ export default class Judge{
|
||||
// 扣分
|
||||
case 3:
|
||||
console.info(judgeTag ,kf[kfLen -1].markcatalog);
|
||||
if(!isExam){
|
||||
avPlayer.playAudio([`km2/${kf[kfLen -1].markcatalog}.mp3`])
|
||||
}
|
||||
await judgeTask.addTask(async ()=>{
|
||||
console.info(judgeTag,'项目扣分 start')
|
||||
await pointsDedute(kf[kfLen -1].xmdm,kf[kfLen -1])
|
||||
@ -303,18 +298,14 @@ export default class Judge{
|
||||
public handEndExam = async ()=>{
|
||||
const {endExam,avPlayer} = this;
|
||||
avPlayer.playAudio(['km2/exam_waiting.mp3'],true)
|
||||
|
||||
this.isEnd = true
|
||||
// 获取最后一次心跳
|
||||
const bytes = await this.getMessageHeartbeat(true);
|
||||
const singlePlay = globalThis.singlePlay
|
||||
singlePlay || globalThis.judgeUdp.send(bytes)
|
||||
|
||||
// c++调用考试结束
|
||||
await examJudgeEndExam();
|
||||
globalThis.isJudge = false
|
||||
//结束考试
|
||||
globalThis.udpClient.onMessage(()=>{});
|
||||
await endExam()
|
||||
}
|
||||
|
||||
@ -513,6 +504,7 @@ export default class Judge{
|
||||
console.info(judgeTag,`考试成绩:${totalScore}`)
|
||||
fileLog.setExamJudgeWuxiData(data)
|
||||
await uploadProgressData();
|
||||
|
||||
setTimeout(()=>{
|
||||
router.back();
|
||||
},3000)
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
//考试回放开关
|
||||
export const judgeConfig = {
|
||||
//本地目录开关
|
||||
isTrajectoryOpen: false,
|
||||
isTrajectoryOpen: true,
|
||||
// 本地模型地址
|
||||
modelPath: 'models/model_enc',
|
||||
// 轨迹回放目录地址
|
||||
trajectoryPath: 'logs/2024_01_24/2024_01_24_11_30_06_2210707689316_620502199005070478_马鸣五/judge_exam_data.txt'
|
||||
trajectoryPath: 'logs/2024_04_02/judge_exam_data.txt'
|
||||
}
|
||||
|
||||
// 2024_01_24_11_30_06_2210707689316_620502199005070478_马鸣五
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user