670完成
This commit is contained in:
@ -257,25 +257,25 @@ class BleReceive {
|
||||
try {
|
||||
// 跳过帧头(第一个字节),从第二个字节开始解析
|
||||
let staticLevelByte = bytes[1];
|
||||
let staticLevelText = '未知';
|
||||
let staticLevelText = '';
|
||||
switch (staticLevelByte) {
|
||||
case 0x65:
|
||||
staticLevelText = '高档';
|
||||
staticLevelText = 'hight';
|
||||
break
|
||||
case 0x66:
|
||||
staticLevelText = '中档';
|
||||
staticLevelText = 'center';
|
||||
break
|
||||
case 0x67:
|
||||
staticLevelText = '低档';
|
||||
staticLevelText = 'low';
|
||||
break
|
||||
case 0x68:
|
||||
staticLevelText = '关闭';
|
||||
staticLevelText = 'close';
|
||||
break
|
||||
}
|
||||
|
||||
// 解析照明档位
|
||||
let lightingLevelByte = bytes[2];
|
||||
let lightingLevelText = lightingLevelByte === 0x6d ? '强光': lightingLevelByte === 0x6e ? '弱光': '关闭';
|
||||
let lightingLevelText = lightingLevelByte === 0x6d ? 'hight': lightingLevelByte === 0x6e ? 'low': 'close';
|
||||
|
||||
// 解析剩余照明时间(第三和第四字节,小端序)
|
||||
let lightingTime = (bytes[3] << 8) | bytes[4];
|
||||
@ -286,26 +286,26 @@ class BleReceive {
|
||||
let batteryLevel = Math.max(0, Math.min(100, batteryLevelByte));
|
||||
|
||||
let warn = bytes[6];
|
||||
if (warn == 0x00) {
|
||||
warn = '无预警';
|
||||
} else if (warn == 0x01) {
|
||||
warn = '弱预警';
|
||||
} else if (warn == 0x02) {
|
||||
warn = '中预警';
|
||||
} else if (warn == 0x03) {
|
||||
warn = '强预警';
|
||||
} else if (warn == 0x04) {
|
||||
warn = '非常强预警';
|
||||
}
|
||||
// if (warn == 0x00) {
|
||||
// warn = '无预警';
|
||||
// } else if (warn == 0x01) {
|
||||
// warn = '弱预警';
|
||||
// } else if (warn == 0x02) {
|
||||
// warn = '中预警';
|
||||
// } else if (warn == 0x03) {
|
||||
// warn = '强预警';
|
||||
// } else if (warn == 0x04) {
|
||||
// warn = '非常强预警';
|
||||
// }
|
||||
|
||||
let staticWarn = bytes[7] == 0x01 ? '静止报警': '无静止报警';
|
||||
let staticWarn = bytes[7] == 0x01;//静止报警
|
||||
let fourGStrenth = bytes[8]; //4g信号强度
|
||||
let sosTxt = bytes[9] == 0x00 ? '关闭' : bytes[9] == 0x01 ? '爆闪模式' : '红蓝模式';
|
||||
let sosTxt = bytes[9] == 0x00 ? '关闭' : bytes[9] == 0x01 ? 'sg' : 'rb';
|
||||
|
||||
receiveData.staticLevel = staticLevelText;
|
||||
receiveData.lightingLevel = lightingLevelText;
|
||||
receiveData.lightingTime = lightingTime ;
|
||||
receiveData.batteryLevel = batteryLevel;
|
||||
receiveData.modeCurr = staticLevelText;
|
||||
receiveData.lightCurr = lightingLevelText;
|
||||
receiveData.xuhang = lightingTime ;
|
||||
receiveData.battary = batteryLevel;
|
||||
receiveData.warnLevel = warn;
|
||||
receiveData.staticWarn = staticWarn;
|
||||
receiveData.fourGStrenth = fourGStrenth;
|
||||
|
Reference in New Issue
Block a user