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");

View File

@ -694,7 +694,8 @@ class BleReceive {
let receiveData = {};
try {
if (!receive.bytes || receive.bytes.length < 3) return receiveData;
const parsed = parseBleData(receive.bytes);
// 与 HBY100-J 页 bleValueNotify 共用 notify避免 parseBleData 执行两次重复日志、FB05 双次 resolve、onNotify 双次
const parsed = parseBleData(receive.bytes, { skipSideEffects: true });
if (!parsed) return receiveData;
if (parsed.longitude !== undefined) receiveData.longitude = parsed.longitude;
if (parsed.latitude !== undefined) receiveData.latitude = parsed.latitude;