summaryrefslogtreecommitdiffstats
path: root/serial/test-serial
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-05-08 14:08:54 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-05-08 14:08:54 +0000
commitfcba5ddbba50277ab533ac9efc8414f8b839ec8e (patch)
tree7075396ea70e58209a49ed7bf3f1cd1060acd366 /serial/test-serial
parent89aa5447d1310dc3b9a8591dbe80abac9239a114 (diff)
Add service test scripts
Diffstat (limited to 'serial/test-serial')
-rwxr-xr-xserial/test-serial48
1 files changed, 48 insertions, 0 deletions
diff --git a/serial/test-serial b/serial/test-serial
new file mode 100755
index 00000000..06e5da55
--- /dev/null
+++ b/serial/test-serial
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+
+import sys
+import time
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),
+ 'org.bluez.Manager')
+
+conn = manager.ActivateService('serial')
+
+serial = dbus.Interface(bus.get_object(conn, '/org/bluez/serial'),
+ 'org.bluez.serial.Manager')
+
+if (len(sys.argv) < 2):
+ print "Usage: %s <address> [service]" % (sys.argv[0])
+ sys.exit(1)
+
+address = sys.argv[1]
+
+if (len(sys.argv) < 3):
+ service = "spp"
+else:
+ service = sys.argv[2]
+
+uuidbase = "-0000-1000-8000-00805F9B34FB"
+
+if (service == "spp"):
+ service = "00001101" + uuidbase
+
+if (service == "dun"):
+ service = "00001103" + uuidbase
+
+device = serial.ConnectService(address, service)
+
+print "Connected %s to %s" % (device, address)
+
+print "Press CTRL-C to disconnect"
+
+try:
+ time.sleep(1000)
+ print "Terminating connection"
+except:
+ pass
+
+serial.DisconnectService(device)