Class NtripClient

java.lang.Object
org.orekit.gnss.metric.ntrip.NtripClient

public class NtripClient extends Object
Source table for ntrip streams retrieval.

Note that all authentication is performed automatically by just calling the standard Authenticator.setDefault(Authenticator) method to set up an authenticator.

Since:
11.0
Author:
Luc Maisonobe
  • Field Details

    • DEFAULT_TIMEOUT

      public static final int DEFAULT_TIMEOUT
      Default timeout for connections and reads (ms).
      See Also:
    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      Default port for ntrip communication.
      See Also:
    • DEFAULT_RECONNECT_DELAY

      public static final double DEFAULT_RECONNECT_DELAY
      Default delay before we reconnect after connection close (s).
      See Also:
    • DEFAULT_RECONNECT_DELAY_FACTOR

      public static final double DEFAULT_RECONNECT_DELAY_FACTOR
      Default factor by which reconnection delay is multiplied after each attempt.
      See Also:
    • DEFAULT_MAX_RECONNECT

      public static final int DEFAULT_MAX_RECONNECT
      Default maximum number of reconnect a attempts without readin any data.
      See Also:
  • Constructor Details

    • NtripClient

      public NtripClient(String host, int port, TimeScales timeScales)
      Build a client for NTRIP.

      The default configuration uses default timeout, default reconnection parameters, no GPS fix and no proxy.

      Parameters:
      host - caster host providing the source table
      port - port to use for connection
      timeScales - known time scales
      Since:
      13.0 see DEFAULT_PORT
  • Method Details

    • getHost

      public String getHost()
      Get the caster host.
      Returns:
      caster host
    • getPort

      public int getPort()
      Get the port to use for connection.
      Returns:
      port to use for connection
    • getTimeScales

      public TimeScales getTimeScales()
      Get the known time scales.
      Returns:
      known time scales
      Since:
      13.0
    • setTimeout

      public void setTimeout(int timeout)
      Set timeout for connections and reads.
      Parameters:
      timeout - timeout for connections and reads (ms)
    • setReconnectParameters

      public void setReconnectParameters(double delay, double delayFactor, int max)
      Set Reconnect parameters.
      Parameters:
      delay - delay before we reconnect after connection close
      delayFactor - factor by which reconnection delay is multiplied after each attempt
      max - max number of reconnect a attempts without reading any data
    • setProxy

      public void setProxy(Proxy.Type type, String proxyHost, int proxyPort)
      Set proxy parameters.
      Parameters:
      type - proxy type
      proxyHost - host name of the proxy (ignored if type is Proxy.Type.DIRECT)
      proxyPort - port number of the proxy (ignored if type is Proxy.Type.DIRECT)
    • getProxy

      public Proxy getProxy()
      Get proxy.
      Returns:
      proxy to use
    • setFix

      public void setFix(int hour, int minute, double second, double latitude, double longitude, double ellAltitude, double undulation)
      Set GPS fix data to send as NMEA sentence to Ntrip caster if required.
      Parameters:
      hour - hour of the fix (UTC time)
      minute - minute of the fix (UTC time)
      second - second of the fix (UTC time)
      latitude - latitude (radians)
      longitude - longitude (radians)
      ellAltitude - altitude above ellipsoid (m)
      undulation - height of the geoid above ellipsoid (m)
    • addObserver

      public void addObserver(int typeCode, String mountPoint, MessageObserver observer)
      Add an observer for an 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 from each mount point (in unspecified order) 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)
      mountPoint - mountPoint from which data must come (if null, notification will be triggered regardless of mount point)
      observer - observer for this message type
    • getSourceTable

      public SourceTable getSourceTable()
      Get a sourcetable.
      Returns:
      source table from the caster
    • startStreaming

      public void startStreaming(String mountPoint, Type type, boolean requiresNMEA, boolean ignoreUnknownMessageTypes)
      Connect to a mount point and start streaming data from it.

      This method sets up an internal dedicated thread for continuously monitoring data incoming from a mount point. When new complete parsed messages becomes available, the observers that have been registered using addObserver() method will be notified about the message.

      This method must be called once for each stream to monitor.

      Parameters:
      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
    • checkException

      public void checkException()
      Check if any of the streaming thread has thrown an exception.

      If a streaming thread has thrown an exception, it will be rethrown here

    • stopStreaming

      public void stopStreaming(int time)
      Stop streaming data from all connected mount points.

      If an exception was encountered during data streaming, it will be rethrown here

      Parameters:
      time - timeout for waiting underlying threads termination (ms)