Class IngredientPipelineService

java.lang.Object
com.tccc.kos.commons.util.ready.ReadyBean
com.tccc.kos.commons.core.service.AbstractService
com.tccc.kos.ext.dispense.pipeline.ingredient.IngredientPipelineService
All Implemented Interfaces:
CtxEventListener, ContextHandleAware, HandleAware, Ready, ReadyAndReadyListener, ReadyListener

public final class IngredientPipelineService extends AbstractService
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.0
Version:
2023-03-06
  • Field Details

  • Method Details

    • onDependenciesReady

      public void onDependenciesReady()
    • getDilutionPump

      public Pump<?> getDilutionPump()
      Returns the pump used for dilution.
    • 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.
    • 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
    • pour

      public 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
    • vpour

      public 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
    • tpour

      public 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
    • 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.
    • 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 ).
    • 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