Enum ChargingState

java.lang.Object
java.lang.Enum<ChargingState>
com.codename1.home.ChargingState
All Implemented Interfaces:
Comparable<ChargingState>

public enum ChargingState extends Enum<ChargingState>
Whether an accessory's battery is charging, for Trait.BATTERY_CHARGING. Read-only.
  • Enum Constant Details

    • UNKNOWN

      public static final ChargingState UNKNOWN

      The accessory could not say.

      HomeKit never produces this -- its characteristic has no such value.

    • NOT_CHARGING

      public static final ChargingState NOT_CHARGING
      On battery.
    • CHARGING

      public static final ChargingState CHARGING
      Charging.
    • FULL

      public static final ChargingState FULL

      On external power with the battery already full.

      HomeKit never produces this; it reports NOT_CHARGING for a full battery sitting on a charger, which is indistinguishable from one that is running down.

    • NOT_CHARGEABLE

      public static final ChargingState NOT_CHARGEABLE

      The battery is not rechargeable -- a coin cell in a sensor.

      Matter and Google Home never produce this. Matter expresses it by the accessory simply not implementing the rechargeable feature, which this API cannot see from the charge attribute alone.

  • Method Details

    • values

      public static ChargingState[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ChargingState valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • of

      public static ChargingState of(TraitValue value)

      Reads a charging state out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answers UNKNOWN.

      Parameters
      Returns

      the state, never null