Pregunta

How can I list all names in the D-Bus sessionBus with C?

I'm looking for the C GIO equivalent for the dbus.list_names python method

I want to list all names in «org.mpris.MediaPlayer2» which as example could be «org.mpris.MediaPlayer2.clementine, org.mpris.MediaPlayer2.someotherplayer, ...»

There is an application called «qdbusviewer» which does something similar

¿Fue útil?

Solución 2

There is no specific GIO method for this tasks,

Bus names can be listet with a call to the «org.freedesktop.DBus.ListNames», filtering has to be done later.

Obtaining informations about the bus can be done with the introspection methods.

Otros consejos

Information about the interface names, methods and arguments should be in the introspection section.

You can request information about an interface (e.g. org.mpris.MediaPlayer2) using the g_dbus_node_info_lookup_interface () method, to which you can give a GDBusNodeInfo argument, which should contain the path of the dbus object you want to query.

From this call you can get back a GDBusInterfaceInfo object which contains information about the methods and arguments of the requested interface.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top