完成BJQ4877功能开发
This commit is contained in:
@ -1587,7 +1587,11 @@ class BleHelper {
|
||||
}
|
||||
//向蓝牙设备发送一个字符串的ASCII码
|
||||
sendString(deviceid, str, writeServiceId, wirteCharactId, ms) {
|
||||
if (str && str.length) {
|
||||
if(str && typeof(str)=='object'){
|
||||
str=JSON.stringify(str);
|
||||
}
|
||||
if (str) {
|
||||
|
||||
let buffer = new ArrayBuffer(str.length);
|
||||
let dataView = new DataView(buffer);
|
||||
|
||||
|
||||
@ -5,7 +5,8 @@ class BleReceive {
|
||||
'/pages/6155/deviceDetail': this.Receive_6155.bind(this),
|
||||
'/pages/7305/BJQ7305': this.Receive_6155.bind(this),
|
||||
'/pages/650/HBY650': this.Receive_650.bind(this),
|
||||
'/pages/670/HBY670': this.Receive_670.bind(this)
|
||||
'/pages/670/HBY670': this.Receive_670.bind(this),
|
||||
'/pages/4877/BJQ4877': this.Receive_4877.bind(this),
|
||||
};
|
||||
}
|
||||
|
||||
@ -490,6 +491,34 @@ class BleReceive {
|
||||
}
|
||||
}
|
||||
|
||||
Receive_4877(receive,f,path,recArr){
|
||||
let receiveData={};
|
||||
|
||||
try {
|
||||
|
||||
console.log("str=",receive.str);
|
||||
receiveData = JSON.parse(receive.str);
|
||||
|
||||
let recCnt = recArr.find(v => {
|
||||
return v.key.replaceAll('/', '').toLowerCase() == f.device.detailPageUrl
|
||||
.replaceAll('/', '').toLowerCase();
|
||||
});
|
||||
if (!recCnt) {
|
||||
if (receiveData.sta_PowerPercent<=20) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "设备电量低",
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
receiveData = {};
|
||||
console.log("文本解析失败",error)
|
||||
}
|
||||
return receiveData;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user