Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scan for bluetooth LE devices via dbus API?

I'm trying to scan for bluetooth LE devices using the bluez DBus API. I've installed bluez-5.25 using

--enable-experimental 

configure option. I can see in the build that support has been compiled in. Interfaces like HeartBeat, ThermoMeter etc. appear in DBus but not the

org.bluez.ProximityMonitor1 

interface. As far as I understand it this interface would be needed for permanent scan for bluetooth LE devices with information about the distance. But I just started to deal with bluez so I'm not sure.

Are all of the necessary things available in the DBus API? And what is needed in order to scan permanently for LE devices?

like image 467
Norbert Hartl Avatar asked Dec 04 '14 15:12

Norbert Hartl


1 Answers

You need to register for DBUS creations of org.bluez.Device1 proxy objects. The org.bluez.Adapter1 interface can then be used to StartDiscovery. This will scan for both Classic and LE devices. When a device is detected a Device1 object will be created and your registered callback will be invoked.

like image 58
kaylum Avatar answered Nov 06 '22 09:11

kaylum