Class ParameterRequestManager

java.lang.Object
org.yamcs.parameter.ParameterRequestManager

public class ParameterRequestManager extends Object
Distributes parameters from ParameterProcessorManager to ParameterConsumer

The consumers will subscribe to parameters, this class (we call it PRM) will subscribe itself to providers and send to consumers each time the providers provide some values.

  • Field Details

    • processor

      public final Processor processor
  • Constructor Details

  • Method Details

    • subscribeAll

      public int subscribeAll(ParameterConsumer consumer)
      called by a consumer to subscribe to all parameters
    • unsubscribeAll

      public boolean unsubscribeAll(int subscriptionId)
      called by a consumer to remove a "subscribe all" subscription return true of the subscription has been removed or false if it was not there
      Parameters:
      subscriptionId -
      Returns:
    • addRequest

      public int addRequest(Collection<Parameter> paraList, ParameterConsumer tpc)
      Called by a consumer to create a new subscription
      Parameters:
      paraList -
      tpc -
      Returns:
      the newly created subscription id
    • addRequest

      public int addRequest(Parameter para, ParameterConsumer tpc)
      Called by a consumer to create a subscription with one parameter
      Parameters:
      para -
      tpc -
      Returns:
      the newly created subscription id
    • addRequest

      public void addRequest(int subscriptionId, List<Parameter> paraList, ParameterConsumer tpc)
      Called by a consumer to create request with a given id. This is called when switching processors, the id is coming from the other processor.
      Parameters:
      subscriptionId - - subscription id
      paraList -
      tpc -
    • addItemsToRequest

      public void addItemsToRequest(int subscriptionId, Parameter para) throws InvalidRequestIdentification
      Called by a consumer to add a parameter to an existing subscription.
      Parameters:
      subscriptionId -
      para -
      Throws:
      InvalidRequestIdentification
    • addItemsToRequest

      public void addItemsToRequest(int subscriptionId, List<Parameter> paraList) throws InvalidRequestIdentification
      Called by a consumer to add parameters to an existing subscription.
      Parameters:
      subscriptionId -
      paraList - list of parameters that are added to the subscription
      Throws:
      InvalidRequestIdentification
    • removeItemsFromRequest

      public void removeItemsFromRequest(int subscriptionID, Parameter param)
      Called by a consumer to remove a parameter from a subscription.

      If the parameter is not part of the subscription, the operation will have no effect.

      Parameters:
      subscriptionID -
      param -
    • removeItemsFromRequest

      public void removeItemsFromRequest(int subscriptionID, List<Parameter> paraList)
      Called by a consumer to remove parameters from a subscription.

      Any parameter that is not in the subscription will be ignored.

      Parameters:
      subscriptionID -
      paraList -
    • removeRequest

      public List<Parameter> removeRequest(int subscriptionId)
      Removes all the parameters from a subscription and returns them into an List.
    • subscribeToProviders

      public void subscribeToProviders(Collection<Parameter> itemList)
      Called to subscribe to providers for the given parameters.

      Unless already subscribed, the PRM will start delivering from now on those parameters.

      Parameters:
      itemList -
    • getParameter

      public Parameter getParameter(String fqn) throws InvalidIdentification
      returns a parameter based on fully qualified name
      Parameters:
      fqn -
      Returns:
      Throws:
      InvalidIdentification
    • getParameter

      public Parameter getParameter(Yamcs.NamedObjectId paraId) throws InvalidIdentification
      Parameters:
      paraId -
      Returns:
      the corresponding parameter definition for a IntemIdentification
      Throws:
      InvalidIdentification - in case no provider knows of this parameter.
    • update

      public void update(ParameterValueList pvlist)
      Called by a provider with a list of provided parameters called "current delivery".

      The PRM will take ownership of the current delivery (and modify it!).

      The following steps are performed (in the provider thread, possible by multiple providers in parallel!):

      1. Run algorithms. All results from algorithms are also added to the list.
      2. Check alarms.
      3. Distribute to subscribers.
      4. Add to parameter cache (if enabled).
      5. Add to the last value cache.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getValuesFromCache

      public List<ParameterValue> getValuesFromCache(Collection<Parameter> plist)
      Returns the last known value for each parameter.
      Parameters:
      plist -
      Returns:
    • getLastValueFromCache

      public ParameterValue getLastValueFromCache(Parameter param)
      Get the last value from cache for a specific parameters
      Parameters:
      param -
      Returns: