diff --git a/AppScope/app.json5 b/AppScope/app.json5 index 9d0a95e..cbef3e0 100644 --- a/AppScope/app.json5 +++ b/AppScope/app.json5 @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.oh.myapplication", + "bundleName": "com.oh.dts", "vendor": "example", "versionCode": 1000000, "versionName": "1.0.0", diff --git a/build-profile.json5 b/build-profile.json5 index 5a79a83..47db1d4 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -4,13 +4,13 @@ { "name": "default", "material": { - "certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer", - "storePassword": "0000001BE66D421B205804C1F052841DA4C90D4B3A39A1553B3CA1CA21F934529A92D16A3A7A35A69A0A3D", + "certpath": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.cer", + "storePassword": "0000001B8F068D534BF0B0245E4BDB69E8CFA101B3E7CD4BE89CFE5B2FD5D27D4CA2734F0FBC84F49A9C68", "keyAlias": "debugKey", - "keyPassword": "0000001B97A92453459A43E1B0A987037A6FECEB014956E03BFD674EE2D1602CA14A7774AE46012DA8A29B", - "profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b", + "keyPassword": "0000001B7EE522481B6BADA6544DD7E5E5D2A7A964971BFFF30CF41899AE5382A42143444D275F293D0744", + "profile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p7b", "signAlg": "SHA256withECDSA", - "storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p12" + "storeFile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p12" } } ], diff --git a/entry/libs/arm64-v8a/libjudgesdk.so b/entry/libs/arm64-v8a/libjudgesdk.so new file mode 100644 index 0000000..e19a94e Binary files /dev/null and b/entry/libs/arm64-v8a/libjudgesdk.so differ diff --git a/entry/libs/armeabi-v7a/libjudgesdk.so b/entry/libs/armeabi-v7a/libjudgesdk.so new file mode 100644 index 0000000..e19a94e Binary files /dev/null and b/entry/libs/armeabi-v7a/libjudgesdk.so differ diff --git a/entry/oh-package-lock.json5 b/entry/oh-package-lock.json5 new file mode 100644 index 0000000..82ec2e0 --- /dev/null +++ b/entry/oh-package-lock.json5 @@ -0,0 +1,18 @@ +{ + "meta": { + "stableOrder": true + }, + "lockfileVersion": 3, + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", + "specifiers": { + "libjudgesdk.so@src/cpp/libJudgeSdk": "libjudgesdk.so@src/cpp/libJudgeSdk" + }, + "packages": { + "libjudgesdk.so@src/cpp/libJudgeSdk": { + "name": "libjudgesdk.so", + "version": "1.0.0", + "resolved": "src/cpp/libJudgeSdk", + "registryType": "local" + } + } +} \ No newline at end of file diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 248c3b7..44b5089 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -5,6 +5,8 @@ "main": "", "author": "", "license": "", - "dependencies": {} + "dependencies": { + "libjudgesdk.so": "file:./src/cpp/libJudgeSdk" + } } diff --git a/entry/src/cpp/libJudgeSdk/Index.d.ts b/entry/src/cpp/libJudgeSdk/Index.d.ts new file mode 100644 index 0000000..9eb33df --- /dev/null +++ b/entry/src/cpp/libJudgeSdk/Index.d.ts @@ -0,0 +1,38 @@ +export const examJudgeVersion: () => string; + +export const examJudgeInit: (data: string, len: number) => number + +export const examJudgeSetLogCallback: (level: number, handle: Function) => number + +export const examJudgeRealExam: (plc: string, len: number) => number + +export const examJudgeSetRealExamCallback: (callback: Function) => number + +export const examJudgeMapImageSetCallback: (callback: Function) => number + +export const examJudgeArtificialMark: (no: number, serial: string, type: number) => number + +export const examJudgeArtificialItem: (no: number, type: number) => number + +export const examJudgeMapSetDrawing: (flag: boolean) => number + +export const examJudgeBeginExam: (data: string, len: number) => number + +export const examJudgeEndExam: () => number + +export const examJudgeDestroy: () => number + +export const examJudgeMapSetParam: (width: number, height: number) => number + +export const examJudgeMapSetScaling: (scale: number) => number + +export const examJudgeSetPerformCallback: (callback: Function) => number + +export const examJudgeSoundEnd: (no: number, code: string, type: number) => number + +export const examCalcGpsDistance: (lng1: number, lat1: number, lng2: number, lat2: number, height: number) => number + +export const examJudgeErrorInfo: (level: number) => number + + + diff --git a/entry/src/cpp/libJudgeSdk/oh-package.json5 b/entry/src/cpp/libJudgeSdk/oh-package.json5 new file mode 100644 index 0000000..1327333 --- /dev/null +++ b/entry/src/cpp/libJudgeSdk/oh-package.json5 @@ -0,0 +1,6 @@ +{ + "name": "libjudgesdk.so", + "types": "./Index.d.ts", + "version": "1.0.0", + "description": "Please describe the basic information." +} \ No newline at end of file diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index c5485c5..fd11329 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -40,7 +40,11 @@ export default class EntryAbility extends UIAbility { async onWindowStageCreate(windowStage: window.WindowStage) { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - + const windowClass = await windowStage.getMainWindow(); + let rect = windowClass.getWindowProperties().windowRect + let width = rect.width + let height = rect.height + console.log("log", width, height) AppStorage.setOrCreate('carInfo', {}) AppStorage.setOrCreate('examinerInfo', {}) AppStorage.setOrCreate('lsh', '0000000000000') @@ -53,18 +57,15 @@ export default class EntryAbility extends UIAbility { judgeVersion: GlobalConfig.version.jn.km3[1] || "", tcpSendNum: 0, videoVersion: '1.0', - ratio: 1280 / 960, //适配比例 + ratio: width / height, //适配比例 pathDir: this.context.filesDir, context: this.context, isJudgeInitBool: false, }) - const windowClass = await windowStage.getMainWindow(); AppStorage.setOrCreate('windowClass', windowClass) - // await windowClass.setWindowLayoutFullScreen(true) await windowClass.setWindowSystemBarEnable([]) //全屏 - // await windowClass.setWindowSystemBarEnable(['navigation']) windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index d6cd08e..90cb160 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -20,7 +20,7 @@ import { delPic } from '../utils/Video'; import { FileHelper } from '../utils/FileHelp'; import { GetCurrentTime } from '../utils/Common'; import { ObtainUdpBusinessInstance } from '../utils/business/ObtainUdpBusiness'; -import { CenterUDPClientInstance } from '../utils/business/CenterUdpBusiness'; +import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness'; import { DrivingDataStorage } from '../utils/business/DrivingDataStorage'; import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness'; import { JudgeEmitterInstance } from '../utils/business/UdpEvent'; @@ -44,6 +44,7 @@ struct Index { @State fd: number = -1; @State carInfo: CarInfoType = {}; @State num: number = 0; + private context = getContext(this) as common.UIAbilityContext; errorDialog: CustomDialogController = new CustomDialogController({ builder: errorMsgDialog({ title: AppStorage.get('title'), @@ -57,14 +58,12 @@ struct Index { alignment: DialogAlignment.Center, }, ) - private fileHelper!: FileHelper + private fileHelper: FileHelper = new FileHelper(this.context) private interval = -1; - private avPlayer!: VoiceAnnounce - private timeInfo!: TimeSynchronizationRspBody - private context = getContext(this) as common.UIAbilityContext; + private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context) + private timeInfo: TimeSynchronizationRspBody = {} async aboutToAppear() { - this.avPlayer = new VoiceAnnounce(this.context); this.ratio = AppStorage.get('baseInfo')?.ratio || 1.4 this.initParamFlag = false this.delLoading = false @@ -133,7 +132,7 @@ struct Index { carId: this.carInfo?.carId, examinationRoomId: this.carInfo?.examinationRoomId, judgeVersion: this.baseInfo?.judgeVersion, - shellVersion: this.baseInfo?.version||"", + shellVersion: this.baseInfo?.version || "", paraKdid: this.timeInfo?.paraKdid || this.timeInfo?.kdid, kdid: this.timeInfo?.kdid || this.timeInfo?.paraKdid, mode: this.timeInfo?.mode, @@ -199,11 +198,9 @@ struct Index { } async createAlbum() { - this.fileHelper = new FileHelper(this.context); const time = GetCurrentTime() const date = time.split(' ')[0] this.fileHelper.createAlbum('jt') - // this.fileHelper.createAlbum('2025-01-02') this.fileHelper.createAlbum('pz'); this.fileHelper.createAlbum(date); } @@ -212,9 +209,9 @@ struct Index { //设置plc udp 同步requesthost ObtainUdpBusinessInstance.init(); - CenterUDPClientInstance.init(); - CenterUDPClientInstance.startHeartBeat() - CenterUDPClientInstance.onMsg((data: centerCallBackMsgType) => { + CenterUDPBusinessInstance.init(); + CenterUDPBusinessInstance.startHeartBeat() + CenterUDPBusinessInstance.onMsg((data: centerCallBackMsgType) => { if (data.id == 32) { AppStorage.setOrCreate('signNum', data.body[1]) } @@ -489,7 +486,6 @@ struct Index { .backgroundColor('#E6E3DF') .borderRadius(19 * this.ratio) } - if (this.loading) { Column() { Image($r('app.media.open_loading')) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index e95109b..194695a 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -42,7 +42,7 @@ import { GetCurrentUserKeyValue } from './UserInfo/utils'; import dayTs from '../utils/Date'; import { GetCurrentTime, NumberToByteArray } from '../utils/Common'; import DB from '../utils/DbSql'; -import { CenterUDPClientInstance } from '../utils/business/CenterUdpBusiness'; +import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness'; import { JudgeEmitterInstance } from '../utils/business/UdpEvent'; import errorMsgDialog from './compontents/errorMsgDialog'; @@ -308,7 +308,7 @@ struct UserInfo { } async onPageHide(): Promise { - CenterUDPClientInstance.offMsg(this.onCenterMsg) + CenterUDPBusinessInstance.offMsg(this.onCenterMsg) } //身份证读卡器初始化 @@ -469,7 +469,7 @@ struct UserInfo { } async heartMsg() { - CenterUDPClientInstance.onMsg(this.onCenterMsg) + CenterUDPBusinessInstance.onMsg(this.onCenterMsg) } //考点端查询缺考指令内容消息请求 @@ -484,7 +484,7 @@ struct UserInfo { placeId: this.carInfo.examinationRoomId as string } // globalThis.udpClient2.sendMsgExt(param, this.context) - CenterUDPClientInstance.sendData(param) + CenterUDPBusinessInstance.sendData(param) } async initSysset() { @@ -808,7 +808,7 @@ struct UserInfo { carNo: this.carInfo.carNo || "", placeId: this.carInfo.examinationRoomId || "" } - CenterUDPClientInstance.sendData(param) + CenterUDPBusinessInstance.sendData(param) // globalThis.udpClient2.sendMsgExt(param, this.context) if (res.examinationStuAbsentRsp && res.examinationStuAbsentRsp.head && res.examinationStuAbsentRsp.head.resultCode == '0') { diff --git a/entry/src/main/ets/pages/compontents/FaceCompare.ets b/entry/src/main/ets/pages/compontents/FaceCompare.ets index d44ce81..d77d38a 100644 --- a/entry/src/main/ets/pages/compontents/FaceCompare.ets +++ b/entry/src/main/ets/pages/compontents/FaceCompare.ets @@ -7,7 +7,7 @@ import { VideoConfigData } from '../../mock'; import { CarInfoType, UDPParamType, VideoConfig } from '../../model'; import { NumberToByteArray } from '../../utils/Common'; import FileUtils from '../../utils/FileUtils'; -import { CenterUDPClientInstance } from '../../utils/business/CenterUdpBusiness'; +import { CenterUDPBusinessInstance } from '../../utils/business/CenterUdpBusiness'; import { takePhoto, takePhotoParam } from '../../utils/Video'; import { voiceService } from '../../utils/Voice'; @@ -244,7 +244,7 @@ export default struct FaceCompare { this.callBackFlag = true } } - CenterUDPClientInstance.sendData(param) + CenterUDPBusinessInstance.sendData(param) // UDP缺失 // globalThis.udpClient2 && globalThis.udpClient2.sendMsgExt(param, this.context) clearInterval(this.interval) @@ -256,10 +256,10 @@ export default struct FaceCompare { carNo: this.carInfo.carNo || "", placeId: this.carInfo.examinationRoomId || "", } - CenterUDPClientInstance.sendData(param2) + CenterUDPBusinessInstance.sendData(param2) } }, 1000) - CenterUDPClientInstance.onMsg((val) => { + CenterUDPBusinessInstance.onMsg((val) => { if (AppStorage.get('statue') != 3) { return } diff --git a/entry/src/main/ets/pages/judgeSDK/api/index.ets b/entry/src/main/ets/pages/judgeSDK/api/index.ets index 2f0fe23..492e06a 100644 --- a/entry/src/main/ets/pages/judgeSDK/api/index.ets +++ b/entry/src/main/ets/pages/judgeSDK/api/index.ets @@ -1,7 +1,6 @@ import libJudgeSdk from 'libjudgesdk.so'; import { JudgeBeginObj, JudgeInitObj, Plc } from '../../../model'; -// import libJudgeSdk from '@ohos.judgesdk' /** * 苏仁君 * @date 2023/04/10 diff --git a/entry/src/main/ets/utils/UdpUtils.ets b/entry/src/main/ets/utils/UdpUtils.ets index b847f43..fd6db3a 100644 --- a/entry/src/main/ets/utils/UdpUtils.ets +++ b/entry/src/main/ets/utils/UdpUtils.ets @@ -4,7 +4,7 @@ import { CarInfoType, EnvironmentConfigurationType } from '../model' import { UDPTag } from '../config' import { BusinessError } from '@ohos.base' import { FillZero, StringToBytes, StringToASCII } from './Common' -import { CenterUDPClientInstance } from './business/CenterUdpBusiness' +import { CenterUDPBusinessInstance } from './business/CenterUdpBusiness' interface MsgExt { id: number, diff --git a/entry/src/main/ets/utils/business/CenterUdpBusiness.ets b/entry/src/main/ets/utils/business/CenterUdpBusiness.ets index 899a2e4..6fd8a59 100644 --- a/entry/src/main/ets/utils/business/CenterUdpBusiness.ets +++ b/entry/src/main/ets/utils/business/CenterUdpBusiness.ets @@ -146,4 +146,4 @@ class CenterUDPBusiness { } } -export const CenterUDPClientInstance = new CenterUDPBusiness(); \ No newline at end of file +export const CenterUDPBusinessInstance = new CenterUDPBusiness(); \ No newline at end of file diff --git a/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets b/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets index 524f758..3ee450d 100644 --- a/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets +++ b/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets @@ -4,7 +4,7 @@ import { fillZero, } from '../../pages/judgeSDK/utils/Common'; import { JudgeConfig } from '../../pages/judgeSDK/utils/judgeConfig'; import { FillZero, StringToASCII } from '../Common'; import UdpClient from '../UdpUtils' -import { CenterUDPClientInstance } from './CenterUdpBusiness'; +import { CenterUDPBusinessInstance } from './CenterUdpBusiness'; import { ObtainUdpBusinessInstance } from './ObtainUdpBusiness'; import systemTime from '@ohos.systemDateTime'; import { examCalcGpsDistance } from '../../pages/judgeSDK/api'; @@ -347,7 +347,7 @@ class JudgeUdpBusiness { //申请远程扣分查询 askKf(directives: number) { const carInfo: CarInfoType = AppStorage.get('carInfo')! - CenterUDPClientInstance.sendData({ + CenterUDPBusinessInstance.sendData({ id: 35, list: [directives], carNo: carInfo.carNo!, @@ -359,7 +359,7 @@ class JudgeUdpBusiness { //确定远程扣分 confirmKf(directives: number, code: number) { const carInfo: CarInfoType = AppStorage.get('carInfo')! - CenterUDPClientInstance.sendData({ + CenterUDPBusinessInstance.sendData({ id: 37, list: [directives, code], carNo: carInfo.carNo!,