summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-06-08 13:23:35 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-06-08 13:23:35 +0000
commitb6ed588dfb99c4b3d12626edb95ff4191351c7b6 (patch)
tree24fbeb63489129b2a3e2b09356b46d9ce6fa225d /hcid
parent5fade3f9798c91058f992a894833a76958802478 (diff)
Update test scripts
Diffstat (limited to 'hcid')
-rwxr-xr-xhcid/simple-agent2
-rwxr-xr-xhcid/simple-service16
-rwxr-xr-xhcid/test-device2
3 files changed, 13 insertions, 7 deletions
diff --git a/hcid/simple-agent b/hcid/simple-agent
index 86a5fa85..7cd29be6 100755
--- a/hcid/simple-agent
+++ b/hcid/simple-agent
@@ -2,10 +2,10 @@
import gobject
+import sys
import dbus
import dbus.service
import dbus.mainloop.glib
-import sys
class Agent(dbus.service.Object):
@dbus.service.method("org.bluez.Agent",
diff --git a/hcid/simple-service b/hcid/simple-service
index 4c2bce4e..5279a3a6 100755
--- a/hcid/simple-service
+++ b/hcid/simple-service
@@ -1,10 +1,9 @@
#!/usr/bin/python
+import sys
import time
import dbus
-bus = dbus.SystemBus()
-
xml = ' \
<?xml version="1.0" encoding="UTF-8" ?> \
<record> \
@@ -101,8 +100,17 @@ xml = ' \
</record> \
'
-adapter = dbus.Interface(bus.get_object('org.bluez', '/'),
- 'org.bluez.Adapter')
+bus = dbus.SystemBus()
+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+ "org.bluez.Manager")
+
+if len(sys.argv) > 1:
+ path = manager.FindAdapter(sys.argv[1])
+else:
+ path = manager.DefaultAdapter()
+
+adapter = dbus.Interface(bus.get_object("org.bluez", path),
+ "org.bluez.Adapter")
handle = adapter.AddServiceRecord(xml)
diff --git a/hcid/test-device b/hcid/test-device
index a4dd0969..f82e8d38 100755
--- a/hcid/test-device
+++ b/hcid/test-device
@@ -5,8 +5,6 @@ import dbus
bus = dbus.SystemBus()
-bus = dbus.SystemBus()
-
manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),