Add new service test script and fix adapter script

This commit is contained in:
Marcel Holtmann 2008-11-01 01:25:46 +01:00
parent 063167c27c
commit 330092231a
3 changed files with 36 additions and 16 deletions

View File

@ -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

View File

@ -20,7 +20,6 @@ if (len(sys.argv) < 2):
print " requestmode <mode>"
print " discoverabletimeout [timeout]"
print " periodicdiscovery [on/off]"
print " addservicerecord <file>"
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)

33
test/test-service Executable file
View File

@ -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 <command>" % (sys.argv[0])
print ""
print " addrecord <file>"
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)