summaryrefslogtreecommitdiffstats
path: root/test/test-service
blob: e00520135644f1d770acad479d5d47247087811e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)