|
|
# D-Bus Examples
|
|
|
|
|
|
Introspect an interface on a system bus object (UPower in this case):
|
|
|
|
|
|
``` python
|
|
|
import dbus
|
|
|
b = dbus.SystemBus()
|
|
|
upower = b.get_object('org.freedesktop.UPower', '/org/freedesktop/UPower')
|
|
|
|
|
|
iface = dbus.Interface(upower, 'org.freedesktop.DBus.Introspectable')
|
|
|
iface.Introspect()
|
|
|
```
|
|
|
|
|
|
This includes an interface called `org.freedesktop.UPower`. Call a method on this interface via the same object:
|
|
|
``` python
|
|
|
iface = dbus.Interface(upower, 'org.freedesktop.UPower')
|
|
|
iface.EnumerateDevices()
|
|
|
``` |
|
|
\ No newline at end of file |