diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index f634772f..8b37c5df 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -8,7 +8,6 @@ import { getEsCarModel, getSyncData, } from '../common/service/initable'; import { getUDP, getUDP2, getUDPGps2 } from '../common/utils/GlobalUdp'; import { initJudgeUdp } from '../common/utils/UdpJudge'; import { judgeConfig } from './judgeSDK/utils/judgeConfig'; -import { getTCP } from '../common/utils/GlobalTcp'; import { getSingleCenterTable, setliushuiNum, takePhotoFn } from '../common/service/indexService'; import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; import promptAction from '@ohos.promptAction'; @@ -19,7 +18,6 @@ import { delPic } from '../common/service/videoService'; import imageBtn from './compontents/imageBtn'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; import { examJudgeVersion } from './judgeSDK/api'; -import IdlServiceExtProxy from '../IdlServiceExt/idl_service_ext_proxy'; import Want from '@ohos.app.ability.Want'; @Entry @@ -41,7 +39,6 @@ struct Index { @State initParamFlag: boolean = false @State fd: number = -1; @State num: number = 0; - private serviceExtProxy: IdlServiceExtProxy private fileHelper = null; private errorDialog: CustomDialogController = new CustomDialogController({ builder: errorMsgDialog({ @@ -79,13 +76,14 @@ struct Index { globalThis.lsh = '1111111111111' globalThis.errorDialog = this.errorDialog globalThis.udpEvent = new UdpEvent(); - await this.startServiceAbility() - + this.startServiceAbility().catch((err) => { + console.log("tcp 启动tcp进程失败") + this.startServiceAbility() + }) getSyncData('MA_SYSSET').then(async (data: any[]) => { data.forEach(async sys => { //判断是否能点开始考试 if (sys.v_no === '305') { - console.log('syssyssyssys') delPic(Number(sys.v_value), 1) delPic(Number(sys.v_value), 2) } @@ -100,43 +98,38 @@ struct Index { bundleName: 'com.oh.dts', abilityName: 'ServiceExtAbility' }; - - await this.context.startServiceExtensionAbility(want).then(() => { - // 成功启动后台服务 - console.log('js-test index.ets Succeeded in starting ServiceExtensionAbility.'); - let self = this; - let options: common.ConnectOptions = { - onConnect(elementName, remote): void { - console.log('js-test index.ets onConnect callback'); - if (remote === null) { - console.log(`js-test index.ets onConnect remote is null`); - return; + return new Promise((resolve, reject) => { + this.context.startServiceExtensionAbility(want).then(() => { + // 成功启动后台服务 + console.log('tcp service Succeeded in starting ServiceExtensionAbility.'); + let options: common.ConnectOptions = { + onConnect(_elementName, remote): void { + console.log('tcp service onConnect callback'); + if (remote === null) { + console.log(`tcp service onConnect remote is null`); + return; + } + }, + onDisconnect(_elementName): void { + console.log('tcp service onDisconnect callback'); + }, + onFailed(code): void { + console.log('tcp service onFailed callback', JSON.stringify(code)); } - self.serviceExtProxy = new IdlServiceExtProxy(remote); - globalThis.serviceExtProxy = self.serviceExtProxy - console.log(`js-test index.ets processData, this.serviceExtProxy == `, self.serviceExtProxy); - }, - onDisconnect(elementName): void { - console.log('js-test index.ets onDisconnect callback'); - }, - onFailed(code): void { - console.log('js-test index.ets onFailed callback', JSON.stringify(code)); } - } - - // 建立连接后返回的Id需要保存下来,在解绑服务时需要作为参数传入 - // let connectionId = context.connectServiceExtensionAbility(want, options); - try { - this.context.connectServiceExtensionAbility(want, options); - } catch (e) { - console.log('js-test index.ets connectServiceExtensionAbility err == ', JSON.stringify(e)); - } - // 成功连接后台服务 - console.log('js-test index.ets connectServiceExtensionAbility success'); - - }).catch((err) => { - console.log(`js-test index.ets Failed to start ServiceExtensionAbility. Code is ${err.code}, message is ${err.message}`); - }); + try { + this.context.connectServiceExtensionAbility(want, options); + } catch (e) { + console.log('tcp service connectServiceExtensionAbility err == ', JSON.stringify(e)); + } + resolve() + // 成功连接后台服务 + console.log('tcp service connectServiceExtensionAbility success'); + }).catch((err) => { + reject(err) + console.log(`tcp service Failed to start ServiceExtensionAbility. Code is ${err.code}, message is ${err.message}`); + }); + }) } async networkExam(isSingle: boolean = false) { @@ -164,9 +157,6 @@ struct Index { // A2牵引车2号导航仪 if (carInfo.kscx == 'A2' && !globalThis.udpClientGps2) { await getUDPGps2(this.context, false) - this.serviceExtProxy.processData("1", () => { - - }) } getSyncData('MA_SYSSET').then((data: any[]) => { data.forEach(sys => { @@ -219,14 +209,10 @@ struct Index { } async onPageShow() { - console.log('ttttt', 1111) await this.userAuth(); - console.log('globalThis.singlePlay', globalThis.singlePlay) if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { - // setVideoParam() - console.log('diyidiy') this.context.resourceManager.getRawFileContent("welcome.wav") - .then(value => { + .then(_value => { this.avPlayer.playAudio(['welcome.wav']) }) .catch(error => { @@ -245,7 +231,6 @@ struct Index { const time = await getCurrentTime() const date = time.split(' ')[0] this.fileHelper.createAlbum('jt') - // this.fileHelper.createAlbum('2025-01-02') this.fileHelper.createAlbum('pz'); this.fileHelper.createAlbum(date); @@ -286,9 +271,6 @@ struct Index { if (carInfo.kscx == 'A2') { console.log("GPS2 udp") getUDPGps2(this.context, false) - this.serviceExtProxy.processData("1", () => { - - }) } }) @@ -446,12 +428,12 @@ struct Index { Column() { Row() { Column() { - Text('V外壳:' + this.version) + Text('V外壳:' + globalThis.version) .fontColor('#CCAE7A') .fontSize(18 * globalThis.ratio) .width('30%') .margin({ bottom: 10 }) - Text('V评判:' + this.judgeVersion) + Text('V评判:' + globalThis.judgeVersion) .fontColor('#CCAE7A') .fontSize(18 * globalThis.ratio) .width('30%') diff --git a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets index 6781530c..77c1e498 100644 --- a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets +++ b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets @@ -279,11 +279,11 @@ export default struct SignDisplayCom { } else { ForEach(["GPS"], (item, i) => { Row() { - Text(item).fontColor(this.gpsActive == i ? '#2D3C5A' : '#fff') + Text(item).fontColor('#fff') } .width(316 / 2 * this.ratio) .height(24 * this.ratio) - .backgroundColor(this.gpsActive == i ? '#fff' : '#1A1A1A') + .backgroundColor('#1A1A1A') .margin({ left: (i === 0 ? 0 : 10) * this.ratio, right: (i === 1 ? 0 : 10) * this.ratio }) .justifyContent(FlexAlign.Center) .onClick(() => { diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts index b9f84b14..3501ca97 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts @@ -1,7 +1,7 @@ //考试回放开关 export const judgeConfig = { // 外壳版本号 - version: "2025.05.15.01", + version: "2025.05.17.01", // 是否A1A3共用一车 isUseSameCar: false, //本地目录开关 diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index fbae337d..bab5beb8 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -24,13 +24,13 @@ "abilities": [ { "name": "EntryAbility", - "srcEntrance": "./ets/entryability/EntryAbility.ets", + "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", "icon": "$media:logo_app", "label": "$string:EntryAbility_label", "startWindowIcon": "$media:icon", "startWindowBackground": "$color:start_window_background", - "visible": true, + "exported": true, "skills": [ { "entities": [