当前位置:   article > 正文

android的特征值,【报Bug】安卓蓝牙读取特征值变化value为空!

uni.readblecharacteristicvalue

// 读取机器2进制事件, 读取后订阅,订阅后监听

readBLECharacteristicValue() {

const deviceId = uni.getStorageSync('deviceId')

const serviceId = uni.getStorageSync('serviceId')

const characteristicId = uni.getStorageSync('characteristicId')

console.log(deviceId);

console.log(serviceId);

console.log(characteristicId);

uni.readBLECharacteristicValue({

// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接

deviceId,

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

serviceId,

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

characteristicId,

success: res => {

console.log('读取设备数据值成功');

console.log(JSON.stringify(res));

this.notifyBLECharacteristicValueChange(); //读之后调用这个,调用完了跳转新页面,之后才是写功能

},

<
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/在线问答5/article/detail/887302
推荐阅读
相关标签
  

闽ICP备14008679号