Enroute Flight Navigation
A navigation app for VFR pilots
Positioning::PositionProvider Class Reference

Central Position Provider. More...

#include <PositionProvider.h>

Public Member Functions

 PositionProvider (QObject *parent=nullptr)
 Standard constructor.
 ~PositionProvider () override
 Standard destructor.
QGeoCoordinate approximateLastValidCoordinate () const
 Getter function for the property with the same name.
QBindable< QGeoCoordinate > bindableApproximateLastValidCoordinate () const
 Getter function for the property with the same name.
QString icon () const
 Getter function for the property with the same name.
QBindable< QString > bindableIcon () const
 Getter function for the property with the same name.
QBindable< QGeoCoordinate > bindableLastValidCoordinate ()
 Getter function for the property with the same name.
QBindable< Units::AnglebindableLastValidTT ()
 Getter function for the property with the same name.
QGeoCoordinate mapCenter () const
 Getter function for the property with the same name.
QBindable< QGeoCoordinate > bindableMapCenter ()
 Getter function for the property with the same name.
void setMapCenter (const QGeoCoordinate &newMapCenter)
 Setter function for the property with the same name.
Positioning::PositionInfo positionInfo () const
 Getter method for property with the same name.
QBindable< Positioning::PositionInfobindablePositionInfo () const
 Getter method for property with the same name.
Units::Distance pressureAltitude () const
 Getter method for property with the same name.
QBindable< Units::DistancebindablePressureAltitude () const
 Getter method for property with the same name.
bool pressureAltitudeImplausible () const
 Getter method for property with the same name.
QBindable< bool > bindablePressureAltitudeImplausible () const
 Getter method for property with the same name.
bool receivingPositionInfo () const
 Getter method for property with the same name.
QBindable< bool > bindableReceivingPositionInfo ()
 Getter method for property with the same name.
QString statusString () const
 Getter method for property with the same name.
QBindable< QString > bindableStatusString () const
 Getter method for property with the same name.
Q_INVOKABLE void startUpdates ()
 startUpdates

Static Public Member Functions

static QGeoCoordinate lastValidCoordinate ()
 Getter function for the property with the same name.
static Units::Angle lastValidTT ()
 Getter function for the property with the same name.

Static Public Attributes

static constexpr Units::Distance pressureAltitudeImplausibleThreshold = Units::Distance::fromFT(5000.0)
 Threshold for the pressure altitude plausibility check.

Properties

QGeoCoordinate approximateLastValidCoordinate
 Approximate last valid coordinate.
QString icon
 Ownship icon.
QGeoCoordinate lastValidCoordinate
 Last valid coordinate reading.
QGeoCoordinate mapCenter
 Map center coordinate.
Units::Angle lastValidTT
 Last valid true track.
Positioning::PositionInfo positionInfo
 Position information.
Units::Distance pressureAltitude
 Pressure altitude.
bool pressureAltitudeImplausible
 Indicator that pressure altitude and geometric altitude are inconsistent.
bool receivingPositionInfo
 Indicator that position information is being received.
QString statusString
 Source status.

Detailed Description

Central Position Provider.

This class collects position data from the various sources (satellite, network, traffic receiver, …) chooses the best available source and exposes the data to QML and other parts of the program.

There exists one static instance of this class, which can be accessed via the method globalInstance(). No other instance of this class should be used.

Data from the standard operating system data source (typically: satnav or wifi) is only provided after startUpdates() has been called.

The methods in this class are reentrant, but not thread safe.

Definition at line 49 of file PositionProvider.h.

Constructor & Destructor Documentation

◆ PositionProvider()

Positioning::PositionProvider::PositionProvider ( QObject * parent = nullptr)
explicit

Standard constructor.

Parameters
parentThe standard QObject parent pointer

Member Function Documentation

◆ approximateLastValidCoordinate()

QGeoCoordinate Positioning::PositionProvider::approximateLastValidCoordinate ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property approximateLastValidCoordinate

Definition at line 186 of file PositionProvider.h.

◆ bindableApproximateLastValidCoordinate()

QBindable< QGeoCoordinate > Positioning::PositionProvider::bindableApproximateLastValidCoordinate ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property approximateLastValidCoordinate

Definition at line 192 of file PositionProvider.h.

◆ bindableIcon()

QBindable< QString > Positioning::PositionProvider::bindableIcon ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property icon

Definition at line 204 of file PositionProvider.h.

◆ bindableLastValidCoordinate()

QBindable< QGeoCoordinate > Positioning::PositionProvider::bindableLastValidCoordinate ( )
inlinenodiscard

Getter function for the property with the same name.

Returns
Property lastValidCoordinate

Definition at line 216 of file PositionProvider.h.

◆ bindableLastValidTT()

QBindable< Units::Angle > Positioning::PositionProvider::bindableLastValidTT ( )
inlinenodiscard

Getter function for the property with the same name.

Returns
Property lastValidTrack

Definition at line 228 of file PositionProvider.h.

◆ bindableMapCenter()

QBindable< QGeoCoordinate > Positioning::PositionProvider::bindableMapCenter ( )
inlinenodiscard

Getter function for the property with the same name.

Returns
Property mapCenter

Definition at line 240 of file PositionProvider.h.

◆ bindablePositionInfo()

QBindable< Positioning::PositionInfo > Positioning::PositionProvider::bindablePositionInfo ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property positionInfo

Definition at line 258 of file PositionProvider.h.

◆ bindablePressureAltitude()

QBindable< Units::Distance > Positioning::PositionProvider::bindablePressureAltitude ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property pressureAltitude

Definition at line 270 of file PositionProvider.h.

◆ bindablePressureAltitudeImplausible()

QBindable< bool > Positioning::PositionProvider::bindablePressureAltitudeImplausible ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property pressureAltitudeImplausible

Definition at line 282 of file PositionProvider.h.

◆ bindableReceivingPositionInfo()

QBindable< bool > Positioning::PositionProvider::bindableReceivingPositionInfo ( )
inlinenodiscard

Getter method for property with the same name.

Returns
Property receivingPositionInfo

Definition at line 294 of file PositionProvider.h.

◆ bindableStatusString()

QBindable< QString > Positioning::PositionProvider::bindableStatusString ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property statusString

Definition at line 306 of file PositionProvider.h.

◆ icon()

QString Positioning::PositionProvider::icon ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property icon

Definition at line 198 of file PositionProvider.h.

◆ lastValidCoordinate()

QGeoCoordinate Positioning::PositionProvider::lastValidCoordinate ( )
staticnodiscard

Getter function for the property with the same name.

Returns
Property lastValidCoordinate

◆ lastValidTT()

Units::Angle Positioning::PositionProvider::lastValidTT ( )
staticnodiscard

Getter function for the property with the same name.

Returns
Property lastValidTrack

◆ mapCenter()

QGeoCoordinate Positioning::PositionProvider::mapCenter ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property mapCenter

Definition at line 234 of file PositionProvider.h.

◆ positionInfo()

Positioning::PositionInfo Positioning::PositionProvider::positionInfo ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property positionInfo

Definition at line 252 of file PositionProvider.h.

◆ pressureAltitude()

Units::Distance Positioning::PositionProvider::pressureAltitude ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property pressureAltitude

Definition at line 264 of file PositionProvider.h.

◆ pressureAltitudeImplausible()

bool Positioning::PositionProvider::pressureAltitudeImplausible ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property pressureAltitudeImplausible

Definition at line 276 of file PositionProvider.h.

◆ receivingPositionInfo()

bool Positioning::PositionProvider::receivingPositionInfo ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property receivingPositionInfo

Definition at line 288 of file PositionProvider.h.

◆ setMapCenter()

void Positioning::PositionProvider::setMapCenter ( const QGeoCoordinate & newMapCenter)
inline

Setter function for the property with the same name.

Parameters
newMapCenterNew map center coordinate

Definition at line 246 of file PositionProvider.h.

◆ startUpdates()

Q_INVOKABLE void Positioning::PositionProvider::startUpdates ( )
inline

startUpdates

Requests permissions if necessary and starts to provide data from the standard operating system data source (typically SatNav or WiFi) if permissions were granted.

Definition at line 332 of file PositionProvider.h.

◆ statusString()

QString Positioning::PositionProvider::statusString ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property statusString

Definition at line 300 of file PositionProvider.h.

Member Data Documentation

◆ pressureAltitudeImplausibleThreshold

Units::Distance Positioning::PositionProvider::pressureAltitudeImplausibleThreshold = Units::Distance::fromFT(5000.0)
staticconstexpr

Threshold for the pressure altitude plausibility check.

If pressure altitude and geometric altitude differ by more than this value, then the pair is considered physically implausible; see the documentation of the property pressureAltitudeImplausible.

Definition at line 319 of file PositionProvider.h.

Property Documentation

◆ approximateLastValidCoordinate

QGeoCoordinate Positioning::PositionProvider::approximateLastValidCoordinate
read

Approximate last valid coordinate.

This property equals lastValidCoordinate, except that it is updated only every ten kilometers.

Definition at line 86 of file PositionProvider.h.

◆ icon

QString Positioning::PositionProvider::icon
read

Ownship icon.

This property holds the URL of the icon that depicts the own position on the moving map and in the lateral view. The icon shape depends on the quality of the current position info (position and true track available or not), and its colors are adapted to night mode.

Definition at line 95 of file PositionProvider.h.

◆ lastValidCoordinate

QGeoCoordinate Positioning::PositionProvider::lastValidCoordinate
read

Last valid coordinate reading.

This property holds the last valid coordinate known. At the first start, this property is set to the location Freiburg Airport, EDTF. The value is stored in a QSetting at destruction, and restored in the construction.

Definition at line 104 of file PositionProvider.h.

◆ lastValidTT

Units::Angle Positioning::PositionProvider::lastValidTT
read

Last valid true track.

This property holds the last valid true track known. At the first start, this property is set to 0°. The value is stored in a QSetting at destruction, and restored in the construction.

Definition at line 121 of file PositionProvider.h.

◆ mapCenter

QGeoCoordinate Positioning::PositionProvider::mapCenter
readwrite

Map center coordinate.

This property holds the current center coordinate of the flight map. It should be set from QML whenever the map center changes. This allows C++ code to use the map center for distance calculations when GPS position is unavailable.

Definition at line 113 of file PositionProvider.h.

◆ positionInfo

Positioning::PositionInfo Positioning::PositionProvider::positionInfo
read

Position information.

This property holds information about the device position. To ensure that the data is up-to-date, the position information will be set to an invalid positionInfo when no data has arrived for more than the time specified in PositionInfo::lifetime.

Definition at line 130 of file PositionProvider.h.

◆ pressureAltitude

Units::Distance Positioning::PositionProvider::pressureAltitude
read

Pressure altitude.

This property holds information about the pressure altitude. If the traffic data provider provides pressure altitude, then this is reported here. If the traffic data provider does not report pressure altitude AND the current aircraft is configured to use cabin pressure for pressure altitude, then cabin pressure is reported here.

Definition at line 140 of file PositionProvider.h.

◆ pressureAltitudeImplausible

bool Positioning::PositionProvider::pressureAltitudeImplausible
read

Indicator that pressure altitude and geometric altitude are inconsistent.

This property is true if pressure altitude and geometric altitude have been differing by unrealistic amounts for a while. This typically happens when the pressure sensor does not measure static pressure, because the device rides in a pressurized cabin, or because the app receives position data from a flight simulator while the device sensor measures the air pressure at the user's desk. If this property is true, then barometric altitude data should not be trusted.

Realistic atmospheric conditions (extremely low QNH together with extreme temperature deviation from ISA) account for differences of no more than about 4,000 ft. To warn, this class requires a difference of more than 5,000 ft, persisting over 30 seconds. The warning clears as soon as the difference drops below 3,000 ft, or as soon as one of the two altitudes becomes unavailable.

Definition at line 159 of file PositionProvider.h.

◆ receivingPositionInfo

bool Positioning::PositionProvider::receivingPositionInfo
read

Indicator that position information is being received.

This is a shortcut for positionInfo().isValid. This property exists because it does not change so often, and can thus be more efficient to use.

Definition at line 167 of file PositionProvider.h.

◆ statusString

QString Positioning::PositionProvider::statusString
read

Source status.

This property holds a translated, human-readable string that describes the status of the positionInfo source. This could typically be a string of the form "OK" or "Insufficient permission to access position info"

Definition at line 175 of file PositionProvider.h.


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