public final class TemperatureMeasurement
- Object
- TemperatureMeasurement
A decoded Temperature Measurement, characteristic 0x2A1C.
Wire format
A flags byte – bit 0 Fahrenheit rather than Celsius, bit 1 timestamp present, bit 2 temperature type present – followed by a 32-bit IEEE-11073 FLOAT.
Note that this is the 32-bit format, whereas blood pressure and glucose
use the 16-bit SFLOAT. They are different encodings with different
reserved values, and decoding one as the other produces numbers that
look plausible enough to ship. A thermometer that cannot obtain a
reading sends a reserved value; this parser returns null rather than
letting it through.
Fields
public static final int SITE_UNKNOWN = 0 | The temperature was measured somewhere this profile does not name. |
public static final int SITE_ARMPIT = 1 | Armpit. |
public static final int SITE_BODY = 2 | Body, general. |
public static final int SITE_EAR = 3 | Ear. |
public static final int SITE_FINGER = 4 | Finger. |
public static final int SITE_GASTROINTESTINAL = 5 | Gastrointestinal tract. |
public static final int SITE_MOUTH = 6 | Mouth. |
public static final int SITE_RECTUM = 7 | Rectum. |
public static final int SITE_TOE = 8 | Toe. |
public static final int SITE_TYMPANUM = 9 | Tympanum, the ear drum. |
Methods
public static TemperatureMeasurement parse(byte[] value) | Decodes a 0x2A1C value. |
public double getCelsius() | The temperature in degrees Celsius, converted from Fahrenheit when the device reported those. |
public double getFahrenheit() | The temperature in degrees Fahrenheit. |
public int getSite() | Where on the body the measurement was taken, as a SITE_ constant. |
public long getTimestampMillis() | The device’s own timestamp in epoch millis, or -1 when absent. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Field details
SITE_UNKNOWN
public static final int SITE_UNKNOWN = 0The temperature was measured somewhere this profile does not name.
SITE_ARMPIT
public static final int SITE_ARMPIT = 1Armpit.
SITE_BODY
public static final int SITE_BODY = 2Body, general.
SITE_EAR
public static final int SITE_EAR = 3Ear.
SITE_FINGER
public static final int SITE_FINGER = 4Finger.
SITE_GASTROINTESTINAL
public static final int SITE_GASTROINTESTINAL = 5Gastrointestinal tract.
SITE_MOUTH
public static final int SITE_MOUTH = 6Mouth.
SITE_RECTUM
public static final int SITE_RECTUM = 7Rectum.
SITE_TOE
public static final int SITE_TOE = 8Toe.
SITE_TYMPANUM
public static final int SITE_TYMPANUM = 9Tympanum, the ear drum.
Method details
parse
public static TemperatureMeasurement parse(byte[] value)Decodes a
0x2A1C value. Returns null for a malformed or
truncated payload, or when the device signalled that it could not
obtain a reading. Never throws.getCelsius
public double getCelsius()The temperature in degrees Celsius, converted from Fahrenheit when
the device reported those.
getFahrenheit
public double getFahrenheit()The temperature in degrees Fahrenheit.
getSite
public int getSite()Where on the body the measurement was taken, as a
SITE_ constant.getTimestampMillis
public long getTimestampMillis()The device’s own timestamp in epoch millis, or
-1 when absent.toString
public String toString()Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + ‘@’ + Integer.toHexString(hashCode())