# Class TemperatureMeasurement

java.lang.Object
com.codename1.health.sensors.TemperatureMeasurement

public final class TemperatureMeasurement extends Object

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

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `SITE_ARMPIT`
  Armpit.
  `static final int`
  `SITE_BODY`
  Body, general.
  `static final int`
  `SITE_EAR`
  Ear.
  `static final int`
  `SITE_FINGER`
  Finger.
  `static final int`
  `SITE_GASTROINTESTINAL`
  Gastrointestinal tract.
  `static final int`
  `SITE_MOUTH`
  Mouth.
  `static final int`
  `SITE_RECTUM`
  Rectum.
  `static final int`
  `SITE_TOE`
  Toe.
  `static final int`
  `SITE_TYMPANUM`
  Tympanum, the ear drum.
  `static final int`
  `SITE_UNKNOWN`
  The temperature was measured somewhere this profile does not name.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `getCelsius()`
  The temperature in degrees Celsius, converted from Fahrenheit when the device reported those.
  `double`
  `getFahrenheit()`
  The temperature in degrees Fahrenheit.
  `int`
  `getSite()`
  Where on the body the measurement was taken, as a `SITE_` constant.
  `long`
  `getTimestampMillis()`
  The device's own timestamp in epoch millis, or `-1` when absent.
  `static TemperatureMeasurement`
  `parse(byte[] value)`
  Decodes a `0x2A1C` value.
  `String`
  `toString()`
  Returns a string representation of the object.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### SITE_UNKNOWN

    public static final int SITE_UNKNOWN
    The temperature was measured somewhere this profile does not name.
    See Also:
      - Constant Field Values

  - ### SITE_ARMPIT

    public static final int SITE_ARMPIT
    Armpit.
    See Also:
      - Constant Field Values

  - ### SITE_BODY

    public static final int SITE_BODY
    Body, general.
    See Also:
      - Constant Field Values

  - ### SITE_EAR

    public static final int SITE_EAR
    Ear.
    See Also:
      - Constant Field Values

  - ### SITE_FINGER

    public static final int SITE_FINGER
    Finger.
    See Also:
      - Constant Field Values

  - ### SITE_GASTROINTESTINAL

    public static final int SITE_GASTROINTESTINAL
    Gastrointestinal tract.
    See Also:
      - Constant Field Values

  - ### SITE_MOUTH

    public static final int SITE_MOUTH
    Mouth.
    See Also:
      - Constant Field Values

  - ### SITE_RECTUM

    public static final int SITE_RECTUM
    Rectum.
    See Also:
      - Constant Field Values

  - ### SITE_TOE

    public static final int SITE_TOE
    Toe.
    See Also:
      - Constant Field Values

  - ### SITE_TYMPANUM

    public static final int SITE_TYMPANUM
    Tympanum, the ear drum.
    See Also:
      - Constant Field Values

- ## 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()
    Description copied from class: `Object`
    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())
    Overrides:
      `toString` in class `Object`