收藏
回答

writeBLECharacteristicValue 怎么发送一个FFFF0501FA到蓝牙?

writeBLECharacteristicValue 传let buffer = new ArrayBuffer(3)
b不执行回调


回答关注问题邀请回答
收藏

1 个回答

  • 律己
    律己
    2021-12-13

    var message='FFFF0501FA'

        var typedArray = new Uint8Array(message.match(/[\da-f]{2}/gi).map(function (h) {

          return parseInt(h, 16)

      }))

    var buffer1 = typedArray.buffer

    wx.writeBLECharacteristicValue({

          characteristicId: that.data.characteristics[1].uuid,

          deviceId:  that.data.devicesId,

          serviceId:that.data.services,

          value: buffer1,

          success:(res)=>{

            console.log("蓝牙数据发送成功");

            console.log(res)

          },

          fail:(res)=>{

            console.log(res)

          }

        })



    2021-12-13
    有用
    回复
登录 后发表内容