Package org.yamcs.parameter
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
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
-
Field Summary
Fields inherited from class org.yamcs.AbstractYamcsService
config, log, serviceName, yamcsInstance
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateEnumeratedParameterType
(Class<? extends Enum<?>> enumClass) createEnumeratedSystemParameter
(String relativeName, Class<? extends Enum<?>> enumClass, String description) Creates an enumerated system parameter by deducing the possible enumeration states from the java enum.createSystemParameter
(String relativeName, Yamcs.Value.Type basicType, String description) createSystemParameter
(String relativeName, Yamcs.Value.Type basicType, UnitType unit, String description) Create a system parameter for a basic value type.createSystemParameter
(String relativeName, AggregateParameterType type, String description) Creates a system parameter for an aggregate type.static SystemParameter
createSystemParameter
(Mdb mdb, String fqn, Value engValue) static SystemParameter
createSystemParameter
(Mdb mdb, String fqn, Value engValue, UnitType unit) static SystemParameter
createSystemParameter
(Mdb mdb, String fqn, Yamcs.Value.Type basicType, String description) static SystemParameter
createSystemParameter
(Mdb mdb, String fqn, Yamcs.Value.Type basicType, UnitType unit, String description) static ParameterType
createSystemParameterType
(Mdb mdb, String name, Value v, UnitType unit) void
doStart()
void
doStop()
static ParameterType
getBasicType
(Mdb mdb, Yamcs.Value.Type type, UnitType unit) getBasicType
(Yamcs.Value.Type type) getBasicType
(Yamcs.Value.Type type, UnitType unit) Create (if not already existing) a basic parameter type in the MDB and return it.static SystemParametersService
getInstance
(String instance) getMdb()
this is the namespace all system parameters should be instatic ParameterValue
Deprecated.static ParameterValue
getOrCreateType
(String name, Supplier<ParameterType.Builder<?>> supplier) static ParameterValue
Deprecated.static ParameterValue
Deprecated.static ParameterValue
Deprecated.static ParameterValue
Deprecated.static ParameterValue
Deprecated.static ParameterValue
Deprecated.static ParameterValue
static ParameterValue
static ParameterValue
static ParameterValue
static ParameterValue
static ParameterValue
static <T extends Enum<T>>
ParameterValuegetSpec()
Returns the valid configuration options for this service.static ParameterValue
getUnsignedIntPV
(String fqn, long time, int v) Deprecated.static ParameterValue
getUnsignedIntPV
(Parameter parameter, long time, int v) void
init
(String yamcsInstance, String serviceName, YConfiguration config) Initialize this service.void
Register a parameter producer to be called each time the parameters are collectedvoid
run()
Run from the timer, collect all parameters and send them on the streamvoid
Unregister producer - from now on it will not be invoked.Methods inherited from class org.yamcs.AbstractYamcsService
getConfig, getYamcsInstance
Methods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.common.util.concurrent.Service
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
-
Constructor Details
-
SystemParametersService
public SystemParametersService()
-
-
Method Details
-
getSpec
Description copied from interface:YamcsService
Returns the valid configuration options for this service.- Specified by:
getSpec
in interfaceYamcsService
- 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 interfaceYamcsService
- Overrides:
init
in classAbstractYamcsService
- Parameters:
yamcsInstance
- The yamcs instance, ornull
if this is a global service.serviceName
- The service name.config
- The configured arguments for this service. IfYamcsService.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
-
doStart
public void doStart()- Specified by:
doStart
in classcom.google.common.util.concurrent.AbstractService
-
doStop
public void doStop()- Specified by:
doStop
in classcom.google.common.util.concurrent.AbstractService
-
run
public void run()Run from the timer, collect all parameters and send them on the stream -
registerProducer
Register a parameter producer to be called each time the parameters are collected -
unregisterProducer
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
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, 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 appropriateAggregateParameterType
- 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, Yamcs.Value.Type basicType, String description) -
createSystemParameter
-
createSystemParameter
public static SystemParameter createSystemParameter(Mdb mdb, String fqn, Value engValue, UnitType unit) -
createSystemParameter
public static SystemParameter createSystemParameter(Mdb mdb, String fqn, Yamcs.Value.Type basicType, UnitType unit, String description) -
createSystemParameter
public static SystemParameter createSystemParameter(Mdb mdb, String fqn, Yamcs.Value.Type basicType, String description) -
createEnumeratedParameterType
-
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
-
getBasicType
-
getBasicType
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
-
getOrCreateType
-
getNewPv
-
getPV
-
getPV
-
getPV
-
getPV
-
getPV
-
getUnsignedIntPV
-
getPV
-
getPV
-
getNewPv
Deprecated. -
getPV
Deprecated. -
getPV
Deprecated. -
getPV
Deprecated. -
getPV
Deprecated. -
getPV
Deprecated. -
getUnsignedIntPV
Deprecated. -
getPV
Deprecated. -
getMdb
-