Prerequisites
Bluetooth LE module relies on Linux BlueZ Bluetooth protocol stack. BlueZ version needs to be at least 5.50. Latest tested version is 5.54.
Consult the Operating System documentation in order to collect further information on how to setup BlueZ on your system.
When used with a Raspberry Pi device, follow this link for instructions on how to set it up.
Only Linux OS is supported.
Installation
There are two approaches for installing the desired Bluetooth LE Module components in the OSGi Runtime: automated and manual installation.
Automated Installation
The scripts for the main bundles can be executed through the Kit Manager from the OSGi Runtime local text console, from a Telnet client or from a Web Admin Console.
There are two different installation scripts for the Bluetooth LE module - bluetoothle.txt and bluetoothle-da.txt located in the bin/pscripts directory.
To execute an install script (i.e. in terms of the Kit Manager to "install a kit"), go to the kitman command group and use the install command. When installing the set of Bluetooth LE bundles, pass the name or the ID of the kit as an argument to the "install" Kit Manager command:
kitman.install "Bluetooth LE Driver"
Or,
kitman.install "Bluetooth LE DA Support"
Manual Installation
If you want to install the Bluetooth LE Module without using one of the provided Kit Manager installation scripts follow the steps below:
fw.i -s -f -l com.prosyst.mbs.bluetooth.le.driver.api.jar
fw.i -s -f -l com.prosyst.mbs.bluetooth.le.driver.service.provider.default.jar
fw.i -f com.prosyst.mbs.bluetooth.le.driver.tinyb-natives.linux_x86_generic.jar
fw.i -f com.prosyst.mbs.bluetooth.le.driver.tinyb-natives.linux_x86_64_generic.jar
fw.i -s -f -l com.prosyst.mbs.bluetooth.le.driver.tinyb.jar
fw.i -s -f -l com.prosyst.mbs.bluetooth.le.driver.commands.jar
In addition, if you would like DA support, install the following bundles:
fw.i -s -f -l com.prosyst.mbs.bluetooth.le.da.hdm.adapter.api.jar
fw.i -s -f -l com.prosyst.mbs.bluetooth.le.da.items.api.jar
fw.i -s -f -l com.prosyst.mbs.bluetooth.le.da.hdm.adapter.jar
With manual installation, you will also have to install the modules Device Access, Units of Measurement Framework, and Functional Items Management separately. To install these modules, use their corresponding install scripts part of the Kit Manager.
Configuring the Bluetooth LE Device
The following configuration options are available via the Bluetooth LE Module.
Bluetooth LE Driver TinyB Configuration Properties
The driver configuration "tinyb.driver.configuration.pid" can be used to make changes to the default settings, however no actual initial configuration of the device is necessary.
Pid: tinyb.driver.configuration.pid
Property ID |
Name |
Type |
Default Value |
Description |
|---|---|---|---|---|
port |
Tinyb JSON Server Communication Port |
int |
2324 |
Defines the primary port for communicating with Tinyb JSON Server process. |
secondaryPort |
Tinyb JSON Server Secondary Communication Port |
int |
23240 |
Defines the port for communicating with Tinyb JSON Server process that will be used in case the primary port is not available. |
discoveryTimeout |
Bluetooth LE Discovery Default Timeout |
int |
30000 |
Defines the default discovery timeout in milliseconds. |
discoveryRSSI |
Bluetooth LE Discovery RSSI Threshold |
int |
0 |
Defines the default discovery RSSI threshold. |
jsonMaxBufferSize |
JSON Client Max Buffer Size |
int |
2097152 |
Defines the maximum size in bytes of received json messages. |
jsonResponseTimeout |
JSON Response Timeout |
long |
10000 |
Defines the time period in milliseconds between sending a json request and receiving a matching response after which response is no longer expected. Have in mind that some methods like connect or pair need extra long time. |
discoveryTransport |
Discovery Transport |
String |
LE |
Defines the type of the transport to be used during discovery. Possible values are: "AUTO", "BREDR", "LE". |
Bluetooth LE DA HDM Adapter Configuration Properties
Pid: mbs.bluetooth.le.da.hdm.adapter
Property ID |
Name |
Type |
Default Value |
Description |
|---|---|---|---|---|
uuids |
White List of Gatt Service UUIDs |
String[] |
0000180f-0000-1000-8000-00805f9b34fb 5d5b1447-f938-4e72-ba34-624f902fa84f 0000ffe0-0000-1000-8000-00805f9b34fb 0000aa80-0000-1000-8000-00805f9b34fb 5cb05cb0-5cb0-0020-0010-00002158a602 02a65821-3000-1000-2000-b05cb05cb05c |
Only devices with advertising UUIDs included in this list will be added in Device Access. An empty list will allow all devices to be added. Previously created devices will not be revisited upon configuration update.
The default list contains the advertising UUIDs of Bosch CISS, TDL, SCD, TI SensorTag and ITAG devices. |
Troubleshooting
1. Make sure that your Operating System Bluetooth stack is operational.
2. If possible try to discover and connect a Bluetooth device directly from the Operating System to make sure communication is possible.
1. Check the status of the bluetooth service for any listed errors.
systemctl status bluetooth
2. Look for an error "Failed to set privacy: Rejected (0x0b)".
Such error is related to BlueZ setting up LE privacy, and resolution for it is available in various internet sources.
3. Restart the bluetooth service and check for the error again.
sudo systemctl restart bluetooth