feat:添加MB2板卡;新档位兼容
This commit is contained in:
parent
8399c5d134
commit
6154af25e1
@ -11,70 +11,100 @@ export default class UdpByOne {
|
|||||||
// PLC localIp
|
// PLC localIp
|
||||||
private LocalIp: string = '192.168.7.170';
|
private LocalIp: string = '192.168.7.170';
|
||||||
// PLC localIpPort
|
// PLC localIpPort
|
||||||
private PLCLocalIpPort: string = '31012';
|
private PLCLocalIpPort: number = 31012;
|
||||||
private OppositeIp: string = '192.168.7.124'
|
private OppositeIp: string = '192.168.7.124'
|
||||||
// PLC oppositeIpPort
|
// PLC oppositeIpPort
|
||||||
private PLCOppositeIpPort: string = '30012';
|
private PLCOppositeIpPort: number = 30012;
|
||||||
// PLC消息
|
// PLC消息
|
||||||
private PLCMsg: ArrayBuffer;
|
private PLCMsg: ArrayBuffer;
|
||||||
// GPS udp
|
// GPS udp
|
||||||
private GPSUDP: any;
|
private GPSUDP: any;
|
||||||
|
private GPSTCP: any;
|
||||||
// GPS localIp
|
// GPS localIp
|
||||||
// GPS localIpPort
|
// GPS localIpPort
|
||||||
private GPSLocalIpPort: string = '31013';
|
private GPSLocalIpPort: number = 31013;
|
||||||
// GPS oppositeIpPort
|
// GPS oppositeIpPort
|
||||||
private GPSOppositeIpPort: string = '30013';
|
private GPSOppositeIpPort: number = 30013;
|
||||||
// GPS消息
|
// GPS消息
|
||||||
private GPSMsg: any;
|
private GPSMsg: any;
|
||||||
|
|
||||||
private timer: number;
|
private timer: number;
|
||||||
|
|
||||||
public type: 1| 2
|
//一型机 二型机
|
||||||
constructor(type) {
|
public terType: 1 | 2
|
||||||
|
//板卡类型
|
||||||
|
public cardType: 0| 1 | 2
|
||||||
|
constructor(terType,cardType) {
|
||||||
|
this.terType = terType;
|
||||||
|
this.cardType = cardType;
|
||||||
this.init()
|
this.init()
|
||||||
console.info('surenjun type=>',type +'')
|
|
||||||
this.type = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(){
|
async init(){
|
||||||
const fileUtil = new FileUtil(globalThis.context)
|
const fileUtil = new FileUtil(globalThis.context)
|
||||||
|
const {terType,cardType} = this
|
||||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
||||||
const result = JSON.parse(data)
|
const result = JSON.parse(data)
|
||||||
this.LocalIp = result.udplocalIp;
|
this.LocalIp = result.udplocalIp;
|
||||||
this.OppositeIp = result.udpOppositeIp;
|
this.OppositeIp = result.udpOppositeIp;
|
||||||
|
this.OppositeIp = result.udpOppositeIp;
|
||||||
|
|
||||||
// 初始化UDP
|
// 初始化UDP
|
||||||
this.PLCUDP = socket.constructUDPSocketInstance();
|
this.PLCUDP = socket.constructUDPSocketInstance();
|
||||||
// this.PLCUDP.bind(this.PLCLocalIp, this.PLCLocalIpPort);
|
// this.PLCUDP.bind(this.PLCLocalIp, this.PLCLocalIpPort);
|
||||||
this.PLCUDP.bind({
|
this.PLCUDP.bind({
|
||||||
address: this.LocalIp, port: parseInt(this.PLCLocalIpPort), family: 1
|
address: this.LocalIp, port: this.PLCLocalIpPort, family: 1
|
||||||
});
|
});
|
||||||
this.GPSUDP = socket.constructUDPSocketInstance();
|
|
||||||
// this.GPSUDP.bind(this.GPSLocalIp, this.GPSLocalIpPort);
|
|
||||||
this.GPSUDP.bind({
|
|
||||||
address: this.LocalIp, port: parseInt(this.GPSLocalIpPort), family: 1
|
|
||||||
});
|
|
||||||
|
|
||||||
this.PLCUDP.on("message", (res, remoteInfo) => {
|
this.PLCUDP.on("message", (res, remoteInfo) => {
|
||||||
this.PLCMsg = res.message;
|
this.PLCMsg = res.message;
|
||||||
})
|
})
|
||||||
|
|
||||||
this.GPSUDP.on("message", (res1, remoteInfo) => {
|
if(terType == 1 && cardType == 1){
|
||||||
let dataView = new DataView(res1.message)
|
this.GPSTCP = socket.constructTCPSocketInstance();
|
||||||
let str = ""
|
await this.GPSTCP.bind({address:this.LocalIp,port:this.GPSLocalIpPort,family: 1});
|
||||||
for (let i = 0; i < dataView?.byteLength; ++i) {
|
try {
|
||||||
let c = String.fromCharCode(dataView?.getUint8(i))
|
await this.GPSTCP.connect({address:{
|
||||||
if (c !== "\n") {
|
address:this.OppositeIp,port:this.GPSOppositeIpPort
|
||||||
str += c
|
}});
|
||||||
}
|
}catch (e) {
|
||||||
|
console.info('surenjun e=>',JSON.stringify(e))
|
||||||
}
|
}
|
||||||
this.GPSMsg = str;
|
console.info('surenjun=>','3')
|
||||||
})
|
this.GPSTCP.on("message", (res1, remoteInfo) => {
|
||||||
|
let dataView = new DataView(res1.message)
|
||||||
|
let str = ""
|
||||||
|
for (let i = 0; i < dataView?.byteLength; ++i) {
|
||||||
|
let c = String.fromCharCode(dataView?.getUint8(i))
|
||||||
|
if (c !== "\n") {str += c}
|
||||||
|
}
|
||||||
|
this.GPSMsg = str;
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.GPSUDP = socket.constructUDPSocketInstance();
|
||||||
|
// this.GPSUDP.bind(this.GPSLocalIp, this.GPSLocalIpPort);
|
||||||
|
await this.GPSUDP.bind({
|
||||||
|
address: this.LocalIp, port: this.GPSLocalIpPort, family: 1
|
||||||
|
});
|
||||||
|
this.GPSUDP.on("message", (res1, remoteInfo) => {
|
||||||
|
let dataView = new DataView(res1.message)
|
||||||
|
let str = ""
|
||||||
|
for (let i = 0; i < dataView?.byteLength; ++i) {
|
||||||
|
let c = String.fromCharCode(dataView?.getUint8(i))
|
||||||
|
if (c !== "\n") {
|
||||||
|
str += c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.GPSMsg = str;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// 重新绑定
|
// 重新绑定
|
||||||
public rebind() {
|
public rebind() {
|
||||||
this.PLCUDP.bind(this.LocalIp, this.PLCLocalIpPort);
|
this.PLCUDP.rebind(this.LocalIp, this.PLCLocalIpPort);
|
||||||
this.GPSUDP.bind(this.LocalIp, this.GPSLocalIpPort);
|
this.GPSUDP?.rebind(this.LocalIp, this.GPSLocalIpPort);
|
||||||
|
this.GPSTCP?.rebind(this.LocalIp, this.GPSLocalIpPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PLC发送消息
|
// PLC发送消息
|
||||||
@ -83,7 +113,7 @@ export default class UdpByOne {
|
|||||||
data: '111111',
|
data: '111111',
|
||||||
address: {
|
address: {
|
||||||
address: this.OppositeIp,
|
address: this.OppositeIp,
|
||||||
port: parseInt(this.PLCOppositeIpPort),
|
port: this.PLCOppositeIpPort,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -96,6 +126,8 @@ export default class UdpByOne {
|
|||||||
// 处理消息
|
// 处理消息
|
||||||
public handleMsg() {
|
public handleMsg() {
|
||||||
let newMessage = PLCGPSData;
|
let newMessage = PLCGPSData;
|
||||||
|
const cardType = this.cardType;
|
||||||
|
console.info('surenjun=> cardType',cardType)
|
||||||
if (this.GPSMsg) {
|
if (this.GPSMsg) {
|
||||||
|
|
||||||
let GPGGAMatch = this.GPSMsg.match(/\$GPGGA[^$]*/);
|
let GPGGAMatch = this.GPSMsg.match(/\$GPGGA[^$]*/);
|
||||||
@ -106,10 +138,14 @@ export default class UdpByOne {
|
|||||||
// 使用正则表达式提取$GPGST消息
|
// 使用正则表达式提取$GPGST消息
|
||||||
let GPGSTMatch = this.GPSMsg.match(/\$GPGST[^$]*/);
|
let GPGSTMatch = this.GPSMsg.match(/\$GPGST[^$]*/);
|
||||||
let GPGSTMsgArr = GPGSTMatch ? GPGSTMatch[0]?.split(",").slice(0, 9) : [];
|
let GPGSTMsgArr = GPGSTMatch ? GPGSTMatch[0]?.split(",").slice(0, 9) : [];
|
||||||
|
|
||||||
|
// 使用正则表达式提取$GPGST消息
|
||||||
|
let GNGSTMatch = this.GPSMsg.match(/\$GNGST[^$]*/);
|
||||||
|
let GNGSTMsgArr = GNGSTMatch ? GNGSTMatch[0]?.split(",").slice(0, 9) : [];
|
||||||
|
|
||||||
// 使用正则提取$PTNL消息
|
// 使用正则提取$PTNL消息
|
||||||
let PTNLMatch = this.GPSMsg.match(/\$PTNL[^$]*/);
|
let PTNLMatch = this.GPSMsg.match(/\$PTNL[^$]*/);
|
||||||
let PTNLMsgArr = PTNLMatch ? PTNLMatch[0].split(",")?.slice(0, 14) : [];
|
let PTNLMsgArr = PTNLMatch ? PTNLMatch[0].split(",")?.slice(0, 14) : [];
|
||||||
|
|
||||||
// 组合GPS数据
|
// 组合GPS数据
|
||||||
// 状态83
|
// 状态83
|
||||||
newMessage[83] = GPGGAMsgArr[6];
|
newMessage[83] = GPGGAMsgArr[6];
|
||||||
@ -122,11 +158,13 @@ export default class UdpByOne {
|
|||||||
// 龄期87
|
// 龄期87
|
||||||
newMessage[87] = GPGGAMsgArr[13];
|
newMessage[87] = GPGGAMsgArr[13];
|
||||||
// 维度因子88
|
// 维度因子88
|
||||||
newMessage[88] = GPGSTMsgArr[6];
|
newMessage[88] = GPGSTMsgArr[6] || GNGSTMsgArr[6];
|
||||||
// 经度因子89
|
// 经度因子89
|
||||||
newMessage[89] = GPGSTMsgArr[7]
|
newMessage[89] = GPGSTMsgArr[7] || GNGSTMsgArr[7];
|
||||||
// 航向角90
|
// 航向角90
|
||||||
newMessage[90] = PTNLMsgArr[3];
|
const hxj = Number(PTNLMsgArr[3])
|
||||||
|
newMessage[90] = (cardType == 0 ? hxj : ((hxj + 180 > 360) ?(hxj + 180 - 360): hxj + 180)).toFixed(4)
|
||||||
|
// newMessage[90] = PTNLMsgArr[3];
|
||||||
// 俯仰角91
|
// 俯仰角91
|
||||||
newMessage[91] = PTNLMsgArr[5];
|
newMessage[91] = PTNLMsgArr[5];
|
||||||
// 航向角状态-收星数92
|
// 航向角状态-收星数92
|
||||||
@ -210,18 +248,19 @@ export default class UdpByOne {
|
|||||||
newMessage[25] = ((Data29 << 24) + (Data30 << 16) + (Data31 << 8) + Data32).toString();
|
newMessage[25] = ((Data29 << 24) + (Data30 << 16) + (Data31 << 8) + Data32).toString();
|
||||||
// 熄火次数 26
|
// 熄火次数 26
|
||||||
newMessage[26] = parseInt(PLCByteArr[33], 2) + '';
|
newMessage[26] = parseInt(PLCByteArr[33], 2) + '';
|
||||||
|
|
||||||
// 方向盘角度 27
|
// 方向盘角度 27
|
||||||
// TODO 档位 磁档位为外接信号
|
// TODO 档位 磁档位为外接信号
|
||||||
newMessage[28] = (globalThis.chuankoMsg == '0' || globalThis.chuankoMsg == '' ||globalThis.chuankoMsg == undefined)?(parseInt(PLCByteArr[13], 2) + ''): globalThis.chuankoMsg;
|
newMessage[28] = (globalThis.chuankoMsg == '0' || globalThis.chuankoMsg == '' ||globalThis.chuankoMsg == undefined)?(parseInt(PLCByteArr[13], 2) + ''): globalThis.chuankoMsg;
|
||||||
|
|
||||||
if(this.type == 1){
|
if(this.terType == 1){
|
||||||
// 超声波1
|
// 超声波1
|
||||||
newMessage[29] = (PLCByteArr[4][1] > 0 ? '300' : '1200')
|
newMessage[29] = (PLCByteArr[4][1] > 0 ? '300' : '1200')
|
||||||
// 超声波2
|
// 超声波2
|
||||||
newMessage[30] = (PLCByteArr[4][0] > 0 ? '300': '1200' )
|
newMessage[30] = (PLCByteArr[4][0] > 0 ? '300': '1200' )
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.type == 2){
|
if(this.terType == 2){
|
||||||
newMessage[29] = (parseInt(PLCByteArr[52], 2) > 10) ? '1200' : '300'
|
newMessage[29] = (parseInt(PLCByteArr[52], 2) > 10) ? '1200' : '300'
|
||||||
newMessage[30] = (parseInt(PLCByteArr[54], 2) > 10) ? '1200': '300'
|
newMessage[30] = (parseInt(PLCByteArr[54], 2) > 10) ? '1200': '300'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import GpsTcpClient from '../utils/GpsTcpClient'
|
|||||||
export default class RearEndUnitsTool {
|
export default class RearEndUnitsTool {
|
||||||
//一型机 二型机 三型机 一体机
|
//一型机 二型机 三型机 一体机
|
||||||
public terType: 0 | 1 | 2 | 3 = 2;
|
public terType: 0 | 1 | 2 | 3 = 2;
|
||||||
|
//C1板卡 B4板卡
|
||||||
|
public cardType: 0 | 1;
|
||||||
public timer: number = 0
|
public timer: number = 0
|
||||||
public diffTimer: number = 0
|
public diffTimer: number = 0
|
||||||
private UdpByOneClass: UdpByOne
|
private UdpByOneClass: UdpByOne
|
||||||
@ -21,6 +23,7 @@ export default class RearEndUnitsTool {
|
|||||||
|
|
||||||
public receiveMsg = (callBack)=> {
|
public receiveMsg = (callBack)=> {
|
||||||
const terType = this.terType;
|
const terType = this.terType;
|
||||||
|
const cardType = this.cardType;
|
||||||
//TODO 临时处理关闭消息接收
|
//TODO 临时处理关闭消息接收
|
||||||
this.cancelMsg()
|
this.cancelMsg()
|
||||||
|
|
||||||
@ -28,8 +31,10 @@ export default class RearEndUnitsTool {
|
|||||||
//一型机
|
//一型机
|
||||||
case 0: {
|
case 0: {
|
||||||
const udpClass = this.getFUdp({
|
const udpClass = this.getFUdp({
|
||||||
type: 1
|
terType: 1,
|
||||||
})
|
cardType,
|
||||||
|
});
|
||||||
|
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
const message = udpClass.handleMsg()
|
const message = udpClass.handleMsg()
|
||||||
callBack && callBack(message)
|
callBack && callBack(message)
|
||||||
@ -40,7 +45,8 @@ export default class RearEndUnitsTool {
|
|||||||
//二型机
|
//二型机
|
||||||
case 1: {
|
case 1: {
|
||||||
const udpClass = this.getFUdp({
|
const udpClass = this.getFUdp({
|
||||||
type: 2
|
terType: 2,
|
||||||
|
cardType
|
||||||
})
|
})
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
const message = udpClass.handleMsg()
|
const message = udpClass.handleMsg()
|
||||||
@ -88,13 +94,14 @@ export default class RearEndUnitsTool {
|
|||||||
const result = JSON.parse(config || '{}')
|
const result = JSON.parse(config || '{}')
|
||||||
//默认设置为三代机
|
//默认设置为三代机
|
||||||
this.terType = result.terType
|
this.terType = result.terType
|
||||||
|
this.cardType = result.cardType
|
||||||
return this.terType
|
return this.terType
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取一型机&二型机单例
|
//获取一型机&二型机单例
|
||||||
private getFUdp({type}) {
|
private getFUdp({terType,cardType}) {
|
||||||
if (!this.UdpByOneClass) {
|
if (!this.UdpByOneClass) {
|
||||||
this.UdpByOneClass = new UdpByOne(type);
|
this.UdpByOneClass = new UdpByOne(terType,cardType);
|
||||||
}
|
}
|
||||||
return this.UdpByOneClass;
|
return this.UdpByOneClass;
|
||||||
}
|
}
|
||||||
@ -118,6 +125,7 @@ export default class RearEndUnitsTool {
|
|||||||
// 转发差分改正数
|
// 转发差分改正数
|
||||||
public sendDiffCorrections = (message) => {
|
public sendDiffCorrections = (message) => {
|
||||||
const type = this.terType
|
const type = this.terType
|
||||||
|
const cardType = this.cardType
|
||||||
//差分改正数截取前5位
|
//差分改正数截取前5位
|
||||||
let dataView = new DataView(message)
|
let dataView = new DataView(message)
|
||||||
const Arraybuffer = message.slice(5, dataView?.byteLength);
|
const Arraybuffer = message.slice(5, dataView?.byteLength);
|
||||||
@ -125,8 +133,13 @@ export default class RearEndUnitsTool {
|
|||||||
switch (type){
|
switch (type){
|
||||||
//一型机
|
//一型机
|
||||||
case 0:
|
case 0:
|
||||||
const GpsTcpClientClass = this.getGpsTcp()
|
//天宝类型板卡
|
||||||
GpsTcpClientClass.sendGpsMsg(Arraybuffer);break
|
if(cardType === 1){
|
||||||
|
globalThis.udpClient?.sendMsg(Arraybuffer);break
|
||||||
|
}else{
|
||||||
|
const GpsTcpClientClass = this.getGpsTcp()
|
||||||
|
GpsTcpClientClass.sendGpsMsg(Arraybuffer);break
|
||||||
|
}
|
||||||
|
|
||||||
//二型机
|
//二型机
|
||||||
case 1: globalThis.udpClient?.sendMsg(Arraybuffer);break
|
case 1: globalThis.udpClient?.sendMsg(Arraybuffer);break
|
||||||
|
|||||||
@ -21,8 +21,10 @@ struct Index {
|
|||||||
// @State inputTextList1: string[] = ['172.37.55.191','18782','192.168.7.1','8082','255.255.255.0','192.168.7.170','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122']
|
// @State inputTextList1: string[] = ['172.37.55.191','18782','192.168.7.1','8082','255.255.255.0','192.168.7.170','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122']
|
||||||
@State inputTextList1: string[] = ['172.37.55.191', '18782', '172.37.55.191', '8082', '255.255.255.0', '192.168.7.1', '114.114.114.114', '192.168.7.124', '20022', '192.168.7.170', '20122']
|
@State inputTextList1: string[] = ['172.37.55.191', '18782', '172.37.55.191', '8082', '255.255.255.0', '192.168.7.1', '114.114.114.114', '192.168.7.124', '20022', '192.168.7.170', '20122']
|
||||||
@State terTextList: string[] = ['一型机', '二型机', '三型机', '一体机']
|
@State terTextList: string[] = ['一型机', '二型机', '三型机', '一体机']
|
||||||
|
@State cardTextList: string[] = ['北云', '天宝MB2']
|
||||||
@State netTextList: string[] = ['否', '是']
|
@State netTextList: string[] = ['否', '是']
|
||||||
@State selectedTerType: number = 0
|
@State selectedTerType: number = 0
|
||||||
|
@State selectedCardType: number = 0
|
||||||
//是否启用网络差分
|
//是否启用网络差分
|
||||||
@State netOpen: number = 0
|
@State netOpen: number = 0
|
||||||
// @State inputTextList2: string[] = []
|
// @State inputTextList2: string[] = []
|
||||||
@ -94,6 +96,7 @@ struct Index {
|
|||||||
})
|
})
|
||||||
}.width('50%').height('14%')
|
}.width('50%').height('14%')
|
||||||
|
|
||||||
|
|
||||||
Row() {
|
Row() {
|
||||||
Text('是否启用网络差分')
|
Text('是否启用网络差分')
|
||||||
.width('40%')
|
.width('40%')
|
||||||
@ -113,7 +116,30 @@ struct Index {
|
|||||||
})
|
})
|
||||||
Text(netText).fontSize(20).fontColor('#FFF')
|
Text(netText).fontSize(20).fontColor('#FFF')
|
||||||
})
|
})
|
||||||
}.width('52%').height('14%')
|
}.width('51%').height('14%')
|
||||||
|
|
||||||
|
|
||||||
|
Row(){
|
||||||
|
Text('板卡类型')
|
||||||
|
.width('40%')
|
||||||
|
.height('100%')
|
||||||
|
.fontColor('#E5CBA1')
|
||||||
|
.padding({ 'left': '35px' })
|
||||||
|
.fontSize(this.inputFontSize * this.ratio)
|
||||||
|
|
||||||
|
ForEach(this.cardTextList, (cardText, index) => {
|
||||||
|
Radio({ value: cardText, group: 'cardRadioGroup' })
|
||||||
|
.borderColor('#E5CBA1')
|
||||||
|
.checked(index === this.selectedCardType)
|
||||||
|
.onChange((value: boolean) => {
|
||||||
|
if(value){
|
||||||
|
this.selectedCardType = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Text(cardText).fontSize(20).fontColor('#FFF')
|
||||||
|
})
|
||||||
|
}.width('49%').height('14%')
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.width('95%')
|
.width('95%')
|
||||||
@ -145,6 +171,7 @@ struct Index {
|
|||||||
centerIp: this.inputTextList1[2],
|
centerIp: this.inputTextList1[2],
|
||||||
centerPort: this.inputTextList1[3],
|
centerPort: this.inputTextList1[3],
|
||||||
terType: this.selectedTerType,
|
terType: this.selectedTerType,
|
||||||
|
cardType: this.selectedCardType,
|
||||||
netOpen: this.netOpen
|
netOpen: this.netOpen
|
||||||
}
|
}
|
||||||
fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param), '')
|
fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param), '')
|
||||||
@ -218,6 +245,7 @@ struct Index {
|
|||||||
this.inputTextList1[2] = result.centerIp
|
this.inputTextList1[2] = result.centerIp
|
||||||
this.inputTextList1[3] = result.centerPort
|
this.inputTextList1[3] = result.centerPort
|
||||||
this.selectedTerType = result.terType
|
this.selectedTerType = result.terType
|
||||||
|
this.selectedCardType = result.cardType
|
||||||
this.netOpen= result.netOpen
|
this.netOpen= result.netOpen
|
||||||
console.log('surenjun', this.selectedTerType + '');
|
console.log('surenjun', this.selectedTerType + '');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,9 @@ import Judge from '../../judgeSDK/utils/judgeReal';
|
|||||||
import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d';
|
import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import {
|
import {
|
||||||
examJudgeMapSetScaling
|
examJudgeMapSetScaling, examJudgeVersion
|
||||||
} from '../../judgeSDK/api'
|
} from '../../judgeSDK/api'
|
||||||
|
import { judgeConfig } from '../../judgeSDK/utils/judgeConfig';
|
||||||
|
|
||||||
interface RoadDataType {
|
interface RoadDataType {
|
||||||
name: string,
|
name: string,
|
||||||
@ -30,6 +31,8 @@ export default struct RealTime {
|
|||||||
@State ratio: number = 1
|
@State ratio: number = 1
|
||||||
@State lane: Object = {}
|
@State lane: Object = {}
|
||||||
@State timer:number = 0
|
@State timer:number = 0
|
||||||
|
@State version: string = ""
|
||||||
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
@ -67,22 +70,28 @@ export default struct RealTime {
|
|||||||
|
|
||||||
Column() {
|
Column() {
|
||||||
if (this.draw) {
|
if (this.draw) {
|
||||||
XComponent({
|
Stack({ alignContent: Alignment.TopEnd }) {
|
||||||
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变
|
XComponent({
|
||||||
type: 'surface',
|
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变
|
||||||
libraryname: 'JudgeSdk'
|
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)
|
|
||||||
})
|
})
|
||||||
|
.width(this.widthNumber)
|
||||||
|
.height(this.heightNumber)
|
||||||
|
.onLoad(() => {
|
||||||
|
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹,false:表示结束绘制
|
||||||
|
})
|
||||||
|
.onDestroy(() => {
|
||||||
|
apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹,false:表示结束绘制
|
||||||
|
this.draw = false;
|
||||||
|
clearInterval(globalThis.realTimer)
|
||||||
|
})
|
||||||
|
|
||||||
|
}.width(this.widthNumber)
|
||||||
|
.height(this.heightNumber)
|
||||||
|
Row() {
|
||||||
|
Text(this.version).margin({ right: 10 }).fontSize(14).fontColor(0x333333)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Column() {
|
Column() {
|
||||||
}
|
}
|
||||||
@ -108,7 +117,10 @@ export default struct RealTime {
|
|||||||
async aboutToDisappear() {
|
async aboutToDisappear() {
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
}
|
}
|
||||||
|
|
||||||
async aboutToAppear() {
|
async aboutToAppear() {
|
||||||
|
this.version = (await examJudgeVersion()) + "/" + judgeConfig.version
|
||||||
|
|
||||||
const judge = new Judge(this)
|
const judge = new Judge(this)
|
||||||
let timer = setInterval(()=>{
|
let timer = setInterval(()=>{
|
||||||
this.lane = globalThis.laneData;
|
this.lane = globalThis.laneData;
|
||||||
|
|||||||
@ -55,7 +55,7 @@ import {
|
|||||||
examJudgeVersion
|
examJudgeVersion
|
||||||
} from './api/index';
|
} from './api/index';
|
||||||
import { getSyncData, upDateTableByArray } from '../../common/service/initable';
|
import { getSyncData, upDateTableByArray } from '../../common/service/initable';
|
||||||
|
import { GlobalConfig } from '../../config';
|
||||||
const judgeTag = 'SURENJUN_JUDGE'
|
const judgeTag = 'SURENJUN_JUDGE'
|
||||||
|
|
||||||
function ifNeedRetry(code: number | string): boolean {
|
function ifNeedRetry(code: number | string): boolean {
|
||||||
@ -276,6 +276,7 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
private fileLog
|
private fileLog
|
||||||
private filePath
|
private filePath
|
||||||
|
private bklx: number = 0
|
||||||
private totalScore: number
|
private totalScore: number
|
||||||
private prevJd: number = 0
|
private prevJd: number = 0
|
||||||
private prevWd: number = 0
|
private prevWd: number = 0
|
||||||
@ -726,12 +727,15 @@ export default class Judge {
|
|||||||
|
|
||||||
// 获取评判初始化数据
|
// 获取评判初始化数据
|
||||||
getJudgeInitData = async () => {
|
getJudgeInitData = async () => {
|
||||||
const {getModelData,getKm3JudgeInitConfig} = this
|
const {getModelData,getKm3JudgeInitConfig,bklx} = this
|
||||||
const carInfo = globalThis.carInfo;
|
const carInfo = globalThis.carInfo;
|
||||||
const { examSubject,plateNo,carId } = carInfo;
|
const { examSubject,plateNo,carId } = carInfo;
|
||||||
const judgeUI = this.judgeUI
|
const judgeUI = this.judgeUI
|
||||||
const {projectsObj,itemInfoObj,markRuleListObj,carType,carName,systemparmArr,carinfoArr} = judgeUI
|
const {projectsObj,itemInfoObj,markRuleListObj,carType,carName,systemparmArr,carinfoArr} = judgeUI
|
||||||
const examType = examSubject == 2 ? 'km2' : 'km3'
|
const examType = examSubject == 2 ? 'km2' : 'km3'
|
||||||
|
const fileUtil = new FileUtil(globalThis.context)
|
||||||
|
const ipConfigStr = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
||||||
|
const ipConfig = JSON.parse(ipConfigStr)
|
||||||
|
|
||||||
let allitems = [];
|
let allitems = [];
|
||||||
if (examSubject == 2) {
|
if (examSubject == 2) {
|
||||||
@ -768,6 +772,8 @@ export default class Judge {
|
|||||||
itemInfoObj,
|
itemInfoObj,
|
||||||
carlist: judgeUI.carlist,
|
carlist: judgeUI.carlist,
|
||||||
carinfo: carinfoArr,
|
carinfo: carinfoArr,
|
||||||
|
//板卡类型
|
||||||
|
bklx,
|
||||||
};
|
};
|
||||||
let km3Config = {}
|
let km3Config = {}
|
||||||
|
|
||||||
@ -1752,8 +1758,14 @@ export default class Judge {
|
|||||||
const filePath = await fileLog.initFileLogo({
|
const filePath = await fileLog.initFileLogo({
|
||||||
name, lsh, idCard
|
name, lsh, idCard
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ipFileUtil = new FileUtil(globalThis.context)
|
||||||
|
const ipConfigStr = await ipFileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
||||||
|
const ipConfig = JSON.parse(ipConfigStr)
|
||||||
|
|
||||||
this.fileLog = fileLog;
|
this.fileLog = fileLog;
|
||||||
this.filePath = filePath;
|
this.filePath = filePath;
|
||||||
|
this.bklx = Number(ipConfig.cardType)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getJudgeBeginData,
|
getJudgeBeginData,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
//考试回放开关
|
//考试回放开关
|
||||||
export const judgeConfig = {
|
export const judgeConfig = {
|
||||||
|
version:'2024.08.21.01',
|
||||||
//本地目录开关
|
//本地目录开关
|
||||||
isTrajectoryOpen: false,
|
isTrajectoryOpen: false,
|
||||||
//是否开启拍照
|
//是否开启拍照
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user