Class TemperatureMeasurement
java.lang.Object
com.codename1.health.sensors.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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intArmpit.static final intBody, general.static final intEar.static final intFinger.static final intGastrointestinal tract.static final intMouth.static final intRectum.static final intToe.static final intTympanum, the ear drum.static final intThe temperature was measured somewhere this profile does not name. -
Method Summary
Modifier and TypeMethodDescriptiondoubleThe temperature in degrees Celsius, converted from Fahrenheit when the device reported those.doubleThe temperature in degrees Fahrenheit.intgetSite()Where on the body the measurement was taken, as aSITE_constant.longThe device's own timestamp in epoch millis, or-1when absent.static TemperatureMeasurementparse(byte[] value) Decodes a0x2A1Cvalue.toString()Returns a string representation of the object.
-
Field Details
-
SITE_UNKNOWN
public static final int SITE_UNKNOWNThe temperature was measured somewhere this profile does not name.- See Also:
-
SITE_ARMPIT
public static final int SITE_ARMPITArmpit.- See Also:
-
SITE_BODY
public static final int SITE_BODYBody, general.- See Also:
-
SITE_EAR
public static final int SITE_EAREar.- See Also:
-
SITE_FINGER
public static final int SITE_FINGERFinger.- See Also:
-
SITE_GASTROINTESTINAL
public static final int SITE_GASTROINTESTINALGastrointestinal tract.- See Also:
-
SITE_MOUTH
public static final int SITE_MOUTHMouth.- See Also:
-
SITE_RECTUM
public static final int SITE_RECTUMRectum.- See Also:
-
SITE_TOE
public static final int SITE_TOEToe.- See Also:
-
SITE_TYMPANUM
public static final int SITE_TYMPANUMTympanum, the ear drum.- See Also:
-
-
Method Details
-
parse
Decodes a0x2A1Cvalue. Returnsnullfor 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 aSITE_constant. -
getTimestampMillis
public long getTimestampMillis()The device's own timestamp in epoch millis, or-1when absent. -
toString
Description copied from class:ObjectReturns 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())
-