博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android BLE API: GATT Notification not received
阅读量:5050 次
发布时间:2019-06-12

本文共 1911 字,大约阅读时间需要 6 分钟。

When setting the value to the descriptor instead of putting descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE), put descriptor.setValue(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE). The callbacks for onCharacteristicChanged are called now.

Can you clarify what "indication" is supposed to do? Based on the docs, I was sure that the right flag to set in this case was ENABLE_NOTIFICATION_VALUE but you're now the second person on this page who has suggested that ENABLE_INDICATION_VALUE is the right flag. What is the difference and use case for each? – 
 
It depends on the Bluetooth Profile implementation inside the bluetooth device. It either uses "Notification" or "Indication" for posting updates. So you'll have to find out which one your device uses. – 
 
Like Boni2k said, it depends on the Bluetooth Profile. If your service follows the standard profiles you should be able to find that information [here] (). If you want to know this programatically, you can call the getProperties() method for your characteristic and do a bitwise AND against the property you want to check if it's different than 0, then it supports that activity. – 
 
What bothers me here is that the Android documentation states that setCharacteristicNotifications works for EITHER notifications or indications. So I assume they are checking the properties internally and writing the correct flags to the characteristic. They also use the method in their example which has worked with some HeartRate monitors. Do you know if the method is flawed? My understanding is that one cannot set BOTH indication/notification flags though some devices may accept that. IF they are doing that then I would say their method IS wrong. – 
 
http://stackoverflow.com/questions/17910322/android-ble-api-gatt-notification-not-received
posted on
2014-06-24 10:15 阅读(
...) 评论(
...)

转载于:https://www.cnblogs.com/savagemorgan/p/3805516.html

你可能感兴趣的文章
【USACO】Watering Hole 2008 Oct
查看>>
动态链接的步骤
查看>>
emacs 缩写词功能
查看>>
Api demo源码学习(2)--App/Activity/Custom Dialog --自定义Activity样式
查看>>
Velocity脚本简明教程
查看>>
虚拟机类加载机制
查看>>
RTSP流媒体数据传输的两种方式(TCP和UDP)
查看>>
大数n!
查看>>
LPC-LINK 2 LPC4370 简化线路图
查看>>
【模板】关于vector的lower_bound和upper_bound以及vector基本用法 STL
查看>>
linux c动态库编译好了,不能用。有些方法报(undefined reference)错误。
查看>>
在CentOS 6.5 中安装JDK 1.7 + Eclipse并配置opencv的java开发环境(二)
查看>>
docker 安装与卸载
查看>>
“搜狐微博零估值”用意何在
查看>>
如何区分 OpenStack Neutron Extension 和 Plugin
查看>>
简述人工智能发展的先决条件
查看>>
AWS API 2.0签名规范
查看>>
MVC3 系统列讲解
查看>>
很开心
查看>>
Codeforces 388 D. Fox and Perfect Sets
查看>>