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 serialDeviceRenamed (const QString &device)
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 ( QObject * parent = nullptr,
RuntimeScheduler * scheduler = nullptr,
const Dependencies & dependencies = {} )
explicit

◆ ~GPSReceiver()

GPSReceiver::~GPSReceiver ( )

Definition at line 181 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 615 of file GPSReceiver.cc.

◆ activeBaseMode()

int GPSReceiver::activeBaseMode ( ) const

Definition at line 511 of file GPSReceiver.cc.

◆ activeEndpoint()

QString GPSReceiver::activeEndpoint ( ) const

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

Definition at line 516 of file GPSReceiver.cc.

◆ activePresentation()

GPSReceiverPresentation GPSReceiver::activePresentation ( ) const

Presentation capabilities of the connected receiver family.

Definition at line 545 of file GPSReceiver.cc.

References gpsReceiverPresentation().

◆ activeRole()

RTKSettings::ReceiverRole GPSReceiver::activeRole ( ) const

Definition at line 535 of file GPSReceiver.cc.

References RTKSettings::ConfiguredBase.

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 495 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 137 of file GPSReceiver.cc.

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

Referenced by canConnect().

◆ connectReceiver()

bool GPSReceiver::connectReceiver ( )

Connects the configured receiver at the user's request, spending the persistent-change permission on this attempt. A serial device that QGroundControl may not open yet is asked for first. Lifecycle observers may stop or replace this receiver, and delete it only with deleteLater().

Definition at line 550 of file GPSReceiver.cc.

References capabilitiesFor(), effectiveConnectionType(), hasReceiver(), GPSReceiverPresentation::persistentConfiguration, and RTKSettings::Serial.

◆ 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 526 of file GPSReceiver.cc.

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

◆ disconnectReceiver()

void GPSReceiver::disconnectReceiver ( )

Disconnects and pauses automatic connection until the user connects again.

Definition at line 579 of file GPSReceiver.cc.

◆ effectiveConnectionType()

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

Definition at line 205 of file GPSReceiver.h.

Referenced by connectionSupported(), and connectReceiver().

◆ errorMessage()

QString GPSReceiver::errorMessage ( ) const

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

Definition at line 243 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 156 of file GPSReceiver.h.

◆ forwardingCorrections()

bool GPSReceiver::forwardingCorrections ( ) const

Definition at line 540 of file GPSReceiver.cc.

Referenced by statusTextChanged().

◆ hasReceiver()

bool GPSReceiver::hasReceiver ( ) const
overridevirtual

Implements GPSReceiverConnector.

Definition at line 501 of file GPSReceiver.cc.

Referenced by connectReceiver(), setWorkerFactory(), and statusTextChanged().

◆ persistentChangesAllowed()

bool GPSReceiver::persistentChangesAllowed ( ) const
inline

Definition at line 200 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 521 of file GPSReceiver.cc.

◆ reconnecting()

bool GPSReceiver::reconnecting ( ) const

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

Definition at line 610 of file GPSReceiver.cc.

Referenced by statusTextChanged().

◆ 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 481 of file GPSReceiver.cc.

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

◆ serialDeviceRenamed

void GPSReceiver::serialDeviceRenamed ( const QString & device)
signal

The receiver connected on the saved serial device, whose port has device as the name to save it by. The settings store it, so that the receiver is found again once it has been replugged.

Referenced by GPSSettingsBindings::bindReceiver().

◆ serialPortEntries()

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

The serial device picker's entries from the last scan. "value" is the name to save the port by: one that survives replugging where the port has one, else its system location. The port that the saved device names goes by the saved name instead, so that the picker finds its selection. "label" is the device's description and system location, marked when another QGroundControl connection, such as a vehicle link, holds the port.

Definition at line 134 of file GPSReceiver.h.

◆ serialPortEntriesChanged

void GPSReceiver::serialPortEntriesChanged ( )
signal

◆ serialSupported()

bool GPSReceiver::serialSupported ( ) const
inline

Definition at line 160 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 124 of file GPSReceiver.cc.

◆ setWorkerFactory()

void GPSReceiver::setWorkerFactory ( WorkerFactory factory)

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

Definition at line 169 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 679 of file GPSReceiver.cc.

◆ startConnectionPolling()

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

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

Definition at line 589 of file GPSReceiver.cc.

References POLL_INTERVAL.

◆ statusText()

QString GPSReceiver::statusText ( ) const
inline

Definition at line 185 of file GPSReceiver.h.

◆ statusTextChanged

void GPSReceiver::statusTextChanged ( )
signal

◆ summaryLabel()

QString GPSReceiver::summaryLabel ( ) const
inline

Definition at line 183 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 601 of file GPSReceiver.cc.

◆ GPSReceiverConnectionPolicyTest

friend class GPSReceiverConnectionPolicyTest
friend

Definition at line 105 of file GPSReceiver.h.

References GPSReceiverConnectionPolicyTest.

Referenced by GPSReceiverConnectionPolicyTest.

◆ GPSReceiverSettingsBindingTest

friend class GPSReceiverSettingsBindingTest
friend

Definition at line 104 of file GPSReceiver.h.

References GPSReceiverSettingsBindingTest.

Referenced by GPSReceiverSettingsBindingTest.

◆ 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.

References GPSReceiverTest.

Referenced by GPSReceiverTest.

Member Data Documentation

◆ OUTPUT_OVERFLOW_WARNING_DURATION

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

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

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: