Interface HolderModel<AdditionalData>

Abstraction of how an ingredient cartridge attaches to a pump. In many cases this is simply a hose that connects a BiB container to a pump, but in more complex devices this represents a cartridge slot which may have associated hardware, such as RFID antenna, indicator lights, and so on. This also holds state about the availability of a pump to pump the connected ingredient.

interface HolderModel<AdditionalData> {
    overrideRfidCode<T>(overrides): Promise<undefined | Assignment>;
    ingredientName: string;
    previousIngredientName: string;
    pumps: IKosModelContainer<PumpModel<any>>;
    sortedPumps: PumpModel<any>[];
    nozzlePaths: string[];
    canPour: boolean;
    isPouring: boolean;
    assignIngredient(ingredientId?): Promise<void>;
    updateIngredient(ingredientId?): void;
    replaceLine(): Promise<void>;
    shouldDefer: boolean;
    troubles: TroubleModel<any>[];
    troubleStatus: string;
    troublesByType: Record<string, TroubleModel<any>[]>;
    ingredient?: IngredientModel<any>;
    previousIngredient?: IngredientModel<any>;
}

Type Parameters

  • AdditionalData extends object = any

Hierarchy (view full)

Properties

ingredientName: string

The name of the ingredient assigned to the holder

previousIngredientName: string

The name of the previous ingredient assigned to the holder

pumps: IKosModelContainer<PumpModel<any>>

The PumpModel models assigned to the holder.

sortedPumps: PumpModel<any>[]

The PumpModel models assigned to the holder sorted by the pump order.

nozzlePaths: string[]

The paths of the nozzles that are attached to the holder. It is possible for a holder to be connected to multiple nozzles depending on the number of pumps it has. For example, some dispensers might be configured to share ingredients across nozzles in cases where less frequently used ingredients are used in smaller quantities.

canPour: boolean

A boolean value that indicates if the ingredient in the holder can be poured. This is derived from the pour status of all of the underlying pumps.

isPouring: boolean

A boolean value that indicates if the ingredient in the holder is currently pouring.

This is derived from the pour status of the underlying pumps indicating if any of the pumps are currently pouring.

shouldDefer: boolean

Indicates that one or more of the pumps associated with the holder have constraints that must be satisfied before pouring can occur. For example, an ingredient may require agitation before pouring can occur. This is used to defer the pour until the constraints are satisfied.

troubles: TroubleModel<any>[]

Array of troubles directly related to this model. Troubles are typically sorted by rank (highest priority first).

troubleStatus: string

Summary status string representing the highest priority trouble. Returns a human-readable status or 'OK' if no troubles exist.

troublesByType: Record<string, TroubleModel<any>[]>

Troubles organized by their type property. Useful for filtering and categorized display of issues.

Example

const errorTroubles = model.troublesByType['ERROR'] || [];
const warningTroubles = model.troublesByType['WARNING'] || [];
ingredient?: IngredientModel<any>

The IngredientModel assigned to the holder

previousIngredient?: IngredientModel<any>

The previous IngredientModel assigned to the holder

Methods

  • Perform an RFID override on the holder

    Type Parameters

    • T extends Record<string, any>

    Parameters

    • overrides: T

    Returns Promise<undefined | Assignment>

    Throws

    AssignmentError(errIdLen) if the id length is invalid

    Throws

    AssignmentError(errCodeLen) if the code length is invalid

    Throws

    AssignmentError(errIdFormat) if the id format is invalid

    Throws

    AssignmentError(errCodeFormat) if the code format is invalid

    Throws

    AssignmentError(errVerify) if the verification fails

    Throws

    AssignmentError(errBadJson) if the json is invalid

  • Assign an ingredient to the holder.

    This method will call into the assignHolderIngredient service to assign the ingredient to the holder.

    If unassigning the ingredient, the unassignHolderIngredient service will be called.

    Parameters

    • Optional ingredientId: string

      The id of the ingredient to assign to the holder. If not specified, the ingredient will be unassigned.

    Returns Promise<void>

  • Update the ingredient id of the holder.

    This method will update the ingredient id of the holder without calling into the assignHolderIngredient or unassignHolderIngredient services.

    It is intended to be used when ingredient assignment events are received from the dispenser, such as when an ingredient is inserted into a holder and the rfid tag is read. In this case, the assignment will be received via the topic handler and the ingredient id will be updated on the holder.

    This method should be used to update state as opposed to the assignIngredient method which should be used to perform the actual assignment.

    Parameters

    • Optional ingredientId: string

      The id of the ingredient to assign to the holder. If not specified, the ingredient will be unassigned.

    Returns void

  • Indicate that the lines associated with holder have been replaced.

    Returns Promise<void>