feat_surenjun #20
@ -9,7 +9,7 @@ import Judge from './judgeSDK/judge'
|
||||
import {defaultJudgeConfigObj} from './judgeSDK/utils//judge-common'
|
||||
import {
|
||||
Project, ProjectObj, MarkRule, CDSBInfo,
|
||||
SYSTEMPARMARR,CARINFO ,MAPPOINT ,MAPITEMPOINTITEM
|
||||
SYSTEMPARMARR,CARINFO ,MAPPOINT ,MAPITEMPOINTITEM,SYSSET
|
||||
} from './judgeSDK/api/judgeSDK.d'
|
||||
import { getCurrentTime, formatTime, getCurrentHourTime,chunkArr } from '../common/utils/tools'
|
||||
import { examJudgeEndExam } from './judgeSDK/api/index'
|
||||
@ -29,9 +29,7 @@ struct Index {
|
||||
async aboutToAppear() {
|
||||
globalThis.windowClass.setWindowSystemBarEnable([''])
|
||||
const time = await getCurrentTime()
|
||||
const examSubject = globalThis.carInfo.examSubject
|
||||
|
||||
this.examSubject = examSubject
|
||||
this.startTime = time.split(' ')[1]
|
||||
this.startFullTime = await getCurrentTime(1);
|
||||
this.startHourTime = await getCurrentHourTime()
|
||||
@ -67,9 +65,8 @@ struct Index {
|
||||
? await this.initSystemKm2Param()
|
||||
: await this.initSystemKm3Param()
|
||||
await this.initMarkRules();
|
||||
}
|
||||
|
||||
await this.initSysset();
|
||||
}
|
||||
await this.initCDSBInfo()
|
||||
|
||||
// 科目三新增读取表数据
|
||||
@ -140,33 +137,44 @@ struct Index {
|
||||
}
|
||||
|
||||
// 获取sysset表信息
|
||||
async initSysset() {
|
||||
const syssetParams = await getSyncData('MA_SYSSET')
|
||||
async initSysset(sysset?:SYSSET[]) {
|
||||
const syssetParams = sysset || await getSyncData('MA_SYSSET')
|
||||
//@ts-ignore
|
||||
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901');
|
||||
this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || '123456'
|
||||
|
||||
const judgeConfig = []
|
||||
const {isTrajectoryOpen} = judgeConfig
|
||||
const syssetJudgeConfigArr = []
|
||||
|
||||
//@ts-ignore
|
||||
syssetParams.forEach((sys) => {
|
||||
if(isTrajectoryOpen){
|
||||
sys.v_no = sys.key;
|
||||
sys.v_name = sys.name;
|
||||
sys.v_value = sys.value
|
||||
}
|
||||
|
||||
const {v_no,v_value} = sys;
|
||||
const v_no_num = v_no * 1;
|
||||
const value = decodeURIComponent(v_value)
|
||||
if(v_no_num >= 10 &&v_no_num <= 900){
|
||||
judgeConfig.push({
|
||||
syssetJudgeConfigArr.push({
|
||||
key: v_no_num,value: value,
|
||||
name: decodeURI(sys.v_name)
|
||||
})
|
||||
}
|
||||
//科目三应行驶距离参数
|
||||
if(sys.v_no == '303'){
|
||||
this.examMileage = sys.v_value + '';
|
||||
}
|
||||
|
||||
this.judgeConfigObj[sys.v_no] = value
|
||||
});
|
||||
this.judgeConfig = judgeConfig;
|
||||
this.judgeConfig = syssetJudgeConfigArr;
|
||||
}
|
||||
|
||||
// 初始化systemParam表
|
||||
async initSystemKm2Param(){
|
||||
const systemParms:any = await getSyncData('MA_SYSTEMPARM')
|
||||
async initSystemKm2Param(sysParam?:SYSTEMPARMARR[]){
|
||||
const systemParms:any = sysParam || await getSyncData('MA_SYSTEMPARM')
|
||||
const carName = this.carName;
|
||||
|
||||
let carNo2 = '',allItems = [];
|
||||
@ -238,7 +246,6 @@ struct Index {
|
||||
})
|
||||
|
||||
const txt2 = decodeURIComponent(systemParm.txt2)
|
||||
|
||||
if (no1 == 6) {
|
||||
const currentProject = {
|
||||
name: decodeURI(systemParm.txt1),
|
||||
@ -250,9 +257,9 @@ struct Index {
|
||||
this.projectsCenterObj[txt2] = currentProject
|
||||
this.projects.push(currentProject)
|
||||
}
|
||||
if(no1 == 3 && no2 == 1 && no3 == 15){
|
||||
this.examMileage = decodeURI(systemParm.txt1)
|
||||
}
|
||||
// if(no1 == 3 && no2 == 1 && no3 == 15){
|
||||
// this.examMileage = decodeURI(systemParm.txt1)
|
||||
// }
|
||||
})
|
||||
const projects = this.projects;
|
||||
if (!projects.length) {
|
||||
@ -382,8 +389,7 @@ struct Index {
|
||||
|
||||
// 初始化本地systemparam表、markrule表
|
||||
async initTrajectoryParam(trajectoryPath:string){
|
||||
const examSubject = globalThis.carInfo.examSubject;
|
||||
|
||||
const {isTrajectoryOpen} = judgeConfig
|
||||
//轨迹回放读取 systemparam表、markrule表
|
||||
const fileUtil = new FileUtil(this.context);
|
||||
const folderPath = await fileUtil.initFolder(trajectoryPath);
|
||||
@ -391,11 +397,16 @@ struct Index {
|
||||
const strArr = str.split('\n');
|
||||
const [initData,beginData] = [strArr[0],strArr[1]];
|
||||
const initDataObj = JSON.parse(initData)
|
||||
const systemparm = initDataObj.systemparm;
|
||||
const examSubject = globalThis.carInfo.examSubject;
|
||||
this.examSubject = isTrajectoryOpen ? (initDataObj.kskm*1):examSubject;
|
||||
globalThis.carInfo.examSubject = this.examSubject
|
||||
examSubject == 2
|
||||
? await this.initSystemKm2Param()
|
||||
: await this.initSystemKm3Param(initDataObj.systemparm)
|
||||
? await this.initSystemKm2Param(systemparm)
|
||||
: await this.initSystemKm3Param(systemparm)
|
||||
//@ts-ignore
|
||||
await this.initMarkRules(testMarkRules);
|
||||
await this.initSysset(initDataObj.sysset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -140,6 +140,11 @@ export interface SOUND {
|
||||
//语音播放提示代码
|
||||
code:string
|
||||
}
|
||||
export interface SYSSET {
|
||||
v_no:string,
|
||||
v_name:string,
|
||||
v_value:string
|
||||
}
|
||||
|
||||
export interface ProjectObj {
|
||||
[k:any]:Project
|
||||
|
||||
@ -20,7 +20,7 @@ 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,getKmProjectVoice} from './utils//judge-common'
|
||||
import {examJudgeSetLogCallback,examJudgeBeginExam,examJudgeInit,examJudgeRealExam,examJudgeSetRealExamCallback,examJudgeSetPerformCallback,examJudgeEndExam,examJudgeArtificialMark,examJudgeArtificialItem} from './api/index'
|
||||
import Want from '@ohos.app.ability.Want';
|
||||
|
||||
import prompt from '@ohos.prompt';
|
||||
|
||||
const judgeTag = 'SURENJUN_JUDGE'
|
||||
@ -129,6 +129,7 @@ export default class Judge{
|
||||
await examJudgeBeginExam(beginExamInfo);
|
||||
console.info(judgeTag,'6.开始考试注册完成')
|
||||
|
||||
avPlayer.playAudio(['voice/ksks.WAV'])
|
||||
// 处理轨迹plc信息
|
||||
if(isTrajectoryOpen){
|
||||
handleTrajectoryUdp(strArr);
|
||||
@ -139,7 +140,7 @@ export default class Judge{
|
||||
globalThis.udpClient.onMessage(async (msg) => {
|
||||
handleUdp(msg)
|
||||
})
|
||||
avPlayer.playAudio(['voice/ksks.WAV'])
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3,12 +3,13 @@
|
||||
//考试回放开关
|
||||
export const judgeConfig = {
|
||||
//本地目录开关
|
||||
isTrajectoryOpen: false,
|
||||
isTrajectoryOpen: true,
|
||||
//是否开启Udp
|
||||
udpOpen:false,
|
||||
// 本地模型地址
|
||||
modelPath: 'models/model_enc',
|
||||
trajectoryPath: 'logs/2024_05_15/0000000000001_342323199501470011_测试学员1_2024_05_15_15_30_23/judge_exam_data.txt'
|
||||
// 轨迹回放地址
|
||||
trajectoryPath: 'logs/2023_06_14/0000000000001_342323199501470011_测试学员1_2023_06_14_15_33_31/judge_exam_data.txt'
|
||||
}
|
||||
|
||||
//0000000000001_342323199501470011_测试学员1_2024_04_28_10_59_44
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import media from '@ohos.multimedia.media';
|
||||
import prompt from '@ohos.prompt';
|
||||
|
||||
const TAG = 'VoiceAnnounce'
|
||||
|
||||
@ -18,7 +19,6 @@ export default class VoiceAnnounce{
|
||||
async playAudio(urls:string[],shit,callback:Function){
|
||||
const {isStopped,queue} = this;
|
||||
this.callback = callback
|
||||
console.info('surenjun',JSON.stringify(callback))
|
||||
if(shit){
|
||||
//队列清空,重新初始化
|
||||
this.isStopped = true;
|
||||
@ -45,6 +45,7 @@ export default class VoiceAnnounce{
|
||||
await go()
|
||||
return
|
||||
}
|
||||
|
||||
await avPlayer.play(queue[0],callback);
|
||||
this.queue.shift();
|
||||
console.info(TAG,JSON.stringify(this.queue),'堆栈弹出');
|
||||
@ -73,14 +74,22 @@ class AVPlayer {
|
||||
this.endCallback = callback
|
||||
const avPlayer = await media.createAVPlayer();
|
||||
this.avPlayer = avPlayer;
|
||||
return new Promise(async (resolve)=>{
|
||||
return new Promise(async (resolve,reject) => {
|
||||
let url = ''
|
||||
await this.setAVPlayerCallback(()=>{
|
||||
//@ts-ignore
|
||||
resolve()
|
||||
});
|
||||
let url = await globalThis.context.resourceManager.getRawFd(name)
|
||||
try {
|
||||
url = await globalThis.context.resourceManager.getRawFd(name);
|
||||
this.avPlayer.fdSrc = url;
|
||||
|
||||
} catch (e) {
|
||||
prompt.showToast({
|
||||
message: `${name}语音文件不存在`,
|
||||
duration: 4000
|
||||
});
|
||||
resolve(1)
|
||||
}
|
||||
})
|
||||
}
|
||||
//音频播放队列
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user