Class SystemParametersService

java.lang.Object
com.google.common.util.concurrent.AbstractService
org.yamcs.AbstractYamcsService
org.yamcs.parameter.SystemParametersService
All Implemented Interfaces:
com.google.common.util.concurrent.Service, Runnable, YamcsService
Direct Known Subclasses:
SystemParametersCollector

public class SystemParametersService extends AbstractYamcsService implements Runnable
Collects each second system processed parameters from whomever registers and sends them on the sys_var stream

Starting with Yamcs 5.5.0, all system parameters have types defined in the MDB. For the basic types (corresponding to scalar values), this class will provide some types (e.g. uint65, float32, etc)

For aggregate, the caller can use the createSystemParameter(String, AggregateParameterType, String) to make the parameter and also add the corresponding type to the MDB.

  • Constructor Details

    • SystemParametersService

      public SystemParametersService()
  • Method Details

    • getSpec

      public Spec getSpec()
      Description copied from interface: YamcsService
      Returns the valid configuration options for this service.
      Specified by:
      getSpec in interface YamcsService
      Returns:
      the argument specification, or null if the args should not be validated.
    • init

      public void init(String yamcsInstance, String serviceName, YConfiguration config) throws InitException
      Description copied from interface: YamcsService
      Initialize this service. This is called before the service is started. All operations should finish fast.
      Specified by:
      init in interface YamcsService
      Overrides:
      init in class AbstractYamcsService
      Parameters:
      yamcsInstance - The yamcs instance, or null if this is a global service.
      serviceName - The service name.
      config - The configured arguments for this service. If YamcsService.getSpec() is implemented then this contains the arguments after being validated (including any defaults).
      Throws:
      InitException - When something goes wrong during the execution of this method.
    • getInstance

      public static SystemParametersService getInstance(String instance)
    • doStart

      public void doStart()
      Specified by:
      doStart in class com.google.common.util.concurrent.AbstractService
    • doStop

      public void doStop()
      Specified by:
      doStop in class com.google.common.util.concurrent.AbstractService
    • run

      public void run()
      Run from the timer, collect all parameters and send them on the stream
      Specified by:
      run in interface Runnable
    • registerProducer

      public void registerProducer(SystemParametersProducer p)
      Register a parameter producer to be called each time the parameters are collected
    • unregisterProducer

      public void unregisterProducer(SystemParametersProducer p)
      Unregister producer - from now on it will not be invoked. Note that the collector collects parameters into a different thread taking all producer in turns, and there might be one collection already started when this method is called.
    • getNamespace

      public String getNamespace()
      this is the namespace all system parameters should be in
      Returns:
      the namespace to be used by the system parameters
    • createSystemParameter

      public SystemParameter createSystemParameter(String relativeName, AggregateParameterType type, String description)
      Creates a system parameter for an aggregate type.

      If the type has no qualified name, one is set and is added to the MDB. Otherwise it is assumed it already comes from he MDB and it is not added.

      Parameters:
      relativeName -
      type -
      Returns:
    • createSystemParameter

      public SystemParameter createSystemParameter(String relativeName, org.yamcs.protobuf.Yamcs.Value.Type basicType, UnitType unit, String description)
      Create a system parameter for a basic value type. The created parameter will have a shared basic parameter type.

      If the type is aggregate, the method createSystemParameter(String, AggregateParameterType, String) should be used after making an appropriate AggregateParameterType

      Parameters:
      relativeName - - the relative name of the parameter, can contain multiple subsystems but cannot start with "/"
      basicType - - any type except aggregate and array
      Returns:
    • createSystemParameter

      public SystemParameter createSystemParameter(String relativeName, org.yamcs.protobuf.Yamcs.Value.Type basicType, String description)
    • createSystemParameter

      public static SystemParameter createSystemParameter(XtceDb mdb, String fqn, Value engValue)
    • createSystemParameter

      public static SystemParameter createSystemParameter(XtceDb mdb, String fqn, Value engValue, UnitType unit)
    • createSystemParameter

      public static SystemParameter createSystemParameter(XtceDb mdb, String fqn, org.yamcs.protobuf.Yamcs.Value.Type basicType, UnitType unit, String description)
    • createSystemParameter

      public static SystemParameter createSystemParameter(XtceDb mdb, String fqn, org.yamcs.protobuf.Yamcs.Value.Type basicType, String description)
    • createEnumeratedParameterType

      public EnumeratedParameterType createEnumeratedParameterType(Class<? extends Enum<?>> enumClass)
    • createEnumeratedSystemParameter

      public SystemParameter createEnumeratedSystemParameter(String relativeName, Class<? extends Enum<?>> enumClass, String description)
      Creates an enumerated system parameter by deducing the possible enumeration states from the java enum.
    • createSystemParameterType

      public static ParameterType createSystemParameterType(XtceDb mdb, String name, Value v, UnitType unit)
    • getBasicType

      public ParameterType getBasicType(org.yamcs.protobuf.Yamcs.Value.Type type)
    • getBasicType

      public ParameterType getBasicType(org.yamcs.protobuf.Yamcs.Value.Type type, UnitType unit)
      Create (if not already existing) a basic parameter type in the MDB and return it.

      Basic type is everything except aggregate and arrays

      Parameters:
      type -
      Returns:
    • getBasicType

      public static ParameterType getBasicType(XtceDb mdb, org.yamcs.protobuf.Yamcs.Value.Type type, UnitType unit)
    • getOrCreateType

      public ParameterType getOrCreateType(String name, Supplier<ParameterType.Builder<?>> supplier)
    • getNewPv

      public static ParameterValue getNewPv(Parameter parameter, long time)
    • getPV

      public static ParameterValue getPV(Parameter parameter, long time, String v)
    • getPV

      public static ParameterValue getPV(Parameter parameter, long time, double v)
    • getPV

      public static ParameterValue getPV(Parameter parameter, long time, float v)
    • getPV

      public static ParameterValue getPV(Parameter parameter, long time, boolean v)
    • getPV

      public static ParameterValue getPV(Parameter parameter, long time, long v)
    • getUnsignedIntPV

      public static ParameterValue getUnsignedIntPV(Parameter parameter, long time, int v)
    • getPV

      public static <T extends Enum<T>> ParameterValue getPV(Parameter parameter, long time, T v)
    • getPV

      public static ParameterValue getPV(Parameter parameter, long time, Value v)
    • getNewPv

      @Deprecated public static ParameterValue getNewPv(String fqn, long time)
      Deprecated.
    • getPV

      @Deprecated public static ParameterValue getPV(String fqn, long time, String v)
      Deprecated.
    • getPV

      @Deprecated public static ParameterValue getPV(String fqn, long time, double v)
      Deprecated.
    • getPV

      @Deprecated public static ParameterValue getPV(String fqn, long time, float v)
      Deprecated.
    • getPV

      @Deprecated public static ParameterValue getPV(String fqn, long time, boolean v)
      Deprecated.
    • getPV

      @Deprecated public static ParameterValue getPV(String fqn, long time, long v)
      Deprecated.
    • getUnsignedIntPV

      @Deprecated public static ParameterValue getUnsignedIntPV(String fqn, long time, int v)
      Deprecated.
    • getPV

      @Deprecated public static ParameterValue getPV(String fqn, long time, Value v)
      Deprecated.
    • getMdb

      public XtceDb getMdb()