Class IngredientPipelineService

java.lang.Object
com.kosdev.kos.ext.dispense.pipeline.ingredient.IngredientPipelineService

public final class IngredientPipelineService extends Object
Service performing ingredient pours based on pump operations and named intents. This service handles high level functions such as pump locking, making sure pumps don't run dry if not supported. This service leverages user supplied implementations for some functions such as converting a named intent to an actual sequence of pump operations.
Since:
1
Version:
1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds an op that requires dilution to be running.
    Return the list of pumps able to pour the specified ingredient.
    Pump<?>
    Returns the pump used for dilution.
    getIntent(Pump<?> pump, String intentType)
    Returns the PumpIntent definition for the specified pump and intent type.
    com.kosdev.kos.commons.util.concurrent.future.FutureWork
    pour(Pump<?> pump, String intentType)
    Returns a future that will pour the specified intent on the specified pump when run.
    void
    Removes an op that requires dilution.
    void
    Sets the pump to be used for dilution.
    com.kosdev.kos.commons.util.concurrent.future.FutureWork
    tpour(Pump<?> pump, int duration, double rate, boolean diluted)
    Returns a future that will perform the specified timed pour on the specified pump.
    com.kosdev.kos.commons.util.concurrent.future.FutureWork
    vpour(Pump<?> pump, double volume, double rate, boolean diluted)
    Returns a future that will perform the specified volume pour on the specified pump.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • getDilutionPump

      public Pump<?> getDilutionPump()
      Returns the pump used for dilution.
      Since:
      1
    • setDilutionPump

      public void setDilutionPump(Pump<?> pump)
      Sets the pump to be used for dilution. Only required if dilution will be used in pump operations. This requires that the pump have a dilution intent defined.
      Since:
      1
    • getIntent

      public PumpIntent getIntent(Pump<?> pump, String intentType)
      Returns the PumpIntent definition for the specified pump and intent type.
      Parameters:
      pump - the pump the intent is for
      intentType - the type of intent to return
      Since:
      1
    • pour

      public com.kosdev.kos.commons.util.concurrent.future.FutureWork pour(Pump<?> pump, String intentType)
      Returns a future that will pour the specified intent on the specified pump when run.
      Parameters:
      pump - the pump the intent is for
      intentType - the type of intent to return
      Since:
      1
    • vpour

      public com.kosdev.kos.commons.util.concurrent.future.FutureWork vpour(Pump<?> pump, double volume, double rate, boolean diluted)
      Returns a future that will perform the specified volume pour on the specified pump. This allows a custom vpour operation to be performed without the need to define an intent. This will construct an internal intent on the fly and pour as any other intent.
      Parameters:
      pump - the pump to pour
      volume - the volume to pour in ml
      rate - the rate to pour in ml/sec
      diluted - if true, pour with dilution
      Since:
      1
    • tpour

      public com.kosdev.kos.commons.util.concurrent.future.FutureWork tpour(Pump<?> pump, int duration, double rate, boolean diluted)
      Returns a future that will perform the specified timed pour on the specified pump. This allows a custom tpour operation to be performed without the need to define an intent. This will construct an internal intent on the fly and pour as any other intent.
      Parameters:
      pump - the pump to pour
      duration - duration of the pour in ms
      rate - the rate to pour in ml/sec
      diluted - if true, pour with dilution
      Since:
      1
    • addDilution

      public void addDilution(PumpOp op)
      Adds an op that requires dilution to be running. Starts dilution when the first op is added. When starting dilution this will block shortly (config value: preDilutionDelayMs ) to allow the dilution flow to start.
      Since:
      1
    • removeDilution

      public void removeDilution(PumpOp op)
      Removes an op that requires dilution. Once the last resource is removed, dilution will stop. When stopping dilution there will be short delay before the flow actually stops in an attempt to keep dilution running across operations that require it (config value: postDilutionDelayMs ).
      Since:
      1
    • getAvailablePumpsByIngredient

      public List<Pump<?>> getAvailablePumpsByIngredient(String ingredientId)
      Return the list of pumps able to pour the specified ingredient.
      Parameters:
      ingredientId - the ingredient to search for
      Since:
      1