From e355f3d2836246b9dbc2d58362ec472f8022bc97 Mon Sep 17 00:00:00 2001 From: Surenjun Date: Thu, 20 Jun 2024 10:49:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=97=A0=E9=94=A1usb=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ets/pages/judgeSDK/utils/judge-common.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judge-common.ts b/entry/src/main/ets/pages/judgeSDK/utils/judge-common.ts index c1b69c19..88bfb2b8 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judge-common.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judge-common.ts @@ -301,6 +301,42 @@ export const plcStrToWXJson = async (plc:string) =>{ return wuXiDataStr } +export const senorToWXDataStr= async (tempData) => { + const {sensor,gps} = tempData; + const timeStr = await getTimeStr() + + const {mkg,aqd,dh1,dh2, zfxd, yfxd, jgd, ygd,ssc , jsc, lhq, fsc, lb, ygq,wd} = sensor + const judgeSignal = [ + //车门 安全带 熄火 发动机启动 左转向 右转向 前照灯近灯 前照灯远灯 + mkg, aqd, dh1, dh2, zfxd, yfxd, jgd, ygd, + // 注车制动 行车制动 离合器 副制动 喇叭 雨刷 危险报警灯 示廓灯 系统未涉及的传感器信号 + ssc , jsc, lhq, fsc, lb, ygq, 0, 0, 0 + ] + + const judgeAnotherSignal = [ + // 低三挡位 左侧单边桥1 左侧单边桥2 右侧单边桥1 右侧单边桥2 雾灯 + '000', '0', '0', '0', '0', wd,,'0', + // 桩杆全无信号 左后绕车 右后绕车 右前绕车 左前绕车 + '000', '0', '0', '0', '0', '0','0' + ] + //@ts-ignore + const str1 = (judgeSignal.join('')*1).toString(16); + //@ts-ignore + const str2 = (judgeAnotherSignal.join('')*1).toString(16); + + const wuXiData = [ + // 卫星时间 精度 纬度 高度 方位角 俯仰角 速度角 速度 横滚 卫星定位状态 + '$KSXT', timeStr, gps.jd, gps.wd, gps.hbg, gps.hxj, gps.fyj, '' , gps.sd, '', gps.dwzt, + //前天线可用星数 后天线可用星数 东向坐标位置 北向位置坐标 天向位置坐标 东向速度 北向速度 天向速度 + '', '', '', '', '', '', '', '','', + //@ts-ignore 评判信号1 评判信号2 发动机转速 + (judgeSignal.join('')*1).toString(16), (judgeAnotherSignal.join('')*1).toString(16) , sensor.fdjzs, + '0xFFFFFFF' + ] + return wuXiData.map(d => (d + '')).join(','); + // console.log('wuXiData',wuXiData.join(',')); +} + //蓝灯 export function sendBlue(){ const arrBlue = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00];