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

#include <GPSReceiver.h>

+ Inheritance diagram for GPSReceiver:
+ Collaboration diagram for GPSReceiver:

Public Types

using Configuration = GPSReceiverConfiguration
 
using WorkerFactory = GPSReceiverWorkerFactory
 
using Dependencies = GPSReceiverDependencies
 

Signals

void receiverChanged ()
 
void errorMessageChanged ()
 
void configurationChanged ()
 
void persistentChangesAllowedChanged ()
 
void serialPortEntriesChanged ()
 
void summaryLabelChanged ()
 
void statusTextChanged ()
 

Public Member Functions

 GPSReceiver (QObject *parent=nullptr, RuntimeScheduler *scheduler=nullptr, const Dependencies &dependencies={})
 
 ~GPSReceiver ()
 
void setConfiguration (const Configuration &configuration)
 
void setWorkerFactory (WorkerFactory factory)
 Inject before connecting; an empty factory restores the real worker.
 
const Configuration & configuration () const
 
QList< GPSSerialPortEntry > serialPortEntries () const
 
std::optional< GPSObservation > acceptedPositionObservation (GPSObservation::PositionUse use) const
 Latest receiver solution that passes the consumer's gates; empty without a fresh fix.
 
Q_INVOKABLE bool connectReceiver ()
 
Q_INVOKABLE void disconnectReceiver ()
 Disconnects and pauses automatic connection until the user connects again.
 
void startConnectionPolling (std::function< bool()> suspended={})
 Runs tick() every POLL_INTERVAL until shutdown(), skipping ticks while suspended returns true.
 
void tick ()
 One step of automatic connection: connections due, reconnections, and USB discovery.
 
void shutdown ()
 
GPSReceiverFactGroup * facts () const
 The receiver's reported state; with no receiver, every Fact is at its metadata default.
 
bool hasReceiver () const override
 
bool serialSupported () const
 
QString errorMessage () const
 The connection or input problem, else a recent report that the receiver dropped output.
 
int activeBaseMode () const
 
QString activeEndpoint () const
 Serial device or TCP host:port of the active receiver.
 
QString receiverIdentity () const
 
QString detectedReceiver () const
 
QString summaryLabel () const
 
QString statusText () const
 
bool reconnecting () const
 The saved receiver is being connected automatically, at startup or after its connection was lost.
 
Q_INVOKABLE GPSReceiverPresentation capabilitiesFor (int role, int manufacturer) const
 Editable settings for a role; configured bases also depend on the manufacturer.
 
GPSReceiverPresentation activePresentation () const
 Presentation capabilities of the connected receiver family.
 
RTKSettings::ReceiverRole activeRole () const
 
bool forwardingCorrections () const
 
bool persistentChangesAllowed () const
 
void setPersistentChangesAllowed (bool allowed)
 Granting permission only lasts until the configuration changes, a session starts or ends, or it is used.
 
RTKSettings::ConnectionType effectiveConnectionType () const
 
bool connectionSupported () const
 UDP only receives, so a receiver QGroundControl configures needs serial or TCP.
 
bool baseModeSupported () const
 
bool canConnect () const
 

Static Public Member Functions

static QList< int > serialBaudRates ()
 The application's serial rates that a receiver accepts as an explicit rate; empty without serial links.
 

Static Public Attributes

static constexpr std::chrono::seconds POLL_INTERVAL {1}
 How often connection polling ticks the receiver.
 
static constexpr std::chrono::seconds OUTPUT_OVERFLOW_WARNING_DURATION {30}
 How long the warning about output the receiver dropped stays after the last report of it.
 
static constexpr std::chrono::seconds SHUTDOWN_TIMEOUT {2}
 How long shutdown() waits for the workers of retired sessions.
 

Friends

class GPSReceiverTest
 The active receiver's RTCM output is a correction source.
 
class GPSReceiverSettingsBindingTest
 
class GPSReceiverConnectionPolicyTest
 

Detailed Description

Runs the local GPS receiver session and publishes its status Facts, corrections, and position. Public methods and report handlers update state first and emit each changed signal once at their end. The status Facts update their raw values as the receiver writes them, and notify QML of new values at most once a second. Observers may stop or replace the receiver from a signal, and delete it only with deleteLater().

Definition at line 66 of file GPSReceiver.h.

Member Typedef Documentation

◆ Configuration

◆ Dependencies

◆ WorkerFactory

Constructor & Destructor Documentation

◆ GPSReceiver()

◆ ~GPSReceiver()

GPSReceiver::~GPSReceiver ( )

Definition at line 167 of file GPSReceiver.cc.

Member Function Documentation

◆ acceptedPositionObservation()

std::optional< GPSObservation > GPSReceiver::acceptedPositionObservation ( GPSObservation::PositionUse  use) const

Latest receiver solution that passes the consumer's gates; empty without a fresh fix.

Definition at line 533 of file GPSReceiver.cc.

References GPSSourceHealth::acceptedObservation().

◆ activeBaseMode()

int GPSReceiver::activeBaseMode ( ) const

Definition at line 444 of file GPSReceiver.cc.

References GPSReceiverSession::baseMode().

◆ activeEndpoint()

QString GPSReceiver::activeEndpoint ( ) const

Serial device or TCP host:port of the active receiver.

Definition at line 449 of file GPSReceiver.cc.

References GPSReceiverSession::endpoint().

◆ activePresentation()

GPSReceiverPresentation GPSReceiver::activePresentation ( ) const

Presentation capabilities of the connected receiver family.

Definition at line 478 of file GPSReceiver.cc.

References gpsReceiverPresentation().

◆ activeRole()

RTKSettings::ReceiverRole GPSReceiver::activeRole ( ) const

Definition at line 468 of file GPSReceiver.cc.

References RTKSettings::ConfiguredBase, and GPSReceiverSession::role().

Referenced by detectedReceiver().

◆ baseModeSupported()

◆ canConnect()

◆ capabilitiesFor()

GPSReceiverPresentation GPSReceiver::capabilitiesFor ( int  role,
int  manufacturer 
) const

Editable settings for a role; configured bases also depend on the manufacturer.

Definition at line 428 of file GPSReceiver.cc.

References RTKSettings::ConfiguredBase, gpsReceiverManufacturerForType(), and gpsReceiverPresentation().

Referenced by baseModeSupported(), canConnect(), and connectReceiver().

◆ configuration()

const Configuration & GPSReceiver::configuration ( ) const
inline

Definition at line 128 of file GPSReceiver.h.

Referenced by setConfiguration().

◆ configurationChanged

void GPSReceiver::configurationChanged ( )
signal

◆ connectionSupported()

bool GPSReceiver::connectionSupported ( ) const

UDP only receives, so a receiver QGroundControl configures needs serial or TCP.

Definition at line 123 of file GPSReceiver.cc.

References RTKSettings::ConfiguredBase, effectiveConnectionType(), GPSReceiverConfiguration::receiverRole, and RTKSettings::Udp.

Referenced by canConnect().

◆ connectReceiver()

bool GPSReceiver::connectReceiver ( )

Connects the configured receiver, spending the persistent-change permission on this attempt. Lifecycle observers may stop or replace this receiver, and delete it only with deleteLater().

Definition at line 483 of file GPSReceiver.cc.

References GPSReceiverConfiguration::baseReceiverManufacturer, capabilitiesFor(), GPSReceiverPresentation::persistentConfiguration, and GPSReceiverConfiguration::receiverRole.

◆ detectedReceiver()

QString GPSReceiver::detectedReceiver ( ) const

Name of the family an Automatic connection detected, such as "Septentrio", or of the protocol a passive receiver's output carries, such as "u-blox (UBX)" or "NMEA"; empty until detected.

Definition at line 459 of file GPSReceiver.cc.

References activeRole(), GPSReceiverSession::detectedType(), gpsInputProtocolName(), gpsReceiverName(), and RTKSettings::Passive.

◆ disconnectReceiver()

void GPSReceiver::disconnectReceiver ( )

Disconnects and pauses automatic connection until the user connects again.

Definition at line 497 of file GPSReceiver.cc.

◆ effectiveConnectionType()

RTKSettings::ConnectionType GPSReceiver::effectiveConnectionType ( ) const
inline

Definition at line 202 of file GPSReceiver.h.

References GPSReceiverConfiguration::effectiveConnectionType().

Referenced by connectionSupported().

◆ errorMessage()

QString GPSReceiver::errorMessage ( ) const

The connection or input problem, else a recent report that the receiver dropped output.

Definition at line 229 of file GPSReceiver.cc.

◆ errorMessageChanged

void GPSReceiver::errorMessageChanged ( )
signal

◆ facts()

GPSReceiverFactGroup * GPSReceiver::facts ( ) const
inline

The receiver's reported state; with no receiver, every Fact is at its metadata default.

Definition at line 153 of file GPSReceiver.h.

Referenced by GPSManager::saveCurrentBasePosition().

◆ forwardingCorrections()

bool GPSReceiver::forwardingCorrections ( ) const

Definition at line 473 of file GPSReceiver.cc.

References GPSReceiverSession::forwardsCorrections().

◆ hasReceiver()

bool GPSReceiver::hasReceiver ( ) const
overridevirtual

Implements GPSReceiverConnector.

Definition at line 434 of file GPSReceiver.cc.

References GPSReceiverSession::hasWorker().

Referenced by setWorkerFactory().

◆ persistentChangesAllowed()

bool GPSReceiver::persistentChangesAllowed ( ) const
inline

Definition at line 197 of file GPSReceiver.h.

◆ persistentChangesAllowedChanged

void GPSReceiver::persistentChangesAllowedChanged ( )
signal

◆ receiverChanged

void GPSReceiver::receiverChanged ( )
signal

Referenced by GPSReceiver().

◆ receiverIdentity()

QString GPSReceiver::receiverIdentity ( ) const

