merge upstream

This commit is contained in:
2026-04-01 08:45:34 +08:00
4 changed files with 92 additions and 56 deletions

View File

@ -1728,28 +1728,18 @@ class BleHelper {
return linkDevice(deviceId);
}).then((res) => {
if (res) { //新连接
if (res) { //新连接(含 createBLEConnection 刚成功)
// console.log("11111111");
if (fIndex == -1) {
// console.log("开始获取服务", targetServiceId)
return this.getService(deviceId, targetServiceId, writeCharId,
notifyCharId); //获取服务
} else {
if (f.wirteCharactId && f.notifyCharactId) {
if (!f.notifyState) {
// console.log("开始订阅特征");
this.subScribe(deviceId, true);
} else {
console.log("不订阅消息");
}
return Promise.resolve(true);
} else {
console.log("开始获取服务", targetServiceId)
return this.getService(deviceId, targetServiceId, writeCharId,
notifyCharId);
}
// 设备已在 LinkedList例如缓存/重连):不能仅用缓存的 write/notify UUID 直接订阅。
// 重连后须先 getBLEDeviceServices否则部分机型 notifyBLECharacteristicValueChange 报 no service(10004)notify 收不到任何数据。
console.log("已缓存设备重新连接,重新发现服务并订阅", deviceId);
return this.getService(deviceId, targetServiceId, writeCharId,
notifyCharId);
}
} else { //已连接过,直接订阅消息
// console.log("11111111");