Compare commits

..

No commits in common. "9473b8c4660ba2b0a9f84b2b14ed311cb4e92844" and "4038aa685850447b944cbd396f0f3df97ede8030" have entirely different histories.

11 changed files with 27 additions and 37 deletions

View File

@ -51,13 +51,12 @@ export async function initCenterCache(params,url){
})
}
//参数下发读表接口
export async function initCenterCacheByKSPT(params,url){
export async function initCenterCacheByKSPT(params){
return await request({
url:'/der2/services/para/initCenterCache.ws',
data:params,
method:'post',
xml:false,
host:url
})
}
@ -78,7 +77,6 @@ export async function initialization(params){
url:'/der2/services/exam/initialization.ws',
data:`<?xml version="1.0" encoding="UTF-8" ?><initializationReq><body><carId>${params.carId}</carId><examinationRoomId>${params.examinationRoomId}</examinationRoomId><shellVersion>${params.shellVersion}</shellVersion><judgeVersion>${params.judgeVersion}</judgeVersion><videoVersion>${params.videoVersion}</videoVersion><carInfo></carInfo><map_Road></map_Road><map_Road_Lane></map_Road_Lane><map_SubItem></map_SubItem><t_CarParmSet></t_CarParmSet><map_ItemClass></map_ItemClass><map_Point></map_Point><map_Point_Item></map_Point_Item><CDSBINFO></CDSBINFO><MARKRULESET></MARKRULESET></body></initializationReq>`,
method:'post',
host:params.host,
xml:true,
})
}

View File

