summaryrefslogtreecommitdiff
path: root/thermometer
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2012-02-15 08:38:18 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-16 15:11:50 +0200
commitdfa888e54f6b2fc48e123de2c58a364615fd92ee (patch)
tree70cf525416e98f4487cebe3ca993625de08499d2 /thermometer
parent63dcb5cdff6037e81d65150a5f3116fceeed299b (diff)
downloadbluez-dfa888e54f6b2fc48e123de2c58a364615fd92ee.tar.gz
thermometer: Fix handling of missing Temperature Type
According to HTS 1.0 (Table 3.1, and Sections 3.1.1.4 and 3.2), the Temperature Type Characteristic is optional. The only restriction is that it shall not be present if the Temperature Type is non-static, for which case the "Temperature Type" field shall be present on the Temperature Measurement Characteristic value. Given there is no default value specified when the Temperature Type is static and unknown, the "Type" entry for MeasurementReceived() on the Thermometer API was made optional.
Diffstat (limited to 'thermometer')
-rw-r--r--thermometer/thermometer.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 9bf988120..7aa621f6d 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);