有些手机通过蓝牙搜索能够搜索的指定设备,但是有些手机却收不到,我这里有两台设备是搜索不到的。
/**
* 搜索蓝牙设备
*/
searchBluetooth: function() {
var that = this;
wx.startBluetoothDevicesDiscovery({
services: [util.MAIN_SERVICE_LIST_UUID],
interval: 3000,
success: function(res) {
console.log(‘开启搜索蓝牙成功’);
},
})
wx.onBluetoothDeviceFound(function(res) {
console.log(res);
console.log(‘发现新的设备’);
// 获取搜索到的蓝牙设备
wx.getBluetoothDevices({
success: function(resList) {
console.log(resList);
that.setData({
bluetoothDevices: resList.devices
});
console.log(that.data.bluetoothDevices);
}
})
})
},