ModeTagStruct

struct ModeTagStruct

Describes a mode tag. The same manufacturer code and mode tag value in separate cluster instances are part of the same namespace and have the same meaning. For example, a manufacturer tag meaning “pinch” can be used both in a cluster whose purpose is to choose the amount of sugar, or in a cluster whose purpose is to choose the amount of salt.

  • The manufacturer’s vendor ID.

    Declaration

    Swift

    let mfgCode: UInt16?
  • The mode tag within a mode tag namespace. If the mfgCode field exists, this is set to a manufacturer-defined value, otherwise, it’s set to a standard value.

    Declaration

    Swift

    let value: UInt16
  • Creates a new Struct instance using data read from the given TraitDecoder.

    Throws

    HomeError.parseError when parsing fails.

    Declaration

    Swift

    init(decoder: TraitDecoder) throws

    Parameters

    decoder

    The raw data representing this Struct.

  • Writes this Struct to the given TraitEncoder. Throws HomeError.parseError if the data could not be encoded.

    Declaration

    Swift

    func encode(with encoder: TraitEncoder) throws
  • Returns the field corresponding to the given field ID.

    Declaration

    Swift

    static func structField(id: UInt32) -> (any Field)?