Take the 2-minute tour ×

how can i check weather the given device is connected. using org.bluez.AudioSource GetProperty I am using c and DBus,can anybody help me to get out of this...

share|improve this question
add comment

1 Answer

I assume you've been looking into the bluez D-BUS API which is a precious documentation for everything related to listening on bluez's signals and query informations. You can find it in any BlueZ source in the doc/ folder.

To check if a device is connected, you first need to get all the bluetooth devices on your computer and their paths using D-BUS, I will not provide any C documentation as you can easily find plenty of examples about this using Google. I will instead show you what D-BUS calls you can make via dbus-send to get such an information.

Get Devices list :

dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.GetProperties

This returns an array of adapters with their paths. Once you have these path(s) you can retrieve the list of all the bluetooth devices paired with your adapter(s).

Get paired devices :

dbus-send --system --print-reply --dest=org.bluez /org/bluez/{pid}/hci0 org.bluez.Adapter.GetProperties

This gives you the list of paired devices whithin the Devices array field.

Once you have the list of devices paired to your Bluetooth Adapter, you can know if it is connected to the AudioSource interface.

Get the devices connected to the AudioSource interface :


I find it more to convenient to first try d-bus calls using dbus-send because the D-BUS C API is a bit confusing and unconvenient to use.

share|improve this answer
add comment

Your Answer


