Compare commits

...

56 Commits

Author SHA1 Message Date
wangzhongjie
46c3825c59 fix: 提交重启应用代码 2025-10-28 17:22:38 +08:00
wangzhongjie
198fa634fe fix: 重启 2025-10-28 16:55:22 +08:00
wangzhongjie
8d6e6e3b6b fix: 重启 2025-10-28 16:27:30 +08:00
4578177d37 feat:串口读取时机优化 2025-10-28 15:27:11 +08:00
d1a1fc8b44 fix:串口引入修改 2025-10-28 15:26:01 +08:00
08e430f02f feat:引入报错修改 2025-10-28 14:51:39 +08:00
379f4c8778 Merge remote-tracking branch 'origin/dev' into dev 2025-10-27 14:58:15 +08:00
273340189d feat:串口读取时机优化 2025-10-27 14:57:59 +08:00
lv
c796add419 闪退提交 2025-10-17 16:09:51 +08:00
lv
670d6d20af 1 2025-10-17 16:05:41 +08:00
lv
a602655278 去垃圾日志 2025-10-17 15:36:17 +08:00
wangzhongjie
d93f0adcaf fix:提交视频参数 2025-10-17 09:10:19 +08:00
wangzhongjie
098644f64b Merge branch 'dev' of http://47.122.70.237:3000/harmony_car/subject-two into dev 2025-10-16 17:52:11 +08:00
lv
264e76d05d 人脸拍照:secondImg为拍照照片 2025-10-16 17:27:56 +08:00
c359ef0568 feat:module.json还原 2025-10-14 13:19:08 +08:00
Surenjun
edb2ed2b45 feat:日志&轨迹导出U盘功能 2025-10-10 14:27:56 +08:00
Surenjun
b765676068 fix:去除无用日志 2025-09-26 10:06:30 +08:00
Surenjun
5732b62000 feat:40502语音文件替换 2025-08-27 13:55:47 +08:00
Surenjun
4c6f25ee3a feat: 模拟灯光相关特性优化 2025-08-18 08:47:42 +08:00
Surenjun
2ff07dd2fb feat: 外壳参数优化 2025-08-08 13:51:22 +08:00
Surenjun
d2e795c82f feat:1. 靠边停车项目进行中不能退出 2.344参数修改 2025-07-29 15:07:29 +08:00
wangzhongjie
8d7173c545 Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev 2025-07-29 14:57:47 +08:00
Surenjun
94b3b2e96a feat:安全员代码 2025-07-24 08:21:02 +08:00
Surenjun
ed4b981807 fix:遗漏方法提交 2025-07-22 18:43:54 +08:00
Surenjun
dc72d33536 feat: 断点续考specialkf修改 2025-07-22 09:14:44 +08:00
wangzhongjie
0c2715821d Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev 2025-07-01 10:42:14 +08:00
0832262cd7 fix:新增853参数 2025-06-30 19:28:17 +08:00
6b54e9da5c Revert "Revert "fix:新增503参数""
This reverts commit 6de9d4bdcb42c67f9533b693f3d70a04b0e8391d.
2025-06-30 19:27:41 +08:00
6de9d4bdcb Revert "fix:新增503参数"
This reverts commit addf143396b30a4b348dcf1830e0da3d4800163b.
2025-06-30 19:26:56 +08:00
addf143396 fix:新增503参数 2025-06-30 19:22:21 +08:00
448a16fab9 fix: 档位串口读取优化 2025-06-28 09:54:28 +08:00
e36b0f018b fix: 1.499参数修改; 2.科目二sbbm字段读取优化 2025-06-28 09:52:27 +08:00
lv
f9beb54a28 冲突提交 2025-06-25 10:21:28 +08:00
lv
f420a9512f 重连 2025-06-25 10:19:26 +08:00
wangzhongjie
2d085b42bf Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev 2025-06-23 14:19:26 +08:00
920323bc78 无用代码清理 2025-06-18 15:24:33 +08:00
6f3bdbf176 fix:退回 2025-06-18 15:10:43 +08:00
8251bed720 fix:优化人工进项目 2025-06-18 15:01:19 +08:00
508c3f3954 fix:档位串口优化 2025-06-18 14:21:05 +08:00
wangzhongjie
2f524da992 Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev 2025-06-05 16:12:27 +08:00
Surenjun
6154af25e1 feat:添加MB2板卡;新档位兼容 2025-05-30 16:51:34 +08:00
wangzhongjie
7447ae3f4d Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev 2025-05-27 11:01:31 +08:00
Surenjun
8399c5d134 feat:judge文件修改 2025-05-27 10:41:14 +08:00
wangzhongjie
5c9af2b914 Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev 2025-05-27 10:16:01 +08:00
ce3a1e86a6 feat: 远程终止考试优化 2025-05-26 14:20:13 +08:00
30aee68389 feat: 三代机中心udp过滤 2025-05-20 15:33:24 +08:00
wangzhongjie
818d2a775d merge 2025-05-20 13:46:10 +08:00
d19ae7d5f5 feat: 优化三代机udp 2025-05-20 09:32:37 +08:00
wangzhongjie
5119c46963 Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev 2025-05-15 17:03:17 +08:00
048a60baeb feat: 优化三代机udp 2025-05-15 16:55:26 +08:00
f888e82b00 feat: 512[7]参数添加 2025-05-15 11:35:04 +08:00
wangzhongjie
bc8017ff71 Merge branch 'dev' of http://88.22.24.105:3000/harmony_car/subject-two into dev 2025-05-15 09:27:24 +08:00
29e11bba39 feat:1.监控画面gps位数改成7;2.经度、纬度数据兼容 2025-05-14 13:16:49 +08:00
wangzhongjie
45772f0b49 fix: 合并 2025-05-09 09:01:48 +08:00
wangzhongjie
fc6f784db1 Merge branch 'dev' of http://47.122.70.237:3000/harmony_car/subject-two into dev 2025-04-22 16:28:54 +08:00
wangzhongjie
afa4983725 关闭本地回放 2025-04-11 13:04:37 +08:00
26 changed files with 664 additions and 199 deletions

View File

