Skip to contentSkip to conversation

Health Thermometer Profile API

PATCH In review Santiago Carot-Nemesio 4 participants 5 messages Jul 4, 2011 – Jul 9, 2011 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Health Thermometer Profile API

---
 doc/thermometer-api.txt |  126 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 doc/thermometer-api.txt
doc/thermometer-api.txt new file +126 -0
new file mode 100644
index 0000000..6392d39
@@ -0,0 +1,126 @@
+BlueZ D-Bus Thermometer API description
+****************************************
+
+	Santiago Carot-Nemesio <[email protected]>
+
+Health Thermometer Profile hierarchy
+=====================================
+
+Service		org.bluez
+Interface	org.bluez.Thermometer
+Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
+
+
+Methods		void SetProperty(string name, variant value)
+
+			Changes the value of the specified property. Only
+			read-write properties can be changed. On success
+			this will emit a PropertyChanged signal.
+
+			Possible Errors: org.bluez.Error.InvalidArguments
+
+		dict GetProperties()
+
+			Returns all properties for the interface. See the
+			Properties section for the available properties.
+
+		RegisterWatcher(object agent)
+
+			Registers a watcher to monitor scanned measurements.
+			This agent will be notified about final temperature
+			measurements.
+
+			Possible Errors: org.bluez.Error.InvalidArguments
+
+		UnregisterWatcher(object agent)
+
+			Unregisters a watcher.
+
+			Final and intermediate temperatures won't be notified to
+			this agent any more.
+
+			Possible Errors: org.bluez.Error.InvalidArguments
+					org.bluez.Error.NotFound
+
+		EnableIntermediateMeasurement(object agent)
+
+			Enables intermediate measurement notifications for this
+			agent if the thermometer supports it.
+
+			Possible Errors: org.bluez.Error.InvalidArguments
+					org.bluez.Error.NotSupported
+
+		DisableIntermediateMeasurement(object agent)
+
+			Disables intermediate measurement notifications for this
+			agent. It will disable notifications in the thermometer
+			when the last agent removes the watcher for intermediate
+			measurements.
+
+			Possible Errors: org.bluez.Error.InvalidArguments
+					org.bluez.Error.NotFound
+
+Signals		PropertyChanged(string name, variant value)
+
+			This signal indicates a changed value of the given
+			property.
+
+Properties	boolean Intermediate [readonly]
+
+			True if the thermometer supports intermediate measurement
+			notifications.
+
+		uint16 Interval (optional) [readwrite]
+
+			The Measurement Interval defines the time (in seconds)
+			between measurements. This interval is not related to
+			the intermediate measurements and must be defined into
+			a valid range. Setting it to zero means that no periodic
+			measurements will be taken.
+
+		uint16 Maximum (optional) [readonly]
+
+			Defines the maximum value allowed for the interval
+			between periodic measurements.
+
+		uint16 Minimum (optional) [readonly]
+
+			Defines the minimum value allowed for the interval
+			between periodic measurements.
+
+
+Health Thermometer Watcher hierarchy
+====================================
+Service		unique name
+Interface	org.bluez.ThermometerWatcher
+Object path	freely definable
+
+Methods		void MeasurementReceived(dict measure)
+
+			This callback gets called when a measure has been
+			scanned	in the thermometer. The Time entry in the dict
+			will be only present if the device supports storing of
+			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.
+
+			Dict is defined as below:
+			{
+				"Exponent" : int8,
+				"Mantissa" : int32,
+				"Unit" : ("Celsius" or "Fahrenheit"),
+				"Time" : uint64,
+				"Type" : ("Armpit", "Body", "Ear", "Finger",
+					"Intestines", "Mouth", "Rectum", "Toe",
+					"Tympanum"),
+				"Measurement" : ("Final" or "Intermediate"),
+			}
+
+			For special cases, the exponent shall always be zero and
+			the mantissa should be one of following values:
+
+			NRes = -(2**23)
+			NaN = +(2**23-1)
+			INFINITY = (2**23-2)
+			-INFINITY = -(2**23-2)
Signature · 1 line
1.7.6
#1 lore raw

SGkgU2FudGlhZ28sCgo8c25pcD4KCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBSZWdpc3Rlcldh dGNoZXIob2JqZWN0IGFnZW50KQo+ICsKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIFJlZ2lzdGVycyBhIHdhdGNoZXIgdG8gbW9uaXRvciBzY2FubmVkIG1lYXN1cmVtZW50cy4K PiArI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gYWxsb3dlZCBmb3IgdGhlIGludGVydmFsCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCBiZXR3ZWVuIHBlcmlvZGljIG1lYXN1cmVtZW50cy4KPiArCj4gKyDCoCDCoCDC oCDCoCDCoCDCoCDCoCB1aW50MTYgTWluaW11bSAob3B0aW9uYWwpIFtyZWFkb25seV0KPiArCj4g KyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBEZWZpbmVzIHRoZSBtaW5pbXVtIHZh bHVlIGFsbG93ZWQgZm9yIHRoZSBpbnRlcnZhbAo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgYmV0d2VlbiBwZXJpb2RpYyBtZWFzdXJlbWVudHMuCj4gKwoKSW50ZXJ2YWxzIGNv dWxkIGJlIGEgY29uZmlnIG9wdGlvbi4gSXQgY2FuIGJlIGV4dGVuZGVkIGxhdGVyIGlmCm5lY2Vz c2FyeSwgbW92ZSB0aGUgY29uZmlnIG9wdGlvbiB0byB0aGUgQVBJKFByb3BlcnR5KSBpcyBlYXNp ZXIgdGhhbgpyZW1vdmUgYSBwcm9wZXJ0eS4KClJlZ2FyZHMsCkNsYXVkaW8K

