diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-01-16 11:18:21 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-01-16 11:18:21 +0000 |
commit | 2666321aed1ad39b9dd3f25879d0993e9f51ed17 (patch) | |
tree | 0b3be926bec75907225d229613bccec8ee0d6fcb /test/dbusdef.py | |
parent | dbe296466fa911e0122194870eb5c7cd89edd5ee (diff) |
Adapt to the service interface changes
Diffstat (limited to 'test/dbusdef.py')
-rw-r--r-- | test/dbusdef.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test/dbusdef.py b/test/dbusdef.py index f039cd4b..c48f8479 100644 --- a/test/dbusdef.py +++ b/test/dbusdef.py @@ -2,6 +2,7 @@ import dbus bus = dbus.SystemBus() + manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager') adapter = dbus.Interface(bus.get_object('org.bluez', manager.DefaultAdapter()), 'org.bluez.Adapter') @@ -10,19 +11,22 @@ test = dbus.Interface(bus.get_object('org.bluez', manager.DefaultAdapter()), 'or rfcomm = dbus.Interface(bus.get_object('org.bluez', manager.DefaultAdapter()), 'org.bluez.RFCOMM') -sdp = dbus.Interface(bus.get_object('org.bluez', manager.DefaultAdapter()), 'org.bluez.SDP') -echo = dbus.Interface(bus.get_object('org.bluez', '/org/bluez/echo'), 'org.bluez.Service') +def create_service(identifier): + try: + path = manager.FindService(identifier) + except: + path = "" + + if (path != ""): + return dbus.Interface(bus.get_object('org.bluez', path), 'org.bluez.Service') -network = dbus.Interface(bus.get_object('org.bluez', '/org/bluez/network'), 'org.bluez.Service') +transfer = create_service("transfer") -input = dbus.Interface(bus.get_object('org.bluez', '/org/bluez/input'), 'org.bluez.Service') +network = create_service("network") -audio = dbus.Interface(bus.get_object('org.bluez', '/org/bluez/audio'), 'org.bluez.Service') +input = create_service("input") -def connect_echo() : - return dbus.Interface(bus.get_object(echo.GetConnectionName(), '/org/bluez/echo'), 'org.freedesktop.DBus.Introspectable') +audio = create_service("audio") -def connect_holtmann() : - holtmann = dbus.Interface(bus.get_object('org.bluez', '/org/holtmann'), 'org.bluez.Service') - return dbus.Interface(bus.get_object(holtmann.GetConnectionName(), '/org/holtmann'), 'org.freedesktop.DBus.Introspectable') +headset = create_service("headset") |