微信小程序发送蓝牙指令
writeBLECharacteristicValue(deviceId, serviceId, characteristicId, action) { let _that = this; // 向蓝牙设备发送一个0x00的16进制数据 //let buffer = (1) //dataView.setUint8(0, Math.random() * 255 | 0) var hex = action //AA55080855AA var typedArray = new Uint8Array(hex.match(/[\da-f]{2}/gi).map(function(h) { return parseInt(h, 16) })) var buffer1 = typedArray.buffer console.log("发送内容:", buffer1) wx.writeBLECharacteristicValue({ deviceId: deviceId, serviceId: serviceId, characteristicId: characteristicId, value: buffer1, success: function(resr) { console.log("发送成功") }, fail: function(res2) { console.log("发送失败:", res2) } }) },