Package org.yamcs.tctm
Class AbstractTmDataLink
- java.lang.Object
-
- com.google.common.util.concurrent.AbstractService
-
- org.yamcs.tctm.AbstractLink
-
- org.yamcs.tctm.AbstractTmDataLink
-
- All Implemented Interfaces:
com.google.common.util.concurrent.Service,SystemParametersProducer,Link,TmPacketDataLink
- Direct Known Subclasses:
FilePollingTmDataLink,TcpTcTmDataLink,TcpTmDataLink,UdpTmDataLink
public abstract class AbstractTmDataLink extends AbstractLink implements TmPacketDataLink, SystemParametersProducer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.yamcs.tctm.Link
Link.Status
-
-
Field Summary
Fields Modifier and Type Field Description protected AtomicLongpacketCountprotected PacketPreprocessorpacketPreprocessorprotected booleanupdateSimulationTime-
Fields inherited from class org.yamcs.tctm.AbstractLink
config, disabled, eventProducer, linkName, log, timeService, yamcsInstance
-
-
Constructor Summary
Constructors Constructor Description AbstractTmDataLink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcollectSystemParameters(long time, List<ParameterValue> list)adds system parameters link status and data in/out to the list.longgetDataInCount()longgetDataOutCount()voidinit(String instance, String name, YConfiguration config)Called at startup to initialize the link.protected voidprocessPacket(TmPacket tmpkt)Sends the packet downstream for processing.voidresetCounters()voidsetTmSink(TmSink tmSink)sets the tm processor that should get all the tm packetsvoidsetupSystemParameters(SystemParametersCollector sysParamCollector)Called by the LinkManager before startup if theSystemParametersCollectorservice is enabled, to setup necessary things for later parameter collection.protected voidupdateStats(int packetSize)called when a new packet is received to update the statistics-
Methods inherited from class org.yamcs.tctm.AbstractLink
connectionStatus, disable, doDisable, doEnable, enable, getConfig, getCurrentTime, getDetailedStatus, getEventLoop, getLinkStatus, getName, getSystemParameters, isDisabled, isRunningAndEnabled
-
Methods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, doStart, doStop, 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 org.yamcs.tctm.Link
disable, enable, getConfig, getDetailedStatus, getLinkStatus, getName, getParent, getSpec, isDisabled, setParent
-
Methods inherited from interface org.yamcs.parameter.SystemParametersProducer
getSystemParameters
-
-
-
-
Field Detail
-
packetCount
protected AtomicLong packetCount
-
packetPreprocessor
protected PacketPreprocessor packetPreprocessor
-
updateSimulationTime
protected boolean updateSimulationTime
-
-
Method Detail
-
init
public void init(String instance, String name, YConfiguration config)
Description copied from interface:LinkCalled at startup to initialize the link.The config corresponds to the map that is under the link definition in yamcs.instance.yaml.
- Specified by:
initin interfaceLink- Overrides:
initin classAbstractLinkconfig- - the configuration - cannot be null (but can be empty)
-
setupSystemParameters
public void setupSystemParameters(SystemParametersCollector sysParamCollector)
Description copied from interface:LinkCalled by the LinkManager before startup if theSystemParametersCollectorservice is enabled, to setup necessary things for later parameter collection.The method is called only on the links that implement the
SystemParametersProducerinterface; they are also registered with theSystemParametersCollectorto be called regularly after the start.- Specified by:
setupSystemParametersin interfaceLink- Overrides:
setupSystemParametersin classAbstractLink
-
collectSystemParameters
protected void collectSystemParameters(long time, List<ParameterValue> list)Description copied from class:AbstractLinkadds system parameters link status and data in/out to the list.The inheriting classes should call super.collectSystemParameters and then add their own parameters to the list
- Overrides:
collectSystemParametersin classAbstractLink
-
getDataInCount
public long getDataInCount()
- Specified by:
getDataInCountin interfaceLink
-
getDataOutCount
public long getDataOutCount()
- Specified by:
getDataOutCountin interfaceLink
-
setTmSink
public void setTmSink(TmSink tmSink)
Description copied from interface:TmPacketDataLinksets the tm processor that should get all the tm packets- Specified by:
setTmSinkin interfaceTmPacketDataLink
-
processPacket
protected void processPacket(TmPacket tmpkt)
Sends the packet downstream for processing.Starting in Yamcs 5.2, if the updateSimulationTime option is set on the link configuration,
- the timeService is expected to be SimulationTimeService
- at initialization, the time0 is set to 0
- upon each packet received, the generationTime (as set by the pre-processor) is used to update the simulation elapsed time
Should be called by all sub-classes (instead of directly calling
TmSink.processPacket(TmPacket)- Parameters:
tmpkt-
-
updateStats
protected void updateStats(int packetSize)
called when a new packet is received to update the statistics- Parameters:
packetSize-
-
resetCounters
public void resetCounters()
- Specified by:
resetCountersin interfaceLink
-
-