Class UdpTmDataLink

java.lang.Object
com.google.common.util.concurrent.AbstractService
All Implemented Interfaces:
com.google.common.util.concurrent.Service, Runnable, SystemParametersProducer, Link, LinkActionProvider, 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
  • Field Details

    • invalidDatagramCount

      protected volatile long invalidDatagramCount
    • tmSocket

      protected DatagramSocket tmSocket
    • port

      protected int port
    • maxLength

      protected int maxLength
    • initialBytesToStrip

      protected int initialBytesToStrip
    • datagram

      protected DatagramPacket datagram
  • Constructor Details

    • UdpTmDataLink

      public UdpTmDataLink()
  • Method Details

    • getSpec

      public Spec getSpec()
      Description copied from interface: Link
      Returns the valid configuration of the input args of this link.
      Specified by:
      getSpec in interface Link
      Returns:
      the argument specification, or null if the args should not be validated.
    • 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()
      Description copied from interface: Link
      Returns a short detail status (one-line)
      Specified by:
      getDetailedStatus in interface Link
      Overrides:
      getDetailedStatus in class AbstractLink
    • getExtraInfo

      public Map<String,Object> getExtraInfo()
      Description copied from interface: Link
      Returns structured information, specific to the link.
      Specified by:
      getExtraInfo in interface Link
    • resetCounters

      public void resetCounters()
      Specified by:
      resetCounters in interface Link
      Overrides:
      resetCounters in class AbstractTmDataLink
    • 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