android ble写成功的回调,安卓使用writeBLECharacteristicValue没有任何回调
手机型号为华为荣耀10 及一加6复现问题的简单代码片段都是按照官网给到API初始化---》 搜索蓝牙---》连接蓝牙---》获取蓝牙serivergetBLEDeviceServices--->获取蓝牙getBLEDeviceCharacteristics---》发送指令let hex1 = '0e,7e,00,00,00,00,00,00,00,00,00,0...
手机型号为华为荣耀10 及一加6
复现问题的简单代码片段 都是按照官网给到API 初始化---》 搜索蓝牙---》连接蓝牙---》获取蓝牙serivergetBLEDeviceServices--->获取蓝牙getBLEDeviceCharacteristics
---》发送指令
let hex1 = '0e,7e,00,00,00,00,00,00,00,00,00,00,00,ff,5a';
// //let hex1 = '0e,7e,01,00,05,0d,0c,00,00,00,00,00,00,e0,5a';
console.log(hex1)
var buffer1 = new Uint8Array(hex1.match(/[\da-f]{2}/gi).map(function (h) {
return parseInt(h, 16)
})).buffer
wx.writeBLECharacteristicValue({
deviceId: that.data.connectedDeviceId,
serviceId: that.data.writeServicweId,
characteristicId: that.data.writeCharacteristicsId,
value: buffer1,
success: function (res) {
// success
console.log("success 指令发送成功");
console.log(res);
},
fail: function (res) {
console.log("调用失败");
},
complete: function (res) {
console.log("调用结束");
// complete
}
})
更多推荐
所有评论(0)