diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index c6ba175..ea4373b 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -12,19 +12,18 @@ import FileUtils from '../utils/FileUtils'; export default class EntryAbility extends UIAbility { async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { + console.log("多伦鸿蒙车载程序启动") try { await DB.init(this.context) await InitTable() let fileUtil = new FileUtils(this.context) + // 一些地址配置 const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'); - console.log("读取配置", data) if (data !== '' && data !== undefined) { - console.log("配置设置") const result: EnvironmentConfigurationType = JSON.parse(data) AppStorage.setOrCreate("EnvironmentConfiguration", result) - const host=`http://${result.centerIp}:${result.centerPort}` - console.log("host",host) - AppStorage.setOrCreate("host",host) + const host = `http://${result.centerIp}:${result.centerPort}` + AppStorage.setOrCreate("host", host) } } catch (e) { console.error('sql first error', e) @@ -46,7 +45,6 @@ export default class EntryAbility extends UIAbility { 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') diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 17e5f02..b6597af 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -125,8 +125,8 @@ struct Index { exam() { this.loadingDialog.open() if (!this.timeInfo) { - AppStorage.setOrCreate('type', 1) - AppStorage.setOrCreate('title', '时间同步接口连接失败') + // AppStorage.setOrCreate('type', 1) + // AppStorage.setOrCreate('title', '时间同步接口连接失败') this.errorDialog.open() promptAction.showToast({ message: `时间同步接口连接失败`, diff --git a/entry/src/main/ets/utils/Request.ets b/entry/src/main/ets/utils/Request.ets index a7c7741..b16b6b0 100644 --- a/entry/src/main/ets/utils/Request.ets +++ b/entry/src/main/ets/utils/Request.ets @@ -131,6 +131,7 @@ export default function Request(options: RequestOption) extraData: options.xml ? options.data : JSON.stringify(options.data), readTimeout: options.timeout || 30 * 1000 }).then(async data => { + console.log(RequestTag, options.url, "返回的数据", JSON.stringify(data)) let result = options.xml ? xmlToJSON(data.result as string) : data.result let resObj: object = new Object() if (typeof result === 'string') { diff --git a/entry/src/main/ets/utils/UdpUtils.ets b/entry/src/main/ets/utils/UdpUtils.ets index 9fa51f7..7d46f99 100644 --- a/entry/src/main/ets/utils/UdpUtils.ets +++ b/entry/src/main/ets/utils/UdpUtils.ets @@ -59,10 +59,11 @@ export default class UdpClient { bindUdp(): Promise | undefined { + console.log(UDPTag, "绑定udp",this.localIp,this.localIpPort) return this.udp?.bind({ address: this.localIp, port: parseInt(this.localIpPort), family: 1 - }).then(res=>{ - console.log(UDPTag,"udp 绑定成功!",JSON.stringify(res)) + }).then(res => { + console.log(UDPTag, "udp 绑定成功!", JSON.stringify(res)) }) } @@ -92,8 +93,8 @@ export default class UdpClient { address: { address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1 } - }).then(res=>{ - console.log(UDPTag,"udp发送成功",JSON.stringify(res)) + }).then(res => { + console.log(UDPTag, "udp发送成功", JSON.stringify(res)) }) } @@ -113,18 +114,18 @@ export default class UdpClient { } async create(udpLocalIp: string, udpLocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) { - console.log(UDPTag,"udp 初始化") + console.log(UDPTag, "udp 初始化参数", udpLocalIp, udpLocalIpPort, udpOppositeIp, udpOppositeIpPort) await this.close() this.localIp = udpLocalIp this.oppositeIp = udpOppositeIp this.localIpPort = udpLocalIpPort this.oppositeIpPort = udpOppositeIpPort - this.udp = socket.constructUDPSocketInstance(); - try{ + try { + this.udp = socket.constructUDPSocketInstance(); this.bindUdp() this.bindEvent() } catch (e) { - console.log(UDPTag,"udp错误",JSON.stringify(e)) + console.log(UDPTag, "udp错误", JSON.stringify(e)) } } diff --git a/entry/src/main/ets/utils/business/ObtainUdpBusiness.ets b/entry/src/main/ets/utils/business/ObtainUdpBusiness.ets index f1cf3b0..0ff3f77 100644 --- a/entry/src/main/ets/utils/business/ObtainUdpBusiness.ets +++ b/entry/src/main/ets/utils/business/ObtainUdpBusiness.ets @@ -98,7 +98,7 @@ class ObtainUdpBusiness { private initSecondGeneration() { } - + // 三代机udp初始化 private initThirdGeneration() { try { let config: EnvironmentConfigurationType = diff --git a/oh-package-lock.json5 b/oh-package-lock.json5 index b959024..d61f840 100644 --- a/oh-package-lock.json5 +++ b/oh-package-lock.json5 @@ -2,8 +2,8 @@ "lockfileVersion": 2, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": { - "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19", - "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3" + "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3", + "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" }, "packages": { "@ohos/hypium@1.0.19": {