|
@@ -162,7 +162,7 @@ function getSecret(deviceId, serviceId, characteristicId, client, kBytes, pBytes
|
|
|
getSecret(deviceId, serviceId, characteristicId, client, kBytes, pBytes, gBytes, obj.laveData);
|
|
|
}
|
|
|
},
|
|
|
- fail: function (res) {}
|
|
|
+ fail: function (res) { }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -192,7 +192,7 @@ function writeDeviceRouterInfoStart(deviceId, serviceId, characteristicId, data)
|
|
|
writeRouterSsid(deviceId, serviceId, characteristicId, null);
|
|
|
}
|
|
|
},
|
|
|
- fail: function (res) {}
|
|
|
+ fail: function (res) { }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -290,7 +290,7 @@ function writeDevicePwd(deviceId, serviceId, characteristicId, data) {
|
|
|
writeDeviceEnd(deviceId, serviceId, characteristicId, null);
|
|
|
}
|
|
|
},
|
|
|
- fail: function (res) {}
|
|
|
+ fail: function (res) { }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -336,7 +336,7 @@ function init() {
|
|
|
if (options.isStart) {
|
|
|
//第一步检查蓝牙适配器是否可用
|
|
|
wx.onBluetoothAdapterStateChange(function (res) {
|
|
|
- if (!res.available) {}
|
|
|
+ if (!res.available) { }
|
|
|
});
|
|
|
if (!itue) {
|
|
|
return;
|
|
@@ -357,6 +357,19 @@ function init() {
|
|
|
let countsTimes = 0;
|
|
|
wx.onBluetoothDeviceFound(function (devices) {
|
|
|
//剔除重复设备,兼容不同设备API的不同返回值
|
|
|
+ // let newOptions = devices.devices;
|
|
|
+ // newOptions.forEach((v) => {
|
|
|
+ // // let name = v.name ?? ""
|
|
|
+ // let deviceId = v.deviceId ?? ""
|
|
|
+ // // let localName =v.localName ?? ""
|
|
|
+ // // if (name && name.includes("MW") ) {
|
|
|
+ // if (deviceId && deviceId.includes("AAA4E8D0")) {
|
|
|
+ // // let deviceStr = `${v.name ?? ""}, ${v.localName ?? ""}; `;
|
|
|
+ // // deviceInfoStr += deviceStr;
|
|
|
+ // console.log("搜索到的MW设备信息2:", mDeviceEvent.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS, JSON.stringify(v));
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+
|
|
|
var isnotexist = true;
|
|
|
if (devices.deviceId) {
|
|
|
if (devices.advertisData) {
|
|
@@ -370,6 +383,8 @@ function init() {
|
|
|
}
|
|
|
}
|
|
|
if (isnotexist) {
|
|
|
+ console.log("打印1")
|
|
|
+
|
|
|
devicesList.push(devices)
|
|
|
}
|
|
|
} else if (devices.devices) {
|
|
@@ -384,7 +399,16 @@ function init() {
|
|
|
}
|
|
|
}
|
|
|
if (isnotexist) {
|
|
|
- devicesList.push(devices.devices[0])
|
|
|
+
|
|
|
+ let name = devices.devices[0].name ?? ""
|
|
|
+ let localName = devices.devices[0].localName ?? ""
|
|
|
+ // AIrSMArT_d03110c71019
|
|
|
+ if (name.includes("AIrSMArT") || localName.includes("AIrSMArT")) {
|
|
|
+ // devices.devices[0].name = name.includes("AIrSMArT") ? name : localName
|
|
|
+ console.log("打印2", JSON.stringify(devices.devices[0]))
|
|
|
+ devicesList.push(devices.devices[0])
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
} else if (devices[0]) {
|
|
|
if (devices[0].advertisData) {
|
|
@@ -398,9 +422,11 @@ function init() {
|
|
|
}
|
|
|
}
|
|
|
if (isnotexist) {
|
|
|
+ console.log("打印3", devices[0].deviceId.inc)
|
|
|
devicesList.push(devices[0])
|
|
|
}
|
|
|
}
|
|
|
+ // console.log("打印:", newOptions);
|
|
|
|
|
|
let obj = {
|
|
|
'type': mDeviceEvent.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS,
|