A transport implementation for the Bluetooth Manager based on TinyB library.
The Bluetooth Manager is a set of java APIs which is designed to streamline all the hard work of dealing with unstable by its nature Bluetooth protocol. A specially designed abstraction layer (transport) is used to bring support for various bluetooth adapters/dongles, operation systems and hardware architecture types.
The following diagram outlines some details of the Bluetooth Manager Transport abstraction layer:
The TinyB transport brings support for:
You must upgrade your Bluez software to 5.43+. This is due to some changes in the DBus API in Bluez 5.43v. UPDATE: The new Bluez version 5.48 is not recommended as it is not yet supported by TinyB library. See: https://github.com/intel-iot-devkit/tinyb/issues/131
You can use systemctl utility to check which Bluez version you are running:
pi@raspberrypi:~ $ sudo systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
Active: active (running) since Fri 2017-12-01 16:33:35 NZDT; 2 days ago
Docs: man:bluetoothd(8)
Main PID: 677 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─677 /usr/libexec/bluetooth/bluetoothd
Dec 01 16:33:34 raspberrypi systemd[1]: Starting Bluetooth service...
Dec 01 16:33:35 raspberrypi bluetoothd[677]: Bluetooth daemon 5.47
Dec 01 16:33:35 raspberrypi systemd[1]: Started Bluetooth service.
Notice a line that contains Bluez version:
Dec 01 16:33:35 raspberrypi bluetoothd[677]: Bluetooth daemon 5.47
If you have an older Bluez version you must upgrade it. There are several ways to accomplish this (ubuntu/raspbian):
sudo apt-get install libglib2.0-dev libdbus-1-dev libudev-dev libical-dev libreadline6 libreadline6-dev
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.47.tar.xz
tar -xf bluez-5.47.tar.xz && cd bluez-5.47
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var
make
sudo make install
nano /lib/systemd/system/bluetooth.service
You should see something like that:
ExecStart=/usr/libexec/bluetooth/bluetoothd
Run the script below to see Bluez version:
pi@raspberrypi:~ $ cd /usr/libexec/bluetooth/
pi@raspberrypi:/usr/libexec/bluetooth $ ./bluetoothd --version
5.47
<busconfig>
<policy user="root">
...
</policy>
<policy group="bluetooth">
<allow send_destination="org.bluez"/>
</policy>
...
</busconfig>
sudo usermod -a -G bluetooth openhab
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
sudo apt-get install debhelper dh-autoreconf flex bison libdbus-glib-1-dev libglib2.0-dev libcap-ng-dev libudev-dev libreadline-dev libical-dev check dh-systemd libebook1.2-dev
wget https://launchpad.net/ubuntu/+archive/primary/+files/bluez_5.43.orig.tar.xz
wget https://launchpad.net/ubuntu/+archive/primary/+files/bluez_5.43-0ubuntu1.debian.tar.xz
wget https://launchpad.net/ubuntu/+archive/primary/+files/bluez_5.43-0ubuntu1.dsc
tar xf bluez_5.43.orig.tar.xz
cd bluez-5.43
tar xf ../bluez_5.43-0ubuntu1.debian.tar.xz
debchange --local=~lorenzen 'Backport to Xenial'
debuild -b -j4
cd ..
sudo dpkg -i *.deb
You are welcome to contribute to the project, the project environment is designed to make it easy by using:
The build process is streamlined by using standard maven tools.
To build the project you will need to install the TinyB library into your maven repository. Run this in the root of the project (use install-dependencies.bat file for windows):
sh .travis/install-dependencies.sh
Then build the project with maven:
mvn clean install
To cut a new release and upload it to the Maven Central Repository:
mvn release:prepare -B
mvn release:perform
Travis CI process will take care of everything, you will find a new artifact in the Maven Central repository when the release process finishes successfully.
All TinyB dependencies (jar file and native libs) are manged by the project and automatically loaded in runtime, so that end-users do not have to build and install TinyB library locally.
In order to update TinyB library the following steps should be done: