How to access BLE on Raspberry Pi 3 using Java?

Viewed 7230

The Raspberry Pi 3 includes BLE support. I confirmed it works by

sudo hcitool lescan

which returned the MAC and BLE 'complete local name' for neighboring advertisers.

How does one access this programmatically, in Java?

3 Answers

To use BLE on Raspberry Pi 3 you have to update bluez (the bluetooth core in Raspbian linux) then use the bluez D-Bus interface to interact with it.

I'm looking for writing my own java lib, but it's very difficult because there are few documentation about D-Bus in java and about bluez.

For bluez there are only the sample code in the last distribution.

For now i have write a simple script that update the bluez version to the latest: https://gist.github.com/tongo/94338cebf4e6367d353439bca8d0a376

I have also found a blog post that talk about d-bus,java and bluez: http://smartspacestuff.blogspot.it/2016/02/i-got-figurin-out-dbus-bluez.html

It was useful, but not very clear for me.

I hope this can help.

If you found other documentation post it.

Related