1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
Tiny Bluetooth LibraryThis project aims to create Bluetooth GATT bindings for C++, Java and other languages, using BlueZ over DBus. Most of the code is automatically generated using gdbus-codegen, including a few additions to the default behaviour, such that it also generates the C++ classes, which wrap the functions normally generated by gdbus-codegen. Using TinyBTinyB requires CMake 3.1+ for building and requires GLib/GIO 2+. It also requires BlueZ with GATT profile activated, which is currently experimental (as of BlueZ 5.37), so you might have to run bluetoothd with the -E flag. For example, on a system with systemd (Fedora, poky, etc.) edit the bluetooth.service file (usually found in /usr/lib/systemd/system/ or /lib/systemd/system) and append -E to ExecStart line, restart the daemon with systemctl restart bluetooth.
The last command will create the include/ and lib/ directories with a copy of the headers and library objects respectively in your build location. Note that doing an out-of-source build may cause issues when rebuilding later on. Our cmake configure has a number of options, cmake-gui or ccmake can show you all the options. The interesting ones are detailed below: Changing install path from /usr/local to /usr
Building debug build:
Using clang instead of gcc:
Cross-compiling on a different system:
To build Java bindings:
To build documentation run:
The hellotinyb example uses a TI Sensor Tag from which it reads the ambient temperature. You have to pass the MAC address of the Sensor Tag as a first parameter to the program. |