@ -148,7 +148,7 @@ export async function getDataBaseTable(params,reqParam) {
"typeRsp": "0" // 赋默认值0无需改变
}
}
let res: any = await initCenterCache(str,reqParam.centerHost)
let res: any = await initCenterCache(str)
if( res.body[params.tableName].length==0){
resolve();
return
@ -248,7 +248,7 @@ export async function getMySystemSetTable(params,reqParam) {
"typeRsp": "0" // 赋默认值0无需改变
}
}
initCenterCacheByKSPT(str,reqParam.url).then((res)=>{
initCenterCacheByKSPT(str).then((res)=>{
if( res.body[params.tableName].length==0){
resolve();
return
@ -357,10 +357,9 @@ export async function upDataZhongxinginitialization(param){
"examinationRoomId": param.examinationRoomId, //考试平台kdid
videoVersion:'1.0',
judgeVersion:param.judgeVersion,
shellVersion: param.shellVersion,
host:param.host
shellVersion: param.shellVersion
}
console.log('daihai2',JSON.stringify(str))
console.log('daihai2')
initialization(str).then(async (res)=>{
console.log('daihai3',JSON.stringify(res))

View File

@ -19,7 +19,7 @@ export async function getUDP() {
globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort)
globalThis.udpClient.sendMsg('111', null)
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
// globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
}, 1000)
})
}
@ -43,7 +43,7 @@ export async function getUDP() {
// globalThis.udpClient.closeUdp(async ()=>{ })
// }
globalThis.udpClient = {}
// globalThis.udpClient.onMessage_1 = () => {}
globalThis.udpClient.onMessage_1 = () => {}
globalThis.host = ''
}
})
@ -66,9 +66,10 @@ export async function getUDP2() {
// 未绑定
console.log(` getUDP2 has no udclent and bind `);
const udpClient2: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
await udpClient2.bindUdp()
await udpClient2.onError_Callback()
await udpClient2.onMessage_2((val) => {
udpClient2.bindUdp()
udpClient2.onError_Callback()
udpClient2.onMessage_2((val) => {
if (val.id == '32') {
globalThis.signNum = val.body[1]
@ -91,6 +92,8 @@ export async function getUDP2() {
}
} else {
globalThis.udpClient2 = {}
globalThis.udpClient2.onMessage_2 = () => {
}
globalThis.udpClient2.setMsgCallBack = () => {
}
}
@ -127,8 +130,8 @@ export async function setJudgeUdp() {
if (config && config[0] && config[0].udplocalIp) {
const {udplocalIp} = config[0];
const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort)
await udpClientbyCenter.bindUdp()
await udpClientbyCenter.onMessage_1((val) => {
udpClientbyCenter.bindUdp()
udpClientbyCenter.onMessage_1((val) => {
console.log('valval', val)
})
// globalThis.judgeUdpClient = udpClientbyCenter;

View File

@ -242,14 +242,18 @@ export default class UdpClientByCenter {
closeUdp(callback?) {
console.log('UdpClientByCenter enter closeUdp ip:' + this.localIp + ' port:' + this.localIpPort);
this.udp.on('close', () => {
console.log('UdpClientByCenter onClose ip:' + this.localIp + ' port:' + this.localIpPort);
this.isWorking = false
if (callback != null) {
callback()
}
}
)
this.udp.close(err => {
if (err) {
console.log('UdpClientByCenter closeUdp failed ip:' + this.localIp + ' port:' + this.localIpPort + ' err:' + JSON.stringify(err));
} else {
this.isWorking = false
if (callback != null) {
callback()
}
console.log('UdpClientByCenter closeUdp succeed ip:' + this.localIp + ' port:' + this.localIpPort);
}
})
@ -257,7 +261,7 @@ export default class UdpClientByCenter {
//plc
onMessage_1(callback?) {
this.udp&&this.udp.on('message', value => {
this.udp.on('message', value => {
console.log(TAG, 'udponmessage')
// 收到的是ArrayBuffer 需要进行转换解析
this.plcUdpError = false

View File

@ -35,7 +35,7 @@ export default async function request(req: any) {
paramsStr = paramsStr.toString();
paramsStr = paramsStr.substring(0, paramsStr.length-1)
try {
let baseUrl=host?host:globalThis.host
let baseUrl=host?host:(globalThis.host||GlobalConfig.host)
// let baseUrl=host?config.csptHost:config.host'
console.info('surenjun',baseUrl)

View File

@ -42,6 +42,7 @@ export default class EntryAbility extends UIAbility {
spzd3:false,
spzd4:false,
}
globalThis.singlePlay=false //单机模式
globalThis.signNum=0//心跳指令编号
globalThis.lsh='0000000000000'//学员流水号
globalThis.ratio= 1700 / 960 //适配比例

View File

@ -15,7 +15,6 @@ import { getliushuiNum, setliushuiNum } from '../common/service/indexService';
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import worker, { MessageEvents } from '@ohos.worker';
import promptAction from '@ohos.promptAction'
import { voiceService } from '../common/service/voiceService';
@Entry
@Component
@ -34,7 +33,6 @@ struct Index {
fileHelper = null;
private fileUtil: FileUtil
private interval = null;
private vocObj = null;
private workerInstance = null;
private context = getContext(this) as common.UIAbilityContext;
@ -215,8 +213,6 @@ struct Index {
globalThis.ratio = 1700 / 960
this.angle = 0
this.loading = false
this.vocObj = new voiceService(async (status, val, next) => {
});
}
async testXMLToJSONInWorker() {
@ -228,9 +224,7 @@ struct Index {
shellVersion: globalThis.version,
paraKdid: globalThis.timeInfo?.paraKdid,
mode: globalThis.timeInfo?.mode,
context: this.context,
host:globalThis.host,
centerHost:globalThis.timeInfo.url
context: this.context
}
workerInstance.postMessage(param);
workerInstance.onmessage = (e: MessageEvents): void => {
@ -293,10 +287,6 @@ struct Index {
// const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) {
this.vocObj.playAudio({
type: 1,
name: 'welcome.wav'
})
globalThis.singlePlay = false
}
this.isSingle = globalThis.singlePlay

View File

@ -555,7 +555,6 @@ struct Index {
}
aboutToAppear() {
this.ratio=globalThis.ratio
this.openFlag = true
const fileUtil = new FileUtil(this.context)
this.fileUtil = fileUtil

View File

@ -308,7 +308,6 @@ export default struct SignDisplayCom {
if (showBack) {
this.ratio=1.4
globalThis.udpClient.onMessage_1((msg) => {
console.log('msgmsg', msg)
if (msg) {

View File

@ -1,5 +1,3 @@
{
"module": {
"name": "entry",
@ -38,7 +36,6 @@
],
"requestPermissions":[
{"name": "ohos.permission.CONNECTIVITY_INTERNAL"},
{"name": "ohos.permission.SET_TIME"},
{
"name": "ohos.permission.INTERNET"
},