1
0
forked from dyf/APP

尝试解决主分支冲突

This commit is contained in:
liub
2025-09-24 08:35:34 +08:00
50 changed files with 61143 additions and 13869 deletions

View File

@ -44,30 +44,33 @@ class BleReceive {
}
ReceiveData(receive,f,path) {
if(f && f.macAddress && f.id){
ReceiveData(receive,f,path,recArr) {
if(f && f.macAddress && f.device && f.device.id){
let data={};
if(f.detailPageUrl=='/pages/6155/deviceDetail'){
console.log("该设备是6155");
data= this.Receive_6155(receive,f,path);
if(f.device.detailPageUrl=='/pages/6155/deviceDetail'){
// console.log("该设备是6155");
data= this.Receive_6155(receive,f,path,recArr);
}
if(f.detailPageUrl=='/pages/650/HBY650'){
console.log("该设备是650");
data= this.Receive_650(receive,f,path);
if(f.device.detailPageUrl=='/pages/650/HBY650'){
// console.log("该设备是650");
data= this.Receive_650(receive,f,path,recArr);
}
if(f.detailPageUrl=='/pages/670/HBY670'){
console.log("该设备是670");
data= this.Receive_670(receive,f,path);
if(f.device.detailPageUrl=='/pages/670/HBY670'){
// console.log("该设备是670");
data= this.Receive_670(receive,f,path,recArr);
}
console.log("收到数据并处理完毕,",data);
// console.log("收到数据并处理完毕,",data);
return data;
}else{
console.log("已收到该消息,但无法处理",receive);
}
console.log("已收到该消息,但无法处理",f);
return receive;
}
Receive_650(receive,f,path) {
Receive_650(receive,f,path,recArr) {
console.log("通用程序正在处理650的数据",receive);
var parseData = () => {
@ -93,7 +96,7 @@ class BleReceive {
staticLevelText = '低档';
modeCurr = "low";
break;
case 0x68:
case 0x64:
staticLevelText = '关闭';
modeCurr = "close";
break;
@ -250,14 +253,14 @@ class BleReceive {
}
Receive_670(receive,f,path){
Receive_670(receive,f,path,recArr){
console.log("pagh=",path);
var todo = (bytes) =>{
console.log("todo");
// console.log("todo",receive);
let receiveData = {};
if (bytes[0] == 0x55) {
try {
console.log("todo");
// console.log("todo");
// 跳过帧头(第一个字节),从第二个字节开始解析
let staticLevelByte = bytes[1];
let staticLevelText = '';
@ -271,11 +274,11 @@ class BleReceive {
case 0x67:
staticLevelText = 'low';
break
case 0x68:
case 0x64:
staticLevelText = 'close';
break
}
console.log("todo");
// console.log("todo");
// 解析照明档位
let lightingLevelByte = bytes[2];
let lightingLevelText = lightingLevelByte === 0x6d ? 'hight': lightingLevelByte === 0x6e ? 'low': 'close';
@ -287,7 +290,7 @@ class BleReceive {
let batteryLevelByte = bytes[5];
let batteryLevel = Math.max(0, Math.min(100, batteryLevelByte));
console.log("todo");
// console.log("todo");
let warn = bytes[6];
if (warn == 0x00) {
warn = 'none';
@ -304,7 +307,7 @@ class BleReceive {
let staticWarn = bytes[7] == 0x01;//静止报警
let fourGStrenth = bytes[8]; //4g信号强度
let sosTxt = bytes[9] == 0x00 ? 'close' : bytes[9] == 0x01 ? 'sg' : 'rb';
console.log("todo");
// console.log("todo");
receiveData.modeCurr = staticLevelText;
receiveData.lightCurr = lightingLevelText;
receiveData.xuhang = lightingTime ;
@ -313,10 +316,25 @@ class BleReceive {
receiveData.staticWarn = staticWarn;
receiveData.fourGStrenth = fourGStrenth;
receiveData.SOS=sosTxt;
this.setBleFormData(receiveData,f);
console.log("recArr=",recArr);
let recCnt=recArr.find(v=>{
return v.key == f.device.detailPageUrl;
});
if(!recCnt){
if (this.formData.staticWarn) { //有静止报警
uni.showModal({
title:"警告",
content:"设备静止报警中",
showCancel:false
});
}
}
} catch(error) {
console.log('数据解析错误:', error);
}
console.log("todo");
// console.log("todo");
} else {
try {
let uint8Array = new Uint8Array(receive.value);
@ -340,6 +358,7 @@ class BleReceive {
console.log('收到纬度:', +this.receiveData.macAddress);
} else {
try {
// console.log("str=",str);
let json=JSON.parse(str);
if("staBlue_picture" in json){
//重发图片
@ -372,7 +391,7 @@ class BleReceive {
} catch (error) {
receiveData={};
console.log("文本解析失败")
// console.log("文本解析失败",error)
}
}
} catch(ex) {
@ -380,7 +399,7 @@ class BleReceive {
console.log('将数据转文本失败', ex);
}
}
console.log("todo",receiveData);
// console.log("todo",receiveData);
this.setBleFormData(receiveData,f);
return receiveData;
}
@ -390,8 +409,81 @@ class BleReceive {
return data;
}
Receive_6155() {
console.log("通用程序正在处理6155的数据");
Receive_6155(receive,f,path,recArr) {
let bytes=receive.bytes;
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
try {
let staticLevelByte = bytes[2];
let getName = function(type) {
let name = "";
switch (type) {
case 0x02:
name = '弱光';
break;
case 0x04:
name = '工作光';
break;
case 0x01:
name = '强光';
break;
case 0x03:
name = '爆闪';
break;
case 0x00:
name = '关闭';
break;
}
return name;
}
let staticLevelText = getName(staticLevelByte);
// 解析照明档位
let lightingLevelByte = bytes[3];
let lightingLevelText = getName(lightingLevelByte);
// 解析剩余电量
let batteryLevelByte = bytes[4];
// 电量百分比范围检查
let batteryLevel = Math.max(0, Math.min(100, batteryLevelByte));
//充电状态
let warn = bytes[5];
if (warn == 0x00) {
warn = '未充电';
} else if (warn == 0x01) {
warn = '充电中';
}
// 解析剩余照明时间(第三和第四字节,小端序)
let lightingTime = "";
let HH = Math.max(0, Math.min(100, bytes[6]));
let mm = Math.max(0, Math.min(100, bytes[7]));
lightingTime = HH + "小时" + mm + "分钟";
let formData={};
formData.mode = staticLevelText;
formData.fuMode = lightingLevelText;
formData.battary = batteryLevel;
formData.statu = warn;
formData.xuhang = lightingTime;
if (batteryLevel <= 20) {
uni.showModal({
content:"设备电量低",
title:"提示"
});
}
this.setBleFormData(formData,f);
return formData;
} catch (error) {
console.log('数据解析错误:', error);
}
}
}