- All Implemented Interfaces:
com.google.common.util.concurrent.Service,SystemParametersProducer,VcUplinkHandler,Link,TcDataLink
Implements the FOP (transmitter) part of the Communications Operations Procedure-1 CCSDS 232.1-B-2 September 2010
The FOP1 implementation is a little different than the standard: the "Initiate AD service with CLCW check" will wait for the first CLCW and immediately set the vS to the nR in the CLCW. The standard specifies that the vS has somehow to be set manually to an CLCW observed value before calling the "Initiate AD with CLCW check" directive.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.yamcs.tctm.Link
Link.StatusNested 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
FieldsModifier and TypeFieldDescriptionstatic final CommandOptionprotected Parameterprotected ArrayDeque<PreparedCommand>Fields inherited from class org.yamcs.tctm.AbstractTcDataLink
cmdPostProcessor, commandHistoryPublisher, dataCount, housekeepingIntervalFields inherited from class org.yamcs.tctm.AbstractLink
config, disabled, eventProducer, linkName, log, timeService, yamcsInstance -
Constructor Summary
ConstructorsConstructorDescriptionCop1TcPacketHandler(String yamcsInstance, String linkName, TcManagedParameters.TcVcManagedParameters vmp, ScheduledThreadPoolExecutor executor) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMonitor(Cop1Monitor monitor) protected voidcollectSystemParameters(long time, List<ParameterValue> list) adds system parameters link status and data in/out to the list.protected Link.StatusIn case the link should be connected (i.e. is running and enabled) this method is called to return the actual connection statusvoiddisableCop1(boolean bypassAll) protected voiddoStart()protected voiddoStop()CompletableFuture<org.yamcs.protobuf.Cop1Config>CompletableFuture<org.yamcs.protobuf.Cop1Status>longReturns the timestamp of the first frame ready to be dispatched orTimeEncoding.INVALID_INSTANTif there is no frame.getFrame()Retrieves the next frame in the Virtual Channel, or returns null if there is no frame available at the moment.return the virtual channel parametersinitiateAD(boolean clcwCheck) initiateAD(boolean clcwCheck, long waitMillisec) Initiate AD with or without CLCW check The returned future will be completed when the operation has been initiated.Initiate AD with Unlock.initiateADWithVR(int vR) Initiate AD with set V(R).voidonCLCW(int clcw) Called when a new CLCW is received from the remote systemvoidvoidvoidremoveMonitor(Cop1Monitor monitor) resume()Resume the AD service (if it is suspended)booleanAttempt to send the command and return true if the command has been sent or its processing has finished.setConfig(org.yamcs.protobuf.Cop1Config config) voidsetDataAvailableSemaphore(Semaphore dataAvailableSemaphore) The semaphore will be used by the data link to signal when there is some data to be transmitted.voidsetupSystemParameters(SystemParametersService sysParamsService) Called by the LinkManager before startup if theSystemParametersServiceservice is enabled, to setup necessary things for later parameter collection.setVs(int vs) setWindowWidth(int K) Set the FOP sliding window with - that is the maximum number of commands that can be unacknoledged at one time.Terminate the AD serviceMethods inherited from class org.yamcs.tctm.AbstractTcDataLink
ackCommand, failedCommand, getCurrentTime, getDataInCount, getDataOutCount, getParent, getYamcsInstance, init, initPostprocessor, postprocess, resetCounters, setCommandHistoryPublisher, setParentMethods inherited from class org.yamcs.tctm.AbstractLink
disable, doDisable, doEnable, enable, getConfig, getDetailedStatus, getEventLoop, getLinkStatus, getName, getSystemParameters, isDisabled, isRunningAndEnabledMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.yamcs.tctm.Link
disable, enable, getConfig, getDetailedStatus, getLinkStatus, getName, getSpec, isDisabled, isEffectivelyDisabledMethods inherited from interface org.yamcs.parameter.SystemParametersProducer
getFrequency, getSystemParametersMethods inherited from interface org.yamcs.tctm.TcDataLink
sendTc
-
Field Details
-
OPTION_BYPASS
-
waitQueue
-
spCop1Status
-
-
Constructor Details
-
Cop1TcPacketHandler
public Cop1TcPacketHandler(String yamcsInstance, String linkName, TcManagedParameters.TcVcManagedParameters vmp, ScheduledThreadPoolExecutor executor)
-
-
Method Details
-
addMonitor
-
removeMonitor
-
sendCommand
Description copied from interface:TcDataLinkAttempt to send the command and return true if the command has been sent or its processing has finished.If false is returned, the
LinkManagerwill attempt to send the command via the next TC link (if any).The link is expected to update the
CommandHistoryPublisher.AcknowledgeSentack in the command history if the method returned true. If it returned false, the ack should not be updated (it will be updated by the next link or by the Link Manager if there is other no link).The link can update the
CommandHistoryPublisher.AcknowledgeSentack with a negative ack and return true (i.e. the command has not been really sent but it has finished processing).The return true/false has been introduced in Yamcs 5.6.0. Before that version, the old method sendTc was implicitly returning true. As of Yamcs 5.6.0 most links return true even when they cannot send the command (setting the negative Sent ack).
Throwing an exception is equivalent with returning false, except a error log will be printed (this is considered a bug)
- Specified by:
sendCommandin interfaceTcDataLink- Returns:
-
getFrame
Description copied from interface:VcUplinkHandlerRetrieves the next frame in the Virtual Channel, or returns null if there is no frame available at the moment.- Specified by:
getFramein interfaceVcUplinkHandler- Returns:
-
getFirstFrameTimestamp
public long getFirstFrameTimestamp()Description copied from interface:VcUplinkHandlerReturns the timestamp of the first frame ready to be dispatched orTimeEncoding.INVALID_INSTANTif there is no frame.The timestamp is used by the
MasterChannelFrameMultiplexerto select the Virtual Channel from which the next frame is sent in case of FIFO priority scheme.- Specified by:
getFirstFrameTimestampin interfaceVcUplinkHandler- Returns:
-
setVs
-
initiateAD
Initiate AD with or without CLCW check The returned future will be completed when the operation has been initiated.- Parameters:
clcwCheck- - if true, a CLCW will be expected from the remote system and used to initialise the vS. - If false, the current value of vS will be used.
-
initiateAD
-
initiateADWithVR
Initiate AD with set V(R). This will cause a BC frame to be sent to the remote system.The returned future is completed as soon as a BC frame has been sent downstream (could be unsuccessful!).
- Parameters:
vR-
-
initiateADWithUnlock
Initiate AD with Unlock. This causes a BC Unlock frame to be sent to the remote system. -
terminateAD
Terminate the AD service- Returns:
-
setWindowWidth
Set the FOP sliding window with - that is the maximum number of commands that can be unacknoledged at one time.- Parameters:
K-- Returns:
-
resume
Resume the AD service (if it is suspended)- Returns:
-
purgeSentQueue
public void purgeSentQueue() -
purgeWaitQueue
public void purgeWaitQueue() -
onCLCW
public void onCLCW(int clcw) Called when a new CLCW is received from the remote system- Parameters:
clcw-
-
doStart
protected void doStart()- Specified by:
doStartin classcom.google.common.util.concurrent.AbstractService
-
doStop
protected void doStop()- Specified by:
doStopin classcom.google.common.util.concurrent.AbstractService
-
getDataAvailableSemaphore
-
disableCop1
public void disableCop1(boolean bypassAll) -
setDataAvailableSemaphore
The semaphore will be used by the data link to signal when there is some data to be transmitted.A permit will be released in these circumstances
- a new AD telecommand has been placed into the incoming queue;
- a BC frame has been released
- a BD command has been released
- Specified by:
setDataAvailableSemaphorein interfaceVcUplinkHandler- Parameters:
dataAvailableSemaphore-
-
getParameters
Description copied from interface:VcUplinkHandlerreturn the virtual channel parameters- Specified by:
getParametersin interfaceVcUplinkHandler- Returns:
-
setConfig
-
getCop1Config
-
getCop1Status
-
setupSystemParameters
Description copied from interface:LinkCalled by the LinkManager before startup if theSystemParametersServiceservice 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 theSystemParametersServiceto be called regularly after the start.- Specified by:
setupSystemParametersin interfaceLink- Overrides:
setupSystemParametersin classAbstractLink
-
collectSystemParameters
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
-
connectionStatus
Description copied from class:AbstractLinkIn case the link should be connected (i.e. is running and enabled) this method is called to return the actual connection status- Specified by:
connectionStatusin classAbstractLink
-