557 lines
19 KiB
Plaintext
Raw Normal View History

2024-01-05 11:11:15 +08:00
import common from '@ohos.app.ability.common';
2024-07-02 11:39:46 +08:00
import router from '@ohos.router';
2025-01-20 08:50:40 +08:00
import { getEsCarModel, getSyncData, } from '../common/service/initable';
2024-07-02 11:39:46 +08:00
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
import { initJudgeUdp } from '../common/utils/UdpJudge';
2024-08-26 19:27:23 +08:00
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
2024-07-02 11:39:46 +08:00
import { getTCP } from '../common/utils/GlobalTcp';
2025-01-20 08:50:40 +08:00
import promptAction from '@ohos.promptAction';
import errorMsgDialog from './compontents/errorMsgDialog';
import imageBtn from './compontents/imageBtn';
2025-01-02 11:01:09 +08:00
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
2025-03-28 11:33:07 +08:00
import { BaseInfoType, centerCallBackMsgType } from '../model/Common';
2025-03-26 14:48:56 +08:00
import {
CarInfoType,
InitializeTheCentralTableType,
MASYSSETTableType,
TimeSynchronizationRspBody
} from '../model';
import { GetCarInfo, GetDeviceInfo, SetCurrentTime, SetSerialNumber, UseAuth } from './Index/utils';
import { GetSyncData, InitializeTheCentralTable } from '../utils/table/Operation';
import { BusinessError } from '@ohos.base';
import { delPic } from '../utils/Video';
2025-03-26 10:37:10 +08:00
import { FileHelper } from '../utils/FileHelp';
import GetDistance from '../utils/business/GetDistance';
import { GetCurrentTime, NumberToByteArray } from '../utils/Common';
2025-03-28 11:33:07 +08:00
import { ObtainSignalData } from '../utils/business/ObtainSignalData';
import { CentralHeartbeat } from '../utils/business/CentralHeartbeat';
2025-02-17 14:20:40 +08:00
2024-08-26 15:09:13 +08:00
2024-01-05 11:11:15 +08:00
@Entry
@Component
struct Index {
@State url: string = ''
@State hasAuth: boolean = false;
2024-08-10 14:00:18 +08:00
@State dialogVisiable: boolean = false;
2025-02-12 10:48:27 +08:00
@State singlePlay: boolean = false;
2025-02-18 10:47:28 +08:00
@State baseInfo: BaseInfoType = {};
2024-01-05 11:11:15 +08:00
@State deviceId: string = '';
@State angle: number = 0
2024-08-12 09:28:12 +08:00
@State dialogRatio: number = 0.8
2024-05-16 09:53:10 +08:00
@State ratio: number = 1700 / 960
2025-01-04 13:51:34 +08:00
@State delLoading: boolean = false
@State loading: boolean = false
2024-12-29 21:43:12 +08:00
@State initParamFlag: boolean = false
2024-01-05 11:11:15 +08:00
@State fd: number = -1;
2025-02-19 13:24:07 +08:00
@State carInfo: CarInfoType = {};
2024-07-03 16:21:56 +08:00
@State num: number = 0;
2025-02-19 13:24:07 +08:00
fileHelper: FileHelper = null;
2024-08-19 14:54:11 +08:00
errorDialog: CustomDialogController = new CustomDialogController({
builder: errorMsgDialog({
2025-02-17 14:20:40 +08:00
title: AppStorage.get('title'),
2025-02-12 10:48:27 +08:00
type: AppStorage.get('type'),
2024-08-19 14:54:11 +08:00
cancel: () => {
},
confirm: () => {
}
}),
customStyle: true,
alignment: DialogAlignment.Center,
},
)
2025-02-12 10:48:27 +08:00
private interval = -1;
2025-02-19 13:24:07 +08:00
private avPlayer: VoiceAnnounce
2025-03-26 14:48:56 +08:00
private timeInfo: TimeSynchronizationRspBody
2025-01-20 08:50:40 +08:00
private context = getContext(this) as common.UIAbilityContext;
2024-07-02 11:39:46 +08:00
2024-08-10 14:00:18 +08:00
@Styles
commStyle(){
2024-08-19 09:32:41 +08:00
.width(220 * this.ratio * this.dialogRatio)
.height(69 * this.ratio * this.dialogRatio)
2024-08-10 14:00:18 +08:00
.backgroundImage($r('app.media.button_nor'))
.backgroundImageSize({ width: '100%', height: '100%' })
2024-08-20 09:12:02 +08:00
// .margin({ bottom: 12 * this.ratio })
2024-08-10 14:00:18 +08:00
}
2024-08-19 09:32:41 +08:00
2024-01-05 11:11:15 +08:00
build() {
Column() {
Column() {
Row() {
Image($r('app.media.logo')).width('30%').height('5.5%').margin({ left: 24 })
Row() {
Image($r('app.media.btn_setting')).width('16.7%').height('12.2%')
.onClick(async () => {
2024-12-29 21:43:12 +08:00
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
2025-01-03 10:25:31 +08:00
// deleteAllPicturesFn()
2024-01-05 11:11:15 +08:00
if (this.loading) {
return
}
router.pushUrl({
url: 'pages/Settings',
}, router.RouterMode.Single);
})
Image($r('app.media.btn_back')).width('14.4%').height('12.2%')
.onClick(() => {
2024-12-29 21:43:12 +08:00
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
2024-08-19 09:32:41 +08:00
this.dialogVisiable = true
2024-01-05 11:11:15 +08:00
})
}
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
}
Column() {
Row() {
2025-02-12 10:48:27 +08:00
if (!this.singlePlay) {
2025-01-20 08:50:40 +08:00
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') })
2025-02-12 10:48:27 +08:00
.margin({ left: 80 * this.ratio })
2024-08-19 09:32:41 +08:00
.onClick(async () => {
2024-12-29 21:43:12 +08:00
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
2025-01-20 08:50:40 +08:00
// ||!this.initParamFlag
2024-08-19 09:32:41 +08:00
if (this.loading) {
2024-12-29 21:43:12 +08:00
// this.errorDialog.open()
2024-08-19 09:32:41 +08:00
return
}
2024-08-22 13:59:33 +08:00
setTimeout(() => {
this.angle = 360
}, 1000)
2024-08-19 09:32:41 +08:00
this.angle = 0
2025-02-12 10:48:27 +08:00
if (!this.timeInfo) {
2025-02-17 14:20:40 +08:00
AppStorage.setOrCreate('type', 1)
AppStorage.setOrCreate('title', '时间同步接口连接失败')
2024-08-23 13:44:42 +08:00
this.errorDialog.open()
2024-08-19 09:32:41 +08:00
promptAction.showToast({
message: `时间同步接口连接失败`,
duration: 3000
});
this.loading = false
return
}
2025-02-12 10:48:27 +08:00
if (!this.carInfo) {
2024-08-21 08:53:26 +08:00
promptAction.showToast({
message: `车辆信息接口获取失败`,
duration: 3000
});
2025-02-17 14:20:40 +08:00
AppStorage.setOrCreate('type', 1)
AppStorage.setOrCreate('title', '车辆信息接口获取失败')
2024-08-23 13:44:42 +08:00
this.errorDialog.open()
2024-08-21 08:53:26 +08:00
this.loading = false
return
}
2024-08-19 09:32:41 +08:00
this.testXMLToJSONInWorker()
2024-06-27 20:53:36 +08:00
2024-02-22 10:40:35 +08:00
2024-08-19 09:32:41 +08:00
})
2024-01-05 11:11:15 +08:00
}
2025-02-12 10:48:27 +08:00
if (this.singlePlay) {
2025-01-20 08:50:40 +08:00
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') })
2025-02-12 10:48:27 +08:00
.margin({ left: 80 * this.ratio })
2024-08-19 09:32:41 +08:00
.onClick(() => {
if (this.loading) {
return
2024-08-15 13:42:36 +08:00
}
2024-12-29 21:43:12 +08:00
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
2024-08-27 19:41:15 +08:00
if (judgeConfig.isTrajectoryOpen) {
2024-08-26 19:27:23 +08:00
router.pushUrl({
url: 'pages/UserInfo',
}, router.RouterMode.Single)
return
}
2024-08-19 09:32:41 +08:00
//判断数据库是否有表数据,有则直接跳转,没有则读取本地数据
2025-02-19 14:32:59 +08:00
getSyncData('MA_SYSSET').then((data: Array<string>) => {
2024-08-19 09:32:41 +08:00
console.log('datadata', JSON.stringify(data))
if (data?.[0]) {
router.pushUrl({
url: 'pages/UserInfo',
}, router.RouterMode.Single)
} else {
this.testXMLToJSONInWorker()
}
2024-08-22 13:59:33 +08:00
});
2024-08-19 09:32:41 +08:00
})
2024-01-05 11:11:15 +08:00
}
2025-01-20 08:50:40 +08:00
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_zj') })
2025-02-12 10:48:27 +08:00
.margin({ right: 80 * this.ratio })
2024-08-19 09:32:41 +08:00
.onClick(() => {
if (this.loading) {
return
}
2024-12-29 21:43:12 +08:00
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
2024-08-19 09:32:41 +08:00
router.pushUrl({
url: 'pages/CarCheck'
}, router.RouterMode.Single);
})
2024-01-05 11:11:15 +08:00
}
.width('100%')
.justifyContent(FlexAlign.SpaceAround)
}
Column() {
Row() {
Column() {
2025-02-12 10:48:27 +08:00
Text('V外壳' + this.baseInfo.version)
2024-01-05 11:11:15 +08:00
.fontColor('#CCAE7A')
2025-02-12 10:48:27 +08:00
.fontSize(18 * this.ratio)
2024-01-05 11:11:15 +08:00
.width('30%')
.margin({ bottom: 10 })
2025-02-17 14:20:40 +08:00
Text('V评判' + this.baseInfo.judgeVersion)
2024-10-28 13:47:03 +08:00
.fontColor('#CCAE7A')
2025-02-12 10:48:27 +08:00
.fontSize(18 * this.ratio)
2024-10-28 13:47:03 +08:00
.width('30%')
.margin({ bottom: 10 })
2025-02-12 10:48:27 +08:00
2025-02-18 13:43:20 +08:00
Text('授权信息:' + (this.baseInfo.hasAuth ? '已授权' : '未授权'))
2024-01-05 11:11:15 +08:00
.fontColor('#CCAE7A')
2025-02-12 10:48:27 +08:00
.fontSize(18 * this.ratio)
2024-01-05 11:11:15 +08:00
.width('30%')
}
.margin({ left: 24 })
.gesture(
GestureGroup(GestureMode.Exclusive,
2024-01-31 14:35:16 +08:00
TapGesture({ count: 2 })
2024-01-05 11:11:15 +08:00
.onAction(() => {
2024-06-27 20:53:36 +08:00
// takePhotoFn(this.context)
2025-02-12 10:48:27 +08:00
this.singlePlay = !this.singlePlay
2025-02-17 14:20:40 +08:00
AppStorage.setOrCreate('singlePlay', this.singlePlay)
2024-06-27 20:53:36 +08:00
2024-01-05 11:11:15 +08:00
})
)
)
2024-07-17 10:19:16 +08:00
Text('考车号:' + this.deviceId)
2024-07-02 11:39:46 +08:00
.fontColor('#CCAE7A')
2025-02-12 10:48:27 +08:00
.fontSize(22 * this.ratio)
2024-07-02 11:39:46 +08:00
.margin({ right: 24 })
2024-01-05 11:11:15 +08:00
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.margin({ bottom: 10 })
}
2024-07-02 11:39:46 +08:00
2024-05-09 13:42:56 +08:00
//
2024-08-10 14:00:18 +08:00
if (this.dialogVisiable) {
2024-08-19 09:32:41 +08:00
Flex({ justifyContent: FlexAlign.Center }) {
2024-08-10 14:00:18 +08:00
Text('确认是否退出应用')
2024-08-19 09:32:41 +08:00
.fontSize(28 * this.ratio * this.dialogRatio)
.margin({ top: 100 * this.ratio * this.dialogRatio })
2024-08-10 14:00:18 +08:00
Row() {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
2024-08-19 09:32:41 +08:00
Text(' 取 消 ')
.fontSize(24 * this.ratio * this.dialogRatio)
.fontColor('#fff')
.width(100 * this.ratio * this.dialogRatio)
2024-08-10 14:00:18 +08:00
}
.commStyle()
.onClick(() => {
this.dialogVisiable = false
2024-12-29 21:43:12 +08:00
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
2024-08-19 09:32:41 +08:00
}).margin({ right: 10 * this.ratio })
2024-08-10 14:00:18 +08:00
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
2024-08-19 09:32:41 +08:00
Text(' 确 定 ')
.fontSize(24 * this.ratio * this.dialogRatio)
.fontColor('#fff')
.width(100 * this.ratio * this.dialogRatio)
2024-08-10 14:00:18 +08:00
}
.commStyle()
.onClick(() => {
2024-12-29 21:43:12 +08:00
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
2024-08-10 14:00:18 +08:00
router.back()
})
2024-08-19 09:32:41 +08:00
}.position({ y: 265 * this.ratio * this.dialogRatio, x: 115 * this.ratio * this.dialogRatio })
2024-08-10 14:00:18 +08:00
}
2024-08-19 09:32:41 +08:00
.width(660 * this.ratio * this.dialogRatio)
.height(360 * this.ratio * this.dialogRatio)
.position({ x: 220 * this.ratio, y: 98 * this.ratio - 265 / 2 * (1 - this.ratio * this.dialogRatio) })
2024-08-10 14:00:18 +08:00
.backgroundColor('#E6E3DF')
2024-08-19 09:32:41 +08:00
.borderRadius(19 * this.ratio * this.dialogRatio)
2024-08-10 14:00:18 +08:00
}
2025-01-04 13:51:34 +08:00
if (this.delLoading) {
2025-01-03 17:24:11 +08:00
Column() {
Image($r('app.media.open_loading'))
2025-02-12 10:48:27 +08:00
.width(200 * this.ratio)
2025-01-03 17:24:11 +08:00
.rotate({ angle: this.angle })
2025-02-12 10:48:27 +08:00
.height(200 * this.ratio)
2025-01-03 17:24:11 +08:00
.animation({
duration: 5000, // 动画时长
curve: Curve.EaseOut, // 动画曲线
delay: 500, // 动画延迟
iterations: -1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
})
2025-02-12 10:48:27 +08:00
.margin({ top: 30 * this.ratio })
2025-01-03 17:24:11 +08:00
2025-01-04 13:51:34 +08:00
Text('正在清理本地数据,请稍候……')
2025-02-12 10:48:27 +08:00
.fontSize(24 * this.ratio)
.margin({ top: 20 * this.ratio })
2025-01-03 17:24:11 +08:00
.fontWeight(400)
}
2025-01-04 13:51:34 +08:00
.visibility(this.delLoading ? Visibility.Visible : Visibility.Hidden)
2025-02-12 10:48:27 +08:00
.width(660 * this.ratio)
.height(360 * this.ratio)
.position({ x: 150 * this.ratio, y: 98 * this.ratio })
2025-01-03 17:24:11 +08:00
.backgroundColor('#E6E3DF')
2025-02-12 10:48:27 +08:00
.borderRadius(19 * this.ratio)
2025-01-03 17:24:11 +08:00
}
2025-01-04 13:51:34 +08:00
2024-01-05 11:11:15 +08:00
if (this.loading) {
2024-07-02 11:39:46 +08:00
Column() {
Image($r('app.media.open_loading'))
2025-02-12 10:48:27 +08:00
.width(200 * this.ratio)
2024-07-02 11:39:46 +08:00
.rotate({ angle: this.angle })
2025-02-12 10:48:27 +08:00
.height(200 * this.ratio)
2024-07-02 11:39:46 +08:00
.animation({
duration: 5000, // 动画时长
curve: Curve.EaseOut, // 动画曲线
delay: 500, // 动画延迟
iterations: -1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
})
2025-02-12 10:48:27 +08:00
.margin({ top: 30 * this.ratio })
2024-07-02 11:39:46 +08:00
Image($r('app.media.car'))
2025-02-12 10:48:27 +08:00
.width(80 * this.ratio)
.height(80 * this.ratio)
.position({ x: 288 * this.ratio, y: 89 * this.ratio })
2024-07-02 11:39:46 +08:00
Text('获取考车信息,请稍候……')
2025-02-12 10:48:27 +08:00
.fontSize(24 * this.ratio)
.margin({ top: 20 * this.ratio })
2024-07-02 11:39:46 +08:00
.fontWeight(400)
}
.visibility(this.loading ? Visibility.Visible : Visibility.Hidden)
2025-02-12 10:48:27 +08:00
.width(660 * this.ratio)
.height(360 * this.ratio)
.position({ x: 150 * this.ratio, y: 98 * this.ratio })
2024-07-02 11:39:46 +08:00
.backgroundColor('#E6E3DF')
2025-02-12 10:48:27 +08:00
.borderRadius(19 * this.ratio)
2024-01-05 11:11:15 +08:00
}
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.SpaceBetween)
.backgroundImagePosition({ x: 0, y: 0 })
.backgroundImage($r('app.media.index_bg'))
.backgroundImageSize({ width: '100%', height: '100%' })
}
2024-08-22 13:59:33 +08:00
async aboutToAppear() {
2025-01-02 11:01:09 +08:00
this.avPlayer = new VoiceAnnounce();
2025-03-26 14:48:56 +08:00
this.ratio = AppStorage.get<number>('ratio')
2025-01-20 08:50:40 +08:00
this.initParamFlag = false
this.delLoading = false
2024-08-19 09:32:41 +08:00
this.dialogVisiable = false
2024-01-05 11:11:15 +08:00
this.angle = 0
this.loading = false
2025-02-17 14:20:40 +08:00
AppStorage.set('lsh', '1111111111111')
// TODO 未改
// globalThis.errorDialog = this.errorDialog
// globalThis.udpEvent = new UdpEvent();
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => {
res.forEach((element) => {
if (element.v_no === "305") {
delPic(Number(element.v_value), 1, this.context)
delPic(Number(element.v_value), 2, this.context)
2025-01-04 13:51:34 +08:00
}
});
2025-01-04 13:51:34 +08:00
});
2025-01-03 17:24:11 +08:00
2024-06-27 20:53:36 +08:00
}
2024-07-02 11:39:46 +08:00
async testXMLToJSONInWorker() {
2024-08-21 08:53:26 +08:00
if (this.loading) {
return
}
2024-08-26 19:27:23 +08:00
// let mode=globalThis.timeInfo?.mode?globalThis.timeInfo?.mode:1
// console.log('mode',mode)
2024-10-28 13:47:03 +08:00
const param: InitializeTheCentralTableType = {
2025-02-12 10:48:27 +08:00
carId: this.carInfo?.carId,
examinationRoomId: this.carInfo?.examinationRoomId,
judgeVersion: this.baseInfo.judgeVersion,
shellVersion: this.baseInfo.version,
paraKdid: this.timeInfo?.paraKdid || this.timeInfo?.kdid,
kdid: this.timeInfo?.kdid || this.timeInfo?.paraKdid,
2025-02-12 10:48:27 +08:00
mode: this.timeInfo?.mode,
2024-08-21 18:05:24 +08:00
context: this.context,
2025-03-26 14:48:56 +08:00
host: AppStorage.get<string>('host'),
2025-02-12 10:48:27 +08:00
centerHost: this.timeInfo?.url,
singlePlay: this.singlePlay
2024-06-27 20:53:36 +08:00
}
2024-08-21 08:53:26 +08:00
this.loading = true
2025-01-20 08:50:40 +08:00
// getSingleCenterTable(param).then((ret) => {
InitializeTheCentralTable(param).then((ret) => {
2025-01-20 08:50:40 +08:00
if (ret) {
GetSyncData<MASYSSETTableType>("MA_SYSSET").then(data => {
2024-10-28 13:47:03 +08:00
data.forEach(sys => {
//判断是否能点开始考试
2025-01-20 08:50:40 +08:00
if (sys.v_no === '854') {
2025-02-17 14:20:40 +08:00
AppStorage.setOrCreate('param854Str', sys.v_value)
2024-10-28 17:11:22 +08:00
}
2025-01-20 08:50:40 +08:00
if (sys.v_no === '824' && decodeURIComponent(sys.v_value) == '0') {
2024-10-28 13:47:03 +08:00
router.pushUrl({
2025-01-20 08:50:40 +08:00
url: 'pages/CarCheck',
2024-10-28 13:47:03 +08:00
params: {
2025-01-20 08:50:40 +08:00
'fromIndex': true
2024-10-28 13:47:03 +08:00
}
}, router.RouterMode.Single)
2025-01-20 08:50:40 +08:00
} else {
2024-10-28 13:47:03 +08:00
router.pushUrl({
url: 'pages/ExaminerLogin',
}, router.RouterMode.Single)
}
})
});
2024-07-01 12:36:46 +08:00
}
2025-01-20 08:50:40 +08:00
})
2024-01-05 11:11:15 +08:00
}
2024-07-02 11:39:46 +08:00
2024-02-26 15:01:27 +08:00
async heartMsg() {
2025-03-28 11:33:07 +08:00
// const signNum = AppStorage.get<number>('signNum')
// const statue = AppStorage.get<string>('statue')
// const lsh = AppStorage.get<string>('lsh')
// const arr = [signNum || 0, statue || 1]
// let tmpList: number[] = [];
// tmpList.push(NumberToByteArray(Number(arr[0]), 1 * 8)[0])
// tmpList.push(NumberToByteArray(Number(arr[1]), 1 * 8)[0])
// const str = lsh || '0000000000000'
// for (let i = 0; i < str.length; i++) {
// tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0])
// }
// TODO 未改
// const param = {
// id: 31,
// list: tmpList,
// carNo: this.carInfo.carNo,
// placeId: this.carInfo.examinationRoomId
// }
2024-06-27 20:53:36 +08:00
// globalThis.udpClient2.initHeartSendMsg(param,this.context)
// if (globalThis.udpClient2.getStatus()) {
// globalThis.udpClient2.sendMsgExt(param, this.context)
// }
2024-01-05 11:11:15 +08:00
}
2025-01-20 08:50:40 +08:00
2024-07-19 09:21:47 +08:00
async onPageShow() {
2025-01-04 13:51:34 +08:00
console.log('ttttt', 1111)
2025-03-26 14:48:56 +08:00
this.singlePlay = AppStorage.get<boolean>('singlePlay')
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')
// await this.userAuth();
UseAuth(this.context).then(() => {
this.initParams()
}).catch(() => {
});
2025-02-12 10:48:27 +08:00
if (this.singlePlay == undefined || this.singlePlay == null) {
2025-01-02 11:01:09 +08:00
// setVideoParam()
console.log('diyidiy')
2025-01-20 08:50:40 +08:00
this.context.resourceManager.getRawFileContent("welcome.wav")
.then(() => {
2025-01-20 08:50:40 +08:00
this.avPlayer.playAudio(['welcome.wav'])
// this.vocObj.playAudio({
// type: 1,
// name: 'welcome.wav'
// })
// let rawFile = value;
})
.catch((error: BusinessError) => {
2025-01-20 08:50:40 +08:00
console.log("getRawFileContent promise error is " + error);
});
2024-08-29 11:04:10 +08:00
2025-02-12 10:48:27 +08:00
this.singlePlay = false
2025-02-17 14:20:40 +08:00
AppStorage.setOrCreate('singlePlay', false)
2024-08-12 14:46:16 +08:00
}
2025-01-02 17:53:34 +08:00
// this.loading = false
2024-08-19 09:32:41 +08:00
this.num = 0
2024-06-27 20:53:36 +08:00
// const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
2025-02-17 14:20:40 +08:00
AppStorage.setOrCreate('lsh', '1111111111111')
2024-05-09 13:42:56 +08:00
}
2024-06-27 20:53:36 +08:00
2024-05-09 13:42:56 +08:00
async createAlbum() {
2025-01-20 08:50:40 +08:00
this.fileHelper = new FileHelper();
const time = await GetCurrentTime()
2025-01-03 10:25:31 +08:00
const date = time.split(' ')[0]
2025-01-20 08:50:40 +08:00
this.fileHelper.createAlbum('jt')
2025-01-04 13:51:34 +08:00
// this.fileHelper.createAlbum('2025-01-02')
2025-01-20 08:50:40 +08:00
this.fileHelper.createAlbum('pz');
this.fileHelper.createAlbum(date);
2024-01-05 11:11:15 +08:00
}
2024-07-03 16:21:56 +08:00
2024-01-05 11:11:15 +08:00
async initParams() {
2024-08-14 13:15:03 +08:00
//设置plc udp 同步requesthost
2025-03-28 11:33:07 +08:00
// await getUDP(this.context, false)
ObtainSignalData.init();
CentralHeartbeat.init();
CentralHeartbeat.getData((data:centerCallBackMsgType)=>{
if (data.id == 32) {
AppStorage.setOrCreate('signNum', data.body[1])
}
},)
2024-07-02 11:39:46 +08:00
this.loading = false
await GetDeviceInfo(this.context)
await GetCarInfo()
2025-03-28 11:33:07 +08:00
// await getUDP2(this.context, false)
2024-08-14 14:46:33 +08:00
getTCP()
2025-03-26 14:48:56 +08:00
this.carInfo = AppStorage.get<CarInfoType>('carInfo')
2025-02-12 10:48:27 +08:00
this.deviceId = this.carInfo.carNo
// await setCurrentTime();
await SetCurrentTime()
2025-03-26 14:48:56 +08:00
this.timeInfo = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')
const distanceClass = AppStorage.get<boolean>('distanceClass')
2025-02-12 10:48:27 +08:00
if (!distanceClass) {
const distanceClass = new GetDistance(this.context)
2024-10-28 13:47:03 +08:00
await distanceClass.initFolder()
2025-02-17 14:20:40 +08:00
AppStorage.setOrCreate('distanceClass', distanceClass)
2025-01-20 08:50:40 +08:00
console.info('surenjun', 'distanceClass=>初始化完成')
2024-10-28 13:47:03 +08:00
}
2025-02-18 13:43:20 +08:00
2025-01-20 08:50:40 +08:00
setTimeout(() => {
this.initParamFlag = true
}, 3000)
2024-01-31 14:35:16 +08:00
initJudgeUdp()
// TODO 摄像头遮挡
// takePhotoFn(this.context)
2024-08-14 14:46:33 +08:00
clearInterval(this.interval)
this.interval = setInterval(() => {
this.num++
// setliushuiNum()
SetSerialNumber()
2024-12-29 21:43:12 +08:00
// getliushuiNum(this.context)
2024-08-19 09:32:41 +08:00
if (this.num >= 3) {
2024-08-14 14:46:33 +08:00
this.heartMsg()
}
}, 1000)
2025-01-03 17:24:11 +08:00
this.createAlbum()
2024-01-05 11:11:15 +08:00
}
2024-07-02 11:39:46 +08:00
2024-01-05 11:11:15 +08:00
async getModel() {
const context = this.context;
//下载模型
await getEsCarModel(context)
}
}