Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java (J2SE) Bluetooth Low Energy (BLE)

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!

like image 327
sgiessmann Avatar asked Mar 04 '15 13:03

sgiessmann


People also ask

What are low energy BLE devices?

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.

Why is BLE low energy?

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.

Is there a Java library for Bluetooth Low-Energy (BLE) sensor?

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.

Can Java IoT applications access remote Bluetooth Low energy devices?

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.

What is Android Bluetooth Low Energy (BLE)?

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.

How to configure IoT devices in your smart home using BLE?

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


2 Answers

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.

like image 54
sgiessmann Avatar answered Oct 20 '22 01:10

sgiessmann


An interesting option is using Kura Bluetooth LE APIs, which are built on top of the TinyB library.

like image 20
Diego Avatar answered Oct 20 '22 00:10

Diego