- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
HI,
I am new with the Bluetooth low energy but I am trying to get the raw payload from a Bluetooth LE climate device.
Can somebody help me with some information or example code on how I can get the broadcasted information?
The HCIDUMP RAW I can see the data and the needed CO2 measurements .
Greetings
Han
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I forgot to mansion that I am trying to write some code in C with BLUEZ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello Han,
Thanks for reaching out!
As you may know, in order to interact with BLE devices you have to use gatttool. BlueZ by default does not include this module, so, usually I would recommend you to install a version of BlueZ that does as explained in https://software.intel.com/en-us/articles/using-the-generic-attribute-profile-gatt-in-bluetooth-low-.... Nevertheless, since you are planning to use BlueZ's API to create a C script, you could find more appropriate to use LibGATT ( https://github.com/jacklund/libgatt) which is simply the same code that gatttool uses but has been bundled into a public library. If you decide to do this, you should take a look at gatt.h ( https://github.com/jacklund/libgatt/blob/master/src/gatt.h), in this file you will find the methods for connect, write, read, etc. This should get you started
I hope this information helps you,
Pedro M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello,
Here are some links that may help you:
- For advertising and scanning: https://github.com/sideralis/iot_ble_device/tree/final GitHub - sideralis/iot_ble_device at final
- For BLE spec: https://www.bluetooth.com/specifications/adopted-specifications/legacy-specifications Legacy Specifications | Bluetooth Technology Website (core version 4.0) which will help you to understand the BlueZ API
- The BlueZ API source: http://git.kernel.org/cgit/bluetooth/bluez.git bluez.git - Bluetooth protocol stack for Linux (look in tools\ folder to find some examples which may help you, and especially hcidump.c as it seems you are getting what your are looking for with this command)
- For issue with Bluetooth docker image for Edison (compiling issue): (See below note1)
- And last, you have to activate ble before being able to use it with c code. This is done with bash command: rfkill unblock bluetooth after each power up of your Edison board
Note1:To correct Bluetooth compilation errors from docker image (if it has not yet been solved by Intel)
- Start a bash
- Type " docker ps " to get your CONTAINER_ID
- Type " docker exec -it CONTAINER_ID bash" to open a bash in docker container
- Type " vi /usr/include/bluetooth/bluetooth.h" to correct error in this file
- Replace the 4 typeof at lines 161, 162, 169 et 170 by __typeof__
- exit and exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello Han,
Do you have any updates about this?
Pedro M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Pedro,
it is a by the side project of me and i am still reading into this issue. And I am not sure if I would like to resolv it in scripting or c code. One thing I am sure to use the data of the air mentor I need to decode the raw string sended As a beacon payload.
i am still looking for some example code for the raw payload data. The scanning program for devices and the distance is working fine
kindly regards
Han
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I understand what you mean, sometimes it involves more trouble to create a C script than a shell script, even though shell scripting is a little bit more complex than C. I would personally try getting done everything manually and if I see that it can be done, I would choose shell scripting. This is because BlueZ's documentation isn't the best, and sometimes, if you are not very familiar with their API, it could be quite challenging to get things done.
Anyway, if you would like to get examples, you might be interested in contacting BlueZ directly to see if they can help you with this. You can do so in http://www.bluez.org/contact/.
I hope this helps and I hope to hear from you again. If you ever have any doubts, please don't hesitate to come back to the community, we'll try to help you in any way we can.
Pedro M.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page