I'm trying to connect to a Bluetooth Low-Energy (BLE) Sensor using Java. So far I searched for a library that interfaces with the BlueZ stack on my Linux.
The only free library I found for Java was Bluecove but it seems, that they don't implement BLE. I checked if my BT dongle was working and recognizing the sensor using Linux command line tools
sudo hcitool lescan
gatttool -i hci0 -b XX:XX:XX:XX:XX:XX -I
and it worked without problems.
After that I tried the Bluecove example for DeviceDiscovery but my sensor didn't show up instead it scanned for normal BT devices. I couldn't find a way to scan for BLE devices.
Doing further research I came to the conclusion that Bluecove just implements JSR-82. If I'm not mistaken this standard is older than BLE and therefore doesn't implement it.
Are there any alternatives to Bluecove that support BLE in Java? I mean there should be because Android has no problems (in newer versions) to communicate with BLE devices.
Thanks in advance!
Bluetooth Low Energy is a power-conserving variant of Bluetooth personal area network (PAN) technology, designed for use by Internet-connected machines and appliances. Also marketed as Bluetooth Smart, Bluetooth LE was introduced in the Bluetooth 4.0 specification as an alternative to Bluetooth Classic.
BLE uses less power than previous versions of bluetooth technologies while still operating over the same 2.4 GHz ISM band. BLE achieves this by constantly being in 'sleep mode' until a connection is initiated.
I'm trying to connect to a Bluetooth Low-Energy (BLE) Sensor using Java. So far I searched for a library that interfaces with the BlueZ stack on my Linux. The only free library I found for Java was Bluecove but it seems, that they don't implement BLE.
This document is a guide for creating Java IoT applications that can access remote Bluetooth Low Energy devices on IoT platforms, such as the Intel® Edison development board. This article is in the Product Showcase section for our sponsors at CodeProject.
The Android application uses a hybrid mobile application architecture – a combination of native application code with a web-based user interface. This tutorial introduces the Android Bluetooth Low Energy (BLE) capabilities embedded in the Android Software Developer Kit, which is accessible in the Android Studio environment.
Check out this code pattern where you use open source technologies like MQTT, Bluetooth, and Node-RED to configure IoT devices in your smart home. Step 1. Set up the hardware Step 2. Build the Arduino BLE peripheral application Step 3. Build the Android BLE central application
After looking into this a while later I found an answer named TinyB.
https://software.intel.com/en-us/java-for-bluetooth-le-apps
TinyB is a BluetoothLE implementation by Intel and it features a Java SDK. So far I've been able to achieve everything I tried.
Hope this helps others stumbling across this topic.
An interesting option is using Kura Bluetooth LE APIs, which are built on top of the TinyB library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With