Compare commits
No commits in common. "40e7655d876e54c8a4603a3d0b4fc86071b34a12" and "f4c64fe80072007c456816cfe7f5c46a271dc252" have entirely different histories.
40e7655d87
...
f4c64fe800
@ -161,11 +161,3 @@ interface VersionInfo {
|
|||||||
km2: string[];
|
km2: string[];
|
||||||
km3: string[];
|
km3: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface centerCallBackMsgType {
|
|
||||||
id: number;
|
|
||||||
length: number;
|
|
||||||
body:number[];
|
|
||||||
sendId:number;
|
|
||||||
}
|
|
||||||
@ -8,7 +8,6 @@ import { CarCheckDataType, CarConfigurationParams, CarInfoType, SpzdType } from
|
|||||||
import { BusinessError } from '@ohos.base';
|
import { BusinessError } from '@ohos.base';
|
||||||
import { voiceService } from '../utils/Voice';
|
import { voiceService } from '../utils/Voice';
|
||||||
import dayTs from '../utils/Date';
|
import dayTs from '../utils/Date';
|
||||||
import { ObtainSignalData } from '../utils/business/ObtainSignalData';
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
@ -180,7 +179,9 @@ struct Index {
|
|||||||
|
|
||||||
getPLCInfo() {
|
getPLCInfo() {
|
||||||
const that = this
|
const that = this
|
||||||
ObtainSignalData.getData((msg)=>{
|
globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg: string) => {
|
||||||
|
console.log('getUDPonMessage_1byCarCheck2')
|
||||||
|
|
||||||
if (!this.breakFlag) {
|
if (!this.breakFlag) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -239,7 +240,6 @@ struct Index {
|
|||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopCheck() {
|
stopCheck() {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import promptAction from '@ohos.promptAction';
|
|||||||
import errorMsgDialog from './compontents/errorMsgDialog';
|
import errorMsgDialog from './compontents/errorMsgDialog';
|
||||||
import imageBtn from './compontents/imageBtn';
|
import imageBtn from './compontents/imageBtn';
|
||||||
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
||||||
import { BaseInfoType, centerCallBackMsgType } from '../model/Common';
|
import { BaseInfoType } from '../model/Common';
|
||||||
import {
|
import {
|
||||||
CarInfoType,
|
CarInfoType,
|
||||||
InitializeTheCentralTableType,
|
InitializeTheCentralTableType,
|
||||||
@ -24,8 +24,6 @@ import { delPic } from '../utils/Video';
|
|||||||
import { FileHelper } from '../utils/FileHelp';
|
import { FileHelper } from '../utils/FileHelp';
|
||||||
import GetDistance from '../utils/business/GetDistance';
|
import GetDistance from '../utils/business/GetDistance';
|
||||||
import { GetCurrentTime, NumberToByteArray } from '../utils/Common';
|
import { GetCurrentTime, NumberToByteArray } from '../utils/Common';
|
||||||
import { ObtainSignalData } from '../utils/business/ObtainSignalData';
|
|
||||||
import { CentralHeartbeat } from '../utils/business/CentralHeartbeat';
|
|
||||||
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@ -433,17 +431,17 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async heartMsg() {
|
async heartMsg() {
|
||||||
// const signNum = AppStorage.get<number>('signNum')
|
const signNum = AppStorage.get<number>('signNum')
|
||||||
// const statue = AppStorage.get<string>('statue')
|
const statue = AppStorage.get<string>('statue')
|
||||||
// const lsh = AppStorage.get<string>('lsh')
|
const lsh = AppStorage.get<string>('lsh')
|
||||||
// const arr = [signNum || 0, statue || 1]
|
const arr = [signNum || 0, statue || 1]
|
||||||
// let tmpList: number[] = [];
|
let tmpList: number[] = [];
|
||||||
// tmpList.push(NumberToByteArray(Number(arr[0]), 1 * 8)[0])
|
tmpList.push(NumberToByteArray(Number(arr[0]), 1 * 8)[0])
|
||||||
// tmpList.push(NumberToByteArray(Number(arr[1]), 1 * 8)[0])
|
tmpList.push(NumberToByteArray(Number(arr[1]), 1 * 8)[0])
|
||||||
// const str = lsh || '0000000000000'
|
const str = lsh || '0000000000000'
|
||||||
// for (let i = 0; i < str.length; i++) {
|
for (let i = 0; i < str.length; i++) {
|
||||||
// tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0])
|
tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0])
|
||||||
// }
|
}
|
||||||
// TODO 未改
|
// TODO 未改
|
||||||
// const param = {
|
// const param = {
|
||||||
// id: 31,
|
// id: 31,
|
||||||
@ -504,18 +502,11 @@ struct Index {
|
|||||||
|
|
||||||
async initParams() {
|
async initParams() {
|
||||||
//设置plc udp 同步requesthost
|
//设置plc udp 同步requesthost
|
||||||
// await getUDP(this.context, false)
|
await getUDP(this.context, false)
|
||||||
ObtainSignalData.init();
|
|
||||||
CentralHeartbeat.init();
|
|
||||||
CentralHeartbeat.getData((data:centerCallBackMsgType)=>{
|
|
||||||
if (data.id == 32) {
|
|
||||||
AppStorage.setOrCreate('signNum', data.body[1])
|
|
||||||
}
|
|
||||||
},)
|
|
||||||
this.loading = false
|
this.loading = false
|
||||||
await GetDeviceInfo(this.context)
|
await GetDeviceInfo(this.context)
|
||||||
await GetCarInfo()
|
await GetCarInfo()
|
||||||
// await getUDP2(this.context, false)
|
await getUDP2(this.context, false)
|
||||||
getTCP()
|
getTCP()
|
||||||
this.carInfo = AppStorage.get<CarInfoType>('carInfo')
|
this.carInfo = AppStorage.get<CarInfoType>('carInfo')
|
||||||
this.deviceId = this.carInfo.carNo
|
this.deviceId = this.carInfo.carNo
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import { CryptoJS } from '@ohos/crypto-js';
|
|||||||
import {
|
import {
|
||||||
BeginExamRequest,
|
BeginExamRequest,
|
||||||
CarInfoType,
|
CarInfoType,
|
||||||
centerCallBackMsgType,
|
|
||||||
DrvexamType,
|
DrvexamType,
|
||||||
ExaminationStuAbsentParams,
|
ExaminationStuAbsentParams,
|
||||||
ExaminerLoginInfo,
|
ExaminerLoginInfo,
|
||||||
@ -45,7 +44,6 @@ import dayTs from '../utils/Date';
|
|||||||
import { GetCurrentTime, NumberToByteArray } from '../utils/Common';
|
import { GetCurrentTime, NumberToByteArray } from '../utils/Common';
|
||||||
import FileUtils from '../utils/FileUtils';
|
import FileUtils from '../utils/FileUtils';
|
||||||
import DB from '../utils/DbSql';
|
import DB from '../utils/DbSql';
|
||||||
import { CentralHeartbeat } from '../utils/business/CentralHeartbeat';
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
@ -468,19 +466,20 @@ struct UserInfo {
|
|||||||
|
|
||||||
async heartMsg() {
|
async heartMsg() {
|
||||||
// TODO UDP缺失
|
// TODO UDP缺失
|
||||||
CentralHeartbeat.getData((val:centerCallBackMsgType)=>{
|
// globalThis.udpClient2 & globalThis.udpClient2.setMsgCallBack(async (val) => {
|
||||||
if (val.id == 32) {
|
// if (val.id == '32') {
|
||||||
AppStorage.setOrCreate('signNum', val.body[1])
|
// AppStorage.setOrCreate('signNum', val.body[1])
|
||||||
if (val.body[0] == 7) {
|
// if (val.body[0] == '7') {
|
||||||
//缺考处理
|
// //缺考处理
|
||||||
this.getqkFn()
|
// this.getqkFn()
|
||||||
this.signNum = val.body[1]
|
// this.signNum = val.body[1]
|
||||||
}
|
// }
|
||||||
} else if (val.id == 42) {
|
// } else if (val.id == '42') {
|
||||||
//收到中心缺考确认消息
|
// //收到中心缺考确认消息
|
||||||
this.qkFn()
|
// console.log('qkfnqkfn', val.body[0])
|
||||||
}
|
// this.qkFn()
|
||||||
},)
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
//考点端查询缺考指令内容消息请求
|
//考点端查询缺考指令内容消息请求
|
||||||
@ -817,8 +816,8 @@ struct UserInfo {
|
|||||||
carNo: this.carInfo.carNo,
|
carNo: this.carInfo.carNo,
|
||||||
placeId: this.carInfo.examinationRoomId
|
placeId: this.carInfo.examinationRoomId
|
||||||
}
|
}
|
||||||
CentralHeartbeat.sendData(param)
|
|
||||||
// globalThis.udpClient2.sendMsgExt(param, this.context)
|
globalThis.udpClient2.sendMsgExt(param, this.context)
|
||||||
if (res.examinationStuAbsentRsp.head.resultCode == '0') {
|
if (res.examinationStuAbsentRsp.head.resultCode == '0') {
|
||||||
this.pageIndex = 0
|
this.pageIndex = 0
|
||||||
this.qkFlag = false
|
this.qkFlag = false
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import { VideoConfigData } from '../../mock';
|
|||||||
import { CarInfoType, UDPParamType, VideoConfig } from '../../model';
|
import { CarInfoType, UDPParamType, VideoConfig } from '../../model';
|
||||||
import { NumberToByteArray } from '../../utils/Common';
|
import { NumberToByteArray } from '../../utils/Common';
|
||||||
import FileUtils from '../../utils/FileUtils';
|
import FileUtils from '../../utils/FileUtils';
|
||||||
import { CentralHeartbeat } from '../../utils/business/CentralHeartbeat';
|
|
||||||
|
|
||||||
interface ParamType {
|
interface ParamType {
|
||||||
id?: number;
|
id?: number;
|
||||||
@ -186,6 +185,19 @@ export default struct FaceCompare {
|
|||||||
this.vocObj && this.vocObj.releasePlayer()
|
this.vocObj && this.vocObj.releasePlayer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getqkFn() {
|
||||||
|
let tmpList: number[] = [];
|
||||||
|
tmpList.push(NumberToByteArray(AppStorage.get <number>('signNum'), 1 * 8)[0])
|
||||||
|
const param: ParamType = {
|
||||||
|
id: 41,
|
||||||
|
list: tmpList,
|
||||||
|
carNo: this.carInfo.carNo,
|
||||||
|
placeId: this.carInfo.examinationRoomId
|
||||||
|
}
|
||||||
|
// TODO UPD缺失
|
||||||
|
// globalThis.udpClient2.sendMsgExt(param, this.context)
|
||||||
|
}
|
||||||
|
|
||||||
async faceComparFn() {
|
async faceComparFn() {
|
||||||
console.log('mmmmm0', 2)
|
console.log('mmmmm0', 2)
|
||||||
this.param.pztd = this.param.rlls
|
this.param.pztd = this.param.rlls
|
||||||
@ -242,7 +254,6 @@ export default struct FaceCompare {
|
|||||||
this.callBackFlag = true
|
this.callBackFlag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CentralHeartbeat.sendData(param)
|
|
||||||
// UDP缺失
|
// UDP缺失
|
||||||
// globalThis.udpClient2 && globalThis.udpClient2.sendMsgExt(param, this.context)
|
// globalThis.udpClient2 && globalThis.udpClient2.sendMsgExt(param, this.context)
|
||||||
clearInterval(this.interval)
|
clearInterval(this.interval)
|
||||||
@ -254,32 +265,31 @@ export default struct FaceCompare {
|
|||||||
carNo: this.carInfo.carNo,
|
carNo: this.carInfo.carNo,
|
||||||
placeId: this.carInfo.examinationRoomId,
|
placeId: this.carInfo.examinationRoomId,
|
||||||
}
|
}
|
||||||
CentralHeartbeat.sendData(param2)
|
|
||||||
|
|
||||||
// TODO UDP缺失
|
// TODO UDP缺失
|
||||||
// globalThis.udpClient2 && globalThis.udpClient2.sendMsgExt(param2, this.context)
|
// globalThis.udpClient2 && globalThis.udpClient2.sendMsgExt(param2, this.context)
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
CentralHeartbeat.getData((val)=>{
|
// TODO UDP缺失
|
||||||
if (AppStorage.get('statue') != 3) {
|
// globalThis.udpClient2.setMsgCallBack((val) => {
|
||||||
return
|
// if (AppStorage.get('statue') != 3) {
|
||||||
}
|
// return
|
||||||
if (val.id == 48) {
|
// }
|
||||||
if (val.body[13] == 1) {
|
// if (val.id == '48') {
|
||||||
this.showFaceCompareFlag = !this.showFaceCompareFlag
|
// if (val.body[13] == '1') {
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
// this.showFaceCompareFlag = !this.showFaceCompareFlag
|
||||||
this.vocObj && this.vocObj.releasePlayer()
|
// this.showFaceCompare = !this.showFaceCompare
|
||||||
this.faceCompareSucess = 1
|
// this.vocObj && this.vocObj.releasePlayer()
|
||||||
clearInterval(this.interval)
|
// this.faceCompareSucess = 1
|
||||||
} else if (val.body[13] == 1 && this.callBackFlag) {
|
// clearInterval(this.interval)
|
||||||
AppStorage.setOrCreate('statue', 2)
|
// } else if (val.body[13] == '0' && this.callBackFlag) {
|
||||||
this.vocObj && this.vocObj.playAudio({
|
// AppStorage.setOrCreate('statue', 2)
|
||||||
type: 1,
|
// this.vocObj && this.vocObj.playAudio({
|
||||||
name: 'face_chekc_fail.wav'
|
// type: 1,
|
||||||
})
|
// name: 'face_chekc_fail.wav'
|
||||||
}
|
// })
|
||||||
}
|
// }
|
||||||
})
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import common from '@ohos.app.ability.common'
|
|||||||
import FileUtils from './FileUtils'
|
import FileUtils from './FileUtils'
|
||||||
import promptAction from '@ohos.promptAction'
|
import promptAction from '@ohos.promptAction'
|
||||||
import { CarInfoType } from '../model'
|
import { CarInfoType } from '../model'
|
||||||
import buffer from '@ohos.buffer'
|
|
||||||
|
|
||||||
type DealMethod = (value: ArrayBuffer) => string
|
type DealMethod = (value: ArrayBuffer) => string
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ export default class UdpClient {
|
|||||||
this.errorEvents.push(callback)
|
this.errorEvents.push(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMsg(data: ArrayBuffer|string): Promise<void> {
|
sendMsg(data: string): Promise<void> {
|
||||||
return this.udp?.getState().then(() => {
|
return this.udp?.getState().then(() => {
|
||||||
return this.udp.send({
|
return this.udp.send({
|
||||||
data,
|
data,
|
||||||
|
|||||||
@ -1,14 +1,10 @@
|
|||||||
// 中心心跳/发送消息
|
// 中心心跳/发送消息
|
||||||
import { CarInfoType, centerCallBackMsgType, EnvironmentConfigurationType, UDPParamType } from '../../model';
|
import { EnvironmentConfigurationType } from '../../model';
|
||||||
import { fillZero, string2Bytes } from '../../pages/judgeSDK/utils/Common';
|
|
||||||
import { NumberToByteArray } from '../Common';
|
|
||||||
import UdpClient from '../UdpUtils';
|
import UdpClient from '../UdpUtils';
|
||||||
|
|
||||||
class centralHeartbeat {
|
class centralHeartbeat {
|
||||||
private centralHeartbeatUdp: UdpClient;
|
private centralHeartbeatUdp: UdpClient;
|
||||||
private timer: number = -1
|
private timer: number = -1
|
||||||
private headLenth: number = 9
|
|
||||||
private sendId: number = 0
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
@ -23,101 +19,19 @@ class centralHeartbeat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 接受中心远程指令
|
// 接受中心远程指令
|
||||||
getData(callback: (data: centerCallBackMsgType) => void) {
|
getData(callback: (data: ArrayBuffer) => void) {
|
||||||
this.centralHeartbeatUdp.onMessage((data: ArrayBuffer) => {
|
this.centralHeartbeatUdp.onMessage((data: ArrayBuffer) => {
|
||||||
let arr: number[] = []
|
|
||||||
let dataView = new DataView(data)
|
|
||||||
for (let i = 0; i < dataView?.byteLength; ++i) {
|
|
||||||
arr[i] = dataView?.getUint8(i)
|
|
||||||
}
|
|
||||||
let idNum = '0x' + fillZero(arr[1].toString(16), 2) + fillZero(arr[0].toString(16), 2);
|
|
||||||
let id = Math.floor(Number(idNum) / 1000)
|
|
||||||
|
|
||||||
let lengthNum = '0x' + fillZero(arr[7].toString(16), 2) + fillZero(arr[6].toString(16), 2);
|
callback(data);
|
||||||
let length = Number(lengthNum);
|
|
||||||
let list: number[] = []
|
|
||||||
for (let i = this.headLenth; i <= this.headLenth + length - 1; i++) {
|
|
||||||
list.push(arr[i])
|
|
||||||
}
|
|
||||||
const result: centerCallBackMsgType = {
|
|
||||||
id,
|
|
||||||
length,
|
|
||||||
body: list,
|
|
||||||
sendId: this.sendId
|
|
||||||
}
|
|
||||||
callback(result)
|
|
||||||
|
|
||||||
// callback(data);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setWholeMsg(params: UDPParamType) {
|
|
||||||
let head: Array<number> = this.setMsgHead(params);
|
|
||||||
let headJudge = this.setMessageExclusive(head);
|
|
||||||
let bodyJudge = this.setMessageExclusive(params.list);
|
|
||||||
let end = [13, 10];
|
|
||||||
const arr: Array<number> = [...head, ...headJudge, ...params.list, ...bodyJudge, ...end]
|
|
||||||
return this.Array2Byte(arr).buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
//length消息体bufferlength id消息类型id bodyStr消息体string
|
|
||||||
// setMsyBody(id,bodyByte){
|
|
||||||
Array2Byte(array: Array<number>) {
|
|
||||||
const buf = new ArrayBuffer(array.length);
|
|
||||||
const view = new Uint8Array(buf);
|
|
||||||
for (let i = 0; i != array.length; ++i) {
|
|
||||||
view[i] = array[i] & 0xFF;
|
|
||||||
}
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
setMsgHead(params: UDPParamType) {
|
|
||||||
let a = string2Bytes(Number(`${params.id}${fillZero(params.placeId, 3)}`), 2 * 8);
|
|
||||||
let b = string2Bytes(Number(`${fillZero(params.carNo, 4)}${AppStorage.get('lshNo')}`), 4 * 8);
|
|
||||||
let c = string2Bytes(params.list.length, 2 * 8);
|
|
||||||
return [...a, ...b, ...c];
|
|
||||||
}
|
|
||||||
|
|
||||||
//异或运算
|
|
||||||
setMessageExclusive(tmpList: Array<number>) {
|
|
||||||
let result: number = tmpList[0];
|
|
||||||
for (let i = 1; i < tmpList.length; i++) {
|
|
||||||
result = result ^ tmpList[i]
|
|
||||||
}
|
|
||||||
return [result];
|
|
||||||
}
|
|
||||||
|
|
||||||
sendData(data: UDPParamType) {
|
|
||||||
this.sendId = data.id
|
|
||||||
const param = this.setWholeMsg(data)
|
|
||||||
this.centralHeartbeatUdp.sendMsg(param);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
sendHeartData() {
|
sendData() {
|
||||||
// 组装消息,一秒发送一次
|
// 组装消息,一秒发送一次
|
||||||
// let data = "1";
|
let data = "1";
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
const signNum = AppStorage.get<number>('signNum')
|
this.centralHeartbeatUdp.sendMsg(data);
|
||||||
const statue = AppStorage.get<string>('statue')
|
|
||||||
const lsh = AppStorage.get<string>('lsh')
|
|
||||||
const arr = [signNum || 0, statue || 1]
|
|
||||||
let tmpList: number[] = [];
|
|
||||||
tmpList.push(NumberToByteArray(Number(arr[0]), 1 * 8)[0])
|
|
||||||
tmpList.push(NumberToByteArray(Number(arr[1]), 1 * 8)[0])
|
|
||||||
const str = lsh || '0000000000000'
|
|
||||||
for (let i = 0; i < str.length; i++) {
|
|
||||||
tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0])
|
|
||||||
}
|
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo')
|
|
||||||
const data: UDPParamType = {
|
|
||||||
id: 31,
|
|
||||||
list: tmpList,
|
|
||||||
carNo: carInfo.carNo,
|
|
||||||
placeId: carInfo.examinationRoomId
|
|
||||||
}
|
|
||||||
const param = this.setWholeMsg(data)
|
|
||||||
this.centralHeartbeatUdp.sendMsg(param);
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user