feat_surenjun #20
@ -93,11 +93,15 @@ export default class UsbService{
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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) {
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,7 @@ 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 {getTranslateSignals,getCarStatus,getCarStatusType,getCenterProjectStatus,plcStrToJson,plcStrToWXJson,promptWxCode,getKmProjectVoice,senorToWXDataStr}  from './utils//judge-common'
 | 
			
		||||
import {examJudgeSetLogCallback,examJudgeBeginExam,examJudgeInit,examJudgeRealExam,examJudgeSetRealExamCallback,examJudgeSetPerformCallback,examJudgeEndExam,examJudgeArtificialMark,examJudgeArtificialItem} from './api/index'
 | 
			
		||||
import UsbService from '../../common/service/usbService'
 | 
			
		||||
 | 
			
		||||
@ -926,6 +926,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)
 | 
			
		||||
@ -940,6 +941,12 @@ export default class Judge{
 | 
			
		||||
      this.tempData = msg
 | 
			
		||||
      this.plcData= msg
 | 
			
		||||
      globalThis.msgStr= ''
 | 
			
		||||
      const str = await senorToWXDataStr(msg);
 | 
			
		||||
      //检测到有无锡所设备接入,需要发送特定的数据,供检测
 | 
			
		||||
      if(usbService.isWXUSBDevice){
 | 
			
		||||
        usbService.sendUSB(str)
 | 
			
		||||
      }
 | 
			
		||||
      console.info(judgeTag,str)
 | 
			
		||||
      await examJudgeRealExam(msg)
 | 
			
		||||
      num++
 | 
			
		||||
    },200)
 | 
			
		||||
@ -1005,7 +1012,7 @@ export default class Judge{
 | 
			
		||||
  private xmxh:string
 | 
			
		||||
  private fileModel:FileModel
 | 
			
		||||
  private filePhoto:FilePhoto
 | 
			
		||||
  private usbService:UsbService
 | 
			
		||||
  private usbService:any
 | 
			
		||||
  //是否是考试模式
 | 
			
		||||
  private isExam:boolean
 | 
			
		||||
  //考试是否结束了
 | 
			
		||||
 | 
			
		||||
@ -315,7 +315,7 @@ export const senorToWXDataStr= async (tempData) => {
 | 
			
		||||
 | 
			
		||||
  const judgeAnotherSignal = [
 | 
			
		||||
  // 低三挡位 左侧单边桥1 左侧单边桥2 右侧单边桥1 右侧单边桥2 雾灯
 | 
			
		||||
    '000',    '0',       '0',      '0',      '0',     wd,,'0',
 | 
			
		||||
    '000',    '0',       '0',      '0',      '0',     '0',,'0',
 | 
			
		||||
    // 桩杆全无信号  左后绕车 右后绕车 右前绕车 左前绕车
 | 
			
		||||
    '000',         '0',   '0',    '0',   '0',   '0','0'
 | 
			
		||||
  ]
 | 
			
		||||
@ -326,17 +326,31 @@ export const senorToWXDataStr= async (tempData) => {
 | 
			
		||||
 | 
			
		||||
  const wuXiData = [
 | 
			
		||||
  //         卫星时间     精度    纬度     高度      方位角    俯仰角    速度角  速度      横滚  卫星定位状态
 | 
			
		||||
    '$KSXT', timeStr,   gps.jd, gps.wd, gps.hbg, gps.hxj, gps.fyj, ''    , gps.sd, '',  gps.dwzt,
 | 
			
		||||
    '$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,
 | 
			
		||||
    // (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];
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@ export const judgeConfig = {
 | 
			
		||||
  // 本地模型地址
 | 
			
		||||
  modelPath: 'models/model_enc',
 | 
			
		||||
  // 轨迹回放地址
 | 
			
		||||
  trajectoryPath: 'logs/2023_06_14/0000000000001_342323199501470011_测试学员1_2023_06_14_15_33_31/judge_exam_data.txt'
 | 
			
		||||
  trajectoryPath: 'logs/0000000000001_342323199501470011_测试学员1_1970_01_01_08_44_33/judge_exam_data.txt'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//0000000000001_342323199501470011_测试学员1_2024_04_28_10_59_44
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user