Diff between 63dcb5cdff6037e81d65150a5f3116fceeed299b and dfa888e54f6b2fc48e123de2c58a364615fd92ee

Changed Files

File Additions Deletions Status
doc/thermometer-api.txt +2 -1 modified
test/test-thermometer +2 -1 modified
thermometer/thermometer.c +3 -8 modified

Full Patch

diff --git a/doc/thermometer-api.txt b/doc/thermometer-api.txt
index 6392d39..2271270 100644
--- a/doc/thermometer-api.txt
+++ b/doc/thermometer-api.txt
@@ -103,7 +103,8 @@ Methods		void MeasurementReceived(dict measure)
 			data. The time value is expressed in seconds since epoch.
 			The value represented is (mantissa) x (10**exponent)
 			See foot note for special values when treating with
-			health devices.
+			health devices. The Type entry is only present if the
+			measurement type is known. Otherwise, it is undefined.
 
 			Dict is defined as below:
 			{
diff --git a/test/test-thermometer b/test/test-thermometer
index 5f9742a..bf3b83e 100755
--- a/test/test-thermometer
+++ b/test/test-thermometer
@@ -24,7 +24,8 @@ class Watcher(dbus.service.Object):
 		if measure.has_key("Time"):
 			print "Time: ", measure["Time"]
 
-		print "Type: ", measure["Type"]
+		if measure.has_key("Type"):
+			print "Type: ", measure["Type"]
 
 def property_changed(name, value):
 
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 9bf9881..7aa621f 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -1086,15 +1086,10 @@ static void proc_measurement(struct thermometer *t, const uint8_t *pdu,
 		type = temptype2str(pdu[index]);
 	} else if (t->has_type)
 		type = temptype2str(t->type);
-	else {
-		DBG("Can't get temperature type");
-		return;
-	}
-
-	if (type == NULL)
-		return;
+	else
+		type = NULL;
 
-	m.type = g_strdup(type);
+	m.type = type ? g_strdup(type) : NULL;
 	m.value = final ? "Final" : "Intermediate";
 
 	recv_measurement(t, &m);