mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-28 22:54:14 +08:00
Add new service test script and fix adapter script
This commit is contained in:
parent
063167c27c
commit
330092231a
@ -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
|
||||
|
@ -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
33
test/test-service
Executable 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)
|
Loading…
Reference in New Issue
Block a user