Class AbstractTcDataLink

java.lang.Object
com.google.common.util.concurrent.AbstractService
org.yamcs.tctm.AbstractLink
org.yamcs.tctm.AbstractTcDataLink
All Implemented Interfaces:
com.google.common.util.concurrent.Service, SystemParametersProducer, Link, LinkActionProvider, TcDataLink
Direct Known Subclasses:
AbstractIntegrationTest.TcDataLink, AbstractThreadedTcDataLink, Cop1TcPacketHandler, TcPacketHandler, YamcsTcLink

public abstract class AbstractTcDataLink extends AbstractLink implements TcDataLink
Base implementation for a TC data link that initialises a post processor and implements basic methods.
  • Field Details

  • Constructor Details

    • AbstractTcDataLink

      public AbstractTcDataLink()
  • Method Details

    • getDefaultSpec

      public Spec getDefaultSpec()
      Description copied from interface: Link
      Returns a default link Spec. 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 interface Link
    • init

      public void init(String yamcsInstance, String linkName, YConfiguration config) throws ConfigurationException
      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 interface Link
      Overrides:
      init in class AbstractLink
      config - - the configuration - cannot be null (but can be empty)
      Throws:
      ConfigurationException
    • initPostprocessor

      protected void initPostprocessor(String instance, YConfiguration config)
    • setCommandHistoryPublisher

      public void setCommandHistoryPublisher(CommandHistoryPublisher commandHistoryListener)
      Specified by:
      setCommandHistoryPublisher in interface TcDataLink
    • postprocess

      protected byte[] postprocess(PreparedCommand pc)
      Postprocesses the command, unless postprocessing is disabled.
      Returns:
      potentially modified binary, or null to indicate that the command should not be handled further.
    • getDataInCount

      public long getDataInCount()
      Specified by:
      getDataInCount in interface Link
      Overrides:
      getDataInCount in class AbstractLink
    • failedCommand

      protected void failedCommand(Commanding.CommandId commandId, String reason)
      Send to command history the failed command
    • ackCommand

      protected void ackCommand(Commanding.CommandId commandId)
      send an ack in the command history that the command has been sent out of the link
      Parameters:
      commandId -