Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » How to get advertisement data via new "BluetoothLeAdapter"(can not find any api like "startAdvertisementScan")
How to get advertisement data via new "BluetoothLeAdapter" [message #1782822] Fri, 02 March 2018 06:48 Go to next message
z b is currently offline z bFriend
Messages: 2
Registered: March 2018
Junior Member
I am using "org.eclipse.kura.bluetooth.le.BluetoothLeAdapter", not "org.eclipse.kura.bluetooth.BluetoothAdapter".

because "org.eclipse.kura.bluetooth.BluetoothAdapter" may not work in future.

I use "this.bluetoothLeAdapter.findDevices(10)", but how to get boradcast data???
Re: How to get advertisement data via new "BluetoothLeAdapter" [message #1783407 is a reply to message #1782822] Mon, 12 March 2018 16:49 Go to previous message
Pierantonio Merlino is currently offline Pierantonio MerlinoFriend
Messages: 35
Registered: March 2016

please take a look here [1] for an example using the new BLE APIs.

In few words, the bluetoothLeAdapter.findDevices(timeout) performs a discovery for near devices returns a Future object. The future.get() method will return a List of BluetoothLeDeviceS. Here is a snippet:

Future<List<BluetoothLeDevice>> future = this.bluetoothLeAdapter.findDevices(this.options.getScantime());
try {
} catch (InterruptedException | ExecutionException e) {
logger.error("Scan for devices failed", e);

You can also pass a Consumer class to the find method to be notified when a devices is detected. Please take a look on the APIs [2] and their implementation [3].




Previous Topic:Command Service
Next Topic:stopping via osgi> exit causes reboot via watchdog
Goto Forum:

Current Time: Tue Sep 25 18:39:51 GMT 2018

Powered by FUDForum. Page generated in 0.01460 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top