标题:
wx.onBLECharacteristicValueChange(CALLBACK)
[打印本页]
作者:
vicky.yu
时间:
2026-7-2 10:08
标题:
wx.onBLECharacteristicValueChange(CALLBACK)
监听低功耗蓝牙设备的特征值变化。必须先启用notify接口才能接收到设备推送的notification。
CALLBACK参数说明:
参数 类型 说明
deviceId string 蓝牙设备 id,参考 device 对象
serviceId string 特征值所属服务 uuid
characteristicId string 特征值 uuid
value ArrayBuffer 特征值最新的值(注意:vConsole 无法打印出 ArrayBuffer 类型数据)
示例代码:
wx.onBLECharacteristicValueChange(function(res) {
console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
})
欢迎光临 赛捷软件论坛 (http://sagesoft.cn/bbs/)
Powered by Discuz! 7.2