summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dbusdef.py24
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")