微信蓝牙小程序无法打开notify
我的蓝牙设备在原生安卓上都正常运行,在微信小程序上打开通知一直提示10007,然后看了下特征值属性,都为false,是我代码问题还是设备问题还是微信小程序暂不支持?
5 回复
wx.createBLEConnection({ // deviceId: "EF801388-1005-3F51-485D-4061AE28C2E5", deviceId: "D8:B0:4C:EA:F6:3A" , success: function (res) { wx.getBLEDeviceServices({ // deviceId: "EF801388-1005-3F51-485D-4061AE28C2E5", deviceId: "D8:B0:4C:EA:F6:3A" , //搜索设备获得的蓝牙设备 id success: function (res) { let service_id = "0003CDD0-0000-1000-8000-00805F9B0131" ; wx.getBLEDeviceCharacteristics({ // deviceId: "EF801388-1005-3F51-485D-4061AE28C2E5", deviceId: "D8:B0:4C:EA:F6:3A" , serviceId: '0003CDD0-0000-1000-8000-00805F9B0131' , success: function (res) { setTimeout( function () { wx.notifyBLECharacteristicValueChange({ // deviceId: "EF801388-1005-3F51-485D-4061AE28C2E5", deviceId: "D8:B0:4C:EA:F6:3A" , serviceId: '0003CDD0-0000-1000-8000-00805F9B0131' , characteristicId: '0000ff01-0000-1000-8000-00805f9b34fb' , state: true , success: function (res) { console.error( "开启通知" , res) wx.onBLECharacteristicValueChange( function (res) { }) fail(res) { console.error( "开启通知失败" ) }, }) }, 250) }, }) }, fail(res) { console.log(res.errMsg); }, }) }, } }) |