Class TcPacketHandler

java.lang.Object
com.google.common.util.concurrent.AbstractService
All Implemented Interfaces:
com.google.common.util.concurrent.Service, SystemParametersProducer, VcUplinkHandler, Link, LinkActionProvider, TcDataLink

public class TcPacketHandler extends AbstractTcDataLink implements VcUplinkHandler
Assembles command packets into TC frames as per CCSDS 232.0-B-3.

All frames have the bypass flag set (i.e. they are BD frames).

  • Field Details

  • Constructor Details

  • Method Details

    • sendCommand

      public boolean sendCommand(PreparedCommand preparedCommand)
      Description copied from interface: TcDataLink
      Attempt to send the command and return true if the command has been sent or its processing has finished.

      If false is returned, the LinkManager will attempt to send the command via the next TC link (if any).

      The link is expected to update the CommandHistoryPublisher.AcknowledgeSent_KEY ack 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.AcknowledgeSent_KEY ack 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:
      sendCommand in interface TcDataLink
      Returns:
    • getFrame

      public TcTransferFrame getFrame()
      Description copied from interface: VcUplinkHandler
      Retrieves the next frame in the Virtual Channel, or returns null if there is no frame available at the moment.
      Specified by:
      getFrame in interface VcUplinkHandler
      Returns:
    • getFirstFrameTimestamp

      public long getFirstFrameTimestamp()
      Description copied from interface: VcUplinkHandler
      Returns the timestamp of the first frame ready to be dispatched or TimeEncoding.INVALID_INSTANT if there is no frame.

      The timestamp is used by the MasterChannelFrameMultiplexer to select the Virtual Channel from which the next frame is sent in case of FIFO priority scheme.

      Specified by:
      getFirstFrameTimestamp in interface VcUplinkHandler
      Returns:
    • getParameters

      public VcUplinkManagedParameters getParameters()
      Description copied from interface: VcUplinkHandler
      return the virtual channel parameters
      Specified by:
      getParameters in interface VcUplinkHandler
      Returns:
    • doStart

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

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

      public void setDataAvailableSemaphore(Semaphore dataAvailableSemaphore)
      Description copied from interface: VcUplinkHandler
      The semaphore will be used by the virtual channel to signal to MasterChannelFrameMultiplexer that data is available to be uplinked
      Specified by:
      setDataAvailableSemaphore in interface VcUplinkHandler
    • connectionStatus

      protected Link.Status connectionStatus()
      Description copied from class: AbstractLink
      In case the link should be connected (i.e. is running and enabled) this method is called to return the actual connection status
      Specified by:
      connectionStatus in class AbstractLink