CostStruct

struct CostStruct

Indicates a generic mechanism for expressing the cost to run an appliance.

  • The type of cost being represented.

    Declaration

  • The value of the cost. A positive number indicates a cost, and a negative number indicates a free benefit.

    Declaration

    Swift

    let value: Int32
  • The number of digits to the right of the decimal point in the Value field. For example, if the value is 102 and DecimalPointsis 2, this would represent a cost of 1.02.

    Declaration

    Swift

    let decimalPoints: UInt8
  • Indicates the currency for the value in the Value field. The value of the currency field must match the values defined by ISO 4217.

    Declaration

    Swift

    let currency: 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)?