Definition at line 454 of file GPSReceiver.cc.

References GPSReceiverSession::identity().

◆ reconnecting()

bool GPSReceiver::reconnecting ( ) const

The saved receiver is being connected automatically, at startup or after its connection was lost.

Definition at line 528 of file GPSReceiver.cc.

◆ serialBaudRates()

QList< int > GPSReceiver::serialBaudRates ( )
static

The application's serial rates that a receiver accepts as an explicit rate; empty without serial links.

Definition at line 414 of file GPSReceiver.cc.

References gpsValidBaudRate(), and SerialPortManager::supportedBaudRates().

◆ serialPortEntries()

QList< GPSSerialPortEntry > GPSReceiver::serialPortEntries ( ) const
inline

The serial device picker's entries from the last scan: "value" is the system location, "label" the device's description and path, marked when another QGroundControl connection, such as a vehicle link, holds the port.

Definition at line 132 of file GPSReceiver.h.

◆ serialPortEntriesChanged

void GPSReceiver::serialPortEntriesChanged ( )
signal

◆ serialSupported()

bool GPSReceiver::serialSupported ( ) const
inline

Definition at line 157 of file GPSReceiver.h.

◆ setConfiguration()

void GPSReceiver::setConfiguration ( const Configuration &  configuration)

◆ setPersistentChangesAllowed()

void GPSReceiver::setPersistentChangesAllowed ( bool  allowed)

Granting permission only lasts until the configuration changes, a session starts or ends, or it is used.

Definition at line 110 of file GPSReceiver.cc.

◆ setWorkerFactory()

void GPSReceiver::setWorkerFactory ( WorkerFactory  factory)

Inject before connecting; an empty factory restores the real worker.

Definition at line 155 of file GPSReceiver.cc.

References hasReceiver().

◆ shutdown()

void GPSReceiver::shutdown ( )

Stops polling and disconnects, then waits up to SHUTDOWN_TIMEOUT for the workers of retired sessions, which otherwise finish on their own once the event loop delivers their exit.

Definition at line 597 of file GPSReceiver.cc.

References ScheduledTask::cancel().

Referenced by GPSManager::shutdown().

◆ startConnectionPolling()

void GPSReceiver::startConnectionPolling ( std::function< bool()>  suspended = {})

Runs tick() every POLL_INTERVAL until shutdown(), skipping ticks while suspended returns true.

Definition at line 507 of file GPSReceiver.cc.

References POLL_INTERVAL, ScheduledTask::scheduleRepeating(), and tick().

Referenced by GPSManager::init().

◆ statusText()

QString GPSReceiver::statusText ( ) const
inline

Definition at line 182 of file GPSReceiver.h.

◆ statusTextChanged

void GPSReceiver::statusTextChanged ( )
signal

◆ summaryLabel()

QString GPSReceiver::summaryLabel ( ) const
inline

Definition at line 180 of file GPSReceiver.h.

◆ summaryLabelChanged

void GPSReceiver::summaryLabelChanged ( )
signal

◆ tick()

void GPSReceiver::tick ( )

One step of automatic connection: connections due, reconnections, and USB discovery.

Definition at line 519 of file GPSReceiver.cc.

Referenced by startConnectionPolling().

Friends And Related Symbol Documentation

◆ GPSReceiverConnectionPolicyTest

friend class GPSReceiverConnectionPolicyTest
friend

Definition at line 105 of file GPSReceiver.h.

◆ GPSReceiverSettingsBindingTest

friend class GPSReceiverSettingsBindingTest
friend

Definition at line 104 of file GPSReceiver.h.

◆ GPSReceiverTest

friend class GPSReceiverTest
friend

The active receiver's RTCM output is a correction source.

The one-use permission to write receiver flash, for the configuration currently selected. Short state for compact views: a configured base's survey state, otherwise the fix type. What the receiver is doing, as a sentence; empty when no receiver is connected or being connected. The configured receiver supports the selected base mode; a passive receiver has none to support. Connect may start the configured receiver: a selected receiver type, base mode and connection it supports.

Definition at line 103 of file GPSReceiver.h.

Member Data Documentation

◆ OUTPUT_OVERFLOW_WARNING_DURATION

constexpr std::chrono::seconds GPSReceiver::OUTPUT_OVERFLOW_WARNING_DURATION {30}
staticconstexpr

How long the warning about output the receiver dropped stays after the last report of it.

Definition at line 114 of file GPSReceiver.h.

◆ POLL_INTERVAL

constexpr std::chrono::seconds GPSReceiver::POLL_INTERVAL {1}
staticconstexpr

How often connection polling ticks the receiver.

Definition at line 112 of file GPSReceiver.h.

Referenced by startConnectionPolling().

◆ SHUTDOWN_TIMEOUT

constexpr std::chrono::seconds GPSReceiver::SHUTDOWN_TIMEOUT {2}
staticconstexpr

How long shutdown() waits for the workers of retired sessions.

Definition at line 116 of file GPSReceiver.h.


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