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) } }) },