Compare commits
2 Commits
ade3486e8e
...
df6ccfa689
| Author | SHA1 | Date | |
|---|---|---|---|
| df6ccfa689 | |||
| dd9e1b62f7 |
@ -554,7 +554,7 @@ export interface TKmItem {
|
|||||||
status: string
|
status: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface KmItems {
|
export interface JudgeConfigObjKmItems {
|
||||||
'1'?: KmItem
|
'1'?: KmItem
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,12 +601,12 @@ export interface JudgeInitObj extends Km3JudgeInitConfig {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JudgeKsxm {
|
export interface JudgeKSXM {
|
||||||
xmdm: number
|
xmdm: number
|
||||||
xmxh: string
|
xmxh: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JudgeKfxm {
|
export interface JudgeKFXM {
|
||||||
xmdm: number
|
xmdm: number
|
||||||
kfdm: string
|
kfdm: string
|
||||||
}
|
}
|
||||||
@ -631,21 +631,21 @@ export interface JudgeBeginObj {
|
|||||||
czlx: number
|
czlx: number
|
||||||
kskssj: number
|
kskssj: number
|
||||||
passing: number
|
passing: number
|
||||||
ksxm: JudgeKsxm[]
|
ksxm: JudgeKSXM[]
|
||||||
ddxk: 0 | 1
|
ddxk: 0 | 1
|
||||||
ddkssj: number
|
ddkssj: number
|
||||||
ykxm: number[]
|
ykxm: number[]
|
||||||
kfxm: JudgeKfxm[]
|
kfxm: JudgeKFXM[]
|
||||||
yklc: number
|
yklc: number
|
||||||
special?: number[]
|
special?: number[]
|
||||||
sczb?: 0 | 1
|
sczb?: 0 | 1
|
||||||
sczbkf?: JudgeKfxm[]
|
sczbkf?: JudgeKFXM[]
|
||||||
dmndg: boolean
|
dmndg: boolean
|
||||||
mfxx: boolean
|
mfxx: boolean
|
||||||
mfxxn: boolean
|
mfxxn: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JudgeXmjs {
|
export interface JudgeXMJS {
|
||||||
xmdm: number
|
xmdm: number
|
||||||
xmxh: string
|
xmxh: string
|
||||||
xmhg: 0 | 1
|
xmhg: 0 | 1
|
||||||
@ -685,7 +685,7 @@ export interface JudgeEventKf {
|
|||||||
type?: 0 | 1 | 2 | 3
|
type?: 0 | 1 | 2 | 3
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JudgeKsjs {
|
export interface JudgeKSJS {
|
||||||
type: 0 | 1
|
type: 0 | 1
|
||||||
qjjl: number
|
qjjl: number
|
||||||
dcjl: number
|
dcjl: number
|
||||||
@ -715,7 +715,7 @@ export interface JudgeLane {
|
|||||||
count: number
|
count: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JudgeNongps {
|
export interface JudgeNonGPS {
|
||||||
type: 0 | 1 | 2 | 3 | 4
|
type: 0 | 1 | 2 | 3 | 4
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -774,16 +774,16 @@ export interface JudgeCallBackData {
|
|||||||
event: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
|
event: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
|
||||||
sj: number
|
sj: number
|
||||||
carzt: -1 | 0 | 1
|
carzt: -1 | 0 | 1
|
||||||
xmks: JudgeKsxm
|
xmks: JudgeKSXM
|
||||||
xmjs: JudgeXmjs
|
xmjs: JudgeXMJS
|
||||||
kf: JudgeKf
|
kf: JudgeKf
|
||||||
ksjs: JudgeKsjs
|
ksjs: JudgeKSJS
|
||||||
xmqx: JudgeKsxm
|
xmqx: JudgeKSXM
|
||||||
sound: JudgeSound
|
sound: JudgeSound
|
||||||
mndg: string
|
mndg: string
|
||||||
lane: JudgeLane
|
lane: JudgeLane
|
||||||
precast: JudgeKsxm
|
precast: JudgeKSXM
|
||||||
nongps: JudgeNongps
|
nongps: JudgeNonGPS
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Km3JudgeInitConfig {
|
export interface Km3JudgeInitConfig {
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import router from '@ohos.router';
|
import router from '@ohos.router';
|
||||||
|
|
||||||
// import { initJudgeUdp } from '../common/utils/UdpJudge';
|
import { JudgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
|
||||||
import promptAction from '@ohos.promptAction';
|
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';
|
||||||
@ -23,8 +22,8 @@ import { GetCurrentTime } from '../utils/Common';
|
|||||||
import { ObtainUdpBusinessInstance } from '../utils/business/ObtainUdpBusiness';
|
import { ObtainUdpBusinessInstance } from '../utils/business/ObtainUdpBusiness';
|
||||||
import { CenterUDPClientInstance } from '../utils/business/CenterUdpBusiness';
|
import { CenterUDPClientInstance } from '../utils/business/CenterUdpBusiness';
|
||||||
import { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
|
import { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
|
||||||
import { initJudgeUdp } from '../utils/business/UdpJudge';
|
import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness';
|
||||||
import { centerUDPClient, judgeUDPClient, lightUDPClient, objUDPClient } from '../utils/UdpUtils';
|
import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
|
||||||
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@ -32,7 +31,7 @@ import { centerUDPClient, judgeUDPClient, lightUDPClient, objUDPClient } from '.
|
|||||||
struct Index {
|
struct Index {
|
||||||
@State url: string = ''
|
@State url: string = ''
|
||||||
@State hasAuth: boolean = false;
|
@State hasAuth: boolean = false;
|
||||||
@State dialogVisiable: boolean = false;
|
@State dialogVisible: boolean = false;
|
||||||
@State singlePlay: boolean = false;
|
@State singlePlay: boolean = false;
|
||||||
@State baseInfo: BaseInfoType = {};
|
@State baseInfo: BaseInfoType = {};
|
||||||
@State deviceId: string = '';
|
@State deviceId: string = '';
|
||||||
@ -69,13 +68,14 @@ struct Index {
|
|||||||
this.ratio = AppStorage.get<number>('ratio')
|
this.ratio = AppStorage.get<number>('ratio')
|
||||||
this.initParamFlag = false
|
this.initParamFlag = false
|
||||||
this.delLoading = false
|
this.delLoading = false
|
||||||
this.dialogVisiable = false
|
this.dialogVisible = false
|
||||||
this.angle = 0
|
this.angle = 0
|
||||||
this.loading = false
|
this.loading = false
|
||||||
AppStorage.set('lsh', '1111111111111')
|
AppStorage.set('lsh', '1111111111111')
|
||||||
// TODO 未改
|
// TODO 未改
|
||||||
// globalThis.errorDialog = this.errorDialog
|
// globalThis.errorDialog = this.errorDialog
|
||||||
// globalThis.udpEvent = new UdpEvent();
|
// globalThis.udpEvent = new UdpEvent();
|
||||||
|
JudgeEmitterInstance.init()
|
||||||
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => {
|
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => {
|
||||||
res.forEach((element) => {
|
res.forEach((element) => {
|
||||||
if (element.v_no === "305") {
|
if (element.v_no === "305") {
|
||||||
@ -84,6 +84,10 @@ struct Index {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async onPageShow(): Promise<void> {
|
||||||
this.singlePlay = AppStorage.get<boolean>('singlePlay')
|
this.singlePlay = AppStorage.get<boolean>('singlePlay')
|
||||||
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')
|
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')
|
||||||
|
|
||||||
@ -96,12 +100,6 @@ struct Index {
|
|||||||
this.context.resourceManager.getRawFileContent("welcome.wav")
|
this.context.resourceManager.getRawFileContent("welcome.wav")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.avPlayer.playAudio(['welcome.wav'])
|
this.avPlayer.playAudio(['welcome.wav'])
|
||||||
|
|
||||||
// this.vocObj.playAudio({
|
|
||||||
// type: 1,
|
|
||||||
// name: 'welcome.wav'
|
|
||||||
// })
|
|
||||||
// let rawFile = value;
|
|
||||||
})
|
})
|
||||||
.catch((error: BusinessError) => {
|
.catch((error: BusinessError) => {
|
||||||
console.log("getRawFileContent promise error is " + error);
|
console.log("getRawFileContent promise error is " + error);
|
||||||
@ -114,6 +112,15 @@ struct Index {
|
|||||||
AppStorage.setOrCreate('lsh', '1111111111111')
|
AppStorage.setOrCreate('lsh', '1111111111111')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Styles
|
||||||
|
commStyle(){
|
||||||
|
.width(220 * this.ratio * this.dialogRatio)
|
||||||
|
.height(69 * this.ratio * this.dialogRatio)
|
||||||
|
.backgroundImage($r('app.media.button_nor'))
|
||||||
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||||
|
// .margin({ bottom: 12 * this.ratio })
|
||||||
|
}
|
||||||
|
|
||||||
async testXMLToJSONInWorker() {
|
async testXMLToJSONInWorker() {
|
||||||
if (this.loading) {
|
if (this.loading) {
|
||||||
return
|
return
|
||||||
@ -225,7 +232,7 @@ struct Index {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.initParamFlag = true
|
this.initParamFlag = true
|
||||||
}, 3000)
|
}, 3000)
|
||||||
initJudgeUdp()
|
JudgeUdpBusinessInstance.init()
|
||||||
// TODO 摄像头遮挡
|
// TODO 摄像头遮挡
|
||||||
// takePhotoFn(this.context)
|
// takePhotoFn(this.context)
|
||||||
clearInterval(this.interval)
|
clearInterval(this.interval)
|
||||||
@ -239,15 +246,6 @@ struct Index {
|
|||||||
this.createAlbum()
|
this.createAlbum()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Styles
|
|
||||||
commStyle(){
|
|
||||||
.width(220 * this.ratio * this.dialogRatio)
|
|
||||||
.height(69 * this.ratio * this.dialogRatio)
|
|
||||||
.backgroundImage($r('app.media.button_nor'))
|
|
||||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
|
||||||
// .margin({ bottom: 12 * this.ratio })
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
Column() {
|
Column() {
|
||||||
@ -274,7 +272,7 @@ struct Index {
|
|||||||
// type: 1,
|
// type: 1,
|
||||||
// name: 'button_media.wav'
|
// name: 'button_media.wav'
|
||||||
// })
|
// })
|
||||||
this.dialogVisiable = true
|
this.dialogVisible = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,7 +337,7 @@ struct Index {
|
|||||||
// type: 1,
|
// type: 1,
|
||||||
// name: 'button_media.wav'
|
// name: 'button_media.wav'
|
||||||
// })
|
// })
|
||||||
if (judgeConfig.isTrajectoryOpen) {
|
if (JudgeConfig.isTrajectoryOpen) {
|
||||||
router.pushUrl({
|
router.pushUrl({
|
||||||
url: 'pages/UserInfo',
|
url: 'pages/UserInfo',
|
||||||
}, router.RouterMode.Single)
|
}, router.RouterMode.Single)
|
||||||
@ -420,7 +418,7 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (this.dialogVisiable) {
|
if (this.dialogVisible) {
|
||||||
Flex({ justifyContent: FlexAlign.Center }) {
|
Flex({ justifyContent: FlexAlign.Center }) {
|
||||||
Text('确认是否退出应用')
|
Text('确认是否退出应用')
|
||||||
.fontSize(28 * this.ratio * this.dialogRatio)
|
.fontSize(28 * this.ratio * this.dialogRatio)
|
||||||
@ -434,7 +432,7 @@ struct Index {
|
|||||||
}
|
}
|
||||||
.commStyle()
|
.commStyle()
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.dialogVisiable = false
|
this.dialogVisible = false
|
||||||
// this.vocObj.playAudio({
|
// this.vocObj.playAudio({
|
||||||
// type: 1,
|
// type: 1,
|
||||||
// name: 'button_media.wav'
|
// name: 'button_media.wav'
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import {
|
|||||||
Project, SYSTEMPARMARR
|
Project, SYSTEMPARMARR
|
||||||
} from './judgeSDK/api/judgeSDK.d';
|
} from './judgeSDK/api/judgeSDK.d';
|
||||||
|
|
||||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
import { JudgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||||
|
|
||||||
import SignDisplayCom from './compontents/signDisplayCom';
|
import SignDisplayCom from './compontents/signDisplayCom';
|
||||||
import {
|
import {
|
||||||
@ -191,8 +191,8 @@ struct Index {
|
|||||||
await this.initCar();
|
await this.initCar();
|
||||||
|
|
||||||
//是否开启轨迹回放模式
|
//是否开启轨迹回放模式
|
||||||
if (judgeConfig.isTrajectoryOpen) {
|
if (JudgeConfig.isTrajectoryOpen) {
|
||||||
this.initTrajectoryParam(judgeConfig.trajectoryPath)
|
this.initTrajectoryParam(JudgeConfig.trajectoryPath)
|
||||||
} else {
|
} else {
|
||||||
await this.initSystemParam()
|
await this.initSystemParam()
|
||||||
await this.initMarkRules();
|
await this.initMarkRules();
|
||||||
@ -288,7 +288,7 @@ struct Index {
|
|||||||
const syssetJudgeConfigArr: SyssetConfig[] = []
|
const syssetJudgeConfigArr: SyssetConfig[] = []
|
||||||
|
|
||||||
syssetParams.forEach((sys: SYSSET) => {
|
syssetParams.forEach((sys: SYSSET) => {
|
||||||
if (judgeConfig.isTrajectoryOpen) {
|
if (JudgeConfig.isTrajectoryOpen) {
|
||||||
sys.v_no = String(sys.key);
|
sys.v_no = String(sys.key);
|
||||||
sys.v_name = sys.name;
|
sys.v_name = sys.name;
|
||||||
sys.v_value = sys.value
|
sys.v_value = sys.value
|
||||||
@ -376,7 +376,7 @@ struct Index {
|
|||||||
// const { isTrajectoryOpen } = judgeConfig
|
// const { isTrajectoryOpen } = judgeConfig
|
||||||
let carNo = '', allItems: string[] = [];
|
let carNo = '', allItems: string[] = [];
|
||||||
systemParms.forEach((systemParm) => {
|
systemParms.forEach((systemParm) => {
|
||||||
if (judgeConfig.isTrajectoryOpen) {
|
if (JudgeConfig.isTrajectoryOpen) {
|
||||||
systemParm.no1 = systemParm.NO1 + '';
|
systemParm.no1 = systemParm.NO1 + '';
|
||||||
systemParm.no2 = systemParm.NO2 + '';
|
systemParm.no2 = systemParm.NO2 + '';
|
||||||
systemParm.no3 = systemParm.NO3 + '';
|
systemParm.no3 = systemParm.NO3 + '';
|
||||||
@ -635,7 +635,7 @@ struct Index {
|
|||||||
|
|
||||||
// 初始化本地systemparam表、markrule表
|
// 初始化本地systemparam表、markrule表
|
||||||
async initTrajectoryParam(trajectoryPath: string) {
|
async initTrajectoryParam(trajectoryPath: string) {
|
||||||
const isTrajectoryOpen = judgeConfig.isTrajectoryOpen
|
const isTrajectoryOpen = JudgeConfig.isTrajectoryOpen
|
||||||
//轨迹回放读取 systemparam表、markrule表
|
//轨迹回放读取 systemparam表、markrule表
|
||||||
const fileUtil = new FileUtils(this.context);
|
const fileUtil = new FileUtils(this.context);
|
||||||
const folderPath = await fileUtil.initFolder(trajectoryPath);
|
const folderPath = await fileUtil.initFolder(trajectoryPath);
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData';
|
|||||||
import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
|
import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
|
||||||
import LoadingPopup from './compontents/judge/LoadingPopup';
|
import LoadingPopup from './compontents/judge/LoadingPopup';
|
||||||
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
|
||||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
import { JudgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||||
// import { initJudgeUdp } from '../common/utils/UdpJudge';
|
// import { initJudgeUdp } from '../common/utils/UdpJudge';
|
||||||
import errorMsgDialog from './compontents/errorMsgDialog';
|
import errorMsgDialog from './compontents/errorMsgDialog';
|
||||||
import imageBtn from './compontents/imageBtn';
|
import imageBtn from './compontents/imageBtn';
|
||||||
@ -44,6 +44,7 @@ import dayTs from '../utils/Date';
|
|||||||
import { GetCurrentTime, NumberToByteArray } from '../utils/Common';
|
import { GetCurrentTime, NumberToByteArray } from '../utils/Common';
|
||||||
import DB from '../utils/DbSql';
|
import DB from '../utils/DbSql';
|
||||||
import { CenterUDPClientInstance } from '../utils/business/CenterUdpBusiness';
|
import { CenterUDPClientInstance } from '../utils/business/CenterUdpBusiness';
|
||||||
|
import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
@ -309,14 +310,14 @@ struct UserInfo {
|
|||||||
// initJudgeUdp()
|
// initJudgeUdp()
|
||||||
// TODO UDP更改
|
// TODO UDP更改
|
||||||
//监听远程开始考试
|
//监听远程开始考试
|
||||||
// globalThis.udpEvent.onBeginExam(async () => {
|
JudgeEmitterInstance.onBeginExam(async () => {
|
||||||
// console.info('surenjun', 'userInfo收到UdpEvent事件')
|
console.info('surenjun', 'userInfo收到UdpEvent事件')
|
||||||
// if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
|
if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
|
||||||
// await this.prePareSCZB()
|
await this.prePareSCZB()
|
||||||
// } else {
|
} else {
|
||||||
// await this.prePareExam()
|
await this.prePareExam()
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,7 +926,7 @@ struct UserInfo {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (judgeConfig.isCheckFireOpen) {
|
if (JudgeConfig.isCheckFireOpen) {
|
||||||
resolve(true)
|
resolve(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { judgeConfig } from '../../judgeSDK/utils/judgeConfig';
|
import { JudgeConfig } from '../../judgeSDK/utils/judgeConfig';
|
||||||
|
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
|
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
|
||||||
@ -90,7 +90,7 @@ export default struct DeductedPopup {
|
|||||||
//上车准备
|
//上车准备
|
||||||
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
|
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
|
||||||
// const { isTrajectoryOpen } = judgeConfig;
|
// const { isTrajectoryOpen } = judgeConfig;
|
||||||
if (judgeConfig.isTrajectoryOpen) {
|
if (JudgeConfig.isTrajectoryOpen) {
|
||||||
await this.initDb()
|
await this.initDb()
|
||||||
} else {
|
} else {
|
||||||
await this.initSysset()
|
await this.initSysset()
|
||||||
@ -113,7 +113,7 @@ export default struct DeductedPopup {
|
|||||||
const examSubject = this.carInfo.examSubject;
|
const examSubject = this.carInfo.examSubject;
|
||||||
//轨迹回放读取 systemparam表、markrule表
|
//轨迹回放读取 systemparam表、markrule表
|
||||||
const fileUtil = new FileUtils(this.context);
|
const fileUtil = new FileUtils(this.context);
|
||||||
const folderPath = await fileUtil.initFolder(judgeConfig.trajectoryPath);
|
const folderPath = await fileUtil.initFolder(JudgeConfig.trajectoryPath);
|
||||||
const str = await fileUtil.readFile(folderPath);
|
const str = await fileUtil.readFile(folderPath);
|
||||||
const strArr = str.split('\n');
|
const strArr = str.split('\n');
|
||||||
// const [initData, beginData] = [strArr[0], strArr[1]];
|
// const [initData, beginData] = [strArr[0], strArr[1]];
|
||||||
@ -121,7 +121,7 @@ export default struct DeductedPopup {
|
|||||||
const beginData = strArr[1];
|
const beginData = strArr[1];
|
||||||
// TODO 补全类型
|
// TODO 补全类型
|
||||||
const initDataObj: ESObject = JSON.parse(initData);
|
const initDataObj: ESObject = JSON.parse(initData);
|
||||||
this.examSubject = Number(judgeConfig.isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject);
|
this.examSubject = Number(JudgeConfig.isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject);
|
||||||
await this.initMarkRules(initDataObj.mark);
|
await this.initMarkRules(initDataObj.mark);
|
||||||
await this.initSysset(initDataObj.sysset);
|
await this.initSysset(initDataObj.sysset);
|
||||||
await this.initStudent()
|
await this.initStudent()
|
||||||
@ -153,7 +153,7 @@ export default struct DeductedPopup {
|
|||||||
kfdm: kf.kfdm,
|
kfdm: kf.kfdm,
|
||||||
})))
|
})))
|
||||||
|
|
||||||
if (judgeConfigObj['418'] == '1' || judgeConfig.kfVoiceOpen) {
|
if (judgeConfigObj['418'] == '1' || JudgeConfig.kfVoiceOpen) {
|
||||||
avPlayer.playAudio([`voice/${mark.markcatalog}.mp3`, `voice/mark_${Math.abs(mark.score)}.mp3`], false, () => {
|
avPlayer.playAudio([`voice/${mark.markcatalog}.mp3`, `voice/mark_${Math.abs(mark.score)}.mp3`], false, () => {
|
||||||
this.closePopup(true)
|
this.closePopup(true)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import FileModel from './utils/fileModel';
|
|||||||
import FilePhoto from './utils/filePhoto';
|
import FilePhoto from './utils/filePhoto';
|
||||||
import FileLog from './utils/fileLog';
|
import FileLog from './utils/fileLog';
|
||||||
import JudgeTask from './utils/judgeTask';
|
import JudgeTask from './utils/judgeTask';
|
||||||
import { judgeConfig } from './utils/judgeConfig';
|
import { JudgeConfig } from './utils/judgeConfig';
|
||||||
import { LANE } from '../judgeSDK/api/judgeSDK.d';
|
import { LANE } from '../judgeSDK/api/judgeSDK.d';
|
||||||
import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation';
|
import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation';
|
||||||
|
|
||||||
@ -55,16 +55,16 @@ import {
|
|||||||
JudgeConfigObj,
|
JudgeConfigObj,
|
||||||
JudgeEventKf,
|
JudgeEventKf,
|
||||||
JudgeInitObj,
|
JudgeInitObj,
|
||||||
JudgeKfxm,
|
JudgeKFXM,
|
||||||
JudgeKsjs,
|
JudgeKSJS,
|
||||||
JudgeKsxm,
|
JudgeKSXM,
|
||||||
JudgePerformInfo,
|
JudgePerformInfo,
|
||||||
JudgeSound,
|
JudgeSound,
|
||||||
JudgeUI,
|
JudgeUI,
|
||||||
JudgeXmjs,
|
JudgeXMJS,
|
||||||
Km3JudgeInitConfig,
|
Km3JudgeInitConfig,
|
||||||
KmItem,
|
KmItem,
|
||||||
KmItems,
|
JudgeConfigObjKmItems,
|
||||||
MarkRule,
|
MarkRule,
|
||||||
Plc,
|
Plc,
|
||||||
ProjectInfo,
|
ProjectInfo,
|
||||||
@ -402,10 +402,10 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private ksjs: JudgeKsjs
|
private ksjs: JudgeKSJS
|
||||||
private kfArr: JudgeEventKf[]
|
private kfArr: JudgeEventKf[]
|
||||||
//所有的科目考试项目(大车&小车)
|
//所有的科目考试项目(大车&小车)
|
||||||
private kmItems: KmItems
|
private kmItems: JudgeConfigObjKmItems
|
||||||
private plcData: Plc
|
private plcData: Plc
|
||||||
// 获取plc数据
|
// 获取plc数据
|
||||||
getPlcData = async (plc: string) => {
|
getPlcData = async (plc: string) => {
|
||||||
@ -686,9 +686,9 @@ export default class Judge {
|
|||||||
this.carztStr = '';
|
this.carztStr = '';
|
||||||
this.kmItems = {};
|
this.kmItems = {};
|
||||||
// 考试回放配置
|
// 考试回放配置
|
||||||
this.isTrajectoryOpen = judgeConfig.isTrajectoryOpen;
|
this.isTrajectoryOpen = JudgeConfig.isTrajectoryOpen;
|
||||||
this.modelPath = judgeConfig.modelPath;
|
this.modelPath = JudgeConfig.modelPath;
|
||||||
this.trajectoryPath = judgeConfig.trajectoryPath;
|
this.trajectoryPath = JudgeConfig.trajectoryPath;
|
||||||
|
|
||||||
this.isExam = !this.judgeUI.singlePlay;
|
this.isExam = !this.judgeUI.singlePlay;
|
||||||
(judgeUI.examSubject == '2' ? testKm2Items : testKm3Items).forEach(item => {
|
(judgeUI.examSubject == '2' ? testKm2Items : testKm3Items).forEach(item => {
|
||||||
@ -794,8 +794,8 @@ export default class Judge {
|
|||||||
const ddxkKfArr = judgeUI.ddxkKfArr
|
const ddxkKfArr = judgeUI.ddxkKfArr
|
||||||
const passingScore = judgeUI.passingScore
|
const passingScore = judgeUI.passingScore
|
||||||
|
|
||||||
const ksxm: JudgeKsxm[] = projects.map(project => {
|
const ksxm: JudgeKSXM[] = projects.map(project => {
|
||||||
const temp: JudgeKsxm = {
|
const temp: JudgeKSXM = {
|
||||||
xmdm: Number(project.projectCode), xmxh: ''
|
xmdm: Number(project.projectCode), xmxh: ''
|
||||||
}
|
}
|
||||||
return temp
|
return temp
|
||||||
@ -806,10 +806,10 @@ export default class Judge {
|
|||||||
return Number(currentProject.projectCode)
|
return Number(currentProject.projectCode)
|
||||||
})) || [];
|
})) || [];
|
||||||
|
|
||||||
const kfxm: JudgeKfxm[] = isDdxk ? (ddxkKfArr?.map(kf => {
|
const kfxm: JudgeKFXM[] = isDdxk ? (ddxkKfArr?.map(kf => {
|
||||||
return {
|
return {
|
||||||
xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1]
|
xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1]
|
||||||
} as JudgeKfxm
|
} as JudgeKFXM
|
||||||
})) : []
|
})) : []
|
||||||
|
|
||||||
const beginInfo: JudgeBeginObj = {
|
const beginInfo: JudgeBeginObj = {
|
||||||
@ -1059,7 +1059,7 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
// 更改考试状态
|
// 更改考试状态
|
||||||
goVoiceAnnounce =
|
goVoiceAnnounce =
|
||||||
async (event: number, xmdm: number, kf: JudgeEventKf[], xmjs: JudgeXmjs, ksjs: JudgeKsjs, xmxh: string) => {
|
async (event: number, xmdm: number, kf: JudgeEventKf[], xmjs: JudgeXMJS, ksjs: JudgeKSJS, xmxh: string) => {
|
||||||
|
|
||||||
const beginProject = this.beginProject
|
const beginProject = this.beginProject
|
||||||
const pointsDedute = this.pointsDedute
|
const pointsDedute = this.pointsDedute
|
||||||
@ -1164,7 +1164,7 @@ export default class Judge {
|
|||||||
console.info('surenjun', '扣分开始')
|
console.info('surenjun', '扣分开始')
|
||||||
//扣分时实时播报语音(0-否+1-是)
|
//扣分时实时播报语音(0-否+1-是)
|
||||||
const currentKf = kf[kfLen -1];
|
const currentKf = kf[kfLen -1];
|
||||||
if (judgeConfig.kfVoiceOpen || (examSubject == '2' && judgeConfigObj['618'] == '1') ||
|
if (JudgeConfig.kfVoiceOpen || (examSubject == '2' && judgeConfigObj['618'] == '1') ||
|
||||||
(examSubject == '3' && judgeConfigObj['418'] == '1')) {
|
(examSubject == '3' && judgeConfigObj['418'] == '1')) {
|
||||||
avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`, `voice/mark_${Math.abs(currentKf.score)}.mp3`])
|
avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`, `voice/mark_${Math.abs(currentKf.score)}.mp3`])
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,8 +53,7 @@ export default class FileModel {
|
|||||||
//获取文件内容
|
//获取文件内容
|
||||||
public getModelContent = (folderPath:string, fileName:string) => {
|
public getModelContent = (folderPath:string, fileName:string) => {
|
||||||
try {
|
try {
|
||||||
const content = this.fileUtil.getFileContent(`${folderPath}/${fileName}`)
|
return this.fileUtil.getFileContent(`${folderPath}/${fileName}`);
|
||||||
return content;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.info('surenjun', JSON.stringify(e))
|
console.info('surenjun', JSON.stringify(e))
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { takePhoto } from '../../../utils/Video';
|
import { takePhoto } from '../../../utils/Video';
|
||||||
import promptAction from '@ohos.promptAction';
|
import promptAction from '@ohos.promptAction';
|
||||||
import { judgeConfig } from './judgeConfig';
|
import { JudgeConfig } from './judgeConfig';
|
||||||
import FileUtils from '../../../utils/FileUtils';
|
import FileUtils from '../../../utils/FileUtils';
|
||||||
import {VideoConfig} from '../../../model/Common'
|
import {VideoConfig} from '../../../model/Common'
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
@ -9,7 +9,7 @@ export default class FilePhoto {
|
|||||||
private params: VideoConfig
|
private params: VideoConfig
|
||||||
private context:common.UIAbilityContext
|
private context:common.UIAbilityContext
|
||||||
public getPhoto = async () => {
|
public getPhoto = async () => {
|
||||||
if (!judgeConfig.isPhotoOpen) {
|
if (!JudgeConfig.isPhotoOpen) {
|
||||||
return ''
|
return ''
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
//考试回放开关
|
//考试回放开关
|
||||||
export const judgeConfig = {
|
export const JudgeConfig = {
|
||||||
//本地目录开关
|
//本地目录开关
|
||||||
isTrajectoryOpen: false,
|
isTrajectoryOpen: false,
|
||||||
//是否开启拍照
|
//是否开启拍照
|
||||||
|
|||||||
@ -41,6 +41,22 @@ export default class UdpClient {
|
|||||||
private errorEvents: Array<Function> = []
|
private errorEvents: Array<Function> = []
|
||||||
private dealMethod: DealMethod<object>
|
private dealMethod: DealMethod<object>
|
||||||
|
|
||||||
|
private bindEvent() {
|
||||||
|
this.udp?.on("message", value => {
|
||||||
|
let result = this.dealMethod(value.message)
|
||||||
|
this.messageEvents.forEach(cb => {
|
||||||
|
cb(result)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.udp.on("error", (err) => {
|
||||||
|
console.log(UDPTag, 'udp error', JSON.stringify(err))
|
||||||
|
this.errorEvents.forEach(cb => {
|
||||||
|
cb(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bindUdp(): Promise<void> {
|
bindUdp(): Promise<void> {
|
||||||
return this.udp.bind({
|
return this.udp.bind({
|
||||||
address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
||||||
@ -55,8 +71,11 @@ export default class UdpClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(): Promise<void> {
|
close(): Promise<void> {
|
||||||
this.udp.off("message")
|
this.messageEvents = []
|
||||||
this.udp.off("error")
|
this.errorEvents = []
|
||||||
|
this.dealMethod = null
|
||||||
|
this.udp?.off("message")
|
||||||
|
this.udp?.off("error")
|
||||||
return this.udp?.close()
|
return this.udp?.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +107,8 @@ export default class UdpClient {
|
|||||||
this.sendMsg(msgData)
|
this.sendMsg(msgData)
|
||||||
}
|
}
|
||||||
|
|
||||||
create(udpLocalIp: string, udpLocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
async create(udpLocalIp: string, udpLocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
||||||
|
await this.close()
|
||||||
this.localIp = udpLocalIp
|
this.localIp = udpLocalIp
|
||||||
this.oppositeIp = udpOppositeIp
|
this.oppositeIp = udpOppositeIp
|
||||||
this.localIpPort = udpLocalIpPort
|
this.localIpPort = udpLocalIpPort
|
||||||
@ -112,21 +132,6 @@ export default class UdpClient {
|
|||||||
offMsg(callback: Function) {
|
offMsg(callback: Function) {
|
||||||
this.messageEvents = this.messageEvents.filter(cb => cb !== callback)
|
this.messageEvents = this.messageEvents.filter(cb => cb !== callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
private bindEvent() {
|
|
||||||
this.udp?.on("message", value => {
|
|
||||||
let result = this.dealMethod(value.message)
|
|
||||||
this.messageEvents.forEach(cb => {
|
|
||||||
cb(result)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
this.udp.on("error", (err) => {
|
|
||||||
console.log(UDPTag, 'udp error', JSON.stringify(err))
|
|
||||||
this.errorEvents.forEach(cb => {
|
|
||||||
cb(err)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取后置机信号
|
// 获取后置机信号
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { CarInfoType, EnvironmentConfigurationType, Gps, Sensor, UDPParamType } from '../../model'
|
import { CarInfoType, EnvironmentConfigurationType, Gps, Sensor, UDPParamType } from '../../model'
|
||||||
import { testKm2Items, testKm3Items } from '../../pages/judgeSDK/dataTest';
|
import { testKm2Items, testKm3Items } from '../../pages/judgeSDK/dataTest';
|
||||||
import { fillZero, } from '../../pages/judgeSDK/utils/Common';
|
import { fillZero, } from '../../pages/judgeSDK/utils/Common';
|
||||||
import { judgeConfig } from '../../pages/judgeSDK/utils/judgeConfig';
|
import { JudgeConfig } from '../../pages/judgeSDK/utils/judgeConfig';
|
||||||
import { FillZero, StringToASCII } from '../Common';
|
import { FillZero, StringToASCII } from '../Common';
|
||||||
import UdpClient from '../UdpUtils'
|
import UdpClient from '../UdpUtils'
|
||||||
import { CenterUDPClientInstance } from './CenterUdpBusiness';
|
import { CenterUDPClientInstance } from './CenterUdpBusiness';
|
||||||
@ -49,8 +49,8 @@ function string2Bytes(num: number | string, len: number) {
|
|||||||
class JudgeUdpBusiness {
|
class JudgeUdpBusiness {
|
||||||
private static instance: JudgeUdpBusiness
|
private static instance: JudgeUdpBusiness
|
||||||
private udp: UdpClient
|
private udp: UdpClient
|
||||||
private udpIndex = 0;
|
|
||||||
private currentUdpIndex = 0;
|
private currentUdpIndex = 0;
|
||||||
|
public udpIndex = 0;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (!JudgeUdpBusiness.instance) {
|
if (!JudgeUdpBusiness.instance) {
|
||||||
@ -203,7 +203,6 @@ class JudgeUdpBusiness {
|
|||||||
dwsxs: p[84],
|
dwsxs: p[84],
|
||||||
jdsxs: Number(origin[92].split('-')[1])
|
jdsxs: Number(origin[92].split('-')[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sensor,
|
sensor,
|
||||||
gps,
|
gps,
|
||||||
@ -231,9 +230,9 @@ class JudgeUdpBusiness {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getMessageHeartbeat(msg: string): Promise<number[]> {
|
async getMessageHeartbeat(msg: string): Promise<number[]> {
|
||||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
||||||
let gpsDigit = judgeConfig.fourInOneScreen.gpsDigit
|
let gpsDigit = JudgeConfig.fourInOneScreen.gpsDigit
|
||||||
const asclshArr = StringToASCII(FillZero(
|
const asclshArr = StringToASCII(FillZero(
|
||||||
AppStorage.get<boolean>("singlePlay")
|
AppStorage.get<boolean>("singlePlay")
|
||||||
? '1111111111111'
|
? '1111111111111'
|
||||||
|
|||||||
@ -14,7 +14,7 @@ enum EventId {
|
|||||||
endExamEventId = 12
|
endExamEventId = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class JudgeEmitter {
|
class JudgeEmitter {
|
||||||
private beginExamCallBack: Function = () => {
|
private beginExamCallBack: Function = () => {
|
||||||
}
|
}
|
||||||
private endExamCallBack: Function = () => {
|
private endExamCallBack: Function = () => {
|
||||||
@ -23,10 +23,6 @@ export default class JudgeEmitter {
|
|||||||
}
|
}
|
||||||
private directives: string
|
private directives: string
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.init()
|
|
||||||
}
|
|
||||||
|
|
||||||
//监听开始考试
|
//监听开始考试
|
||||||
public onBeginExam(callBack?: Function) {
|
public onBeginExam(callBack?: Function) {
|
||||||
console.info('surenjun', '注册远程开始考试事件')
|
console.info('surenjun', '注册远程开始考试事件')
|
||||||
@ -124,3 +120,5 @@ export default class JudgeEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const JudgeEmitterInstance = new JudgeEmitter()
|
||||||
|
|
||||||
|
|||||||
@ -1,314 +0,0 @@
|
|||||||
import systemTime from '@ohos.systemDateTime';
|
|
||||||
|
|
||||||
import { testKm2Items, testKm3Items } from '../../pages/judgeSDK/dataTest/index';
|
|
||||||
import { judgeConfig } from '../../pages/judgeSDK/utils/judgeConfig';
|
|
||||||
import { examCalcGpsDistance } from '../../pages/judgeSDK/api';
|
|
||||||
import { judgeUDPClient, lightUDPClient, objUDPClient } from '../UdpUtils';
|
|
||||||
import { CarInfoType, Gps, Sensor } from '../../model';
|
|
||||||
import { FillZero, StringToASCII } from '../Common';
|
|
||||||
|
|
||||||
interface PLCDataType {
|
|
||||||
sensor: Sensor,
|
|
||||||
gps: Gps,
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ProjectDataType {
|
|
||||||
code: string
|
|
||||||
status: number
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ProjectItemType {
|
|
||||||
code: ProjectDataType
|
|
||||||
status: string
|
|
||||||
}
|
|
||||||
|
|
||||||
function convertGpsCoord2(num: number) {
|
|
||||||
const tempNum = Math.floor(num);
|
|
||||||
const du = Math.floor(tempNum / 100);
|
|
||||||
const fen = tempNum % 100 + num - tempNum;
|
|
||||||
return du + fen / 60
|
|
||||||
}
|
|
||||||
|
|
||||||
function string2Bytes(num: number | string, len: number) {
|
|
||||||
let str = (Math.floor(Number(num))).toString(2);
|
|
||||||
if (str.length > len) {
|
|
||||||
console.log('数据长度不对~~');
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let byteString = FillZero(str, len);
|
|
||||||
|
|
||||||
let arrBytes: number[] = [];
|
|
||||||
for (let i = byteString.length; i > 0; ) {
|
|
||||||
let j = i - 8;
|
|
||||||
if (j < 0) {
|
|
||||||
j = 0
|
|
||||||
}
|
|
||||||
let s = byteString.slice(j, i);
|
|
||||||
let v = parseInt(s, 2);
|
|
||||||
arrBytes.push(v);
|
|
||||||
i = i - 8
|
|
||||||
}
|
|
||||||
return arrBytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 中心plc实时信号转换成字节
|
|
||||||
function getTranslateSignals(tempItems: number[]) {
|
|
||||||
const len = Math.floor(tempItems.length / 8);
|
|
||||||
const arr: string[] = [];
|
|
||||||
for (let i = 0; i < len; i++) {
|
|
||||||
arr.push(tempItems.slice(i * 8, (i + 1) * 8).join(''));
|
|
||||||
}
|
|
||||||
return arr.map(numStr => parseInt(numStr, 2)).map(item => string2Bytes(item, 8)[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
// 中心所有项目转换
|
|
||||||
function getTranslateProject(): string[] {
|
|
||||||
const examSubject = AppStorage.get<string>("examSubject");
|
|
||||||
const tempItems: ProjectItemType[] =
|
|
||||||
(examSubject === '2' ? testKm2Items : testKm3Items).map((code: ProjectDataType) => {
|
|
||||||
let data: ProjectItemType = {
|
|
||||||
code,
|
|
||||||
status: '0'
|
|
||||||
}
|
|
||||||
return data
|
|
||||||
})
|
|
||||||
const arr: string[] = [];
|
|
||||||
for (let i = 0; i <= 4; i++) {
|
|
||||||
const temp = tempItems.slice(i * 4, (i + 1) * 4);
|
|
||||||
let tempArr = temp.map(item => item.status)
|
|
||||||
if (i === 4) {
|
|
||||||
tempArr = examSubject === '2'
|
|
||||||
//bit36-bit39保留
|
|
||||||
? tempArr.concat(['00', '00'])
|
|
||||||
//bit30-bit39保留
|
|
||||||
: tempArr.concat(['00', '00', '00'])
|
|
||||||
}
|
|
||||||
|
|
||||||
arr.push(tempArr.join(''));
|
|
||||||
}
|
|
||||||
return arr
|
|
||||||
}
|
|
||||||
|
|
||||||
// plc数据转换成对象
|
|
||||||
async function getPlcData(plc: string): Promise<PLCDataType> {
|
|
||||||
const time = await systemTime.getCurrentTime()
|
|
||||||
let origin = plc.split(",")
|
|
||||||
let p = origin.map(item => Number(item))
|
|
||||||
let sensor: Sensor = {
|
|
||||||
aqd: p[19],
|
|
||||||
mkg: p[14],
|
|
||||||
ssc: p[13],
|
|
||||||
jsc: p[12],
|
|
||||||
fsc: p[18],
|
|
||||||
lhq: p[17],
|
|
||||||
lb: p[4],
|
|
||||||
skd: p[9],
|
|
||||||
jgd: p[7],
|
|
||||||
ygd: p[8],
|
|
||||||
//左方向灯 右方向灯 双跳灯 雾灯 雨刮器 点火1 点火2 发动机转速 档位 车速
|
|
||||||
zfxd: p[2],
|
|
||||||
yfxd: p[3],
|
|
||||||
shtd: p[20],
|
|
||||||
wd: p[10],
|
|
||||||
ygq: p[11],
|
|
||||||
dh1: p[5],
|
|
||||||
dh2: p[6],
|
|
||||||
fdjzs: p[25],
|
|
||||||
dw: p[28],
|
|
||||||
cs: p[23],
|
|
||||||
fxp: Number(origin[27].split('_')[0]),
|
|
||||||
//累计脉冲 溜车脉冲 超声波左后 超声波右后 超声波右前 超声波左前 座椅 仪表盘 后视镜 倒车镜 光照 雨量
|
|
||||||
ljmc: p[24],
|
|
||||||
lcmc: 0,
|
|
||||||
csbzh: p[32],
|
|
||||||
csbyh: p[30],
|
|
||||||
csbyq: p[31],
|
|
||||||
csbzq: p[29],
|
|
||||||
zy: 0,
|
|
||||||
tbp: 0,
|
|
||||||
hsj: 0,
|
|
||||||
dcj: 0,
|
|
||||||
gx: 0,
|
|
||||||
yl: 0,
|
|
||||||
yy: 0,
|
|
||||||
sde: 0,
|
|
||||||
xhd: '',
|
|
||||||
rmndg: 0,
|
|
||||||
wav: 0,
|
|
||||||
mndg: ''
|
|
||||||
}
|
|
||||||
let gps: Gps = {
|
|
||||||
bklx: p[56],
|
|
||||||
dwzt: p[83],
|
|
||||||
jdzt: Number(origin[92].split('-')[0]),
|
|
||||||
sj: time,
|
|
||||||
jd: p[96],
|
|
||||||
wd: p[95],
|
|
||||||
hxj: p[90],
|
|
||||||
fyj: p[91],
|
|
||||||
hbg: p[85],
|
|
||||||
gdc: p[86],
|
|
||||||
sd: p[97],
|
|
||||||
age: p[87],
|
|
||||||
jdyz: p[89],
|
|
||||||
wdyz: p[88],
|
|
||||||
dwsxs: p[84],
|
|
||||||
jdsxs: Number(origin[92].split('-')[1])
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
sensor,
|
|
||||||
gps,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDwStatusType(dw: number) {
|
|
||||||
switch (dw) {
|
|
||||||
case 0:
|
|
||||||
return [0, 0, 0, 0]
|
|
||||||
case 1:
|
|
||||||
return [0, 0, 0, 1]
|
|
||||||
case 2:
|
|
||||||
return [0, 0, 1, 0]
|
|
||||||
case 3:
|
|
||||||
return [0, 0, 1, 1]
|
|
||||||
case 4:
|
|
||||||
return [0, 1, 0, 0]
|
|
||||||
case 5:
|
|
||||||
return [0, 1, 0, 1]
|
|
||||||
case 9:
|
|
||||||
return [1, 0, 0, 1]
|
|
||||||
default:
|
|
||||||
return [0, 0, 0, 0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function initJudgeUdp() {
|
|
||||||
AppStorage.setOrCreate("serialIndex", 0)
|
|
||||||
AppStorage.setOrCreate("udpIndex", 0)
|
|
||||||
const arrBlue = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00];
|
|
||||||
const arrBlueBuffer = new Uint8Array(arrBlue).buffer
|
|
||||||
lightUDPClient.sendMsg(arrBlueBuffer);
|
|
||||||
let prevJd = 0, preWd = 0
|
|
||||||
objUDPClient.onMsg(async (msg: string) => {
|
|
||||||
const stashArr = msg.split(',')
|
|
||||||
if (stashArr[0] != '#DN_GD') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const udpIndex = AppStorage.get<number>("udpIndex");
|
|
||||||
const isJudge = AppStorage.get<boolean>("isJudge");
|
|
||||||
if (udpIndex % 5 === 0 && !isJudge) {
|
|
||||||
const bytes = await getMessageHeartbeat(msg);
|
|
||||||
const msgArr: string[] = msg.split(',');
|
|
||||||
const jd = convertGpsCoord2(Number(msgArr[96]));
|
|
||||||
const wd = convertGpsCoord2(Number(msgArr[95]) || 0);
|
|
||||||
judgeUDPClient.send(bytes)
|
|
||||||
if (prevJd && Number(msgArr[83]) === 4) {
|
|
||||||
const distance = await examCalcGpsDistance({
|
|
||||||
jd1: prevJd,
|
|
||||||
wd1: preWd,
|
|
||||||
jd2: jd,
|
|
||||||
wd2: wd,
|
|
||||||
h: Number(msgArr[90]) || 1,
|
|
||||||
})
|
|
||||||
//@ts-ignore
|
|
||||||
// globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1)
|
|
||||||
}
|
|
||||||
prevJd = jd;
|
|
||||||
preWd = wd;
|
|
||||||
}
|
|
||||||
AppStorage.set("udpIndex", udpIndex + 1)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getMessageHeartbeat(msg: string): Promise<number[]> {
|
|
||||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
|
||||||
let gpsDigit = judgeConfig.fourInOneScreen.gpsDigit
|
|
||||||
const asclshArr = StringToASCII(FillZero(
|
|
||||||
AppStorage.get<boolean>("singlePlay")
|
|
||||||
? '1111111111111'
|
|
||||||
: AppStorage.get<string>("lsh"),
|
|
||||||
13));
|
|
||||||
const ascksyhArr = StringToASCII(carInfo.examSubject === '2' ? '0000000000000' : '1111111111111')
|
|
||||||
const ascsbxhArr = StringToASCII('00000000')
|
|
||||||
const serialIndex = AppStorage.get<number>("serialIndex")
|
|
||||||
const plcData = await getPlcData(msg);
|
|
||||||
let param: number[] = Object.entries(plcData.sensor)
|
|
||||||
.filter((item: [string, number]) => {
|
|
||||||
let keys =
|
|
||||||
["zfxd", "yfxd", "shtd", "ygd", "jgd", "skd", "dh1", "dh2", "lhq", "jsc", "ssc", "fsc", "lb", "mkg", "aqd"]
|
|
||||||
return keys.indexOf(item[0])
|
|
||||||
})
|
|
||||||
.map((item: [string, number]) => item[1])
|
|
||||||
.concat(getDwStatusType(plcData.sensor.dw))
|
|
||||||
.concat([0, 0, plcData.sensor.ygq, plcData.sensor.wd, 0])
|
|
||||||
const translateSignals = getTranslateSignals(param)
|
|
||||||
const translateProject = getTranslateProject();
|
|
||||||
const translateJd = Number(convertGpsCoord2(plcData.gps.wd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit);
|
|
||||||
const translateWd = Number(convertGpsCoord2(plcData.gps.jd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit)
|
|
||||||
const translateProjects = translateProject.map(numStr => string2Bytes(parseInt(numStr, 2), 8)[0])
|
|
||||||
let tempSd = Number((plcData.gps.sd * 1.852).toFixed(0))
|
|
||||||
if (tempSd < 1) {
|
|
||||||
tempSd = 0
|
|
||||||
}
|
|
||||||
const arr: number[][] = [
|
|
||||||
//考生号
|
|
||||||
asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
|
|
||||||
//考试员号
|
|
||||||
ascksyhArr.map(ksyh => string2Bytes(ksyh, 8)[0]),
|
|
||||||
//科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间
|
|
||||||
string2Bytes(`${0}${'00:00:000'}`, 4 * 8),
|
|
||||||
// 消息序号
|
|
||||||
string2Bytes(serialIndex, 2 * 8),
|
|
||||||
translateSignals,
|
|
||||||
string2Bytes(tempSd * 100, 2 * 8),
|
|
||||||
string2Bytes(plcData.sensor.fdjzs / 100, 8),
|
|
||||||
string2Bytes(translateJd, 4 * 8),
|
|
||||||
string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8),
|
|
||||||
//GPS东向距离
|
|
||||||
string2Bytes(0, 4 * 8),
|
|
||||||
//GPS北向距离
|
|
||||||
string2Bytes(0, 4 * 8),
|
|
||||||
//航向角
|
|
||||||
string2Bytes(plcData.gps.hxj * 100, 2 * 8),
|
|
||||||
//俯仰角
|
|
||||||
string2Bytes(plcData.gps.fyj * 100, 2 * 8),
|
|
||||||
// 高程(海拔)
|
|
||||||
string2Bytes(plcData.gps.hbg * 100, 4 * 8),
|
|
||||||
//dddd
|
|
||||||
translateProjects,
|
|
||||||
//当前项目编号
|
|
||||||
string2Bytes(0, 8),
|
|
||||||
//场地设备编号
|
|
||||||
ascsbxhArr.map(sbxh => string2Bytes(sbxh, 8)[0]),
|
|
||||||
//本次考试行驶距离
|
|
||||||
string2Bytes(0, 2 * 8),
|
|
||||||
//扣分值
|
|
||||||
string2Bytes(0, 2 * 8),
|
|
||||||
//扣分数
|
|
||||||
string2Bytes(0, 2 * 8),
|
|
||||||
//扣分项数量
|
|
||||||
string2Bytes(0, 8),
|
|
||||||
//n个扣分序号
|
|
||||||
// [].map(kf => string2Bytes(kf.markcatalog, 8)),
|
|
||||||
[],
|
|
||||||
//牵引车第二gps精度、纬度
|
|
||||||
string2Bytes(0, 4 * 8), string2Bytes(0, 4 * 8),
|
|
||||||
//牵引车第二航向角
|
|
||||||
string2Bytes(0, 2 * 8),
|
|
||||||
//摩托压线 Byte[20],
|
|
||||||
string2Bytes(0, 20 * 8),
|
|
||||||
//考试用时
|
|
||||||
string2Bytes(FillZero(0, 4), 4 * 8),
|
|
||||||
//项目用时
|
|
||||||
string2Bytes(FillZero(0, 2), 2 * 8),
|
|
||||||
//设备信号状态
|
|
||||||
string2Bytes(0, 4 * 8),
|
|
||||||
]
|
|
||||||
let result: number[] = [];
|
|
||||||
arr.forEach(itemArr => {
|
|
||||||
result = result.concat(itemArr)
|
|
||||||
})
|
|
||||||
AppStorage.setOrCreate("serialIndex", 0)
|
|
||||||
return [...new Uint8Array(result)]
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user