Compare commits

..

No commits in common. "33bb4207253c1493ecd1232765bcfc2e40166656" and "78436c39f76d542599e1a6981582b295018ba671" have entirely different histories.

14 changed files with 353 additions and 307 deletions

View File

@ -498,7 +498,6 @@ export interface JudgeUI {
dw: string
endExamDialogController: CustomDialogController
generateExamRecordsDialogController: CustomDialogController
laneSignal:PerLane,
}

View File

@ -207,7 +207,9 @@ struct Index {
DifferentialAndSignal.init()
this.initWork = true
}
DifferentialAndSignal.onMsg(() => {
// dConsole.log("外层接受")
})
}
build() {

View File

@ -38,15 +38,14 @@ import {
SyssetConfig,
SYSTEMPARMARR,
User,
ProcessDataEnumType,
PerLane
ProcessDataEnumType
} from '../model';
import { GetSyncData } from '../utils/table/Operation';
import dayTs from '../utils/Date';
import { GetCurrentTime } from '../utils/Common';
import FileUtils from '../utils/FileUtils';
import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog';
import { DefaultJudgeConfigData, InitialPerLane, ProcessDataMock } from '../mock';
import { DefaultJudgeConfigData, ProcessDataMock } from '../mock';
import { dConsole } from '../utils/LogWorker';
import ConfirmDialog from './compontents/ConfirmDialog';
import CarLoadingDialog from './compontents/CarLoading';
@ -147,18 +146,10 @@ struct JudgePage {
@State carInfo: CarInfoType = {}
@State isErrorMsgEnd: boolean = false
@State disConnectErrorOpen: boolean = false
@State @Watch("laneSignalChange") laneSignal: PerLane = InitialPerLane
laneSignalChange() {
dConsole.log("车道信号变化1", this.laneSignal)
}
public context = getContext(this) as common.UIAbilityContext;
// 信号查看弹窗
signalTrajectoryDialogController: CustomDialogController = new CustomDialogController({
builder: SignalTrajectoryDialog({
laneSignal: this.laneSignal
}),
builder: SignalTrajectoryDialog(),
customStyle: true,
autoCancel: true
})
@ -176,7 +167,8 @@ struct JudgePage {
text: "确认结束考试?",
onConfirm: async () => {
if (this.isErrorMsgEnd) {
dConsole.log(JudgeTag, "router back1")
dConsole.log(JudgeTag, "结束考试")
this.judge.closeAllFiles()
router.back()
return
}
@ -195,7 +187,7 @@ struct JudgePage {
try {
this.judge.checkExamIsEnd(true);
} catch (e) {
dConsole.log(JudgeTag, "router back2")
this.judge.closeAllFiles()
router.back()
}
}
@ -513,7 +505,6 @@ struct JudgePage {
message: '读取数据库信息失败,请重新联网更新!',
duration: 8000
});
dConsole.log(JudgeTag, "router back3")
router.back();
}
}
@ -696,13 +687,9 @@ struct JudgePage {
Column() {
// 顶部
HeaderComponent({
logoExpansionBuilder: () => {
this.logoExpansionBuilder()
},
logoExpansionBuilder: this.logoExpansionBuilder,
customizeReturnArea: true,
backAreaBuilder: () => {
this.backAreaBuilder()
}
backAreaBuilder: this.backAreaBuilder
})
Row() {
Row() {

View File

@ -1,14 +1,9 @@
import { PerLane } from '../../model'
import { dConsole } from '../../utils/LogWorker'
import SignalDisplayComponent from '../compontents/SignalDisplay'
import TabComponent from '../compontents/Tab'
@CustomDialog
export default struct SignalTrajectoryDialog {
@State active: number = 0
@Link laneSignal: PerLane
private controller?: CustomDialogController
build() {
@ -37,8 +32,7 @@ export default struct SignalTrajectoryDialog {
Scroll() {
Column() {
SignalDisplayComponent({
active: this.active,
laneSignal: this.laneSignal
active: this.active
})
}.height(890)
}.width("100%")

View File

@ -1,7 +1,6 @@
import SignalDisplayComponent from './compontents/SignalDisplay';
import router from '@ohos.router';
import TabComponent from './compontents/Tab';
import { InitialPerLane } from '../mock';
@Entry
@Component
@ -42,8 +41,7 @@ struct SignDisplayPage {
}.width("100%").height(100)
SignalDisplayComponent({
active: this.active,
laneSignal: InitialPerLane
active: this.active
})
}
.width('100%')

View File

@ -14,7 +14,6 @@ struct TerminalInfoPage {
@State config: EnvironmentConfigurationType = {}
private fileUtil!: FileUtils
private context = getContext(this) as common.UIAbilityContext;
@State isProcessing: boolean = false;
async aboutToAppear() {
this.fileUtil = new FileUtils(this.context)
@ -40,199 +39,172 @@ struct TerminalInfoPage {
Column() {
Column() {
Button().opacity(1).width(0).height(0)
Scroll() {
Flex({
wrap: FlexWrap.Wrap,
}) {
if (this.config.isOpenFiniteDifference === "1") {
blockComponent({
value: this.config.tcpOppositeIp,
change: (value: string) => {
this.config.tcpOppositeIp = value;
}
})
blockComponent({
label: "差分响应端口",
value: this.config.tcpOppositePort,
change: (value: string) => {
this.config.tcpOppositePort = value;
}
})
Flex({
wrap: FlexWrap.Wrap,
}) {
if (this.config.isOpenFiniteDifference === "1") {
blockComponent({
value: this.config.tcpOppositeIp,
change: (value: string) => {
this.config.tcpOppositeIp = value;
}
})
blockComponent({
label: "差分响应端口",
value: this.config.tcpOppositePort,
change: (value: string) => {
this.config.tcpOppositePort = value;
}
})
}
blockComponent({
label: "中心服务器IP",
value: this.config.centerIp,
change: (value: string) => {
this.config.centerIp = value;
}
blockComponent({
label: "中心服务器IP",
value: this.config.centerIp,
change: (value: string) => {
this.config.centerIp = value;
}
})
blockComponent({
label: "中心响应端口",
value: this.config.centerPort,
change: (value: string) => {
this.config.centerPort = value;
}
})
blockComponent({
label: "后置机IP",
value: this.config.udpOppositeIp,
change: (value: string) => {
this.config.udpOppositeIp = value;
}
})
blockComponent({
label: "后置机响应端口",
value: this.config.udpOppositeIpPort,
change: (value: string) => {
this.config.udpOppositeIpPort = value;
}
})
if (this.config.carType === "4") {
blockComponent({
label: "后置机响应端口2",
value: this.config.udpOppositeIpPortTwo,
change: (value: string) => {
this.config.udpOppositeIpPortTwo = value;
}
})
})
blockComponent({
label: "中心响应端口",
value: this.config.centerPort,
change: (value: string) => {
this.config.centerPort = value;
}
blockComponent({
label: "前置机IP",
value: this.config.udplocalIp,
change: (value: string) => {
this.config.udplocalIp = value;
this.config.tcplocalIp = value
}
})
blockComponent({
label: "后置机UDP本地端口",
value: this.config.udplocalIpPort,
change: (value: string) => {
this.config.udplocalIpPort = value;
}
})
if (this.config.carType === "4") {
blockComponent({
label: "后置机UDP本地端口2",
value: this.config.udplocalIpPortTwo,
change: (value: string) => {
this.config.udplocalIpPortTwo = value;
}
})
})
blockComponent({
label: "后置机IP",
value: this.config.udpOppositeIp,
change: (value: string) => {
this.config.udpOppositeIp = value;
}
// blockComponent({
// label: "TCP本地端口",
// value: this.config.tcplocalIpPort,
// change: (value: string) => {
// this.config.tcplocalIpPort = value;
// }
// })
})
blockComponent({
label: "后置机响应端口",
value: this.config.udpOppositeIpPort,
change: (value: string) => {
this.config.udpOppositeIpPort = value;
}
})
if (this.config.carType === "4") {
blockComponent({
label: "子网掩码",
value: this.config.netMask,
label: "后置机响应端口2",
value: this.config.udpOppositeIpPortTwo,
change: (value: string) => {
this.config.netMask = value;
this.config.udpOppositeIpPortTwo = value;
}
})
}
blockComponent({
label: "前置机IP",
value: this.config.udplocalIp,
change: (value: string) => {
this.config.udplocalIp = value;
this.config.tcplocalIp = value
}
})
blockComponent({
label: "后置机UDP本地端口",
value: this.config.udplocalIpPort,
change: (value: string) => {
this.config.udplocalIpPort = value;
}
})
if (this.config.carType === "4") {
blockComponent({
label: "默认网关",
value: this.config.gateway,
label: "后置机UDP本地端口2",
value: this.config.udplocalIpPortTwo,
change: (value: string) => {
this.config.gateway = value;
this.config.udplocalIpPortTwo = value;
}
})
blockComponent({
label: "DNS",
value: this.config.dnsServers,
change: (value: string) => {
this.config.dnsServers = value;
}
})
blockComponent({
label: "外壳版本",
value: this.config.version,
change: (value: string) => {
this.config.version = value;
}
})
blockComponent({
label: "评判版本",
value: this.config.judgeVersion,
change: (value: string) => {
this.config.judgeVersion = value;
}
})
blockComponent({
label: "车型",
type: 4,
value: this.config.carType,
change: (value: string) => {
this.config.carType = value;
}
})
blockComponent({
label: "后置机类型",
type: 1,
value: this.config.rearMachineModel,
change: (value: string) => {
this.config.rearMachineModel = value;
}
})
blockComponent({
label: "是否开启差分",
type: 5,
value: this.config.isOpenFiniteDifference,
change: (value: string) => {
this.config.isOpenFiniteDifference = value;
}
})
blockComponent({
label: "是否开启日志",
type: 2,
value: this.config.isOpenLog,
change: (value: string) => {
this.config.isOpenLog = value;
}
})
blockComponent({
label: "板卡类型",
type: 3,
value: this.config.boardType,
change: (value: string) => {
this.config.boardType = value;
}
})
blockComponent({
label: "开启调试(重启APP)",
type: 6,
value: this.config.isOpenDebugger,
change: (value: string) => {
this.config.isOpenDebugger = value;
}
})
}.margin(20)
}
// blockComponent({
// label: "TCP本地端口",
// value: this.config.tcplocalIpPort,
// change: (value: string) => {
// this.config.tcplocalIpPort = value;
// }
// })
blockComponent({
label: "子网掩码",
value: this.config.netMask,
change: (value: string) => {
this.config.netMask = value;
}
})
blockComponent({
label: "默认网关",
value: this.config.gateway,
change: (value: string) => {
this.config.gateway = value;
}
})
blockComponent({
label: "DNS",
value: this.config.dnsServers,
change: (value: string) => {
this.config.dnsServers = value;
}
})
blockComponent({
label: "车型",
type: 4,
value: this.config.carType,
change: (value: string) => {
this.config.carType = value;
}
})
blockComponent({
label: "后置机类型",
type: 1,
value: this.config.rearMachineModel,
change: (value: string) => {
this.config.rearMachineModel = value;
}
})
blockComponent({
label: "是否开启差分",
type: 5,
value: this.config.isOpenFiniteDifference,
change: (value: string) => {
this.config.isOpenFiniteDifference = value;
}
})
blockComponent({
label: "是否开启日志",
type: 2,
value: this.config.isOpenLog,
change: (value: string) => {
this.config.isOpenLog = value;
}
})
blockComponent({
label: "板卡类型",
type: 3,
value: this.config.boardType,
change: (value: string) => {
this.config.boardType = value;
}
})
blockComponent({
label: "是否开启调试",
type: 6,
value: this.config.isOpenDebugger,
change: (value: string) => {
this.config.isOpenDebugger = value;
}
})
}
.height(650)
.width("100%")
.backgroundColor("#282828")
.height(650)
.borderRadius(20)
.margin(20)
.padding({
top: 10
})
Row() {
Image($r('app.media.bc')).height(80).objectFit(ImageFit.Contain).onClick(() => {
if (this.isProcessing) {
Prompt.showToast({
message: "请勿频繁点击",
duration: 3000
})
return
}
this.isProcessing = true
dConsole.log(TerminalInfoTag, "保存配置", JSON.stringify(this.config))
AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config)
this.fileUtil.addFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt', JSON.stringify(this.config))
@ -256,13 +228,8 @@ struct TerminalInfoPage {
message: '设置成功',
duration: 3000
});
// 延迟几秒
setTimeout(() => {
this.isProcessing = false
}, 3000)
}
});
})
}
.width("100%")

View File

@ -28,18 +28,14 @@ export default struct SignalDisplayComponent {
// 原始数据
@State rawData: string = "$GPS,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
// 车道信息
@Link @Watch("laneSignalChange") laneSignal: PerLane
laneSignalChange(){
dConsole.log("车道信号变化3",this.laneSignal)
}
@State laneSignal: PerLane = InitialPerLane
aboutToAppear(): void {
DifferentialAndSignal.onMsg(this.getMsg)
}
aboutToDisappear(): void {
DifferentialAndSignal.offMsg(this.getMsg)
DifferentialAndSignal.onMsg(this.getMsg)
}
getMsg = (data: string) => {
@ -166,7 +162,6 @@ export default struct SignalDisplayComponent {
struct trajectoryComponent {
@State scaleNum: number = 100
scaleFn = async (num: number) => {
console.log("缩放传入数据", num.toString())
const scaleNum = this.scaleNum
if (scaleNum > 0 && scaleNum < 5000) {
this.scaleNum += num;
@ -177,7 +172,6 @@ struct trajectoryComponent {
if (scaleNum > 5000 && num < 0) {
this.scaleNum += num;
}
console.log("缩放数据", this.scaleNum.toString())
await examJudgeMapSetScaling(this.scaleNum);
}
getScaleNum = (): number => {
@ -193,7 +187,7 @@ struct trajectoryComponent {
build() {
Stack({
alignContent: Alignment.TopEnd
alignContent: Alignment.TopStart
}) {
XComponent({
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称注意这个ID要和C++侧一致,不能变
@ -212,7 +206,7 @@ struct trajectoryComponent {
})
Row() {
Image($rawfile('judge/big.png')).width(60).onClick(() => {
this.scaleFn(-this.getScaleNum())
this.scaleFn(this.getScaleNum() - 1)
})
Image($rawfile('judge/small.png')).width(60).onClick(() => {
this.scaleFn(this.getScaleNum())
@ -247,7 +241,6 @@ struct LaneComponent {
]
getValues(roadColumn: RoadDataType) {
dConsole.log(SignDisplayTag, "车道信息", this.laneSignal)
let key = roadColumn.key;
let str = ''
if (Array.isArray(key)) {

View File

@ -0,0 +1,161 @@
import apiJudgeSdk from 'libJudgeSdk.so';
import { examJudgeMapSetScaling } from '../../judgeSDK/api';
import { PerLane } from '../../../model';
import { InitialPerLane } from '../../../mock';
interface RoadDataType {
name: string,
key: string | string[]
}
@Component
export default struct RealTime {
@State message: string = '开始绘制'
// 控制XComponent组件的创建和销毁
@State draw: boolean = false
//模拟考试项目
@State scaleNum: number = 100
@State gpsActive: number = 1
@State ratio: number = 1
@State lane: PerLane = InitialPerLane
scaleFn = async (num: number) => {
const scaleNum = this.scaleNum
if (scaleNum > 0 && scaleNum < 5000) {
this.scaleNum += num;
}
if (scaleNum === 0 && num > 0) {
this.scaleNum += num;
}
if (scaleNum > 5000 && num < 0) {
this.scaleNum += num;
}
await examJudgeMapSetScaling(this.scaleNum);
}
private widthNumber: string | number | Resource = 0
private heightNumber: string | number | Resource = 0
private RoadData: Array<RoadDataType> = [
{ name: '路段组号', key: 'MapRoad_Code_No' },
{ name: '路段编码', key: 'MapRoad_Name' },
{ name: '车轮压线', key: ['TouchLineType', 'TouchDir'] },
{ name: '车身碰线', key: ['TouchLineTypeCS', 'TouchLineDirCS'] },
{ name: '基准车道', key: ['BasePointInLaneNo', 'BaseLaneCount'] },
{ name: '前点车道', key: ['FrontPointLaneNo', 'FrontPointLaneCount'] },
{ name: '后车点道', key: ['BackPointLaneNo', 'BackPointLaneCount'] },
{ name: '左前/后车身距离', key: ['Body_LF_ToLeftEdge', 'Body_LB_ToLeftEdge'] },
{ name: '右前/后车身距离', key: ['Body_RF_ToRightEdge', 'Body_RB_ToRightEdge'] },
{ name: '右前/后车身边线', key: ['Body_RF_ToBaseLine', 'Body_RB_ToBaseLine'] },
{ name: '右前/后轮距离', key: ['Wheel_RF_ToRightEdge', 'Wheel_RB_ToRightEdge'] },
{ name: '右前/后轮边线', key: ['Wheel_RF_ToBaseLine', 'Wheel_RB_ToBaseLine'] },
{ name: '左前/后轮距离', key: ['Wheel_LF_ToRightEdge', 'Wheel_LB_ToRightEdge'] },
{ name: '左前/后轮边线', key: ['Wheel_LF_ToBaseLine', 'Wheel_LB_ToBaseLine'] },
{ name: '车道属性', key: ['BasePointInLaneDir', 'CrossLineAttr', 'DirInverse'] },
{ name: '形状', key: ['InShapeAttr', 'ShapeNo', 'ShapeNoWheel'] },
{ name: '路段点', key: ['CrossPointNo'] },
]
async aboutToDisappear() {
// clearInterval(this.timer)
}
async aboutToAppear() {
// const judge = new Judge(this)
// let timer = setInterval(() => {
// this.lane = globalThis.laneData;
// }, 1000)
// this.timer = timer
}
getScaleNum = (): number => {
const scaleNum = this.scaleNum;
if (scaleNum < 200) return 10;
if (scaleNum < 400) return 30;
if (scaleNum < 600) return 50;
if (scaleNum < 800) return 70;
if (scaleNum < 1000) return 100;
if (scaleNum < 2000) return 500;
return 1000;
}
getValues(roadColumn: RoadDataType) {
const lane = this.lane;
let key = roadColumn.key;
let str = ''
if (Array.isArray(key)) {
key.forEach((k, index) => {
str += (Reflect.get(lane, k) === undefined ? '' : Reflect.get(lane, k)) + (index == key.length - 1 ? '' : '/')
})
} else {
str = Reflect.get(lane, key) === undefined ? '' : Reflect.get(lane, key)
}
return str
}
build() {
Row() {
Column() {
Row() {
Text('车道信息').fontColor(this.gpsActive == 0 ? '#2D3C5A' : '#fff').fontSize(20)
}
.width('100%')
.height(37)
.backgroundColor(this.gpsActive == 0 ? '#fff' : '#1A1A1A')
.margin({ top: 10 * this.ratio, right: 10 })
.justifyContent(FlexAlign.Center)
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) {
ForEach(this.RoadData, (item: RoadDataType) => {
Column() {
Text(`${item.name}:${this.getValues(item)}`)
.fontSize(20)
.lineHeight(30)
.fontColor('#fff')
}.height(30).justifyContent(FlexAlign.Start).width('100%')
})
}.margin({ top: 5 })
}.width(168 * 1.5)
.height(this.heightNumber)
.backgroundColor('#282828')
.margin({ top: 6 * this.ratio, })
Column() {
if (this.draw) {
XComponent({
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称注意这个ID要和C++侧一致,不能变
type: 'surface',
libraryname: 'JudgeSdk'
// libraryname: 'judgesdk'
})
.width(this.widthNumber)
.height(this.heightNumber)
.onLoad(() => {
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制
})
.onDestroy(() => {
apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹false:表示结束绘制
this.draw = false;
// clearInterval(globalThis.realTimer)
})
} else {
Column() {
}
.width(this.widthNumber)
.height(this.heightNumber)
}
}
.width('100%')
.backgroundColor('#fff')
Row() {
Image($rawfile('judge/big.png')).width(60).onClick(() => {
this.scaleFn(this.getScaleNum() - 1)
})
Image($rawfile('judge/small.png')).width(60).onClick(() => {
this.scaleFn(this.getScaleNum())
}).margin({ left: 20 })
}.position({ x: '32%', y: 60 })
}
.height('100%')
}
}

View File

@ -285,16 +285,6 @@ export default class Judge {
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
return
}
const gpsPart = msg.split("#END$GPS,")[1];
const gpsStatus = gpsPart.split(",")[0];
if (gpsStatus === "4") {
dConsole.log(JudgeTag, "差分状态正常", gpsStatus)
this.judgeUI.isDwztRight = true
} else {
dConsole.log(JudgeTag, "差分状态异常", gpsStatus)
this.judgeUI.isDwztRight = false
}
this.judgeUI.isDwztRight
const plcData = await this.getPlcData(msg);
// 4.过程数据
await this.fileLog?.setExamJudgeData(JSON.stringify(plcData))
@ -601,7 +591,7 @@ export default class Judge {
num++
// 4.过程数据
this.tempData = msg
// this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3);
this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3);
this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + '';
this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + ''
this.plcData = msg
@ -1085,6 +1075,7 @@ export default class Judge {
const checkExamIsEnd = this.checkExamIsEnd
const checkProjectIsStart = this.checkProjectIsStart
const lane = this.lane
const closeAllFiles = this.closeAllFiles
const projectsObj: object = judgeUI.projectsObj
const judgeConfigObj: object = judgeUI.judgeConfigObj
@ -1341,6 +1332,7 @@ export default class Judge {
const avPlayer = this.avPlayer
const judgeTask = this.judgeTask
const isManual = this.isManual
const closeAllFiles = this.closeAllFiles
const judgeConfigObj = judgeUI.judgeConfigObj
const examSubject = judgeUI.examSubject
@ -1362,7 +1354,7 @@ export default class Judge {
if (!singlePlay && isManual && !isAllProjectsEnd) {
avPlayer?.playAudio(['voice/empty.mp3'], true, () => {
this.isUdpEnd = true;
dConsole.log(JudgeTag, "router back7")
closeAllFiles()
router.back();
})
return
@ -1404,6 +1396,7 @@ export default class Judge {
const avPlayer = this.avPlayer
const kfArr = this.kfArr
const filePath = this.filePath
const closeAllFiles = this.closeAllFiles
const lsh = judgeUI.lsh;
const idCard = judgeUI.idCard;
@ -1443,7 +1436,6 @@ export default class Judge {
drvexam
}
let backTimeOut = setTimeout(() => {
dConsole.log(JudgeTag, "router back6")
router.back()
}, 90 * 1000)
const temp = await this.sendWriteObjectOut(data, filePath);
@ -1457,6 +1449,7 @@ export default class Judge {
this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!'
}
this.isUdpEnd = true;
closeAllFiles()
// this.judgeUI.loadingPopupVisible = false;
dConsole.log(JudgeTag, ' 关闭车辆loading1')
this.judgeUI.generateExamRecordsDialogController.close()
@ -1543,7 +1536,7 @@ export default class Judge {
if (kfArr && kfArr.length - 1 === index) {
avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
this.isUdpEnd = true;
dConsole.log(JudgeTag, "router back4")
closeAllFiles()
router.back();
})
throw new Error('End Loop')
@ -1552,7 +1545,7 @@ export default class Judge {
} else {
avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
this.isUdpEnd = true;
dConsole.log(JudgeTag, "router back5")
closeAllFiles()
router.back();
})
throw new Error('End Loop')
@ -1566,10 +1559,9 @@ export default class Judge {
avPlayer?.playAudio([voiceURL], true, () => {
setTimeout(() => {
this.isUdpEnd = true
closeAllFiles()
dConsole.log(JudgeTag, ' 关闭车辆loading2')
this.judgeUI.generateExamRecordsDialogController.close()
dConsole.log(JudgeTag, "router back8")
DifferentialAndSignal.clearMsg()
router.back();
}, param302 == '8' ? 3000 : 0)
})
@ -1849,6 +1841,11 @@ export default class Judge {
break;
}
}
closeAllFiles = () => {
setTimeout(() => {
this.fileLog?.closeAllFiles()
}, 1000)
}
//开始评判
private async judging(callBack: Function) {
@ -1860,8 +1857,15 @@ export default class Judge {
const kssycs = judgeUI.kssycs
const manualMarkRules = judgeUI.manualMarkRules
const fileLog = new FileLog(judgeUI.context);
const filePath = await fileLog?.initFileLogo({
name, lsh, idCard
});
this.fileLog = fileLog;
this.filePath = filePath;
const getJudgeBeginData = this.getJudgeBeginData;
const handleUdp = this.handleUdp;
const handDistance = this.getJudgeBeginData;
const handleTrajectoryUdp = this.handleTrajectoryUdp;
const isTrajectoryOpen = this.isTrajectoryOpen;
@ -1880,7 +1884,7 @@ export default class Judge {
await examJudgeSetLogCallback(3, async (level: number, info: string, len: number) => {
dConsole.log(JudgeTag, '评判日志:' + info)
// await fileLog?.setExamJudgeLogData(info);
dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData, info)
dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData,info)
})
dConsole.info(JudgeTag, '2.注册日志回调完成')
@ -1899,7 +1903,7 @@ export default class Judge {
await examJudgeSetRealExamCallback(async (strData: string, len: number) => {
// 评判回调日志
// await fileLog?.setExamJudgeCallbackData(strData)
dConsole.writeProcessData(ProcessDataEnumType.JudgeProgressCallbackData, strData)
dConsole.writeProcessData(ProcessDataEnumType.JudgeProgressCallbackData,strData)
dConsole.info(JudgeTag, '评判回调数据', strData)
await this.handleRealExam(strData, callBack)
})
@ -1915,8 +1919,6 @@ export default class Judge {
this.judgeUI.jl = jl
//TODO 待优化 跨组件传值不生效
// globalThis.laneData = performInfo.lane;
dConsole.log(JudgeTag, "车道信息", performInfo.lane)
this.judgeUI.laneSignal = performInfo.lane
})
let beginExamInfo: JudgeBeginObj | undefined = undefined
@ -1927,6 +1929,7 @@ export default class Judge {
} else {
beginExamInfo = await getJudgeBeginData()
}
await fileLog?.setExamJudgeData(JSON.stringify(beginExamInfo))
if (beginExamInfo) {
await examJudgeBeginExam(beginExamInfo);
}
@ -1958,7 +1961,7 @@ export default class Judge {
DifferentialAndSignal.onMsg((data: string) => {
const result: WorkerBackMessage = JSON.parse(data)
if (result.type === WorkerBackMessageType.ObtainUdpData) {
this.handleUdp(result.data as string)
handleUdp(result.data as string)
dConsole.writeProcessData(ProcessDataEnumType.PlcData, result.data as string)
}
//TODO UDP修改

View File

@ -29,8 +29,8 @@ export default class FileLog {
}
// 无锡所接口数据
public setExamJudgeWuxiData = async (str: string) => {
// this.examJudgeWuxiDataFd =
// await this.fileUtil.editFile(`${this.folderPath}/wuxi_exam_data.txt`, str);
this.examJudgeWuxiDataFd =
await this.fileUtil.editFile(`${this.folderPath}/wuxi_exam_data.txt`, str);
}
// 无锡所过程数据
public setExamJudgeWuxiProgressData = async (str: string) => {

View File

@ -12,8 +12,6 @@ export default class TcpClient {
private tcpSendNum: number = 0
private tcp: socket.TCPSocket = socket.constructTCPSocketInstance()
private events: Array<Function> = []
// 连接状态是否成功
private linkStatus: boolean = false
constructor() {
if (!TcpClient.instance) {
@ -60,7 +58,6 @@ export default class TcpClient {
}, timeout: 1000 * 15
})
.then(() => {
this.linkStatus = true
this.getMessage()
console.log(TCPTag, "tcp connect success")
return this.tcp.setExtraOptions({
@ -71,7 +68,6 @@ export default class TcpClient {
resolve(true)
})
.catch((err: BusinessError) => {
this.linkStatus = false
console.log(TCPTag, "tcp connect or keepAlive error: ", JSON.stringify(err))
console.log(TCPTag, "tcp 重启服务")
reject(err)
@ -80,10 +76,6 @@ export default class TcpClient {
}
getMessage() {
if (!this.linkStatus) {
console.log(TCPTag, '不允许获取消息: TCP未连接');
return;
}
this.tcp.on("message", value => {
let data = new DataView(value.message)
this.events.forEach(cb => {
@ -96,7 +88,6 @@ export default class TcpClient {
// 重新绑定tcp
async reBind() {
console.log(TCPTag, 'tcp rebind')
await this.close()
this.tcp = socket.constructTCPSocketInstance();
await this.bindTcp()
@ -118,19 +109,11 @@ export default class TcpClient {
// 监听tcp消息
onMsg(callback: Function) {
if (this.events.includes(callback)) {
console.log(TCPTag, '已经存在这个获取消息方法了');
return;
}
this.events.push(callback);
this.events.push(callback)
}
// 接收tcp消息
sendMsg(data: string): Promise<void> {
if (!this.linkStatus) {
console.log(TCPTag, '不允许发送: TCP未连接');
return Promise.reject(new Error('TCP connection is not established'));
}
return this.tcp?.send({
data
}).catch(async (err: BusinessError) => {

View File

@ -37,8 +37,6 @@ export default class UdpClient {
private messageEvents: Array<Function> = []
private errorEvents: Array<Function> = []
private dealMethod?: DealMethod<object>
// 连接状态
private linkStatus: boolean = false
// 绑定udp连接
bindUdp(): Promise<void> | undefined {

View File

@ -50,11 +50,6 @@ class differentialAndSignal {
this.events = this.events.filter((cb) => cb !== callback);
}
// 清除监听
clearMsg() {
this.events = []
}
// 关闭
close() {
this.events = [];
@ -72,8 +67,7 @@ class differentialAndSignal {
getMessage() {
this.workerInstance.onmessage = (e: MessageEvents): void => {
if (e.data) {
console.log(WorkerTag, "Worker 收到消息: " + e.data);
console.log(WorkerTag, "Worker 目前监听数量: " + this.events.length.toString());
// console.log(WorkerTag, "Worker 收到消息: " + e.data);
this.events.forEach((callback) => {
callback(e.data);
});

View File

@ -98,40 +98,7 @@ async function InitExam(dirName: string) {
// 写过程数据
async function WriteProcessData(type: ProcessDataEnumType, data: string) {
if (type === ProcessDataEnumType.WuxiExam) {
// 改变数据为无锡所需要的数据
const plcData = data.split(',');
const time = dayTs().format("YYYY-MM-DD HH:mm:ss")
const lineData = [
/*帧头*/time,
/*卫星时间*/time,
/*经度*/ plcData[95],
/*纬度*/ plcData[95],
/*高度*/ plcData[86],
/*方位角*/ 0,
/*俯仰角*/ plcData[91],
/*速度角*/'',
/*速度*/ plcData[97],
/*横滚*/'',
/*卫星定位状态*/'',
/*卫星定向状态*/'',
/*前天线可用星数*/'',
/*后天线可用星数*/'',
/*东向位置坐标*/'',
/*北向位置坐标*/'',
/*天向位置坐标*/'',
/*东向速度*/'',
/*北向速度*/'',
/*评判信号1*/[plcData[14], plcData[19], plcData[5], '', plcData[2], plcData[3], plcData[7], plcData[8],
plcData[13], plcData[12], plcData[17], '', plcData[4], plcData[11], plcData[20], plcData[9], 0].join(','),
/*评判信号2*/['', plcData[28], '', '', plcData[10], '', '', '', '', '', '', '', '', '', '', '', '', ''].join(','),
/*发动机转速*/ plcData[25],
/*结束符*/ time,
];
writeQueue.push({ type, data: JSON.stringify(lineData) });
} else {
writeQueue.push({ type, data });
}
writeQueue.push({ type, data });
if (!isProcessing) {
processQueue();