Closed r-t-s closed 4 years ago
You have to gather the LEAdvertisingManager1
on the bluetooth adapter you are using.
So change the code:
LEAdvertisingManager1 advm = sDBus.getRemoteObject("org.bluez", "/org/bluez", LEAdvertisingManager1.class);
to:
LEAdvertisingManager1 advm = sDBus.getRemoteObject("org.bluez", "/org/bluez/hci0", LEAdvertisingManager1.class);
Note the second parameter! If your adapter is not called hci0, change it to the name of your adapter.
A quick note on the "options". I did not use LEAdvertisingManager1
before, but after reading the C++ code from bluez commandline client, I think that the properties listed here (or in the javadoc of LEAdvertisement1 interface class) are the supported options.
The bluez commandline client defines the options in a struct in the file, line 63 client/advertising.c
Not sure what are valid "OPTIONS" for the registration. When I try (I have also tried null, but get null pointer exception):
I get the following exception:
For reference: my Class Code (Started from Python Example ... plan to customize when I get it working!)