@ -5,9 +5,9 @@
"name": "default",
"material": {
"certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.cer",
"storePassword": "0000001B0A8E97F78561FFE1B2E5B57C296BFC3D297047253237158BC25CD7077892C41C1C83FAFFDE4A0A",
"storePassword": "0000001BAC2A2242CBD30042192466419A8087398301FC1759A9BBCFD659DD68D4D6AC1F21A3C57322816D",
"keyAlias": "debugKey",
"keyPassword": "0000001B654E765B79C902CB9E3A6D97A40F5852412CEE5AC37E949F430C754DB02327838E925EDF861314",
"keyPassword": "0000001B6BC513F0EF12E88D402A699731288AA9D23B4A26CCDD08F4A6CBC6FDDBBCCEFBB2C5AFE4D3E3E8",
"profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.p12"

View File

@ -189,6 +189,7 @@ export async function uploadExamMileage(params) {
<lsh>${params.lsh}<lsh>
<kskssj>${params.examinationRoomId}<kskssj>
<kslc>${params.kslc}<kslc>
<specialkf>${params.specialkf}<specialkf>
</body>
</uploadExamMileageReq>`,
method: 'post',

View File

@ -11,70 +11,100 @@ export default class UdpByOne {
// PLC localIp
private LocalIp: string = '192.168.7.170';
// PLC localIpPort
private PLCLocalIpPort: string = '31012';
private PLCLocalIpPort: number = 31012;
private OppositeIp: string = '192.168.7.124'
// PLC oppositeIpPort
private PLCOppositeIpPort: string = '30012';
private PLCOppositeIpPort: number = 30012;
// PLC消息
private PLCMsg: ArrayBuffer;
// GPS udp
private GPSUDP: any;
private GPSTCP: any;
// GPS localIp
// GPS localIpPort
private GPSLocalIpPort: string = '31013';
private GPSLocalIpPort: number = 31013;
// GPS oppositeIpPort
private GPSOppositeIpPort: string = '30013';
private GPSOppositeIpPort: number = 30013;
// GPS消息
private GPSMsg: any;
private timer: number;
public type: 1| 2
constructor(type) {
//一型机 二型机
public terType: 1 | 2
//板卡类型
public cardType: 0| 1 | 2
constructor(terType,cardType) {
this.terType = terType;
this.cardType = cardType;
this.init()
console.info('surenjun type=>',type +'')
this.type = type;
}
async init(){
const fileUtil = new FileUtil(globalThis.context)
const {terType,cardType} = this
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
const result = JSON.parse(data)
this.LocalIp = result.udplocalIp;
this.OppositeIp = result.udpOppositeIp;
this.OppositeIp = result.udpOppositeIp;
// 初始化UDP
this.PLCUDP = socket.constructUDPSocketInstance();
// this.PLCUDP.bind(this.PLCLocalIp, this.PLCLocalIpPort);
this.PLCUDP.bind({
address: this.LocalIp, port: parseInt(this.PLCLocalIpPort), family: 1
address: this.LocalIp, port: this.PLCLocalIpPort, family: 1
});
this.GPSUDP = socket.constructUDPSocketInstance();
// this.GPSUDP.bind(this.GPSLocalIp, this.GPSLocalIpPort);
this.GPSUDP.bind({
address: this.LocalIp, port: parseInt(this.GPSLocalIpPort), family: 1
});
this.PLCUDP.on("message", (res, remoteInfo) => {
this.PLCMsg = res.message;
})
this.GPSUDP.on("message", (res1, remoteInfo) => {
let dataView = new DataView(res1.message)
let str = ""
for (let i = 0; i < dataView?.byteLength; ++i) {
let c = String.fromCharCode(dataView?.getUint8(i))
if (c !== "\n") {
str += c
}
if(terType == 1 && cardType == 1){
this.GPSTCP = socket.constructTCPSocketInstance();
await this.GPSTCP.bind({address:this.LocalIp,port:this.GPSLocalIpPort,family: 1});
try {
await this.GPSTCP.connect({address:{
address:this.OppositeIp,port:this.GPSOppositeIpPort
}});
}catch (e) {
console.info('surenjun e=>',JSON.stringify(e))
}
this.GPSMsg = str;
})
console.info('surenjun=>','3')
this.GPSTCP.on("message", (res1, remoteInfo) => {
let dataView = new DataView(res1.message)
let str = ""
for (let i = 0; i < dataView?.byteLength; ++i) {
let c = String.fromCharCode(dataView?.getUint8(i))
if (c !== "\n") {str += c}
}
this.GPSMsg = str;
})
}else{
this.GPSUDP = socket.constructUDPSocketInstance();
// this.GPSUDP.bind(this.GPSLocalIp, this.GPSLocalIpPort);
await this.GPSUDP.bind({
address: this.LocalIp, port: this.GPSLocalIpPort, family: 1
});
this.GPSUDP.on("message", (res1, remoteInfo) => {
let dataView = new DataView(res1.message)
let str = ""
for (let i = 0; i < dataView?.byteLength; ++i) {
let c = String.fromCharCode(dataView?.getUint8(i))
if (c !== "\n") {
str += c
}
}
this.GPSMsg = str;
})
}
}
// 重新绑定
public rebind() {
this.PLCUDP.bind(this.LocalIp, this.PLCLocalIpPort);
this.GPSUDP.bind(this.LocalIp, this.GPSLocalIpPort);
this.PLCUDP.rebind(this.LocalIp, this.PLCLocalIpPort);
this.GPSUDP?.rebind(this.LocalIp, this.GPSLocalIpPort);
this.GPSTCP?.rebind(this.LocalIp, this.GPSLocalIpPort);
}
// PLC发送消息
@ -83,7 +113,7 @@ export default class UdpByOne {
data: '111111',
address: {
address: this.OppositeIp,
port: parseInt(this.PLCOppositeIpPort),
port: this.PLCOppositeIpPort,
}
})
}
@ -96,6 +126,8 @@ export default class UdpByOne {
// 处理消息
public handleMsg() {
let newMessage = PLCGPSData;
const cardType = this.cardType;
console.info('surenjun=> cardType',cardType)
if (this.GPSMsg) {
let GPGGAMatch = this.GPSMsg.match(/\$GPGGA[^$]*/);
@ -106,10 +138,14 @@ export default class UdpByOne {
// 使用正则表达式提取$GPGST消息
let GPGSTMatch = this.GPSMsg.match(/\$GPGST[^$]*/);
let GPGSTMsgArr = GPGSTMatch ? GPGSTMatch[0]?.split(",").slice(0, 9) : [];
// 使用正则表达式提取$GPGST消息
let GNGSTMatch = this.GPSMsg.match(/\$GNGST[^$]*/);
let GNGSTMsgArr = GNGSTMatch ? GNGSTMatch[0]?.split(",").slice(0, 9) : [];
// 使用正则提取$PTNL消息
let PTNLMatch = this.GPSMsg.match(/\$PTNL[^$]*/);
let PTNLMsgArr = PTNLMatch ? PTNLMatch[0].split(",")?.slice(0, 14) : [];
// 组合GPS数据
// 状态83
newMessage[83] = GPGGAMsgArr[6];
@ -122,11 +158,13 @@ export default class UdpByOne {
// 龄期87
newMessage[87] = GPGGAMsgArr[13];
// 维度因子88
newMessage[88] = GPGSTMsgArr[6];
newMessage[88] = GPGSTMsgArr[6] || GNGSTMsgArr[6];
// 经度因子89
newMessage[89] = GPGSTMsgArr[7]
newMessage[89] = GPGSTMsgArr[7] || GNGSTMsgArr[7];
// 航向角90
newMessage[90] = PTNLMsgArr[3];
const hxj = Number(PTNLMsgArr[3])
newMessage[90] = (cardType == 0 ? hxj : ((hxj + 180 > 360) ?(hxj + 180 - 360): hxj + 180)).toFixed(4)
// newMessage[90] = PTNLMsgArr[3];
// 俯仰角91
newMessage[91] = PTNLMsgArr[5];
// 航向角状态-收星数92
@ -210,18 +248,19 @@ export default class UdpByOne {
newMessage[25] = ((Data29 << 24) + (Data30 << 16) + (Data31 << 8) + Data32).toString();
// 熄火次数 26
newMessage[26] = parseInt(PLCByteArr[33], 2) + '';
// 方向盘角度 27
// TODO 档位 磁档位为外接信号
newMessage[28] = (globalThis.chuankoMsg == '0' || globalThis.chuankoMsg == '' ||globalThis.chuankoMsg == undefined)?(parseInt(PLCByteArr[13], 2) + ''): globalThis.chuankoMsg;
if(this.type == 1){
if(this.terType == 1){
// 超声波1
newMessage[29] = (PLCByteArr[4][1] > 0 ? '300' : '1200')
// 超声波2
newMessage[30] = (PLCByteArr[4][0] > 0 ? '300': '1200' )
}
if(this.type == 2){
if(this.terType == 2){
newMessage[29] = (parseInt(PLCByteArr[52], 2) > 10) ? '1200' : '300'
newMessage[30] = (parseInt(PLCByteArr[54], 2) > 10) ? '1200': '300'
}

View File

@ -8,6 +8,8 @@ import GpsTcpClient from '../utils/GpsTcpClient'
export default class RearEndUnitsTool {
//一型机 二型机 三型机 一体机
public terType: 0 | 1 | 2 | 3 = 2;
//C1板卡 B4板卡
public cardType: 0 | 1;
public timer: number = 0
public diffTimer: number = 0
private UdpByOneClass: UdpByOne
@ -21,6 +23,7 @@ export default class RearEndUnitsTool {
public receiveMsg = (callBack)=> {
const terType = this.terType;
const cardType = this.cardType;
//TODO 临时处理关闭消息接收
this.cancelMsg()
@ -28,8 +31,10 @@ export default class RearEndUnitsTool {
//一型机
case 0: {
const udpClass = this.getFUdp({
type: 1
})
terType: 1,
cardType,
});
this.timer = setInterval(() => {
const message = udpClass.handleMsg()
callBack && callBack(message)
@ -40,7 +45,8 @@ export default class RearEndUnitsTool {
//二型机
case 1: {
const udpClass = this.getFUdp({
type: 2
terType: 2,
cardType
})
this.timer = setInterval(() => {
const message = udpClass.handleMsg()
@ -88,13 +94,14 @@ export default class RearEndUnitsTool {
const result = JSON.parse(config || '{}')
//默认设置为三代机
this.terType = result.terType
this.cardType = result.cardType
return this.terType
}
//获取一型机&二型机单例
private getFUdp({type}) {
private getFUdp({terType,cardType}) {
if (!this.UdpByOneClass) {
this.UdpByOneClass = new UdpByOne(type);
this.UdpByOneClass = new UdpByOne(terType,cardType);
}
return this.UdpByOneClass;
}
@ -118,6 +125,7 @@ export default class RearEndUnitsTool {
// 转发差分改正数
public sendDiffCorrections = (message) => {
const type = this.terType
const cardType = this.cardType
//差分改正数截取前5位
let dataView = new DataView(message)
const Arraybuffer = message.slice(5, dataView?.byteLength);
@ -125,8 +133,13 @@ export default class RearEndUnitsTool {
switch (type){
//一型机
case 0:
const GpsTcpClientClass = this.getGpsTcp()
GpsTcpClientClass.sendGpsMsg(Arraybuffer);break
//天宝类型板卡
if(cardType === 1){
globalThis.udpClient?.sendMsg(Arraybuffer);break
}else{
const GpsTcpClientClass = this.getGpsTcp()
GpsTcpClientClass.sendGpsMsg(Arraybuffer);break
}
//二型机
case 1: globalThis.udpClient?.sendMsg(Arraybuffer);break

View File

@ -7,12 +7,14 @@ import { takePhoto, deleteAllFileByPiC } from '../../common/service/videoService
// import { VideoConfigData } from '../../mock';
import request from '@ohos.request'
import Prompt from '@system.prompt';
import util from '@ohos.util';
import {
delSyncTable,
getDataBaseTable,
getMySystemSetTable,
upDataZhongxinginitialization,
getSyncData,
upDateTable
} from '../../common/service/initable'
import { GlobalConfig } from '../../config/index'
@ -103,7 +105,7 @@ export async function uploadLogFile() {
// 将要上传的文件拷贝到缓存目录并压缩
async function getCopyFiles() {
export async function getCopyFiles() {
const absolutePath = '/mnt/hmdfs/100/account/device_view/local/files/duolun/logs'
const tempPath = globalThis.context.cacheDir + '/temp';
@ -138,10 +140,12 @@ async function getCopyFiles() {
const filenames = await fs.listFile('/data/log/hilog');
for (let i = 0; i < filenames.length; i++) {
if (filenames[i].split('.')[0] == 'hilog') {
const date = filenames[i].split('.')[2].split('-')[0]
if (date == nowDate) {
try {
fs.copyFileSync('/data/log/hilog/' + filenames[i], globalThis.context.cacheDir + '/temp/' + filenames[i])
} catch (e) {
console.error(TAG, e);
}
}
}
@ -305,6 +309,7 @@ export async function getDoubleCeneterTable(param) {
return
}
}
getChuankouFn()
reslove(true)
router.pushUrl({
url: 'pages/ExaminerLogin',
@ -319,6 +324,7 @@ export async function getSingleCenterTable(param) {
console.log('teststet0')
upDataZhongxinginitialization(param).then((result) => {
if (result === true) {
getChuankouFn()
resolve(true)
} else {
console.log('联网更新失败,请检查网络后重新更新')
@ -433,17 +439,22 @@ let fd
const devPath = "/dev/ttyS3"
function openChuankouFn(callback) {
console.log('SerialOpen in indexservice, path=' + devPath)
//TODO 自动挡车不读取串口
testNapi.SerialOpenAsync(devPath, (fd) => {
globalThis.fd = fd;
globalThis.num = 0
let parity = 0x4e; // 'N'
let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => {
callback()
});
});
getSyncData('ES_CARINFO').then(result => {
const carInfo = result[0] || {};
globalThis.carInfo.kscx = carInfo.kscx
console.info('srj ES_CARINFO=>',JSON.stringify(carInfo))
if(carInfo.kscx == 'C1'){
testNapi.SerialOpenAsync(devPath, (fd) => {
globalThis.fd = fd;
globalThis.ChounkouInit = true;
globalThis.num = 0
let parity = 0x4e; // 'N'
let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => {
callback()
});
});
}
})
}
function getChuankouFnMsg() {
@ -451,9 +462,9 @@ function getChuankouFnMsg() {
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
testNapi.SerialSendAsync(globalThis.fd, databuff, (ret) => {
testNapi.SerialRecvAsync(globalThis.fd, timeout, (revTestInfo) => {
const message = revTestInfo?.recevedBuf?.toString()
if (message == '') {
let msgBuf = util.TextDecoder.create().decodeWithStream(new Uint8Array(revTestInfo?.recevedBuf))
if (message == '' || msgBuf == '') {
globalThis.num = 1
// clearInterval(chuankou)
testNapi.SerialClose(globalThis.fd);
@ -464,16 +475,8 @@ function getChuankouFnMsg() {
return
}
const msg = message?.split(',')
if (!msg?.length) {
} else if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) {
} else if (msg.length < 12) {
} else {
globalThis.chuankoMsg = msg[9]
}
let dang = Number(msgBuf?.split(",")?.[1]?.split('\r')[0] || 0)
globalThis.chuankoMsg =( msg[9] === '' || msg[9] >10 ) ? dang: msg[9]
setTimeout(() => {
getChuankouFnMsg()
}, 500)

View File

@ -218,7 +218,8 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
// @ts-ignore
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
if (flag == 0) {
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err, snapResult) => {
// @ts-ignore
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, false,(err, snapResult) => {
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize);
callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode })
});

View File

@ -3,7 +3,7 @@ import { getSyncData } from '../service/initable';
import hilog from '@ohos.hilog';
import FileUtil from '../../common/utils/File'
import { GlobalConfig } from '../../config/index'
const TAG = 'socketTag[TcpDemo.TcpClient]'
export async function getTCP(flag=false) {
globalThis.getCloseTcp=true
const fileUtil = new FileUtil(globalThis.context)
@ -35,10 +35,16 @@ export async function getTCP(flag=false) {
console.log('ttttttt00')
clearInterval(globalThis.intervalSendmsg)
globalThis.intervalSendmsg=setInterval(()=>{
globalThis.intervalSendmsg=setInterval(async()=>{
console.log('getCloseTcp',globalThis.carInfo.carNo)
if(!globalThis.getCloseTcp){
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
globalThis.tcpStep+=1
if(globalThis.tcpStep>30){
console.log(TAG,'tcp重连开始')
globalThis.tcpStep=0
getTCP()
}
}
},1000/3)
globalThis.TcpClient.onError((val) => {
@ -68,10 +74,16 @@ export async function getTCP(flag=false) {
console.log('ttttttt12')
clearInterval(globalThis.intervalSendmsg)
globalThis.intervalSendmsg=setInterval(()=>{
globalThis.intervalSendmsg=setInterval(async()=>{
// console.log('getCloseTcp',globalThis.getCloseTcp)
if(!globalThis.getCloseTcp){
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
globalThis.tcpStep+=1
if(globalThis.tcpStep>30){
console.log(TAG,'tcp重连开始')
globalThis.tcpStep=0
getTCP()
}
}
},1000/3)
globalThis.TcpClient.onError((val) => {

View File

@ -0,0 +1,63 @@
import dataPreferences from '@ohos.data.preferences';
let context = getContext(this);
let preference: dataPreferences.Preferences;
const SYSTEM_DB: string = 'system.db' //其他信息
const USER_DB: string = 'user.db' //用户信息
class PreferenceUtils {
// 写入其他缓存数据
async writeOtherData(value: dataPreferences.ValueType, key: string) {
// if (value === null) {
// return;
// }
if (!preference) {
await this.getPreferencesFromStorage(SYSTEM_DB);
}
try {
await preference.put(key, value);
} catch (err) {
console.info(`Failed to put value, Cause: ${err}`);
}
await preference.flush();
}
// 获取其他缓存数据
async getOtherModel<T extends dataPreferences.ValueType>(key: string) {
let value: dataPreferences.ValueType = 1;
if (!preference) {
await this.getPreferencesFromStorage(SYSTEM_DB);
}
try {
value = (await preference.get(key, ''));
} catch (err) {
console.info(`Failed to get value, Cause: ${err}`);
}
if (value === '') {
return;
}
return value as T;
}
// 删除登录数据
async deletePreferences() {
try {
await dataPreferences.deletePreferences(context, USER_DB);
} catch (err) {
console.info(`Failed to delete preferences, Cause: ${err}`);
}
;
}
// 创建登录数据preference
async getPreferencesFromStorage(name: string) {
try {
preference = await dataPreferences.getPreferences(context, name);
} catch (err) {
console.info(`Failed to get preferences, Cause: ${err}`);
}
}
}
export default new PreferenceUtils();

View File

@ -148,13 +148,12 @@ export default class TcpClient {
this.tcpSendNum=0
return
}
globalThis.getCloseTcp=true
console.log(`${TAG} TCPsend error ${JSON.stringify(err)}`)
// this.writeLog({
// time:dateFormat(new Date()),
// message: `${TAG} TCPsend error ${JSON.stringify(err)}`,
// })
reslove(false)
reject(false)
});
})
}
@ -165,6 +164,7 @@ export default class TcpClient {
// time:dateFormat(new Date()),
// PLC:`${TAG} Tcponmessage`,
// })
globalThis.tcpStep=0
globalThis.tcpUdpError = false
if (value) {
callback && callback(value.message)

View File

@ -20,6 +20,7 @@ import prompt from '@ohos.prompt';
import promptAction from '@ohos.promptAction';
import { getUDP } from './GlobalUdp';
import RearEndUnitsTool from '../rearEndUnitsTool/index'
import { getCurrentTime } from '../../common/utils/tools';
const TAG = '[UdpDemo.UdpClient]'
@ -62,6 +63,7 @@ export default class UdpClientByCenter {
globalThis.retClass = new RearEndUnitsTool(globalThis.context)
}
this.retClass = globalThis.retClass
console.log(`${TAG} init UdpClientByCenter`)
}
getStatus() {
@ -86,6 +88,11 @@ export default class UdpClientByCenter {
// time:dateFormat(new Date()),
// PLC:`${TAG} getUDPudp rebind success`,
// })
const terType = this.retClass.terType
//TODO 临时处理过滤掉中心udp
if(localIpPort != '8800' && terType == 2){
this.udp && this.udp.on('message', this.message_1Fn);
}
}).catch(err => {
//globalThis.closeHeartSocket=true
this.isWorking = false
@ -102,11 +109,17 @@ export default class UdpClientByCenter {
address: this.localIp, port: parseInt(this.localIpPort), family: 1
});
promise.then(() => {
const localIpPort = this.localIpPort
this.isWorking = true
// this.writeLog({
// time:dateFormat(new Date()),
// PLC:`${TAG} getUDPudp bind success`,
// })
const terType = this.retClass.terType
//TODO 临时处理过滤掉中心udp
if(localIpPort != '8800' && terType == 2){
this.udp && this.udp.on('message', this.message_1Fn);
}
}).catch(err => {
this.isWorking = false
console.info('surenjun err=>', JSON.stringify(err))
@ -305,19 +318,18 @@ export default class UdpClientByCenter {
})
}
// TODO 赋值onMessage_1
//plc
onMessage_1(callback?) {
const terType = globalThis.retClass?.terType;
if (terType == 2) {
//三型机
this.onMessage_1Callback = callback;
this.udp && this.udp.on('message', this.message_1Fn);
} else {
this.retClass.receiveMsg(callback)
//TODO 临时处理
globalThis.retClass = this.retClass
}
//TODO 临时处理
globalThis.retClass = this.retClass
// this.udp && this.udp.on('message', this.message_1Fn);
}
@ -328,7 +340,8 @@ export default class UdpClientByCenter {
console.info('surenjun', 'getUDP关闭udp message监听事件 成功')
}
message_1Fn = (value) => {
message_1Fn = async (value) => {
// console.info('surenjun2','set message_1Fn=>' + await getCurrentTime())
let callback = this.onMessage_1Callback
// 收到的是ArrayBuffer 需要进行转换解析
this.plcUdpError = false
@ -365,7 +378,9 @@ export default class UdpClientByCenter {
globalThis.dialogOpen = false
this.chafenFlag = 0
}
// console.info('surenjun2','set message_1Fn=>' + newArr.toString())
callback && callback(newArr.toString())
// console.info('surenjun 左方向灯=>', newArr.toString())
this.currentValue = newArr.toString();
} else {
callback && callback('')

View File

@ -261,8 +261,8 @@ const getPlcData = async (plc: string) => {
//TODO gps数据
//gps时间 经度 纬度 航向角 俯仰角 海拔高 高度差 速度
sj: time,
jd: p[96],
wd: p[95],
jd: Math.max(Number(p[95]),Number(p[96])),
wd: Math.min(Number(p[95]),Number(p[96])),
hxj: p[90],
fyj: p[91],
hbg: p[85],

View File

@ -0,0 +1,41 @@
import common from '@ohos.app.ability.common'
import fs from '@ohos.file.fs';
import zlib from '@ohos.zlib';
import { getCurrentTime } from './tools'
import {getCopyFiles} from '../service/indexService'
const TAG = '[usbUtils]'
export class UsbUtils {
private context: common.UIAbilityContext
constructor(context: common.UIAbilityContext) {
this.context = context
}
getUsbDiskPath(): Promise<string> {
return new Promise((resolve, reject) => {
let path = ""
try {
path = fs.listFileSync("/mnt/data/external")[0]
} catch (error) {
console.log("err", JSON.stringify(error))
reject(error)
return
}
resolve('/mnt/data/external' + '/' + path)
})
}
async copyFilesToUsb() {
const time = await getCurrentTime(0)
const date = time.split(' ')[0]
const output = await this.getUsbDiskPath();
const filename = await getCopyFiles();
const filePath = globalThis.context.cacheDir + '/' + filename
let stat = fs.statSync(filePath)
console.log(TAG,`压缩包文件${globalThis.carInfo?.carNo}-${date}大小:` + (Math.ceil(stat.size / 1024 / 1024)) + 'M')
fs.copyFileSync(filePath, `${output}/${globalThis.carInfo?.carNo}-${date}.zip`)
console.log(TAG,'转移压缩包完成:' ,output)
fs.rmdirSync(filePath);
}
}

View File

@ -10,9 +10,15 @@ import { GlobalConfig } from '../config/global'
import { tcpUtil } from '../common/utils/TcpRequest';
import DB from '../common/database/DbSql';
import { initTable } from '../common/service/initable';
import appRecovery from '@ohos.app.ability.appRecovery';
export default class EntryAbility extends UIAbility {
async onCreate(want, launchParam) {
appRecovery.enableAppRecovery(
appRecovery.RestartFlag.ALWAYS_RESTART,
appRecovery.SaveOccasionFlag.SAVE_WHEN_ERROR,
appRecovery.SaveModeFlag.SAVE_WITH_FILE
);
try {
console.log("sql first")
await DB.init(this.context)
@ -23,6 +29,7 @@ export default class EntryAbility extends UIAbility {
console.error('sql first error', e)
}
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
}
@ -38,7 +45,7 @@ export default class EntryAbility extends UIAbility {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
await tcpUtil.init()
globalThis.tcpStep = 0
globalThis.carInfo = {}
globalThis.examinerInfo = {}

View File

@ -10,7 +10,7 @@ import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
import { initJudgeUdp } from '../common/utils/UdpJudge';
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import { getTCP } from '../common/utils/GlobalTcp';
import { getSingleCenterTable, setliushuiNum, takePhotoFn ,uploadLogFile} from '../common/service/indexService';
import { getSingleCenterTable, setliushuiNum, takePhotoFn, uploadLogFile } from '../common/service/indexService';
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import promptAction from '@ohos.promptAction';
import errorMsgDialog from './compontents/errorMsgDialog';
@ -19,11 +19,11 @@ import UdpEvent from '../common/utils/UdpEvent';
import { delPic } from '../common/service/videoService';
import imageBtn from './compontents/imageBtn';
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import {updateModelAndCar} from '../common/autoUpdate/index'
// import {uploadLogFile} from '../common/service/indexService'
import { getModalValueCdAndCar } from '../api';
// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { updateModelAndCar } from '../common/autoUpdate/index'
import { UsbUtils } from '../common/utils/UsbUtils'
import appRecovery from '@ohos.app.ability.appRecovery';
import PreferenceUtils from '../common/utils/PreferenceUtils';
import CozyMsgDialog from './compontents/CozyDialog';
@Entry
@Component
@ -80,7 +80,23 @@ struct Index {
Column() {
Column() {
Row() {
Image($r('app.media.logo')).width('30%').height('5.5%').margin({ left: 24 })
Image($r('app.media.logo')).width('30%').height('5.5%').margin({ left: 24 }).gesture(
GestureGroup(GestureMode.Exclusive,
TapGesture({ count: 2 })
.onAction(async () => {
const usbUtils = new UsbUtils(this.context)
this.loading = true
this.loadingText = '正在导出日志和轨迹,请稍候……'
try {
await usbUtils.copyFilesToUsb()
} catch (e) {
}
this.loading = false
this.loadingText = ''
})
)
)
Row() {
Image($r('app.media.btn_setting')).width('16.7%').height('12.2%')
.onClick(async () => {
@ -342,7 +358,7 @@ struct Index {
.width(80 * globalThis.ratio)
.height(80 * globalThis.ratio)
.position({ x: 288 * globalThis.ratio, y: 89 * globalThis.ratio })
Text(this.loadingText ||'获取考车信息,请稍候……')
Text(this.loadingText || '获取考车信息,请稍候……')
.fontSize(24 * globalThis.ratio)
.margin({ top: 20 * globalThis.ratio })
.fontWeight(400)
@ -364,6 +380,7 @@ struct Index {
}
async aboutToAppear() {
// setInterval(() => {
// let date = new Date();
// console.info('jiangsong1:timeSynchronization begin ');
@ -407,7 +424,18 @@ struct Index {
}
})
});
const isRestart = await PreferenceUtils.getOtherModel("isRestart")
if (isRestart === "1") {
PreferenceUtils.writeOtherData("0", "isRestart")
setTimeout(() => {
router.pushUrl({
url: 'pages/UserInfo',
params: {
type: 1
}
}, router.RouterMode.Single);
}, 2000)
}
}
aboutToDisappear() {
@ -438,9 +466,9 @@ struct Index {
this.loading = true
console.log("sql 1111")
getSingleCenterTable(param).then(async (ret:any) => {
getSingleCenterTable(param).then(async (ret: any) => {
if(!this.isModelInit){
if (!this.isModelInit) {
this.loading = true
this.loadingText = '正在下载考车模型,请稍候……'
await updateModelAndCar(false)
@ -449,7 +477,7 @@ struct Index {
this.isModelInit = true
}
if(typeof ret == 'object' && ret.resultCode == '3'){
if (typeof ret == 'object' && ret.resultCode == '3') {
this.loadingText = '正在下载考车最新版本,请稍候……'
this.loading = true
await updateModelAndCar(true)
@ -469,7 +497,7 @@ struct Index {
if (globalThis.singlePlay) {
router.pushUrl({
url: 'pages/userInfo'
},router.RouterMode.Single)
}, router.RouterMode.Single)
return
}
if (globalThis.singlePlay) {
@ -677,6 +705,11 @@ struct Index {
}, 1000)
this.createAlbum()
getSyncData('ES_CARINFO').then(result => {
const carInfo = result[0] || {};
globalThis.carInfo.kscx = carInfo.kscx
})
// clearInterval(globalThis.demo)
// globalThis.demo= setInterval(()=>{
// const str= {"carId":"1062","examinationRoomId":"2","videoVersion":"1.0","judgeVersion":"2023.09.30.1","shellVersion":"2023.12.13.01","host":"http://172.37.55.191:8082"}

View File

@ -442,7 +442,7 @@ struct Index {
const ddxkKsxmArr = examItemsArrs[2]?.split(',').filter(item => item) || []
const ddxkKfArr = examItemsArrs[3]?.split('^').filter(item => item) || []
if (judgeConfigObj['432'] == 2 || examSubject == 2) {
//TODO 带项目带里程
if (ddxkKsxmArr?.length) {
//断点续考
ddxkKsxmArr.forEach(xmdm => {
@ -455,6 +455,8 @@ struct Index {
})
this.ddxkKsxmArr = ddxkKsxmArr
}
this.specialkf = examItemsArrs[4];
this.yklc = Number(examItemsArrs[1]) || 0
}
//扣分续考
ddxkKfArr.forEach((kf) => {
@ -480,6 +482,7 @@ struct Index {
this.ddxkKfArr = ddxkKfArr
this.ddxkTime = Date.parse(startTime);
this.isDdxk = true
}
}
@ -563,7 +566,7 @@ struct Index {
//上车准备&起步都开始时
if (this.syssetParam386 == '3'
&& (this.projectsObj[1].type == '2' || this.projectsObj[1].type == '3')
&& this.projectsObj[2].type == '2'
&& (this.projectsObj[2].type !== '1' && this.projectsObj[2].type !== undefined)
&& !this.syssetParam386ET3
) {
this.judge.rmndg = 2;
@ -572,7 +575,7 @@ struct Index {
}
// 上传考试里程
async uploadMileage() {
async uploadMileage(specialkf) {
if (!globalThis.singlePlay) {
const {lsh,startExamTime:kskssj,jl:kslc} = this
const { carId ,examinationRoomId} = globalThis.carInfo;
@ -581,7 +584,9 @@ struct Index {
examinationRoomId,
lsh,
kskssj,
kslc
//考试里程单位cm
kslc:kslc * 100,
specialkf
})
}
}
@ -915,6 +920,25 @@ struct Index {
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => {
//靠边停车进行中&且其它项目都已经完成 不能结束
if(!this.singlePlay && this.projectsObj['40600']?.type == '2' && this.isRequiredProjectsEnd){
Prompt.showToast({
message: '靠边停车项目进行中,不允许手动退出!',
duration: 4000
});
return
}
//考试未结束且有扣分,不允许退出
if (!this.singlePlay && this.judgeConfigObj['344'] == 1 && this.kfArr.length > 0&& !this.isAllProjectsEnd ) {
Prompt.showToast({
message: '考试未结束且有扣分,不允许手动退出!',
duration: 4000
});
return
}
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
@ -1024,13 +1048,7 @@ struct Index {
router.back()
return
}
if (this.judgeConfigObj['344'] == 1) {
Prompt.showToast({
message: '考试未结束,不允许手动退出!',
duration: 4000
});
return
}
this.endPopupVisible = false;
this.loadingPopupVisible = true
clearInterval(this.timer);
@ -1422,7 +1440,7 @@ struct Index {
// 必考项目除靠边停车是否全部完成
@State isRequiredProjectsEnd: boolean = false;
// 考试项目是否全部完成
// @State isAllProjectsEnd: boolean = false;
@State isAllProjectsEnd: boolean = false;
@State lane: LANE = { road: '', num: 0, count: 0 }
@State roadData: Object = {};
//定位差分状态时候正常
@ -1443,4 +1461,8 @@ struct Index {
@State errorMsg: string = ''
@State isErrorMsgEnd: boolean = false
@State disConnectErrorOpen: boolean = false
//开始考试特殊标记
@State specialkf:string = ''
//已考里程
@State yklc:number = 0
}

View File

@ -21,8 +21,10 @@ struct Index {
// @State inputTextList1: string[] = ['172.37.55.191','18782','192.168.7.1','8082','255.255.255.0','192.168.7.170','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122']
@State inputTextList1: string[] = ['172.37.55.191', '18782', '172.37.55.191', '8082', '255.255.255.0', '192.168.7.1', '114.114.114.114', '192.168.7.124', '20022', '192.168.7.170', '20122']
@State terTextList: string[] = ['一型机', '二型机', '三型机', '一体机']
@State cardTextList: string[] = ['北云', '天宝MB2']
@State netTextList: string[] = ['否', '是']
@State selectedTerType: number = 0
@State selectedCardType: number = 0
//是否启用网络差分
@State netOpen: number = 0
// @State inputTextList2: string[] = []
@ -94,6 +96,7 @@ struct Index {
})
}.width('50%').height('14%')
Row() {
Text('是否启用网络差分')
.width('40%')
@ -113,7 +116,30 @@ struct Index {
})
Text(netText).fontSize(20).fontColor('#FFF')
})
}.width('52%').height('14%')
}.width('51%').height('14%')
Row(){
Text('板卡类型')
.width('40%')
.height('100%')
.fontColor('#E5CBA1')
.padding({ 'left': '35px' })
.fontSize(this.inputFontSize * this.ratio)
ForEach(this.cardTextList, (cardText, index) => {
Radio({ value: cardText, group: 'cardRadioGroup' })
.borderColor('#E5CBA1')
.checked(index === this.selectedCardType)
.onChange((value: boolean) => {
if(value){
this.selectedCardType = index
}
})
Text(cardText).fontSize(20).fontColor('#FFF')
})
}.width('49%').height('14%')
}
}
.width('95%')
@ -145,6 +171,7 @@ struct Index {
centerIp: this.inputTextList1[2],
centerPort: this.inputTextList1[3],
terType: this.selectedTerType,
cardType: this.selectedCardType,
netOpen: this.netOpen
}
fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param), '')
@ -218,6 +245,7 @@ struct Index {
this.inputTextList1[2] = result.centerIp
this.inputTextList1[3] = result.centerPort
this.selectedTerType = result.terType
this.selectedCardType = result.cardType
this.netOpen= result.netOpen
console.log('surenjun', this.selectedTerType + '');
}

View File

@ -24,6 +24,9 @@ import errorMsgDialog from './compontents/errorMsgDialog';
import imageBtn from './compontents/imageBtn';
import FileUtil from '../common/utils/File';
import DB, { ColumnType } from '../common/database/DbSql';
import CozyMsgDialog from './compontents/CozyDialog';
import PreferenceUtils from '../common/utils/PreferenceUtils';
import appRecovery from '@ohos.app.ability.appRecovery';
@Entry
@Component
@ -78,6 +81,7 @@ struct UserInfo {
@State faceFlag: string = '0';
@State FaceOpenStatue: string = '0'; //是否开启人脸识别
@State faceCatchImg: string = ''
@State examCount: number = 0
@State systemParam: systemParam = {
'Param341': true, //是否按顺序考试
'Param803Str': '0', //开始考试前必须解开安全带或关车门
@ -91,6 +95,7 @@ struct UserInfo {
'Param398': '0', //考前上车准备
'Param835': '0', //考前上车准备
'Param850': '0', //考前上车准备
'Param853': '0', //未熄火不能开始考试
}
@State startExam: boolean = false
// 过程照片拍照
@ -184,6 +189,10 @@ struct UserInfo {
{ label: '考试员名', key: 'ksy2' },
]
private fileUtil: FileUtil
cozyDialog: CustomDialogController = new CustomDialogController({
builder: CozyMsgDialog(),
autoCancel: false
})
aboutToAppear() {
this.fileUtil = new FileUtil(this.context)
@ -191,6 +200,15 @@ struct UserInfo {
}
async onPageShow() {
if (this.examCount > 5) {
PreferenceUtils.writeOtherData("1", "isRestart")
this.cozyDialog.open()
// 延迟关闭
setTimeout(() => {
this.cozyDialog.close()
appRecovery.restartApp()
}, 3000)
}
this.isExamStart = false
this.startExam = false
this.updateTimeLimit = false
@ -209,7 +227,7 @@ struct UserInfo {
if (!globalThis.singlePlay) {
// @ts-ignore
if (routerParam.type != 1) {
console.info('surenjun','Judge返回到UserInfo界面')
console.info('surenjun', 'Judge返回到UserInfo界面')
// @ts-ignore
this.list = await getSyncData('USERLIST')
// @ts-ignore
@ -218,7 +236,7 @@ struct UserInfo {
console.log('surenjun useruser1=>,', JSON.stringify(data))
const user = data[0]
if(!Number(user.kssycs)){
if (!Number(user.kssycs)) {
this.list = this.list.filter(res => {
return res.sfzmhm != user.sfzmhm
})
@ -537,6 +555,9 @@ struct UserInfo {
if (sys.v_no === '770') {
that.systemParam.Param770Str = sys.v_value;
}
if (sys.v_no === '853') {
that.systemParam.Param853 = sys.v_value;
}
if (sys.v_no === '835') {
that.systemParam.Param835 = sys.v_value;
}
@ -946,8 +967,10 @@ struct UserInfo {
const {isCheckFireOpen} = judgeConfig
const {systemParam,isBoardPrePareSetPopupOpen} = this;
const Param803Str = systemParam.Param803Str
if (Param803Str === '') {
const Param853Str = systemParam.Param853
if (Param803Str === '' && Param853Str != '1') {
return true
}
return new Promise((resolve, reject) => {
if (isCheckFireOpen) {
@ -963,6 +986,14 @@ struct UserInfo {
const ygd = msgArr[8];
const ssc = msgArr[13];
const dw = msgArr[28];
if (Param853Str == '1' && fdjzs * 1 > 0) {
this.avPlayer.playAudio(['voice/熄火.mp3'])
promptAction.showToast({
message: '请熄火',
duration: 4000
})
reject(false)
}
// 开始考试信号检测
if (Param803Str !== '') {
//安全带
@ -1143,12 +1174,12 @@ struct UserInfo {
CommText({
ratio: this.ratio,
color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000',
text: this.systemParam.Param850&&Number(this.systemParam.Param850)>0?"*****":item.lsh
text: this.systemParam.Param850 && Number(this.systemParam.Param850) > 0 ? "*****" : item.lsh
})
CommText({
ratio: this.ratio,
color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000',
text: this.systemParam.Param850&&Number(this.systemParam.Param850)>0?"*****":decodeURIComponent(item.xm)
text: this.systemParam.Param850 && Number(this.systemParam.Param850) > 0 ? "*****" : decodeURIComponent(item.xm)
})
}
}
@ -1217,39 +1248,39 @@ struct UserInfo {
Column() {
ForEach(this.labelBlocks, (item) => {
if(this.systemParam.Param850=='1'){
LabelBlock({ label: item.label, ratio: this.ratio, value:'*****'})
if (this.systemParam.Param850 == '1') {
LabelBlock({ label: item.label, ratio: this.ratio, value: '*****' })
}
else if(this.systemParam.Param850=='2'){
if(item.key=='xm'){
else if (this.systemParam.Param850 == '2') {
if (item.key == 'xm') {
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser.xh })
}else if(item.key=='ksxl'){
} else if (item.key == 'ksxl') {
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser[item.key] })
}else{
} else {
LabelBlock({ label: item.label, ratio: this.ratio, value: '*****' })
}
}else if(this.systemParam.Param850=='4'){
if(item.key=='ksxl'){
} else if (this.systemParam.Param850 == '4') {
if (item.key == 'ksxl') {
LabelBlock({ label: item.label, ratio: this.ratio, value: '*****' })
}else{
} else {
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser[item.key] })
}
}else if(this.systemParam.Param850=='5'){
if(item.key=='xm'){
} else if (this.systemParam.Param850 == '5') {
if (item.key == 'xm') {
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser.xh })
}else{
} else {
LabelBlock({ label: item.label, ratio: this.ratio, value: '*****' })
}
}else if(this.systemParam.Param850=='6'){
if(item.key=='ksxl'||item.key=='kssycs'){
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser[item.key] })
}else if(item.key=='sfzmhm'){
} else if (this.systemParam.Param850 == '6') {
if (item.key == 'ksxl' || item.key == 'kssycs') {
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser[item.key] })
} else if (item.key == 'sfzmhm') {
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser.sfzmhm.slice(-6) })
}else{
} else {
LabelBlock({ label: item.label, ratio: this.ratio, value: '*****' })
}
}
else{
else {
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser[item.key] })
}
@ -1267,7 +1298,7 @@ struct UserInfo {
// .commStyle()
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.yydj_btn') })
.margin({ bottom: 12 * this.ratio })
.onClick(()=>{
.onClick(() => {
globalThis.judgeUdp.askVoice()
})
@ -1312,19 +1343,35 @@ struct UserInfo {
} else {
// Image($r('app.media.ksks_btn'))
// .commStyle()
// Button(){
// Text("add")
// }.width(100).height(30).onClick(()=>{
// this.examCount++
// if (this.examCount > 2) {
// PreferenceUtils.writeOtherData("1", "isRestart")
// this.cozyDialog.open()
// // 延迟关闭
// setTimeout(() => {
// this.cozyDialog.close()
// appRecovery.restartApp()
// }, 3000)
// }
//
// })
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.ksks_btn') })
.margin({ bottom: 12 * this.ratio })
.onClick(async () => {
if (this.systemParam.Param612Str == '1') {
return
}
if(!globalThis.singlePlay&&Number(this.systemParam.Param835)&&Number(this.currentUser.yycs)&&Number(this.systemParam.Param835)<=Number(this.currentUser.yycs)){
this.type='4'
this.title='当前考生预约考试次数为'+this.currentUser.yycs
if (!globalThis.singlePlay && Number(this.systemParam.Param835) && Number(this.currentUser.yycs) && Number(this.systemParam.Param835) <= Number(this.currentUser.yycs)) {
this.type = '4'
this.title = '当前考生预约考试次数为' + this.currentUser.yycs
this.errorDialog.open()
return
}
this.examCount++
console.log("已经考了", this.examCount + "个学员")
await this.prePareExam()
})
}
@ -1482,4 +1529,5 @@ type systemParam = {
'Param398': string, //考前上车准备
'Param835': string, //考前上车准备
'Param850': string, //考前上车准备
'Param853': string, //未熄火不能开始考试
}

View File

@ -0,0 +1,18 @@
@CustomDialog
export default struct CozyMsgDialog {
private controller?: CustomDialogController
build() {
Column() {
Column() {
Text("温馨提示").fontSize(50)
Row() {
Text("设备已经进行过6次考试,马上进入内存以及数据优化过,请稍等片刻,请勿对机器进行操作,感谢配合!")
.fontSize(30).lineHeight(40)
}.width("100%").margin({
top: 20
}).padding(20)
}
}.width("100%").height(300).padding(20)
}
}

View File

@ -187,8 +187,8 @@ export default struct FaceCompare {
this.base64 = this.imageBase64 + data.base64
faceCompare({
sfzh: this.sfzh,
secondImage: this.firstImage.substr(22),
firstImage: data.base64,
secondImage:data.base64,
firstImage: this.firstImage.substr(22),
type: 2,
verifyType: 1
})

View File

@ -3,8 +3,9 @@ import Judge from '../../judgeSDK/utils/judgeReal';
import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d';
import common from '@ohos.app.ability.common';
import {
examJudgeMapSetScaling
examJudgeMapSetScaling, examJudgeVersion
} from '../../judgeSDK/api'
import { judgeConfig } from '../../judgeSDK/utils/judgeConfig';
interface RoadDataType {
name: string,
@ -30,6 +31,8 @@ export default struct RealTime {
@State ratio: number = 1
@State lane: Object = {}
@State timer:number = 0
@State version: string = ""
constructor() {
super()
@ -67,22 +70,28 @@ export default struct RealTime {
Column() {
if (this.draw) {
XComponent({
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称注意这个ID要和C++侧一致,不能变
type: 'surface',
libraryname: 'JudgeSdk'
// libraryname: 'judgesdk'
})
.width(this.widthNumber)
.height(this.heightNumber)
.onLoad(() => {
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制
})
.onDestroy(() => {
apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹false:表示结束绘制
this.draw = false;
clearInterval(globalThis.realTimer)
Stack({ alignContent: Alignment.TopEnd }) {
XComponent({
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称注意这个ID要和C++侧一致,不能变
type: 'surface',
libraryname: 'JudgeSdk'
})
.width(this.widthNumber)
.height(this.heightNumber)
.onLoad(() => {
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制
})
.onDestroy(() => {
apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹false:表示结束绘制
this.draw = false;
clearInterval(globalThis.realTimer)
})
}.width(this.widthNumber)
.height(this.heightNumber)
Row() {
Text(this.version).margin({ right: 10 }).fontSize(14).fontColor(0x333333)
}
} else {
Column() {
}
@ -108,7 +117,10 @@ export default struct RealTime {
async aboutToDisappear() {
clearInterval(this.timer)
}
async aboutToAppear() {
this.version = (await examJudgeVersion()) + "/" + judgeConfig.version
const judge = new Judge(this)
let timer = setInterval(()=>{
this.lane = globalThis.laneData;

View File

@ -55,9 +55,16 @@ import {
examJudgeVersion
} from './api/index';
import { getSyncData, upDateTableByArray } from '../../common/service/initable';
import { GlobalConfig } from '../../config';
const judgeTag = 'SURENJUN_JUDGE'
function ifNeedRetry(code: number | string): boolean {
let arr = ["B210010", "B210023", "B210024", "B210031", "B210033", "B210034", "B210041"]
if (!arr.includes(code + "") && code != 1) {
return true
}
return false
}
export default class Judge {
// 过程照片拍照
getPhoto = async (empty?: boolean) => {
@ -233,7 +240,6 @@ export default class Judge {
}
// 处理udp plc信号
handleUdp = async (msg) => {
console.info('plc信号', msg)
const {fileLog,getPlcData,usbService,isUdpEnd,isExamEnd,judgeUI} = this
const stachArr = msg.split(',')
if (stachArr[0] != '#DN_GD' || isUdpEnd) {
@ -254,20 +260,21 @@ export default class Judge {
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
//TODO 暂时关闭差分检测异常
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
if (!isExamEnd) {
await examJudgeRealExam(plcData)
}
const udpIndex = globalThis.udpIndex;
let [prevJd, preWd] = [0, 0]
if (udpIndex % 5 === 0 && !isUdpEnd) {
const judgeUdp = globalThis.judgeUdp
const bytes = await this.getMessageHeartbeat(isExamEnd);
judgeUdp.send(bytes)
}
if (!isExamEnd) {
await examJudgeRealExam(plcData)
}
let [prevJd, preWd] = [0, 0]
globalThis.udpIndex += 1
}
private fileLog
private filePath
private bklx: number = 0
private totalScore: number
private prevJd: number = 0
private prevWd: number = 0
@ -459,6 +466,8 @@ export default class Judge {
//所有的科目考试项目(大车&小车)
private testKmItems: any
private plcData: any
//特殊扣分标记
private specialkf:string = ''
// 获取plc数据
getPlcData = async (plc: string) => {
const {fileLog,mndgStr,rmndg} = this;
@ -517,7 +526,7 @@ export default class Judge {
const bytes = await this.getMessageHeartbeat();
bytes && globalThis.judgeUdp.send(bytes)
}, 50)
}, 1000)
globalThis.judgeTimer = judgeTimer;
}
@ -529,14 +538,14 @@ export default class Judge {
// 调代理接口是否断网了
private isJudgeDisConnect: boolean;
// 项目开始接口同步
beginProject = async (ksxm) => {
beginProject = async (ksxm,xmxh?:string) => {
const carInfo = globalThis.carInfo;
const { examSubject,plateNo } = carInfo;
const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this;
const {judgeUI,fileLog,getSbbm,filePath} = this;
const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI
const time = await getCurrentTime();
const project = projectsObj[ksxm]
const sbxh = getSbbm(ksxm, xmxh)
const sbxh = getSbbm(ksxm, xmxh || this.xmxh)
const data = {
//系统类别 接口序列号 接口标识
xtlb: '17', jkxlh: serialNumber, jkid: '17C52',
@ -563,15 +572,15 @@ export default class Judge {
promptWxCode('17C52', code)
}
// 项目结束接口同步
endProject = async (ksxm) => {
endProject = async (ksxm,xmxh?:string) => {
const carInfo = globalThis.carInfo;
const deviceNo = globalThis.deviceNo;
const { examSubject,plateNo,carNo } = carInfo;
const {judgeUI,fileLog,getSbxh,xmxh,getSbbm,filePath} = this;
const {judgeUI,fileLog,getSbxh,getSbbm,filePath} = this;
const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,xldm,} = judgeUI
const time = await getCurrentTime();
const project = projectsObj[ksxm]
const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh)
const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh || this.xmxh)
const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C55',
@ -591,6 +600,12 @@ export default class Judge {
}
}
const {code} = await this.sendWriteObjectOut(data, filePath)
//科三 & 432=3
if(examSubject == 3 && this.judgeUI.judgeConfigObj['432'] == 2){
this.judgeUI.uploadMileage()
}
if (code === 2300007) {
this.isJudgeDisConnect = true;
}
@ -603,18 +618,25 @@ export default class Judge {
}
private videoData: any
private disConnectNum: number = 0;
//调用监管接口
//调用监管接口
sendWriteObjectOut = async (data, filePath) => {
const temp = await writeObjectOut(data, filePath);
console.log("wzj", JSON.stringify(temp))
if (
//后台连接中心异常
temp.code == -1 || temp.code == 0 ||
//断网&网络超时次数计算
temp.code == 2300007 || temp.code == 2300028) {
if (this.disConnectNum == 0) {
console.log("wzj", "第一次发送", JSON.stringify(data))
}
if (this.disConnectNum < 5 && this.disConnectNum > 0) {
console.log("wzj", "第" + this.disConnectNum + "次重新发送", JSON.stringify(data))
}
// 不是成功的接口就需要补传
if (ifNeedRetry(temp.code)) {
this.disConnectNum += 1;
if (this.disConnectNum < 5) {
if (temp.code == 2300028) {
await new Promise(resolve => setTimeout(resolve, 2000)); // 延迟1秒
}
return await this.sendWriteObjectOut(data, filePath)
}
}
@ -711,12 +733,15 @@ export default class Judge {
// 获取评判初始化数据
getJudgeInitData = async () => {
const {getModelData,getKm3JudgeInitConfig} = this
const {getModelData,getKm3JudgeInitConfig,bklx} = this
const carInfo = globalThis.carInfo;
const { examSubject,plateNo,carId } = carInfo;
const judgeUI = this.judgeUI
const {projectsObj,itemInfoObj,markRuleListObj,carType,carName,systemparmArr,carinfoArr} = judgeUI
const examType = examSubject == 2 ? 'km2' : 'km3'
const fileUtil = new FileUtil(globalThis.context)
const ipConfigStr = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
const ipConfig = JSON.parse(ipConfigStr)
let allitems = [];
if (examSubject == 2) {
@ -753,6 +778,8 @@ export default class Judge {
itemInfoObj,
carlist: judgeUI.carlist,
carinfo: carinfoArr,
//板卡类型
bklx,
};
let km3Config = {}
@ -812,15 +839,15 @@ export default class Judge {
xmdm: xmdm * 1, kfdm
}
})) : [],
//TODO 已考里程待修改
yklc: 0,
yklc: judgeUI.yklc,
special: [],
//TODO 科目三参数临时写死
sczb: (sczb === undefined || sczb == 0) ? 0 : 1,
sczbkf: kfdm,
dmndg: false,
mfxx: false,
mfxxn: false
mfxxn: false,
//科目三特殊扣分项
specialkf:judgeUI.specialkf,
}
console.info(judgeTag, '5.获取开始考试数据完成')
return beginInfo
@ -1045,7 +1072,7 @@ export default class Judge {
if (!isEnd) {
judgeTask.addTask(async () => {
console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
await beginProject(xmdm)
await beginProject(xmdm,xmxh)
}, {
isDelay: true
})
@ -1074,7 +1101,7 @@ export default class Judge {
if (!projectIsEnd) {
judgeTask.addTask(async () => {
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
await endProject(xmdm);
await endProject(xmdm,xmxh)
this.xmmcSingleCode = 0;
this.xmmcEndCode = undefined;
}, {
@ -1152,8 +1179,8 @@ export default class Judge {
const {lsh,idCard,serialNumber,ksdd,projectsObj} = judgeUI
const time = await getCurrentTime();
const project = getProjectInfo(ksxm);
//科目三夜间行驶.模拟灯光、上车准备出现通用评判ksxm为当前进行的项目
const checkProjects = ['17', '41', '1'];
//科目三夜间行驶.模拟灯光、上车准备出现非本项目的扣分ksxm需转换为为当前进行的项目
const checkProjects = ['1', '41', '17'];
//获取正在进行的项目
const inProjects = Reflect.ownKeys(projectsObj).filter(projectKey => projectsObj[projectKey].type == 2);
@ -1163,7 +1190,8 @@ export default class Judge {
commonKsxm = projectCode
}
})
console.info(judgeTag, 'commonKsxm=>' + commonKsxm)
console.info(judgeTag, 'project=>' + project)
const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C53',
drvexam: {
@ -1173,7 +1201,7 @@ export default class Judge {
? (commonKsxm
? (projectsObj[commonKsxm].projectCodeCenter)
: (examSubject == 3 ? 30000 : (xmmcEndCode == undefined ? 10000 : xmmcEndCode)))
: project.projectCodeCenter,
: (projectsObj[commonKsxm]?.projectCodeCenter || project.projectCodeCenter),
kfxm: kf.markcatalog,
kfxmmx: `${ksxm},${kf.markserial}`,
sfzmhm: idCard,
@ -1185,7 +1213,6 @@ export default class Judge {
}
}
console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm)
const {code} = await this.sendWriteObjectOut(data, filePath);
if (code == 2300007) {
this.isJudgeDisConnect = true
@ -1215,10 +1242,13 @@ export default class Judge {
} else {
//收到综合评判语音时,显示综合评判弹窗
if(code[0] == 'zhpp'){
const param512 = (this.judgeUI.judgeConfigObj['512'] || '').split(',');
this.judgeUI.isDeductedPopShow = false
clearTimeout(this.deductedPopShowTimer)
this.judgeUI.isDeductedPopShow = true
this.judgeUI.defaultTabIndex = 1
if(param512[7] != 0){
this.judgeUI.isDeductedPopShow = true
this.judgeUI.defaultTabIndex = 1
}
this.isEndTip = true
}
avPlayer.playAudio([`voice/${code[0]}.mp3`])
@ -1691,7 +1721,7 @@ export default class Judge {
// 检测差分状态
checkDwzt = async (type) => {
const {avPlayer} = this;
const judgeConfig = this.judgeUI.judgeConfig;
const config499 = this.judgeUI.judgeConfigObj['499'];
switch (type) {
case 0:
this.judgeUI.isDwztRight = true;
@ -1699,10 +1729,17 @@ export default class Judge {
case 1:
this.judgeUI.dwztErrorVisible = true;
clearInterval(this.judgeUI.timer);
clearInterval(globalThis.judgeTimer)
avPlayer.playAudio([`voice/差分状态异常.mp3`], true)
setTimeout(() => {
router.back()
}, 3000)
try {
this.checkExamIsEnd(true);
} catch (e) {
this.closeAllFiles()
router.back()
}
}, config499 * 1000)
break;
case 2:
@ -1735,8 +1772,14 @@ export default class Judge {
const filePath = await fileLog.initFileLogo({
name, lsh, idCard
});
const ipFileUtil = new FileUtil(globalThis.context)
const ipConfigStr = await ipFileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
const ipConfig = JSON.parse(ipConfigStr)
this.fileLog = fileLog;
this.filePath = filePath;
this.bklx = Number(ipConfig.cardType)
const {
getJudgeBeginData,
@ -1781,6 +1824,7 @@ export default class Judge {
this.handleRealExam(strData, callBack)
})
await examJudgeSetPerformCallback(async (info) => {
console.info('评判实时数据', info)
const performInfo = JSON.parse(info)
@ -1792,6 +1836,11 @@ export default class Judge {
this.judgeUI.jl = jl
//TODO 待优化 跨组件传值不生效
globalThis.laneData = performInfo.lane;
//特殊扣分标记上传中心
if(performInfo.specialkf !== this.specialkf){
this.judgeUI.uploadMileage(performInfo.specialkf)
this.specialkf = performInfo.specialkf
}
})
// 3.开始考试
@ -1868,7 +1917,8 @@ export default class Judge {
//监听远程终止考试
globalThis.udpEvent.onStopExam(async () => {
const config392 = (this.judgeUI.judgeConfigObj['392'] || [20,'81']).split(',');
const config392 = (this.judgeUI.judgeConfigObj['392'] || '20,81').split(',');
console.info(judgeTag, '开始远程终止考试扣分')
this.setJudgeMark(config392[0]*1, config392[1], 2);
})

View File

@ -1,5 +1,6 @@
//考试回放开关
export const judgeConfig = {
version:'2024.08.21.01',
//本地目录开关
isTrajectoryOpen: false,
//是否开启拍照
@ -19,7 +20,7 @@ export const judgeConfig = {
//四合一画面配置
fourInOneScreen:{
//gps位数
gpsDigit:6
gpsDigit:7
},
// 杭州科目二
// trajectoryPath: 'logs/2024_07_19/0000000000001_342323199501470011_测试学员1_2024_07_19_06_49_12/judge_exam_data.txt',

View File

@ -0,0 +1,42 @@
import socket from '@ohos.net.socket';
class SafetyOfficer{
// 是否开启安全员
private isOpen:boolean = false
// 心跳端口
private heartBeatPort:number = 8054
// 数据端口
private dataPort:number = 8052
// 本地端口
private localUdpPort:number = 19961
udpClient:socket.UDPSocket
//协议格式:帧头,数据长度,流水号,消息标识,数据区,保留,帧尾
constructor(context) {
let udp: socket.UDPSocket = socket.constructUDPSocketInstance();
this.udpClient = udp
}
//初始化指令
heartBeatFn = async ()=> {
//车牌号 时间戳 空 空 空 空 空 @
'$SBXS,85,20250603115529563,B202,赣A78QK6@360803200602253517@1@20250603115523132@@@@@李从星@001@@001@2506455453517,05,*SBJS'
}
//开始考试
beginExamFn = async ()=>{
//车牌号 考试身份证 状态 开始考试时间 考试次数 考车信息 窗户标注信息 方向盘标注信息 考生姓名 安全员编号 是否合格 安全员姓名 流水号
}
//结束考试
endExamFn = async ()=>{
//车牌号 考试身份证 状态 开始考试时间 考试次数 考车信息 窗户标注信息 方向盘标注信息 考生姓名 安全员编号 是否合格 安全员姓名 流水号
}
//obd&gps相关数据
sendObdData = async ()=>{
//考试员号 考试车型 车牌号 科目类型+考试开始时间 设备信号状态 速度 发动机转速 GPS纬度 GPS经度 主天线位置 GPS东向距离 GPS北向距离
//航向角 俯仰角 高程 项目状态 当前项目编号 场地设备编号 本次考试行驶总距离 扣分值 扣分项数量 n个扣分序号 考车车型 车牌号
//工控机是否在播报语音 安全员姓名
}
}

View File

@ -1,11 +1,11 @@
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ts",
"deviceTypes": [
"default",
"tablet",
@ -13,17 +13,16 @@
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntrance": "./ets/entryability/EntryAbility.ts",
"srcEntry": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:logo_app",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"visible": true,
"exported": true,
"skills": [
{
"entities": [
@ -37,7 +36,11 @@
}
],
"requestPermissions":[
{"name": "ohos.permission.INSTALL_BUNDLE"},
{"name": "ohos.permission.UNINSTALL_BUNDLE"},
{"name": "ohos.permission.ACCESS_SERVICE_DM"},
{"name": "ohos.permission.CONNECTIVITY_INTERNAL"},
{"name": "ohos.permission.SET_TIME"},
{
"name": "ohos.permission.INTERNET"

13
test.bat Normal file
View File

@ -0,0 +1,13 @@
@echo off
set TOOLCHAIN_PATH=.\win
cd %TOOLCHAIN_PATH%
.\hdc.exe kill
.\hdc.exe shell hilog -w stop
.\hdc.exe shell hilog -r
echo "操作完成"
pause