Class StreamMonitor

All Implemented Interfaces:
Runnable, EncodedMessage

public class StreamMonitor extends AbstractEncodedMessage implements Runnable
Monitor for retrieving streamed data from one mount point.
Since:
11.0
Author:
Luc Maisonobe
  • Constructor Details

    • StreamMonitor

      public StreamMonitor(NtripClient client, String mountPoint, Type type, boolean requiresNMEA, boolean ignoreUnknownMessageTypes, double reconnectDelay, double reconnectDelayFactor, int maxRetries)
      Build a monitor for streaming data from a mount point.
      Parameters:
      client - associated NTRIP client
      mountPoint - mount point providing the stream
      type - messages type of the mount point
      requiresNMEA - if true, the mount point requires a NMEA GGA sentence in the request
      ignoreUnknownMessageTypes - if true, unknown messages types are silently ignored
      reconnectDelay - delay before we reconnect after connection close
      reconnectDelayFactor - factor by which reconnection delay is multiplied after each attempt
      maxRetries - max number of reconnect attempts without reading any data
  • Method Details

    • addObserver

      public void addObserver(int typeCode, MessageObserver observer)
      Add an observer for encoded messages.

      If messages of the specified type have already been retrieved from a stream, the observer will be immediately notified with the last message as a side effect of being added.

      Parameters:
      typeCode - code for the message type (if set to 0, notification will be triggered regardless of message type)
      observer - observer for this message type
    • stopMonitoring

      public void stopMonitoring()
      Stop monitoring.
    • getException

      public OrekitException getException()
      Retrieve exception caught during monitoring.
      Returns:
      exception caught
    • run

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

      protected int fetchByte()
      Fetch the next byte from the message.
      Specified by:
      fetchByte in class AbstractEncodedMessage
      Returns:
      next byte from the message, as a primitive integer, or -1 if end of data has been reached