fix: 修复轨迹
This commit is contained in:
parent
1016b32873
commit
0077cdc077
@ -1,6 +1,7 @@
|
||||
import socket from '@ohos.net.socket'
|
||||
import { UDPTag } from '../config'
|
||||
import { FillZero, StringToASCII } from './Common'
|
||||
import { BusinessError } from '@ohos.base'
|
||||
|
||||
interface MsgExt {
|
||||
id: number,
|
||||
@ -81,7 +82,9 @@ export default class UdpClient {
|
||||
address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1
|
||||
}
|
||||
}).then(res => {
|
||||
// console.log(UDPTag, "udp发送成功", JSON.stringify(res))
|
||||
console.log(UDPTag, "udp发送成功", JSON.stringify(res))
|
||||
}).catch((e: BusinessError) => {
|
||||
console.error(UDPTag, "udp发送失败", JSON.stringify(e))
|
||||
})
|
||||
}
|
||||
|
||||
@ -141,7 +144,7 @@ export default class UdpClient {
|
||||
private bindEvent() {
|
||||
this.udp?.on("message", value => {
|
||||
let result = this.dealMethod?.(value.message)
|
||||
// console.log(UDPTag, "中心返回消息", result)
|
||||
console.log(UDPTag, "udp获取消息", result)
|
||||
this.messageEvents.forEach(cb => {
|
||||
cb(result)
|
||||
})
|
||||
|
||||
@ -12,6 +12,10 @@ class differentialSignal {
|
||||
|
||||
init(config: EnvironmentConfigurationType) {
|
||||
this.differentialSignalTcp = new TcpClient();
|
||||
this.differentialSignalTcp.onError(() => {
|
||||
console.error(TCPTag, "TCP发生错误")
|
||||
this.differentialSignalTcp.reBind()
|
||||
})
|
||||
// let config: EnvironmentConfigurationType =
|
||||
// AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration") || {
|
||||
// tcplocalIp: "",
|
||||
@ -33,6 +37,7 @@ class differentialSignal {
|
||||
// 组装消息,一秒发送五次
|
||||
let data = "1";
|
||||
this.timer = setInterval(() => {
|
||||
console.log(TCPTag, "发送给中心消息")
|
||||
this.differentialSignalTcp.sendMsg(data);
|
||||
}, 200);
|
||||
|
||||
@ -41,7 +46,7 @@ class differentialSignal {
|
||||
// 获取消息
|
||||
getData(callback: (data: ArrayBuffer) => void) {
|
||||
this.differentialSignalTcp.onMsg((data: ArrayBuffer) => {
|
||||
// console.log(TCPTag, "获取", data);
|
||||
console.log(TCPTag, "获取TCP消息", data);
|
||||
callback(data);
|
||||
});
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ function initFn(result: WorkerMessage) {
|
||||
function getDataFn(config: EnvironmentConfigurationType) {
|
||||
// 获取TCP差分改正数信号
|
||||
DifferentialSignal.getData((data: ArrayBuffer) => {
|
||||
// console.log(WorkerTag, "Received differential signal data:", data.byteLength, "bytes")
|
||||
console.log(WorkerTag, "获取中心差分改正消息:", data.byteLength, "bytes")
|
||||
// TCP拿到差分改正数发给后置机
|
||||
ObtainUdpBusinessInstance.sendData(data)
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user