Class UdpTmDataLink

java.lang.Object
com.google.common.util.concurrent.AbstractService
All Implemented Interfaces:
com.google.common.util.concurrent.Service, Runnable, SystemParametersProducer, Link, TmPacketDataLink

public class UdpTmDataLink extends AbstractTmDataLink implements Runnable
Receives telemetry packets via UDP. One UDP datagram = one TM packet.

Options:

  • port - the UDP port to listen to
  • maxLength - the maximum length of the datagram (and thus the TM packet length + initialBytesToStrip). If a datagram longer than this size will be received, it will be truncated. Default: 1500 (bytes)
  • initialBytesToStrip - if configured, skip that number of bytes from the beginning of the datagram. Default: 0
  • Constructor Details

    • UdpTmDataLink

      public UdpTmDataLink()
  • Method Details

    • init

      public void init(String instance, String name, YConfiguration config) throws ConfigurationException
      Creates a new UDP TM Data Link
      Specified by:
      init in interface Link
      Overrides:
      init in class AbstractTmDataLink
      config - - the configuration - cannot be null (but can be empty)
      Throws:
      ConfigurationException - if port is not defined in the configuration
    • doStart

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

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

      public void run()
      Specified by:
      run in interface Runnable
    • getNextPacket

      public TmPacket getNextPacket()
      Called to retrieve the next packet. It blocks in readining on the multicast socket
      Returns:
      anything that looks as a valid packet, just the size is taken into account to decide if it's valid or not
    • getDetailedStatus

      public String getDetailedStatus()
      returns statistics with the number of datagram received and the number of invalid datagrams
      Specified by:
      getDetailedStatus in interface Link
      Overrides:
      getDetailedStatus in class AbstractLink
      Returns:
      more detailed status information
    • doDisable

      public void doDisable()
      Sets the disabled to true such that getNextPacket ignores the received datagrams
      Overrides:
      doDisable in class AbstractLink
    • doEnable

      public void doEnable() throws SocketException
      Sets the disabled to false such that getNextPacket does not ignore the received datagrams
      Overrides:
      doEnable in class AbstractLink
      Throws:
      SocketException
    • 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