QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
NTRIPManager Class Reference

#include <NTRIPManager.h>

+ Inheritance diagram for NTRIPManager:
+ Collaboration diagram for NTRIPManager:

Classes

struct  Configuration
 The NTRIP settings as values; the application's settings binding supplies them. More...
 

Public Types

enum class  ConnectionStatus {
  Disconnected = 0 , Connecting = 1 , Connected = 2 , Reconnecting = 3 ,
  Error = 4
}
 Public connection status. Numeric values are stable — QML binds against them. More...
 
enum class  Event {
  StartRequested , StopRequested , ConfigInvalid , TransportConnected ,
  TransportError , TransportFatalError , ReconnectDue , ReconnectGaveUp ,
  HotReconfigure
}
 
using Dependencies = NTRIPManagerDependencies
 
using TransportFactory = std::function< NTRIPTransport *(const Configuration &configuration, QObject *parent)>
 Creates the transport of one connection attempt, parented to parent; null opens an NTRIPHttpTransport.
 

Signals

void connectionStatusChanged ()
 
void statusMessageChanged ()
 
void securityWarningChanged ()
 
void ggaSourceChanged ()
 
void enableRequested ()
 Retrying after an error turns the saved connection on.
 
void certificatePinChanged (const QString &pin)
 The trusted self-signed caster certificate changed, or was forgotten (empty); the settings should store it.
 

Public Member Functions

 NTRIPManager (QObject *parent=nullptr, RuntimeScheduler *scheduler=nullptr, const Dependencies &dependencies={})
 
 ~NTRIPManager () override
 
void init ()
 Applies the configuration; call once the position providers are installed.
 
void setConfiguration (const Configuration &configuration)
 
const Configuration & configuration () const
 
ConnectionStatus connectionStatus () const
 
QString connectionStatusText () const
 
QString statusMessage () const
 
QString securityWarning () const
 Set while a connected stream sends its credentials without TLS.
 
QString ggaSource () const
 
NTRIPSourceTableController * sourceTableController ()
 
NTRIPConnectionStats * connectionStats ()
 
Q_INVOKABLE void fetchMountpoints (const QGeoCoordinate &sortCoordinate=QGeoCoordinate())
 
void setTransportFactory (TransportFactory factory)
 An empty factory restores NTRIPHttpTransport for every attempt.
 
void setGgaPositionProvider (NTRIPGgaReporter::PositionSource source, NTRIPGgaReporter::PositionProvider provider)
 
Q_INVOKABLE void retryNTRIP ()
 Retry a user-visible error, preserving the enabled setting for subsequent automatic retries.
 
void shutdown ()
 Permanently retire this manager, including deferred settings work.
 

Friends

class NTRIPManagerTest
 Short connection state for compact views.
 

Detailed Description

Manages the NTRIP caster connection lifecycle as an explicit event-driven state machine. All connection state changes flow through _dispatch() and the transition table in NTRIPManager.cc — there is no second, internal state enum. Entry actions own per-state side effects: each Connecting entry opens a new transport and registers it as the NTRIP correction source, teardown retires both, and the manager schedules reconnects.

Definition at line 52 of file NTRIPManager.h.

Member Typedef Documentation

◆ Dependencies

◆ TransportFactory

using NTRIPManager::TransportFactory = std::function<NTRIPTransport*(const Configuration& configuration, QObject* parent)>

Creates the transport of one connection attempt, parented to parent; null opens an NTRIPHttpTransport.

Definition at line 141 of file NTRIPManager.h.

Member Enumeration Documentation

◆ ConnectionStatus

enum class NTRIPManager::ConnectionStatus
strong

Public connection status. Numeric values are stable — QML binds against them.

Enumerator
Disconnected 
Connecting 
Connected 
Reconnecting 
Error 

Definition at line 71 of file NTRIPManager.h.

◆ Event

enum class NTRIPManager::Event
strong

Internal state-machine events, public only so the log names them. Each represents an external stimulus; the transition table in _dispatch() maps (state, event) to the next state.

Enumerator
StartRequested 

Settings enable went true, or the user retried an error.

StopRequested 

Settings enable went false, or the manager shut down.

ConfigInvalid 

Connection configuration failed validation.

TransportConnected 

NTRIPTransport emitted connected().

TransportError 

NTRIPTransport emitted a retryable error.

TransportFatalError 

NTRIPTransport emitted a non-retryable error.

ReconnectDue 

The reconnect delay elapsed or the network returned.

ReconnectGaveUp 

The reconnect attempt ceiling was reached.

HotReconfigure 

Transport-affecting setting changed while connected; reconnect in place.

Definition at line 83 of file NTRIPManager.h.

Constructor & Destructor Documentation

◆ NTRIPManager()

NTRIPManager::NTRIPManager ( QObject *  parent = nullptr,
RuntimeScheduler *  scheduler = nullptr,
const Dependencies &  dependencies = {} 
)
explicit

◆ ~NTRIPManager()

NTRIPManager::~NTRIPManager ( )
override

Definition at line 91 of file NTRIPManager.cc.

References shutdown().

Member Function Documentation

◆ certificatePinChanged

void NTRIPManager::certificatePinChanged ( const QString &  pin)
signal

