From 330092231a0223b254287b65bfaccb63adbd42d2 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 1 Nov 2008 01:25:46 +0100 Subject: [PATCH] Add new service test script and fix adapter script --- test/Makefile.am | 6 +++--- test/test-adapter | 13 ------------- test/test-service | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 16 deletions(-) create mode 100755 test/test-service diff --git a/test/Makefile.am b/test/Makefile.am index 90e20812d..ce11943ec 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -38,8 +38,8 @@ INCLUDES = -I$(top_srcdir)/common EXTRA_DIST = apitest hsplay hsmicro bdaddr.8 dbusdef.py \ list-devices test-discovery test-manager test-adapter \ - test-device test-serial test-telephony simple-agent \ - simple-service service-record.dtd service-did.xml \ - service-spp.xml service-opp.xml service-ftp.xml + test-device test-service test-serial test-telephony \ + simple-agent simple-service service-record.dtd \ + service-did.xml service-spp.xml service-opp.xml service-ftp.xml MAINTAINERCLEANFILES = Makefile.in diff --git a/test/test-adapter b/test/test-adapter index 2ec8adef5..44cd97bfd 100755 --- a/test/test-adapter +++ b/test/test-adapter @@ -20,7 +20,6 @@ if (len(sys.argv) < 2): print " requestmode " print " discoverabletimeout [timeout]" print " periodicdiscovery [on/off]" - print " addservicerecord " sys.exit(1) if (sys.argv[1] == "address"): @@ -75,17 +74,5 @@ if (sys.argv[1] == "periodicdiscovery"): time.sleep(120) sys.exit(0) -if (sys.argv[1] == "addservicerecord"): - if (len(sys.argv) < 3): - print "Need file parameter" - else: - f = open(sys.argv[2]) - record = f.read() - f.close() - handle = adapter.AddServiceRecord(record) - print "0x%x" % (handle) - time.sleep(120) - sys.exit(0) - print "Unknown command" sys.exit(1) diff --git a/test/test-service b/test/test-service new file mode 100755 index 000000000..e00520135 --- /dev/null +++ b/test/test-service @@ -0,0 +1,33 @@ +#!/usr/bin/python + +import sys +import dbus +import time + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager") + +adapter = dbus.Interface(bus.get_object("org.bluez", manager.FindAdapter("any")), + "org.bluez.Service") + +if (len(sys.argv) < 2): + print "Usage: %s " % (sys.argv[0]) + print "" + print " addrecord " + sys.exit(1) + +if (sys.argv[1] == "addrecord"): + if (len(sys.argv) < 3): + print "Need file parameter" + else: + f = open(sys.argv[2]) + record = f.read() + f.close() + handle = adapter.AddRecord(record) + print "0x%x" % (handle) + time.sleep(120) + sys.exit(0) + +print "Unknown command" +sys.exit(1)