小程序安卓蓝牙写入数据的时候,总是报1008
发布于 5 年前 作者 lmeng 18238 次浏览 来自 问答

安卓连接成功,getService成功   getBLEDeviceCharacteristics成功,notifyBLECharacteristicValueChange也成功,就是writeBLECharacteristicValue的时候报 1008   ,换了多个安卓手机,都是这样,不知道是为什么。

另外,安卓搜索蓝牙设备的时候,奇慢,不知道是程序和什么相关。

3 回复

我现在的问题是。notifyBLECharacteristicvalueChange 这个调用失败,但是确定notify =true

wx.createBleConnection之前 先停止搜搜wx.stopBluetoothDeviceDiscovery.然后再连。连接需要的deviceId就是你wx.getBluetoothDevices得到的deviceId  (我是通过调用开始搜索成功之后,接着调用wx.onBluetoothDeviceFound监听发现设备得到的deviceId)  能帮i的就这么多了。

请教下楼主android怎么连接蓝牙的,是wx.openBluetoothAdapter=》wx.startBluetoothDevicesDiscovery=》wx.getBluetoothDevices=》wx.createBLEConnection这样调用的吗?我用android手机时wx.createBLEConnection报10003错误死活连不上,wx.createBLEConnection的参数是mac地址吗?还是要转成uuid?求指教,万分感谢

回到顶部