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 Details

  • 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