Enum LockState
- All Implemented Interfaces:
Comparable<LockState>
The state of a door lock, for Trait.LOCK_STATE and
Trait.TARGET_LOCK_STATE.
Only SECURED and UNSECURED may be written; the rest describe
situations an accessory reports and a caller cannot ask for.
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe mechanism is stuck.The bolt is partly thrown: not locked, and not simply open either.Locked.The accessory could not say.Unlocked. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether this state may be written toTrait.TARGET_LOCK_STATE.static LockStateof(TraitValue value) Reads a lock state out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answersUNKNOWN.static LockStateReturns the enum constant of this type with the specified name.static LockState[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class Enum
clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf
-
Enum Constant Details
-
SECURED
Locked.
Maps to HomeKit's
securedand Matter'sLocked. -
UNSECURED
Unlocked.
Maps to HomeKit's
unsecuredand to both of Matter'sUnlockedandUnlatched-- the latter is a 1.4 addition meaning the latch has been pulled back as well as the bolt, which HomeKit has no way to say. -
PARTIALLY_LOCKED
The bolt is partly thrown: not locked, and not simply open either.
Matter's
NotFullyLocked. Its own constant rather than being folded into a neighbour, because both alternatives lose real information -- calling itJAMMEDasserts a fault that may not exist, and calling itUNKNOWNthrows away a state the accessory was specific about.HomeKit never produces this.
-
JAMMED
The mechanism is stuck.
Unreachable outside HomeKit. HomeKit publishes a jam as a value of the lock characteristic, so it arrives here. Matter reports it as a
LockOperationErrororDoorLockAlarmevent, and this release does not claim Matter events -- so a jammed Matter lock reportsPARTIALLY_LOCKEDorUNKNOWNinstead. Do not build a safety feature on this constant. -
UNKNOWN
The accessory could not say. Also what a nullable MatterLockStateresolves to when it is null.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
of
Reads a lock state out of a trait value, total: a value that is not an enum, or whose ordinal is outside this set, answers
UNKNOWN.Parameters
value: a value read fromTrait.LOCK_STATEorTrait.TARGET_LOCK_STATE, ornull
Returns
the state, never
null -
isWritable
public boolean isWritable()Whether this state may be written to
Trait.TARGET_LOCK_STATE.Returns
-