41 Star 46 Fork 438

OpenHarmony/communication_bluetooth

 / 详情

【OpenHarmony3.2 beta1】【API】【bluetooth】不同服务通道设置消息监听失败

已完成
缺陷
创建于  
2022-11-14 16:43

【bluetooth】【5/5】简要描述:

不同服务通道设置消息监听失败

【环境信息】:

  • 网络环境
  • 硬件开发板型号:DAYU200
  • 软件版本信息或tag节点:OpenHarmony3.2 beta1
  • 测试环境
  • 其他

【预置条件】:

1、设备蓝牙可以正常使用,针对BLE低功耗蓝牙进行操作

【测试步骤】:

1、获取到蓝牙客户端 GattClientDevice 对象,通过GattClientDevice获取到蓝牙服务

2、通过不同的服务UUID获取到BLECharacteristic,查看特征属性,

假设现在存在以下两个服务

服务1:

SERVICE_UUID1:6E400001-B5A3-F393-E0A9-E50E24DCCA9E

BLECharacteristicUuid1_1:6E400003-B5A3-F393-E0A9-E50E24DCCA9E 具备:Notify 能力

BLECharacteristicUuid1_2:6E400002-B5A3-F393-E0A9-E50E24DCCA9E 具备:write 能力

服务2:

SERVICE_UUID2:0000180F-0000-1000-8000-00805F9B34FB

BLECharacteristicUuid2_1:00002A19-0000-1000-8000-00805F9B34FB 具备:Notify、read 能力

步骤1:通过 let success1: boolean = this.mGattClientDevice.setNotifyCharacteristicChanged(this.BLECharacteristicUuid1_1, true)
设置成功
通过 let success: boolean = this.mGattClientDevice.writeCharacteristicValue(this.BLECharacteristicUuid1_2) 写成功

步骤2:通过 let success1: boolean = this.mGattClientDevice.setNotifyCharacteristicChanged(this.BLECharacteristicUuid2_1, true)
设置失败

通过 this.mGattClientDevice.readCharacteristicValue(this.BLECharacteristicUuid2_1, (err, characteristic: bluetooth.BLECharacteristic) => {...})失败,返回错误码code=-1

还是相同的操作,将步骤先后顺序调换:先执行步骤2设置成功成功,再执行步骤1则设置失败。

综上所述,一个GattClientDevice是否只能执行一个通道的setNotifyCharacteristicChanged、readCharacteristicValue、writeCharacteristicValue操作,需要同步的操作不同服务的这些接口需要如何处理。

【预期结果】:

可以操作多服务通道

【实际结果】:

不能设置不同通道的读、写、通知监听

【恢复手段】:

【出现概率】:【5/5】

【定位信息】:

    1. Log、截图、多媒体文件等,所有和问题有关的信息:

评论 (1)

xjszzz9 创建了缺陷 2年前
xjszzz9 修改了描述 2年前
展开全部操作日志

设计上是可以的,需要提供日志查看分析为什么失败

lilong 任务状态待办的 修改为验收中 2年前
baomin 任务状态验收中 修改为已完成 2年前

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
lilong-lilong32 xjszzz9-xjszzz9
1
https://gitee.com/openharmony/communication_bluetooth.git
git@gitee.com:openharmony/communication_bluetooth.git
openharmony
communication_bluetooth
communication_bluetooth

搜索帮助