添加102
This commit is contained in:
@ -510,7 +510,7 @@ class BleHelper {
|
||||
}
|
||||
|
||||
uni.onBluetoothAdapterStateChange((state) => {
|
||||
// console.log('蓝牙状态发生变化:' + JSON.stringify(state));
|
||||
console.log('蓝牙状态发生变化:' + JSON.stringify(state));
|
||||
this.data.discovering = state.discovering;
|
||||
|
||||
if (this.data.available !== state.available) {
|
||||
@ -632,18 +632,23 @@ class BleHelper {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
console.log("111111111")
|
||||
uni.onBluetoothDeviceFound((res) => {
|
||||
// console.log("发现新设备:" + JSON.stringify(devices));
|
||||
// console.log("发现新设备:" + JSON.stringify(res,'name'));
|
||||
let arr = [];
|
||||
for (var i = 0; i < res.devices.length; i++) {
|
||||
let item = res.devices[i];
|
||||
if(item.name){
|
||||
console.log("发现新设备",item.name+" "+item.RSSI);
|
||||
}
|
||||
|
||||
let f = serviceDic.find(v => {
|
||||
return item.advertisServiceUUIDs
|
||||
.includes(v.serviceId);
|
||||
});
|
||||
if (f) {
|
||||
|
||||
console.log("发现新设备:", item);
|
||||
console.log("发现目标设备:", item);
|
||||
arr.push(item);
|
||||
}
|
||||
|
||||
@ -788,7 +793,7 @@ class BleHelper {
|
||||
if (isUpdate) {
|
||||
this.updateCache();
|
||||
}
|
||||
// console.log("str1=", str);
|
||||
console.log("str1=", str);
|
||||
} catch (ex) {
|
||||
console.error("将数据转文本失败", ex);
|
||||
}
|
||||
@ -927,7 +932,7 @@ class BleHelper {
|
||||
services: serviceId ? [serviceId] : [],
|
||||
allowDuplicatesKey: true,
|
||||
success: (res) => {
|
||||
//console.log('开始搜索蓝牙设备成功');
|
||||
console.log('开始搜索蓝牙设备成功');
|
||||
resolve(res);
|
||||
|
||||
},
|
||||
@ -1888,6 +1893,7 @@ class BleHelper {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
let instance = null;
|
||||
|
||||
Reference in New Issue
Block a user