Package 

Interface TemperatureMeasurementCallback

    • Method Summary

      Modifier and Type Method Description
      abstract void onTemperatureMeasurementReceived(@NonNull() BluetoothDevice device, float temperature, int unit, @Nullable() Calendar calendar, @Nullable() Integer type) Callback called when Temperature Measurement or Intermediate Temperaturecharacteristic has changed its value.
      static float toCelsius(float temperature, int unit) Converts the value provided in given unit to Celsius degrees.
      static float toFahrenheit(float temperature, int unit) Converts the value provided in given unit to Fahrenheit degrees.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • onTemperatureMeasurementReceived

         abstract void onTemperatureMeasurementReceived(@NonNull() BluetoothDevice device, float temperature, int unit, @Nullable() Calendar calendar, @Nullable() Integer type)

        Callback called when Temperature Measurement or Intermediate Temperaturecharacteristic has changed its value.

        Use toCelsius or toFahrenheit to convert units.

        Parameters:
        device - the target device.
        temperature - the temperature received in given unit
        unit - the temperature unit (UNIT_C or UNIT_F).
        calendar - an optional timestamp of measurement.
        type - an optional type where the temperature was measured, see TYPE_* constants.
      • toCelsius

         static float toCelsius(float temperature, int unit)

        Converts the value provided in given unit to Celsius degrees.If the unit is already UNIT_C it will be returned as is.

        Parameters:
        temperature - the temperature value in given unit.
        unit - the unit of the value (UNIT_C or UNIT_F).
      • toFahrenheit

         static float toFahrenheit(float temperature, int unit)

        Converts the value provided in given unit to Fahrenheit degrees.If the unit is already UNIT_F it will be returned as is.

        Parameters:
        temperature - the temperature value in given unit.
        unit - the unit of the value (UNIT_C or UNIT_F).