Merge pull request 'feat_surenjun' (#20) from feat_surenjun into main

Reviewed-on: #20
This commit is contained in:
wangzhongjie 2024-07-02 10:35:19 +08:00
commit 273a411f83
425 changed files with 380 additions and 256 deletions

3
entry/.gitignore vendored
View File

@ -2,4 +2,5 @@
/.preview
/build
/.cxx
/.idea
/.idea
/oh_modules

View File

@ -0,0 +1,120 @@
// 导入USB接口api包。
import usb from '@ohos.usbManager';
const LOGTAG = 'USBSERVICES'
//字符串转字节
function stringToArr(str){
var arr = [];
for (var i = 0, j = str.length; i < j; ++i) {
arr.push(str.charCodeAt(i));
}
return arr
}
//plc数据转成无锡科研所usb字节数据
function plcStrToWXCodeArr(wuXiDataStr){
const arr = stringToArr(wuXiDataStr);
//数据包总长度 有效长度
let packetSize = 65,maxDataSize = 63;
let packetArr = []
const loop = Math.ceil(arr.length / maxDataSize)
for(let i = 0; i< loop; i++){
const thisPacket = arr.slice(i * maxDataSize,(i + 1) * maxDataSize)
const oSize = maxDataSize - thisPacket.length;
//补齐0x00
if(oSize > 0){
let oSizeArr = []
for(let j = 0;j < oSize;j++){oSizeArr.push(0x00)}
packetArr.push([thisPacket.length].concat(thisPacket).concat(oSizeArr));
}else{
packetArr.push([thisPacket.length].concat(thisPacket));
}
}
return packetArr
}
export default class UsbService{
private devicepipe : usb.USBDevicePipe
private outEndpoint: usb.USBEndpoint
public isWXUSBDevice:Boolean
constructor() {
//是否是无锡检测设备
this.isWXUSBDevice = false
this.devicepipe
this.init()
}
init = async()=>{
// 获取设备列表。
let deviceList : Array<usb.USBDevice> = usb.getDevices();
deviceList.forEach(async (device:usb.USBDevice) => {
const {vendorId,productId} = device;
console.log(LOGTAG,JSON.stringify(device));
//无锡所检测设备接入
if(vendorId === 6790 && productId === 58409){
// if(vendorId === 2385 && productId === 5734){
// 申请操作指定的device的操作权限。
try {
let bool = usb.hasRight(device.name);
console.info(LOGTAG,'bool =>' + bool)
const isExit = await usb.requestRight(device.name);
console.info(LOGTAG,'isExit =>' + isExit)
if(isExit){
let devicepipe : usb.USBDevicePipe = usb.connectDevice(device);
let interfaces = device.configs[0].interfaces[0];
let ret = usb.claimInterface(devicepipe, interfaces,true);
console.info(LOGTAG,'ret =>' + ret);
if(ret === 0 ){
let outEndpoint : usb.USBEndpoint = interfaces.endpoints[1];
let inEndpoint : usb.USBEndpoint = interfaces.endpoints[0];
this.isWXUSBDevice = true;
this.devicepipe = devicepipe
this.outEndpoint = outEndpoint
}else{
console.info(LOGTAG,'usb claimInterface failed')
}
}else{
console.info(LOGTAG,'isExit =>' +'false')
}
} catch (e) {
console.info(LOGTAG,'e=>' + JSON.stringify(e))
}
}
});
}
sendUSB =async (wuXiDataStr) => {
console.info(LOGTAG,'正在发送数据')
const {devicepipe,isWXUSBDevice,outEndpoint} = this;
console.info(LOGTAG,'正在发送数据')
if(isWXUSBDevice){
console.info(LOGTAG,wuXiDataStr)
const codeArr = plcStrToWXCodeArr(wuXiDataStr);
for(let i = 0; i < codeArr.length;i++){
try {
console.info(LOGTAG,'正在发送数据')
const f = await usb.bulkTransfer(devicepipe, outEndpoint, new Uint8Array(codeArr[i]))
console.info(LOGTAG,'发送成功数据长度为:' + f)
} catch (e) {
console.info(LOGTAG,JSON.stringify(e))
}
}
}else{
console.info(LOGTAG,'usb设备初始化失败')
}
}
}
// export default initUsbServicesFn

View File

@ -1,7 +1,7 @@
import systemTime from '@ohos.systemDateTime';
import { Array2Byte, fillZero, string2Bytes, stringToASC } from '../../common/utils/tools';
import { testKmItems } from '../../pages/judgeSDK/dataTest/index';
import { setJudgeUdp, setTopLineUdp } from './GlobleUdp';
import { setJudgeUdp, setTopLineUdp } from './GlobalUdp';
import { convertGpsCoord2 } from '../utils/tools';

View File

@ -1,4 +1,3 @@
// @ts-nocheck
import { VideoConfig } from './interfaces'
import common from '@ohos.app.ability.common';
import router from '@ohos.router'
@ -10,14 +9,15 @@ import {
getEsCarModel,
} from '../common/service/initable'
import FileUtil from '../common/utils/File'
import { getUDP, getUDP2 } from '../common/utils/GlobleUdp'
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp'
import {initJudgeUdp} from '../common/utils/UdpJudge'
import { getTCP } from '../common/utils/GlobleTcp'
import { getTCP } from '../common/utils/GlobalTcp'
import TcpClient from '../common/utils/TcpClient';
import testNapi from '@ohos.hiserialsdk'
import {setliushuiNum,getliushuiNum,getSingleCenterTable,getDoubleCeneterTable,takePhotoFn} from '../common/service/indexService'
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import worker, { MessageEvents } from '@ohos.worker';
import Prompt from '@system.prompt';
@Entry
@Component
@ -110,7 +110,7 @@ struct Index {
}, 1000)
this.angle = 0
if(!globalThis.timeInfo){
promptAction.showToast({
Prompt.showToast({
message: `网络连接失败`,
duration: 3000
});
@ -338,7 +338,6 @@ struct Index {
// await this.getModel()
// const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00]
// globalThis.udpClientByTopLine.sendMsg(Array2Byte(arr).buffer)
console.info(testNapi)
}
async getModel() {
const context = this.context;

View File

@ -1,5 +1,5 @@
import router from '@ohos.router'
import prompt from '@ohos.prompt'
import Prompt from '@system.prompt';
import common from '@ohos.app.ability.common';
import EndPoPup from './compontents/judge/end-popup'
import LoadingPopup from './compontents/judge/loading-popup'
@ -98,8 +98,8 @@ struct Index {
const students = await getSyncData('USER')
const stuInfo = students[0] || {};
const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx} = stuInfo;
this.name = xm;
this.idCard = sfzmhm;
this.name = xm || '测试考生';
this.idCard = sfzmhm || '01234567891010';
this.lsh = lsh;
this.kszp = kszp;
this.ksdd = ksdd;
@ -212,7 +212,7 @@ struct Index {
const projects = this.projects;
if(!projects.length){
prompt.showToast({
Prompt.showToast({
message: '读取数据库信息失败,请重新考试!',
duration: 8000
});
@ -223,7 +223,7 @@ struct Index {
//初始化systemParam表
async initSystemKm3Param(sysParam?:SYSTEMPARMARR[]) {
const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM')
console.log('systemParms',JSON.stringify(systemParms))
const {isTrajectoryOpen} = judgeConfig
systemParms.forEach((systemParm) => {
@ -263,7 +263,7 @@ struct Index {
})
const projects = this.projects;
if (!projects.length) {
prompt.showToast({
Prompt.showToast({
message: '读取数据库信息失败,请重新考试!',
duration: 8000
});
@ -405,7 +405,7 @@ struct Index {
? await this.initSystemKm2Param(systemparm)
: await this.initSystemKm3Param(systemparm)
//@ts-ignore
await this.initMarkRules(testMarkRules);
await this.initMarkRules(initDataObj.mark);
await this.initSysset(initDataObj.sysset);
}
@ -484,28 +484,43 @@ struct Index {
}.height(40)
Row() {
Flex({ direction: FlexDirection.Column }) {
List({}) {
ForEach(this.kfArr, (item) => {
ListItem() {
Column() {
Row() {
Text(item.xmmcStr).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
Text(`${item.score}分`).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
}
.width('100%')
.backgroundColor('#38260B')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ top: 12, bottom: 12, left: 8, right: 5 })
Text(item.desc)
.fontSize(this.BIGFONTSIZE)
.fontColor('#E5CBA1')
.margin({ top: 10, bottom: 8, left: 5, right: 5 })
}.margin({ top: 15 }).alignItems(HorizontalAlign.Start)
if(this.kfArr.length){
List({}) {
ForEach(this.kfArr, (item) => {
ListItem() {
Column() {
Row() {
Text(item.xmmcStr).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
Text(`${item.score}分`).fontSize(this.BIGFONTSIZE).fontColor('#FFF')
}
.width('100%')
.backgroundColor('#38260B')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ top: 12, bottom: 12, left: 8, right: 5 })
Text(item.desc)
.fontSize(this.BIGFONTSIZE)
.fontColor('#E5CBA1')
.margin({ top: 10, bottom: 8, left: 5, right: 5 })
}.margin({ top: 15 }).alignItems(HorizontalAlign.Start)
}.margin({bottom:25})
})
}.padding({left:15,right:15,top:30,bottom:5})
}else{
Column() {
Row() {
Text('暂无扣分项').fontSize(this.BIGFONTSIZE).fontColor('#FFF')
}
.width('100%')
.backgroundColor('#38260B')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ top: 12, bottom: 12, left: 8, right: 3 })
}.margin({ top: 35 }).padding({left:20,right:20}).alignItems(HorizontalAlign.Start)
}
}.margin({bottom:25})
})
}.padding({left:15,right:15,top:30,bottom:5})
}
.backgroundImage($rawfile('judge/score_bg.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
@ -570,7 +585,7 @@ struct Index {
this.amplifiedImgIndex = index;this.isAmplifyPopShow = true
} else{
if(index === 5){
prompt.showToast({
Prompt.showToast({
message: `${xmmcStr}未结束,不允许靠边停车`,
duration: 8000
});
@ -632,7 +647,7 @@ struct Index {
if(this.judgeConfigObj['342'] == 0){
this.isDeductedPopShow = true
}else{
prompt.showToast({
Prompt.showToast({
message: '平台配置不允许人工评判!',
duration: 4000
});
@ -640,7 +655,6 @@ struct Index {
})
}
Row(){
Row(){}.width(60).height(60).backgroundImage($rawfile('judge/phone.png'), ImageRepeat.NoRepeat).backgroundImageSize({ width: '100%', height: '100%' })
Text('呼叫请求').fontColor('#FFF').fontSize(32).padding({right:12})
@ -658,7 +672,7 @@ struct Index {
if(this.judgeConfigObj['353'] == '0' ){
this.endPopupVisible = true
}else{
prompt.showToast({
Prompt.showToast({
message: '车上不允许手动结束考试!',
duration: 4000
});

View File

@ -1,145 +0,0 @@
import hilog from '@ohos.hilog';
import apiJudgeSdk from 'libJudgeSdk.so';
import Judge from './judgeSDK/utils/judge-real';
import { MarkRule, Project, ProjectObj } from './judgeSDK/api/judgeSDK.d';
import AccountTable from '../common/database/tables/AccountTable';
import MA_SYSSET from '../common//constants/MA_SYSSET';
import common from '@ohos.app.ability.common';
import { getSyncData } from '../common/service/initable';
@Entry
@Component
export default struct Index {
@State message: string = '开始绘制'
// 控制XComponent组件的创建和销毁
@State draw: boolean = false
//监管接口序列号
@State serialNumber: number = 0
//模拟考试项目
@State projects: Project[] = []
@State projectsObj: ProjectObj = {}
@State markRuleListObj: MarkRule = {}
private context = getContext(this) as common.UIAbilityContext;
// xcomponentController: XComponentController = new XComponentController()
build() {
Row() {
Column() {
if (this.draw) {
XComponent({
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称注意这个ID要和C++侧一致,不能变
type: 'surface',
libraryname: 'JudgeSdk'
})
.width(640)
.height(480)
.onLoad(() => {
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制
hilog.info(0x0000, 'sdk-tag-ets', 'onLoad');
})
.onDestroy(() => {
hilog.info(0x0000, 'sdk-tag-ets', 'onDestroy');
apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹false:表示结束绘制
})
} else {
Column() {
}
.width(640 / 2)
.height(480 / 2)
}
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.fontColor('rgba(255,255,255,0)')
.onClick(() => {
hilog.info(0x0000, 'sdk-tag-ets', 'start render');
// 控制XComponent组件的创建和销毁创建XComponent组件时会调用libentry.so中的模块注册函数Init
this.draw = !this.draw;
clearInterval(globalThis.realTimer)
})
}
.width('100%')
.backgroundColor('#777777')
}
.height('100%')
}
async aboutToAppear() {
await this.initMarkRules();
//初始化项目
await this.initProjectInfo();
//初始化sysset表
await this.initSysset()
const judge = new Judge(this)
}
//获取项目信息
async initProjectInfo() {
const that = this;
const systemParamsArr = await getSyncData('MA_SYSTEMPARM')
const itemInfoArr = await getSyncData('MA_ITEMINFO')
//@ts-ignore
const filterProjectsArr = systemParamsArr.filter(item => item.no1 == 6)
that.projects = filterProjectsArr.map(project => {
//TODO 临时代码
const testType = {
0: 1,
2: 4,
3: 3,
5: 5,
6: 2
}
const currentProject = {
name: decodeURI(project.txt1),
abbreviation: decodeURI(project.txt3),
projectCode: decodeURI(project.no2),
projectCodeCenter: decodeURI(project.txt2),
//@ts-ignore
type: testType[decodeURI(project.no2)*1]
// type:'0' + (project.type || '1')
}
that.projectsObj[project.no2] = currentProject
return currentProject
});
}
//获取扣分代码信息
async initMarkRules() {
const that = this;
const markRuleParams = await getSyncData('MA_MARKRULE')
//@ts-ignore
markRuleParams.forEach(mark => {
that.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = {
itemno: mark.itemno * 1,
markcatalog: mark.markcatalog,
markshow: decodeURI(mark.markshow),
markreal: mark.markreal * 1,
markserial: mark.markserial
};
})
}
// 获取sysset表信息
async initSysset() {
const that = this;
const db = new AccountTable(() => {
}, MA_SYSSET);
const syssetParams = await getSyncData('MA_SYSSET')
//@ts-ignore
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901');
that.serialNumber = serialNumberArr || '1234567'
}
aboutToDisappear() {
//apiJudgeSdk.stopRender();
}
}

View File

@ -88,6 +88,7 @@ struct Index {
gateway: this.inputTextList1[5],//value.gateway网关
netMask: this.inputTextList1[4],//value.netMask网络掩码
dnsServers: this.inputTextList1[6],
// @ts-ignore
domain: ""
}, (error) => {
if (error) {

View File

@ -80,7 +80,7 @@ export default struct SignDisplayCom {
@State gpsActive: number = 1
@Prop active: number = 0
@State msgStr: string = ''
@State interval: any=''
@State interval: number=0
@State @Watch('outClick') outFlag: boolean = false;
private timer = null

View File

@ -14,7 +14,7 @@ const amplifyArrs = [
]
@Component
struct EndPopup {
export default struct EndPopup {
constructor() {
super()
}
@ -35,5 +35,3 @@ struct EndPopup {
.onClick(()=>{this.closeAmplifyPop()})
}
}
export default EndPopup

View File

@ -5,7 +5,7 @@ interface SEL{
}
@Component
struct DeductedPopup {
export default struct DeductedPopup {
constructor() {
super()
}
@ -149,6 +149,4 @@ struct DeductedPopup {
.onClick(()=>{this.closePopup()})
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
}
}
export default DeductedPopup
}

View File

@ -1,6 +1,6 @@
@Component
struct EndPopup {
export default struct EndPopup {
constructor() {
super()
}
@ -22,6 +22,4 @@ struct EndPopup {
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
}
}
export default EndPopup
}

View File

@ -1,6 +1,5 @@
@Component
struct LoadingPopup {
export default struct LoadingPopup {
constructor() {
super()
}
@ -17,5 +16,3 @@ struct LoadingPopup {
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
}
}
export default LoadingPopup

View File

@ -4,13 +4,8 @@ import apiJudgeSdk from 'libJudgeSdk.so';
// import apiJudgeSdk from '@ohos.judgesdk';
import Judge from '../../judgeSDK/utils/judge-real'
// import Judge from '../../judgeSDK/judge-track-playback'
import {Project,ProjectObj,MarkRule} from '../../judgeSDK/api/judgeSDK.d'
import AccountTable from '../../../common/database/tables/AccountTable';
import MA_SYSSET from '../../../common//constants/MA_SYSSET';
import common from '@ohos.app.ability.common';
import { getSyncData } from '../../../common/service/initable'
import {testAllitems,testUIAllitems,testMarkRules} from '../../judgeSDK/dataTest/index'
@Component
struct RealTime {

View File

@ -1,25 +0,0 @@
@Component
export default struct EndPopup {
constructor() {
super()
}
private title:string = ''
private cancelFn:(event?: ClickEvent) => void
private confirmFn:(event?: ClickEvent) => void
build(){
Column(){
Column(){
Text(this.title).fontSize(38).margin({bottom:20})
Row(){}.height(50)
Row(){
Text('取消').backgroundImage($rawfile('judge/end-btn.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(250).height(100).fontSize(30).fontColor('#FFF').textAlign(TextAlign.Center).onClick(this.cancelFn)
Text('确定').backgroundImage($rawfile('judge/end-btn.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(250).height(100).fontSize(30).fontColor('#FFF').textAlign(TextAlign.Center).margin({left:45}).onClick(this.confirmFn)
}
}.width('80%').height('70%').backgroundColor('#E6E3DF').borderRadius(38).position({y:'12%',x:'10%'}).justifyContent(FlexAlign.Center)
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
}
}

View File

@ -3116,7 +3116,6 @@ export const testMarkRules = [{
}, {
"itemno": "41",
"markcatalog": "41603",
"markdepend": "通过急弯、坡路、拱桥、人行横道或者没有交通信号灯控制的路口时,不交替使用远近光灯示意",
"markreal": "-100",

View File

@ -18,11 +18,22 @@ import { judgeConfig } from './utils/judge-config'
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 prompt from '@ohos.prompt';
import {getTranslateSignals,getCarStatus,getCarStatusType,getCenterProjectStatus,plcStrToJson,plcStrToWXJson,promptWxCode,getKmProjectVoice,senorToWXDataStr} from './utils/judge-common'
import {
examJudgeSetLogCallback,
examJudgeBeginExam,
examJudgeInit,
examJudgeRealExam,
examJudgeSetRealExamCallback,
examJudgeSetPerformCallback,
examJudgeEndExam,
examJudgeArtificialMark,
examJudgeArtificialItem,
examJudgeMapSetScaling,
examJudgeMapSetParam
} from './api/index'
import UsbService from '../../common/service/usbService'
import Prompt from '@system.prompt';
const judgeTag = 'SURENJUN_JUDGE'
export default class Judge{
@ -40,6 +51,8 @@ export default class Judge{
this.fileUtil = new FileUtil(judgeUI.context)
this.judgeTask = new JudgeTask()
const mediaTest= new FilePhoto(judgeUI.context);
const usbService = new UsbService();
this.usbService = usbService
this.filePhoto = mediaTest
this.kfArr = judgeUI.kfArr
this.xmmcStr = '';this.xmmcCode = '';this.carztStr = '';
@ -130,12 +143,19 @@ export default class Judge{
console.info(judgeTag,'6.开始考试注册完成')
avPlayer.playAudio(['voice/ksks.WAV'])
await examJudgeMapSetParam(640, 480); //设置参数宽、高
await examJudgeMapSetScaling(120); //设置缩放比例一般默认填100就是100%的意思) 数字越大视野越大数字越小视野越小不能为0
this.judgeUI.draw = true
// 处理轨迹plc信息
if(isTrajectoryOpen){
handleTrajectoryUdp(strArr);
return
}
// 处理实时udp里的plc信号
globalThis.udpClient.onMessage(async (msg) => {
handleUdp(msg)
@ -250,12 +270,15 @@ export default class Judge{
const {xmdm,code} = sound;
//判断是不是模拟灯光语音
const isLight = code.slice(0,3) === '417';
console.info(judgeTag,'评判语音提示' + JSON.stringify(sound))
if(isLight){
console.info(judgeTag,'模拟灯光开始播放:' + code)
}
avPlayer.playAudio([`voice/${code}.mp3`],true,()=>{
if(isLight){
this.wav = 1;
console.info(judgeTag,'模拟灯光播放代码:' + code)
console.info(judgeTag,'播放结束:' + code)
setTimeout(()=>{
this.wav = 1;
})
}
})
@ -338,7 +361,7 @@ export default class Judge{
const {judgeConfigObj,totalScore} = judgeUI
if(judgeConfigObj['344'] == 1){
prompt.showToast({
Prompt.showToast({
message: '考试未结束,不允许手动退出!',
duration: 4000
});
@ -788,7 +811,6 @@ export default class Judge{
let tempArr = [];
arr.forEach(itemArr =>{ tempArr = tempArr.concat(itemArr)})
this.serialIndex += 1;
console.log('kmkmkm2',tempArr.length)
return Array2Byte(tempArr)
}
@ -940,6 +962,7 @@ export default class Judge{
handleTrajectoryUdp = async (strArr) => {
const {fileLog} = this;
let num = 2;
const {usbService} = this;
const judgeTimer = setInterval(async ()=>{
const msg = JSON.parse(strArr[num]);
await fileLog.setExamJudgeData(msg)
@ -954,6 +977,11 @@ export default class Judge{
this.tempData = msg
this.plcData= msg
globalThis.msgStr= ''
const str = await senorToWXDataStr(msg);
//检测到有无锡所设备接入,需要发送特定的数据,供检测
if(usbService.isWXUSBDevice){
usbService.sendUSB(str)
}
await examJudgeRealExam(msg)
num++
},200)
@ -1019,6 +1047,7 @@ export default class Judge{
private xmxh:string
private fileModel:FileModel
private filePhoto:FilePhoto
private usbService:UsbService
//是否是考试模式
private isExam:boolean
//考试是否结束了

View File

@ -301,6 +301,56 @@ export const plcStrToWXJson = async (plc:string) =>{
return wuXiDataStr
}
export const senorToWXDataStr= async (tempData) => {
const {sensor,gps} = tempData;
const timeStr = await getTimeStr()
const {mkg,aqd,dh1,dh2, zfxd, yfxd, jgd, ygd,ssc , jsc, lhq, fsc, lb, ygq,wd} = sensor
const judgeSignal = [
//车门 安全带 熄火 发动机启动 左转向 右转向 前照灯近灯 前照灯远灯
mkg, aqd, dh1, dh2, zfxd, yfxd, jgd, ygd,
// 注车制动 行车制动 离合器 副制动 喇叭 雨刷 危险报警灯 示廓灯 系统未涉及的传感器信号
ssc , jsc, lhq, fsc, lb, ygq, 0, 0, 0
]
const judgeAnotherSignal = [
// 低三挡位 左侧单边桥1 左侧单边桥2 右侧单边桥1 右侧单边桥2 雾灯
'000', '0', '0', '0', '0', '0',,'0',
// 桩杆全无信号 左后绕车 右后绕车 右前绕车 左前绕车
'000', '0', '0', '0', '0', '0','0'
]
//@ts-ignore
const str1 = (judgeSignal.join('')*1).toString(16);
//@ts-ignore
const str2 = (judgeAnotherSignal.join('')*1).toString(16);
const wuXiData = [
// 卫星时间 精度 纬度 高度 方位角 俯仰角 速度角 速度 横滚 卫星定位状态
'$KSXT', timeStr, gps.jd, gps.wd, gps.hbg, gps.hxj, gps.fyj, '0' , gps.sd, '0', gps.dwzt,
//前天线可用星数 后天线可用星数 东向坐标位置 北向位置坐标 天向位置坐标 东向速度 北向速度 天向速度
'0', '0', '0', '0', '0', '0', '0', '0','0',
//@ts-ignore 评判信号1 评判信号2 发动机转速
// (judgeSignal.join('')*1).toString(16), (judgeAnotherSignal.join('')*1).toString(16) , sensor.fdjzs,
'0006', '0001' , sensor.fdjzs,
'0xFFFFFFF'
]
return wuXiData.map(d => (d + '')).join(',');
// console.log('wuXiData',wuXiData.join(','));
}
export const getTimeStr = async () =>{
const date = await systemTime.getDate()
const timeStr = '';
const Y = date.getFullYear();
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) ;
const D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
const h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours());
const m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes());
const s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
const ss = (date.getMilliseconds() +'').slice(0,2);
return timeStr + Y + M +D +h +m +s +'.' + ss
}
//蓝灯
export function sendBlue(){
const arrBlue = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00];

View File

@ -3,15 +3,14 @@
//考试回放开关
export const judgeConfig = {
//本地目录开关
isTrajectoryOpen: false,
isTrajectoryOpen: true,
//是否开启Udp
udpOpen:false,
// 本地模型地址
modelPath: 'models/model_enc',
// 轨迹回放地址
trajectoryPath: 'logs/2024_06_18/0000000000001_342323199501470011_测试学员1_2024_06_18_14_32_25/judge_exam_data.txt'
trajectoryPath: 'logs/2024_06_18/0000000000001_342323199501470011_测试学员1_2024_06_26_10_04_23/judge_exam_data.txt'
}
//0000000000001_342323199501470011_测试学员1_2024_04_28_10_59_44
// 模拟灯光轨迹
// test_sub3_car_test_jinan-32038219990808021X-20240417092356.txt

View File

@ -1,11 +1,5 @@
import {
examJudgeSetLogCallback,
examJudgeBeginExam,
examJudgeInit,
examJudgeRealExam,
examJudgeSetRealExamCallback,
examJudgeMapSetParam,
examJudgeMapSetDrawing,
examJudgeMapSetScaling
} from '../api/index'
import systemTime from '@ohos.systemDateTime';

View File

@ -1,4 +1,5 @@
import prompt from '@ohos.prompt'
import Prompt from '@system.prompt'
const TAG = 'SURENJUN_JUDGE'
export default class JudgeTask{
@ -17,8 +18,8 @@ export default class JudgeTask{
try {
await currentTask();
}catch (e){
console.info(TAG,'过程数据接口解析错误')
prompt.showToast({
// console.info(TAG,'过程数据接口解析错误')
Prompt.showToast({
message: '过程数据接口解析错误',
duration: 3000
});

View File

@ -1,5 +1,5 @@
import media from '@ohos.multimedia.media';
import prompt from '@ohos.prompt';
import Prompt from '@system.prompt';
const TAG = 'VoiceAnnounce'
@ -84,7 +84,7 @@ class AVPlayer {
url = await globalThis.context.resourceManager.getRawFd(name);
this.avPlayer.fdSrc = url;
} catch (e) {
prompt.showToast({
Prompt.showToast({
message: `${name}语音文件不存在`,
duration: 4000
});

View File

@ -9,7 +9,6 @@
"pages/TerminalInfos",
"pages/VideoConfig",
"pages/SignDisplay",
"pages/RealTime",
"pages/Roads",
"pages/Judge"
],

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More