The trusted self-signed caster certificate changed, or was forgotten (empty); the settings should store it.

Referenced by GPSSettingsBindings::bindNtrip(), and setConfiguration().

◆ configuration()

const Configuration & NTRIPManager::configuration ( ) const
inline

Definition at line 119 of file NTRIPManager.h.

Referenced by setConfiguration().

◆ connectionStats()

NTRIPConnectionStats * NTRIPManager::connectionStats ( )
inline

Definition at line 134 of file NTRIPManager.h.

◆ connectionStatus()

ConnectionStatus NTRIPManager::connectionStatus ( ) const
inline

Definition at line 121 of file NTRIPManager.h.

◆ connectionStatusChanged

void NTRIPManager::connectionStatusChanged ( )
signal

◆ connectionStatusText()

QString NTRIPManager::connectionStatusText ( ) const

Definition at line 105 of file NTRIPManager.cc.

References Connected, Connecting, Disconnected, Error, and Reconnecting.

◆ enableRequested

void NTRIPManager::enableRequested ( )
signal

Retrying after an error turns the saved connection on.

Referenced by GPSSettingsBindings::bindNtrip(), and retryNTRIP().

◆ fetchMountpoints()

void NTRIPManager::fetchMountpoints ( const QGeoCoordinate &  sortCoordinate = QGeoCoordinate())

Fetches the caster's mountpoints, ordered by distance from sortCoordinate; an invalid coordinate keeps the caster's order.

Definition at line 194 of file NTRIPManager.cc.

References NTRIPManager::Configuration::connection, and NTRIPSourceTableController::fetch().

◆ ggaSource()

QString NTRIPManager::ggaSource ( ) const
inline

Definition at line 130 of file NTRIPManager.h.

References NTRIPGgaReporter::currentSource().

◆ ggaSourceChanged

void NTRIPManager::ggaSourceChanged ( )
signal

Referenced by NTRIPManager().

◆ init()

void NTRIPManager::init ( )

Applies the configuration; call once the position providers are installed.

Definition at line 122 of file NTRIPManager.cc.

References NTRIPGgaReporter::configure(), and NTRIPManager::Configuration::gga.

Referenced by GPSManager::init().

◆ retryNTRIP()

void NTRIPManager::retryNTRIP ( )

Retry a user-visible error, preserving the enabled setting for subsequent automatic retries.

Definition at line 174 of file NTRIPManager.cc.

References NTRIPManager::Configuration::enabled, enableRequested(), and Error.

◆ securityWarning()

QString NTRIPManager::securityWarning ( ) const

Set while a connected stream sends its credentials without TLS.

Definition at line 99 of file NTRIPManager.cc.

References Connected, NTRIPManager::Configuration::connection, and NTRIPConnectionConfig::credentialsInClearWarning().

◆ securityWarningChanged

void NTRIPManager::securityWarningChanged ( )
signal

◆ setConfiguration()

void NTRIPManager::setConfiguration ( const Configuration &  configuration)

Before init() the configuration is only stored. After it, stream changes apply after a short debounce, so editing a field does not reconnect per keystroke, and GGA changes apply at once.

Definition at line 133 of file NTRIPManager.cc.

References NTRIPConnectionConfig::allowSelfSignedCerts, certificatePinChanged(), configuration(), NTRIPGgaReporter::configure(), NTRIPManager::Configuration::connection, NTRIPManager::Configuration::enabled, NTRIPManager::Configuration::filter, NTRIPManager::Configuration::gga, NTRIPConnectionConfig::pinnedCertificate, and ScheduledTask::schedule().

Referenced by GPSSettingsBindings::bindNtrip().

◆ setGgaPositionProvider()

void NTRIPManager::setGgaPositionProvider ( NTRIPGgaReporter::PositionSource  source,
NTRIPGgaReporter::PositionProvider  provider 
)

Definition at line 160 of file NTRIPManager.cc.

References NTRIPGgaReporter::setPositionProvider().

Referenced by NTRIPVehicleGgaSource::attach().

◆ setTransportFactory()

void NTRIPManager::setTransportFactory ( TransportFactory  factory)
inline

An empty factory restores NTRIPHttpTransport for every attempt.

Definition at line 144 of file NTRIPManager.h.

◆ shutdown()

void NTRIPManager::shutdown ( )

Permanently retire this manager, including deferred settings work.

Definition at line 184 of file NTRIPManager.cc.

References NTRIPSourceTableController::cancel().

Referenced by GPSManager::shutdown(), and ~NTRIPManager().

◆ sourceTableController()

NTRIPSourceTableController * NTRIPManager::sourceTableController ( )
inline

Definition at line 132 of file NTRIPManager.h.

◆ statusMessage()

QString NTRIPManager::statusMessage ( ) const
inline

Definition at line 125 of file NTRIPManager.h.

◆ statusMessageChanged

void NTRIPManager::statusMessageChanged ( )
signal

Friends And Related Symbol Documentation

◆ NTRIPManagerTest

friend class NTRIPManagerTest
friend

Short connection state for compact views.

Definition at line 67 of file NTRIPManager.h.


The documentation for this class was generated from the following files: