uni-app ble启动notify失败
uni-app ble启动notify失败
测试过的手机:
华为pot-al00a 10.0.0.174
iPhone12.5.5
示例代码:
notifyBLECharacteristicValueChange() {
let deviceId = this.equipment[0].deviceId;
let serviceId = this.servicesData[0].uuid;
let characteristicId = this.characteristicsData[0].uuid;
let notify = this.characteristicsData[0].properties.notify;
console.log(deviceId);
console.log(serviceId);
console.log(characteristicId);
console.log(notify);
var that = this;
uni.notifyBLECharacteristicValueChange({
state: true, // 启用 notify 功能
// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
deviceId,
// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
serviceId,
// 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
characteristicId,
success(res) {
console.log('notifyBLECharacteristicValueChange success:' + res.errMsg);
console.log(JSON.stringify(res));
that.onBLECharacteristicValueChange();
},
fail(res) {
console.log(JSON.stringify(res));
}
});
},
操作步骤:
- 一直重复
预期结果:
- 解决问题
实际结果:
- 未解决
bug描述:
调用uni.notifyBLECharacteristicValueChange一直失败错误信息如下
{"errMsg":"notifyBLECharacteristicValueChange:fail error,Property unsupport Notify or Indicate,https://ask.dcloud.net.cn/article/282","errCode":-10007,"code":-10007}
代码示例中打印的日志信息如下
45569B0D-9032-03FD-F854-31DB93A1445D
49535343-FE7D-4AE5-8FA9-9FAFD205E455
49535343-ACA3-481C-91EC-D85E28A60318
[Boolean] true
{"errMsg":"notifyBLECharacteristicValueChange:fail error,Property unsupport Notify or Indicate,https://ask.dcloud.net.cn/article/282","errCode":-10007,"code":-10007}
| 项目信息 | 详细信息 |
|---|---|
| 产品分类 | uniapp/App |
| PC开发环境操作系统 | Mac |
| PC开发环境操作系统版本号 | 10.15.7 |
| HBuilderX类型 | 正式 |
| HBuilderX版本号 | 3.2.11 |
| 手机系统 | 全部 |
| 手机厂商 | 华为 |
| 页面类型 | vue |
| 打包方式 | 云端 |
| 项目创建方式 | HBuilderX |
更多关于uni-app ble启动notify失败的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复


