赞
踩
// 读取机器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(); //读之后调用这个,调用完了跳转新页面,之后才是写功能
},
<Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。