收藏
回答

notifyBLECharacteristicValueChange 无法开启读

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug notifyBLECharacteristicValueChange 客户端 6.7.1 2.0.0

- 当前 Bug 的表现(可附上截图)

无法读取蓝牙数据


- 预期表现

可以读取蓝牙数据


- 复现路径

TI CC2541


- 提供一个最简复现 Demo

参见:

https://www.jianshu.com/p/8690dbafe849

小程序调用相关代码发送命令后无法回复。



相关说明代码

wx.notifyBLECharacteristicValueChanged(

{

        state: true, // 启用 notify 功能

        // 这里的 deviceId 需要在上面的 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取

        deviceId: deviceIdA,

        // 这里的 serviceId 需要在上面的 getBLEDeviceServices 接口中获取

        serviceId: serviceIdA,

        // 这里的 characteristicId 需要在上面的 getBLEDeviceCharacteristics 接口中获取

        characteristicId: characteristicIdB,

        complete: function (res) {

        console.log('recv ready notifyBLECharacteristicValueChanged message:', res.errMsg)

        me.setData({

        reminding: '设备已连接',

        beginClass: 'begin',

        disableState: '',

    })

    }

})




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

1 个回答

登录 后发表内容