Camel Bluetooth component

Camel Bluetooth component can retrieve information about the bluetooth devices available within the device range. Under the hood Bluetooth component uses bluecove library (http://www.bluecove.org/arrow-up-right). Bluetooth component supports both the consumer and producer endpoints.

Maven dependency

Maven users should add the following dependency to their POM file:

io.rhiotcamel-bluetooth${rhiot.version}

Avaliable for rhiot.version >= 0.1.3

URI format

bluetooth:label

For example to find all bluetooth devices available near the device, the following route can be used:

from("bluetooth:scan").to("mock:devices");

The message body is a io.rhiot.component.bluetooth.BluetoothDevice instance:

BluetoothDevices[] devices = consumerTemplate.receiveBody("bluetooth:scan", BluetoothDevices[].class);

You can also request the bluetooth device scanning using the producer endpoint:

from("direct:scan").to("bluetooth:scan").to("mock:devices");

Or using the producer template directly:

BluetoothDevices[] devices = template.requestBody("bluetooth:scan", BluetoothDevices[].class);

Options

Option

Default value

Description

consumer.initialDelay

1000

Milliseconds before the polling starts.

consumer.delay

5000

Delay between each bluetooth device scan.

consumer.useFixedDelay

false

Set to true to use a fixed delay between polls, otherwise fixed rate is used. See ScheduledExecutorService in JDK for details.

bluetoothDevicesProvider

new BluecoveBluetoothDeviceProvider()

reference to theio.rhiot.component.bluetooth.BluetoothDevicesProvider instance used to scan bluetooth devices.

serviceDiscovery

false

Search for services on bluetooth device.

Installer

The Bluetooth component installs it's own dependencies for Debian-based systems using apt-get, these include blueman and libbluetooth-dev, as well as their dependencies. You can configure the installer or set an alternate one on the component:

You can also specify alternate/additional dependencies for your platform, if your platform uses my-custom-tools for example, you should configure the component as follows:

If an Installer is not set on the component, Camel will try to find an instance in the registryarrow-up-right. So for example for Spring application, you can configure the installer as a bean:

Last updated

Was this helpful?