DispenseItem

struct DispenseItem

The state of a given disensible item.

  • Name of the item.

    Declaration

    Swift

    let itemName: String
  • Amount of that item remaining in the device. If the device is currently dispensing, this reports the remaining amount or what the amount will be once the device finishes dispensing.

    Declaration

    Swift

    let amountRemaining: Google.DispenseTrait.Amount
  • Amount of that item that the device most recently dispensed. If the device is currently dispensing, this should report the amount it dispensed prior to the current dispensing amount.

    Declaration

    Swift

    let amountLastDispensed: Google.DispenseTrait.Amount
  • Indicates if the device is currently dispensing this item.

    Declaration

    Swift

    let isCurrentlyDispensing: Bool
  • 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)?