Skip to contentSkip to conversation

Add thermometer python script

PATCH In review Santiago Carot-Nemesio 2 participants 2 messages Nov 22, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add thermometer python script

---
 Makefile.tools        |    4 +-
 test/test-thermometer |   81 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 test/test-thermometer
Makefile.tools +2 -2
index ff93bc9..796a413 100644
@@ -215,8 +215,8 @@ EXTRA_DIST += test/apitest test/sap-client test/hsplay test/hsmicro \
 		test/test-input test/test-attrib test/test-proximity \
 		test/test-sap-server test/test-oob test/test-serial-proxy \
 		test/service-record.dtd test/service-did.xml \
-		test/service-spp.xml test/service-opp.xml test/service-ftp.xml
-
+		test/service-spp.xml test/service-opp.xml test/service-ftp.xml \
+		test/test-thermometer
 
 if HIDD
 bin_PROGRAMS += compat/hidd
test/test-thermometer new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
1.7.7.4
#1 lore raw

Hi Santiago,

Makefile.tools EXTRA_DIST += test/apitest test/sap-client test/hsplay test/hsmicro \ · line 219

Quoted 10 lines · Santiago Carot-Nemesio
Makefile.tools +2 -2
@@ -215,8 +215,8 @@ EXTRA_DIST += test/apitest test/sap-client test/hsplay test/hsmicro \
 		test/test-input test/test-attrib test/test-proximity \
 		test/test-sap-server test/test-oob test/test-serial-proxy \
 		test/service-record.dtd test/service-did.xml \
-		test/service-spp.xml test/service-opp.xml test/service-ftp.xml
-
+		test/service-spp.xml test/service-opp.xml test/service-ftp.xml \
+		test/test-thermometer

The idea is to have these ordered so that the tests come before the xml files, i.e. add your test after test-serial-proxy.

Makefile.tools EXTRA_DIST += test/apitest test/sap-client test/hsplay test/hsmicro \

Quoted 4 lines
Makefile.tools +4 -0
+	exit_on_release = True
+
+	def set_exit_on_release(self, exit_on_release):
+		self.exit_on_release = exit_on_release

What's this for? Doesn't seem to be used anywhere.

Quoted 10 lines
Makefile.tools +10 -0
+	option_list = [
+		make_option("-i", "--adapter", action="store",
+			type="string", dest="adapter"),
+		make_option("-b", "--device", action="store",
+			type="string", dest="address"),
+		]
+
+	parser = OptionParser(option_list=option_list)
+
+	(options, args) = parser.parse_args()

Makefile.tools

Quoted 10 lines
Makefile.tools +10 -0
+
+	if options.adapter:
+		adapter_path = manager.FindAdapter(options.adapter)
+	else:
+		adapter_path = manager.DefaultAdapter()
+
+	adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
+							"org.bluez.Adapter")
+
+	device_path = adapter.FindDevice(options.address)

I know you've probably just copied the options.address stuff from test-proximity, but since the remote address is mandatory why not make it a plain (non-switch) command line parameter. You're in any case missing the check for whether it was provided or not which would probably trigger an exception instead of a clean error message.

Johan