#2 lore raw
Quoted 21 lines · Claudio Takahasi

Hi Santiago,

<snip>

Quoted 17 lines
doc/thermometer-api.txt new file +17 -0
+               RegisterWatcher(object agent)
+
+                       Registers a watcher to monitor scanned measurements.
+                       This agent will be notified about final temperature
+                       measurements.
+
+                       Possible Errors: org.bluez.Error.InvalidArguments
+
+               UnregisterWatcher(object agent)
+
+                       Unregisters a watcher.
+
+                       Final and intermediate temperatures won't be notified to
+                       this agent any more.
+
+                       Possible Errors: org.bluez.Error.InvalidArguments
+                                       org.bluez.Error.NotFound
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+               EnableIntermediateMeasurement(object agent)

It'd be good to try hide from the apps notifications and indications. My opinion is: watchers doesn't need to know if the characteristic value is a notification or indication.
The thermometer implementation could enable automatically notifications if there is at least one watcher registered.

The API does that for final measurements. This only enables/disables the intermediate ones.

Quoted 2 lines

Is it important to know if the characteristic value is intermediate or not?

Yes. Intermediate is a "rough" measurement that is sent for display purposes only, to keep the user happy, and not necessary when there is nobody watching. The final measurement is the "trusted" one.

#3 lore raw
In reply to Claudio Takahasi

Hi Claudio,

2011/7/6 Claudio Takahasi <[email protected]>:

Quoted 19 lines

Hi Santiago,

<snip>

Quoted 15 lines

+               RegisterWatcher(object agent)

doc/thermometer-api.txt new file +14 -0
+
+                       Registers a watcher to monitor scanned measurements.
+                       This agent will be notified about final temperature
+                       measurements.
+
+                       Possible Errors: org.bluez.Error.InvalidArguments
+
+               UnregisterWatcher(object agent)
+
+                       Unregisters a watcher.
+
+                       Final and intermediate temperatures won't be notified to
+                       this agent any more.
+
Quoted 8 lines
Quoted 4 lines

+                       Possible Errors: org.bluez.Error.InvalidArguments
+                                       org.bluez.Error.NotFound +
+               EnableIntermediateMeasurement(object agent)

It'd be good to try hide from the apps notifications and indications. My opinion is: watchers doesn't need to know if the characteristic value is a notification or indication.

The Notification word in the API refers to way that the plugin will report to applications about measures received. Nothing related with the property of the characteristic. The idea is that applications does not worried about that. Always a measurement (notification or indication) is received the callback in the watcher gets called.

Quoted 4 lines

The thermometer implementation could enable automatically notifications if there is at least one watcher registered.

Is it important to know if the characteristic value is intermediate or not?

Yes, for example there may be watchers that want to feed a display with intermediate values until the final measurement arrives, in opposite, EEE11073-20601 watchers dont need get intermediate ones to work so we dont need to bother them with intermediate measurements.

Quoted 42 lines
Quoted 42 lines
doc/thermometer-api.txt new file +41 -0
+
+                       Enables intermediate measurement notifications for this
+                       agent if the thermometer supports it.
+
+                       Possible Errors: org.bluez.Error.InvalidArguments
+                                       org.bluez.Error.NotSupported
+
+               DisableIntermediateMeasurement(object agent)
+
+                       Disables intermediate measurement notifications for this
+                       agent. It will disable notifications in the thermometer
+                       when the last agent removes the watcher for intermediate
+                       measurements.
+
+                       Possible Errors: org.bluez.Error.InvalidArguments
+                                       org.bluez.Error.NotFound
+
+Signals                PropertyChanged(string name, variant value)
+
+                       This signal indicates a changed value of the given
+                       property.
+
+Properties     boolean Intermediate [readonly]
+
+                       True if the thermometer supports intermediate measurement
+                       notifications.
+
+               uint16 Interval (optional) [readwrite]
+
+                       The Measurement Interval defines the time (in seconds)
+                       between measurements. This interval is not related to
+                       the intermediate measurements and must be defined into
+                       a valid range. Setting it to zero means that no periodic
+                       measurements will be taken.
+
+               uint16 Maximum (optional) [readonly]
+
+                       Defines the maximum value allowed for the interval
+                       between periodic measurements.
+
+               uint16 Minimum (optional) [readonly]
Quoted 9 lines

doc/thermometer-api.txt line 90

Quoted 4 lines
doc/thermometer-api.txt new file +4 -0
+
+                       Defines the minimum value allowed for the interval
+                       between periodic measurements.
+

Intervals could be a config option. It can be extended later if necessary, move the config option to the API(Property) is easier than remove a property.

Do you mean to move it to the bluetoothd configuration file? I think that it's not a good a idea because this value should be in a determinated range imposed by the device. Each device can have it own range and it may differ among all those kind of devices.

Regards.

#4 lore raw
In reply to Santiago Carot-Nemesio

Hi,

Quoted 4 lines · Santiago Carot-Nemesio
---
 doc/thermometer-api.txt |  126 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 doc/thermometer-api.txt

I've pushed this upstream. It doesn't mean that it'd the final API, but at least we have a starting point for the implementation.

Johan