蓝牙接口写入问题 writeBLECharacteristicValue
官网给出的例子
// 向蓝牙设备发送一个0x00的16进制数据let buffer = new ArrayBuffer(1)let dataView = new DataView(buffer)dataView.setUint8(0, 0)wx.writeBLECharacteristicValue({ // 这里的 deviceId 需要在上面的 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取 deviceId: deviceId, // 这里的 serviceId 需要在上面的 getBLEDeviceServices 接口中获取 serviceId: serviceId, // 这里的 characteristicId 需要在上面的 getBLEDeviceCharacteristics 接口中获取 characteristicId: characteristicId, // 这里的value是ArrayBuffer类型 value: buffer, success: function (res) { console.log('writeBLECharacteristicValue success', res.errMsg) }}) |
要转的string 是这个 var code = ‘at+md=10’;
试了几次都不成功,请问具体怎么转,有详细的例子吗?
