添加报警功能

This commit is contained in:
liub
2025-08-28 14:05:06 +08:00
parent c2aa8bfa2f
commit 9846fe2315
18 changed files with 1212 additions and 444 deletions

View File

@ -105,17 +105,17 @@ class BleHelper {
}
linkAllDevices() {
console.log("模块启动时,自动连接已连接过的设备", this.data.LinkedList);
// console.log("模块启动时,自动连接已连接过的设备", this.data.LinkedList);
if (this.data.LinkedList && this.data.LinkedList.length > 0) {
for (var i = 0; i < this.data.LinkedList.length; i++) {
let device = this.data.LinkedList[i];
console.log("自动连接:" + device.deviceId);
// console.log("自动连接:" + device.deviceId);
this.LinkBlue(device.deviceId, device.writeServiceId, device.wirteCharactId, device
.notifyCharactId);
}
} else {
console.log("无设备连接");
// console.log("无设备连接");
}
}
@ -128,7 +128,7 @@ class BleHelper {
}
const currentPage = pages[pages.length - 1];
console.log("currentPage=", currentPage.route);
// console.log("currentPage=", currentPage.route);
return currentPage.route;
}
@ -181,7 +181,7 @@ class BleHelper {
key = new Date().getTime();
}
if (key) {
console.log("订阅消息回调,key=" + key);
// console.log("订阅消息回调,key=" + key);
let f = this.cfg.receivDataCallback.findIndex((v) => {
return v.key == key;
});
@ -363,7 +363,7 @@ class BleHelper {
uni.openBluetoothAdapter({
success: (args) => {
console.log("蓝牙初始化成功:" + JSON.stringify(args));
// console.log("蓝牙初始化成功:" + JSON.stringify(args));
this.data.isOpenBlue = true;
this.data.available=true;
resolve(true);
@ -371,7 +371,7 @@ class BleHelper {
if (this.data.isSubscribe) { //整个App生命周期只订阅一次
return;
}
console.log("开始订阅各类变化消息");
// console.log("开始订阅各类变化消息");
this.data.isSubscribe = true;
@ -417,7 +417,7 @@ class BleHelper {
uni.setStorageSync(this.StorageKey, this.data
.LinkedList);
} else {
console.log("蓝牙连接已恢复,", res);
// console.log("蓝牙连接已恢复,", res);
}
});
@ -437,7 +437,7 @@ class BleHelper {
uni.onBLECharacteristicValueChange((receive) => {
//订阅消息
console.log("收到订阅消息",receive);
// console.log("收到订阅消息",receive);
let f=this.data.LinkedList.find((v) => {
return v.deviceId == receive.deviceId;
})
@ -500,7 +500,7 @@ class BleHelper {
str: str,
hexs: hexs
};
console.log("监听到特征值:" + JSON.stringify(recData));
// console.log("监听到特征值:" + JSON.stringify(recData));
if (this.cfg.receivDataCallback) {
if (this.cfg.receivDataCallback.length > 0) {
@ -678,7 +678,7 @@ class BleHelper {
state: state,
success: (res) => {
if (state) {
console.log("订阅消息成功", res);
// console.log("订阅消息成功", res);
} else {
console.log("取消订阅成功", res);
}