TinyB  0.5.1
TinyB - The Tiny Bluetooth LE library
Tiny Bluetooth LE Library

This project aims to create clean, modern and easy to use Bluetooth LE API. TinyB exposes the BLE GATT API for C++, Java and other languages, using BlueZ over DBus.

API Documentation

Up to date API documentation can be found:

A guide for getting started with TinyB on Java is available here: https://software.intel.com/en-us/java-for-bluetooth-le-apps.

Using TinyB

TinyB requires CMake 3.1+ for building and requires GLib/GIO 2.40+. 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.

1 mkdir build
2 cd build
3 cmake ..
4 make
5 make install

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

1 -DCMAKE_INSTALL_PREFIX=/usr

Building debug build:

1 -DCMAKE_BUILD_TYPE=DEBUG

Using clang instead of gcc:

1 -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++

Cross-compiling on a different system:

1 -DCMAKE_CXX_FLAGS:STRING=-m32 -march=i586
2 -DCMAKE_C_FLAGS:STRING=-m32 -march=i586

To build Java bindings:

1 -DBUILDJAVA=ON

To build documentation run:

1 make doc

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.

Changes

Common issues

If you have any issues, please go through the Troubleshooting Guide. If the solution is not there, please create a new issue on Github.

Contributing to TinyB

You must agree to Developer Certificate of Origin and Sign-off your code, using a real name and e-mail address. Please check the Contribution document for more details.