问题描述
我试图通过一台Linux机器一个BLE模块(模块运行的心脏速率曲线)进行通信。到目前为止,我已经能够做到我需要的一切,除了聆听声明和适应症(例如侦听心率测量通知)。我使用的内核版本3.5和的bluez-5.3。
I'm trying to communicate with a BLE module through a Linux machine (the module is running a heart rate profile). So far, I've been able to do everything I need except listening for Notifications and indications (e.g. listening for the Heart Rate Measurement Notification). I'm using kernel version 3.5 and bluez-5.3.
使用至今Succcessful命令:
Succcessful commands used so far:
hcitool lescan
hcitool lecc
gatttool -b <Mac Address> --primary
gatttool -b <MAC Address> --characteristics
gatttool -b <MAC Address> --char-read
gatttool -b <MAC Address> --char-desc
gatttool -b <MAC Address> --interactive
失败的命令:
gatttool -b <MAC Address> --listen
任何帮助是极大AP preciated。
Any help is greatly appreciated.
推荐答案
试试这个...
运行 gatttool -b&LT; MAC地址&gt; --interactive
像你以前那样。你会得到一个提示,然后键入连接
。你应该看到一个 CON
在提示表明您已经连接到设备上。然后键入炭火读UUID 2902
。你应该得到的所有CCC(客户端特性配置)的列表,在设备上属性。 <一href=\"http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.client_characteristic_configuration.xml\">You可以尝试把它们都设0100得到通知,0200适应症,0300两种或0000的一切了。中键入帮助
来查看所有命令和他们的论点。
Run gatttool -b <MAC Address> --interactive
like you did before. You'll get a prompt and then you type connect
. You should see a CON
in the prompt indicating that you've connected to the device. Then type char-read-uuid 2902
. You should get a list of all CCC (Client Characteristic Configuration) attributes on the device. You can try setting them all to 0100 to get notifications, 0200 for indications, 0300 for both, or 0000 for everything off. Type help
to see all the commands and their arguments.
使用该的 - 听
参数需要你与其他命令夫妇它来打开通知和/或指示。所以这里的,在配合bluez 4.101工作的例子:
The use of the --listen
argument requires you to couple it with other commands to turn on the notifications and/or indications. So here's an example that works in Bluez 4.101:
gatttool -b <MAC Address> --char-write-req --handle=0x0031 --value=0100 --listen
显然,你需要将手柄更改为您要打开通知的CCC的句柄。不过,我还是觉得比较容易的方式只使用交互模式。
Obviously you need to change the handle to the handle of the CCC that you want to turn on notifications for. However, I still find it way easier to just use the interactive mode.
这篇关于蓝牙低功耗:侦听在linux通知/指示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!