|
@@ -73,7 +73,7 @@ class BleUtil {
|
|
|
const strings = require('./../../utils/strings');
|
|
|
var services = await that.manager.getNotifyServices(device);
|
|
|
if (strings.isEmpty(services)) {
|
|
|
- onChanged(false, device);
|
|
|
+ onChanged(false);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -81,9 +81,25 @@ class BleUtil {
|
|
|
async function (notifyServiceId, notifyCharaterId) {
|
|
|
var isTrue = that.manager.monitorCharacteristicValueChange(device, notifyServiceId, notifyCharaterId);
|
|
|
if (!isTrue) {
|
|
|
- onChanged(false, device);
|
|
|
+ onChanged(false);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ ///解决连接之后会有一段时间显示离线,先添加进去就不会了
|
|
|
+ var has = false;
|
|
|
+ var compareList = that.bleManager.getCompareList();
|
|
|
+ for (var j = 0; j < compareList.length; j++) {
|
|
|
+ if (compareList[j].deviceId == device.deviceId) {
|
|
|
+ has = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!has) {
|
|
|
+ compareList.unshift(device);
|
|
|
+ that.bleManager.setCompareList(compareList);
|
|
|
+ }
|
|
|
+ onChanged(true);
|
|
|
+
|
|
|
const hex_util = require('./../../utils/hex_util');
|
|
|
const bt_parse = require('./../../devices/bluetooth/bt_parse');
|
|
|
that.manager.onBLECharacteristicValueChange(function (value) {
|
|
@@ -99,7 +115,7 @@ class BleUtil {
|
|
|
});
|
|
|
},
|
|
|
function () {
|
|
|
- onChanged(false, device);
|
|
|
+ onChanged(false);
|
|
|
return;
|
|
|
});
|
|
|
}
|