This commit is contained in:
wangzhongjie 2025-10-16 17:52:11 +08:00
commit 098644f64b
11 changed files with 142 additions and 30 deletions

View File

@ -10,7 +10,7 @@
"keyPassword": "0000001BABDF12118AF1E7E6AFF8D76FA6D89B08D9E1EC05B6A55CFDAABB51A25D3EA85D9B0E3570B4E666",
"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"
"storeFile": "/Users/surenjun/.ohos/config/openharmony/auto_ohos_default_subject_two_git_com.oh.dts.p12"
}
}
],

View File

@ -105,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';
@ -140,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);
}
}
}

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

@ -20,10 +20,7 @@ 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 { UsbUtils } from '../common/utils/UsbUtils'
@Entry
@Component
@ -80,7 +77,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 () => {

View File

@ -566,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;
@ -920,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'
@ -1029,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);
@ -1427,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 = {};
//定位差分状态时候正常

View File

@ -969,7 +969,7 @@ struct UserInfo {
const ygd = msgArr[8];
const ssc = msgArr[13];
const dw = msgArr[28];
if(Param853Str == '1'){
if(Param853Str == '1' && fdjzs * 1 > 0){
this.avPlayer.playAudio(['voice/熄火.mp3'])
promptAction.showToast({
message: '请熄火',

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

@ -267,9 +267,7 @@ export default class Judge {
judgeUdp.send(bytes)
}
if (!isExamEnd) {
console.info(judgeTag, 'start examJudgeRealExam')
await examJudgeRealExam(plcData)
console.info(judgeTag, 'end examJudgeRealExam')
}
let [prevJd, preWd] = [0, 0]
globalThis.udpIndex += 1
@ -528,7 +526,7 @@ export default class Judge {
const bytes = await this.getMessageHeartbeat();
bytes && globalThis.judgeUdp.send(bytes)
}, 50)
}, 1000)
globalThis.judgeTimer = judgeTimer;
}
@ -1181,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);
@ -1192,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: {
@ -1202,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,

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,5 +1,4 @@
{
"module": {
"name": "entry",
@ -13,7 +12,6 @@
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
@ -37,7 +35,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"