summaryrefslogtreecommitdiffstats
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
parent89aa5447d1310dc3b9a8591dbe80abac9239a114 (diff)
Add service test scripts
-rw-r--r--network/Makefile.am2
-rwxr-xr-xnetwork/test-network27
-rw-r--r--serial/Makefile.am2
-rwxr-xr-xserial/test-serial48
4 files changed, 77 insertions, 2 deletions
diff --git a/network/Makefile.am b/network/Makefile.am
index e01bd4b9..17869043 100644
--- a/network/Makefile.am
+++ b/network/Makefile.am
@@ -23,6 +23,6 @@ AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @HAL_CFLAGS@ @GLIB_CFLAGS@
INCLUDES = -I$(top_srcdir)/common
-EXTRA_DIST = network.service network-api.txt
+EXTRA_DIST = network.service network-api.txt test-network
MAINTAINERCLEANFILES = Makefile.in
diff --git a/network/test-network b/network/test-network
new file mode 100755
index 00000000..8860003b
--- /dev/null
+++ b/network/test-network
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),
+ 'org.bluez.Manager')
+
+conn = manager.ActivateService('network')
+
+network = dbus.Interface(bus.get_object(conn, '/org/bluez/network'),
+ 'org.bluez.network.Manager')
+
+try:
+ nap = dbus.Interface(bus.get_object('org.bluez.network',
+ network.FindAdapter('nap')),
+ 'org.bluez.network.Server')
+except:
+ pass
+
+try:
+ gn = dbus.Interface(bus.get_object('org.bluez.network',
+ network.FindAdapter('gn')),
+ 'org.bluez.network.Server')
+except:
+ pass
diff --git a/serial/Makefile.am b/serial/Makefile.am
index 240429a6..9d47f2db 100644
--- a/serial/Makefile.am
+++ b/serial/Makefile.am
@@ -20,6 +20,6 @@ AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@
INCLUDES = -I$(top_srcdir)/common
-EXTRA_DIST = serial.service serial-api.txt
+EXTRA_DIST = serial.service serial-api.txt test-serial
MAINTAINERCLEANFILES = Makefile.in
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)