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
,LinkActionProvider
,TmPacketDataLink
- Direct Known Subclasses:
FilePollingTmDataLink
,TcpTmDataLink
,UdpTmDataLink
,YamcsTmArchiveLink
,YamcsTmLink
public abstract class AbstractTmDataLink
extends AbstractLink
implements TmPacketDataLink, SystemParametersProducer
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.yamcs.tctm.Link
Link.Status
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
Modifier and TypeFieldDescriptionprotected AtomicLong
protected PacketPreprocessor
protected boolean
Fields inherited from class org.yamcs.tctm.AbstractLink
config, dataInCount, dataOutCount, disabled, eventProducer, LINK_NAMESPACE, linkName, log, timeService, yamcsInstance
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
collectSystemParameters
(long time, List<ParameterValue> list) adds system parameters link status and data in/out to the list.long
long
Returns a default linkSpec
.void
init
(String instance, String name, YConfiguration config) Called at startup to initialize the link.protected void
processPacket
(TmPacket tmpkt) Sends the packet downstream for processing.void
void
sets the tm sink that should get all the tm packetsvoid
setupSystemParameters
(SystemParametersService sysParamService) Called by the LinkManager before startup if theSystemParametersService
service is enabled, to setup necessary things for later parameter collection.protected void
updateStats
(int packetSize) called when a new packet is received to update the statisticsMethods inherited from class org.yamcs.tctm.AbstractLink
addAction, connectionStatus, dataIn, dataOut, disable, doDisable, doEnable, enable, getAction, getActions, getConfig, getCurrentTime, getDetailedStatus, getEventLoop, getLinkStatus, getName, getParent, getSystemParameters, getYamcsInstance, isDisabled, isRunningAndEnabled, setParent
Methods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, 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, getExtraInfo, getLinkStatus, getName, getParent, getSpec, isDisabled, isEffectivelyDisabled, setParent
Methods inherited from interface org.yamcs.parameter.SystemParametersProducer
getFrequency, getSystemParameters
Methods inherited from interface org.yamcs.tctm.TmPacketDataLink
isTmPacketDataLinkImplemented
-
Field Details
-
packetCount
-
packetPreprocessor
-
updateSimulationTime
protected boolean updateSimulationTime
-
-
Constructor Details
-
AbstractTmDataLink
public AbstractTmDataLink()
-
-
Method Details
-
getDefaultSpec
Description copied from interface:Link
Returns a default linkSpec
. This can be used in an implementation of {Link.getSpec()
. Eventually (after a few years), it is expected to migrate this logic directly into {LinkLink.getSpec()
, rather than returning null from there. But we want to give sufficient time for links everywhere to start defining their arguments.- Specified by:
getDefaultSpec
in interfaceLink
-
init
Description copied from interface:Link
Called at startup to initialize the link.The config corresponds to the map that is under the link definition in yamcs.instance.yaml.
- Specified by:
init
in interfaceLink
- Overrides:
init
in classAbstractLink
config
- - the configuration - cannot be null (but can be empty)
-
setupSystemParameters
Description copied from interface:Link
Called by the LinkManager before startup if theSystemParametersService
service is enabled, to setup necessary things for later parameter collection.The method is called only on the links that implement the
SystemParametersProducer
interface; they are also registered with theSystemParametersService
to be called regularly after the start.- Specified by:
setupSystemParameters
in interfaceLink
- Overrides:
setupSystemParameters
in classAbstractLink
-
collectSystemParameters
Description copied from class:AbstractLink
adds 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:
collectSystemParameters
in classAbstractLink
-
getDataInCount
public long getDataInCount()- Specified by:
getDataInCount
in interfaceLink
- Overrides:
getDataInCount
in classAbstractLink
-
getDataOutCount
public long getDataOutCount()- Specified by:
getDataOutCount
in interfaceLink
- Overrides:
getDataOutCount
in classAbstractLink
-
setTmSink
Description copied from interface:TmPacketDataLink
sets the tm sink that should get all the tm packets- Specified by:
setTmSink
in interfaceTmPacketDataLink
-
processPacket
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:
resetCounters
in interfaceLink
- Overrides:
resetCounters
in classAbstractLink
-