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
Member
Hi,

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 {
filterDevices(future.get());
} 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].

Best,
Pier

[1] https://github.com/eclipse/kura/blob/develop/kura/examples/org.eclipse.kura.example.ble.tisensortag.tinyb/src/main/java/org/eclipse/kura/example/ble/tisensortag/tinyb/BluetoothLe.java

[2] https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/bluetooth/le/BluetoothLeAdapter.java

[3] https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.ble.provider/src/main/java/org/eclipse/kura/internal/ble/BluetoothLeAdapterImpl.java
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