Enroute Flight Navigation
A navigation app for VFR pilots
Traffic::TrafficDataProvider Class Reference

Traffic receiver. More...

#include <TrafficDataProvider.h>

Public Slots

void connectToTrafficReceiver ()
 Start attempt to connect to traffic receiver.
void disconnectFromTrafficReceiver ()
 Disconnect from traffic receiver.
void setPassword (const QString &SSID, const QString &password)
 Send password to the traffic data sources.

Signals

void connectionInfosChanged ()
 Notifier signal.
void dataSourcesChanged ()
 Notifier signal.
void passwordRequest (const QString &SSID)
 Password request.
void passwordStorageRequest (const QString &SSID, const QString &password)
 Password storage request.
void receivingHeartbeatChanged ()
 Notifier signal.
void trafficReceiverRuntimeErrorChanged ()
 Notifier signal.
void trafficReceiverSelfTestErrorChanged ()
 Notifier signal.
void warningChanged (const Traffic::Warning &)
 Notifier signal.

Public Member Functions

 TrafficDataProvider (QObject *parent=nullptr)
 Default constructor.
QList< Traffic::ConnectionInfoconnectionInfos () const
 Getter method for property with the same name.
QBindable< QList< Traffic::ConnectionInfo > > bindableConnectionInfos ()
 Getter method for property with the same name.
bool currentSourceIsInternetService () const
 Getter method for property with the same name.
QBindable< bool > bindableCurrentSourceIsInternetService ()
 Getter method for property with the same name.
QList< Traffic::TrafficDataSource_Abstract * > dataSources () const
 Getter method for property with the same name.
Positioning::PositionInfo positionInfo () const
 Getter method for property with the same name.
QBindable< Positioning::PositionInfobindablePositionInfo ()
 Getter method for property with the same name.
Units::Distance pressureAltitude () const
 Getter method for property with the same name.
QBindable< Units::DistancebindablePressureAltitude ()
 Getter method for property with the same name.
bool receivingHeartbeat () const
 Getter method for property with the same name.
QBindable< bool > bindableReceivingHeartbeat ()
 Getter method for property with the same name.
QString statusString () const
 Getter method for property with the same name.
QBindable< QString > bindableStatusString ()
 Getter method for property with the same name.
QList< Traffic::TrafficFactor_WithPosition * > trafficObjects () const
 Getter method for property with the same name.
Traffic::TrafficFactor_DistanceOnlytrafficObjectWithoutPosition () const
 Getter method for property with the same name.
QString trafficReceiverRuntimeError () const
 Getter function for the property with the same name.
QString trafficReceiverSelfTestError () const
 Getter function for the property with the same name.
Traffic::Warning warning () const
 Getter method for property with the same name.
void addDataSource (Traffic::TrafficDataSource_Abstract *source)
 Add an additional data source.
Q_INVOKABLE QString addDataSource (const Traffic::ConnectionInfo &connectionInfo)
 Add an additional data source.
Q_INVOKABLE QString addDataSource_UDP (quint16 port)
 Add an additional data source.
Q_INVOKABLE QString addDataSource_SerialPort (const QString &portNameOrDescription, ConnectionInfo::BaudRate baudRate, ConnectionInfo::StopBits stopBits, ConnectionInfo::FlowControl flowControl)
 Add an additional data source.
Q_INVOKABLE QString addDataSource_TCP (const QString &host, quint16 port)
 Add an additional data source.
Q_INVOKABLE QString addDataSource_OGN ()
 Add an additional data source.
Q_INVOKABLE bool hasDataSource_SerialPort (const QString &portNameOrDescription)
 Check if serial port connection already exists.
Q_INVOKABLE void removeDataSource (Traffic::TrafficDataSource_Abstract *source)
 Remove data sources.

Properties

QList< Traffic::ConnectionInfoconnectionInfos
 Connection Infos.
bool currentSourceIsInternetService
 Internet service flag.
QList< Traffic::TrafficDataSource_Abstract * > dataSources
 Traffic data sources.
Positioning::PositionInfo positionInfo
 Position information.
Units::Distance pressureAltitude
 Pressure altitude.
bool receivingHeartbeat
 Heartbeat indicator.
QString statusString
 Source status.
QList< Traffic::TrafficFactor_WithPosition * > trafficObjects
 Traffic objects whose position is known.
Traffic::TrafficFactor_DistanceOnlytrafficObjectWithoutPosition
 Most relevant traffic object whose position is not known.
QString trafficReceiverRuntimeError
 String describing the current traffic data receiver errors.
QString trafficReceiverSelfTestError
 String describing the traffic data receiver errors found in self-test.
Traffic::Warning warning
 Current traffic warning.

Detailed Description

Traffic receiver.

This class manages multiple TrafficDataSources. It combines the data streams, and passes data from the most relevant (if any) traffic data source on to the consumers of this class.

By default, it watches the following data channels:

  • TCP connection to 192.168.1.1, port 2000
  • TCP connection to 192.168.10.1, port 2000

This class also acts as a PositionInfoSource, and passes position data (that some traffic receivers provide) on to the the consumers of this class.

Following the standards established by the app ForeFlight, this classEnroute broadcasts a UDP message on port 63093 every 5 seconds while the app is running in the foreground. This message allows devices to discover Enroute’s IP address, which can be used as the target of UDP unicast messages.

Definition at line 52 of file TrafficDataProvider.h.

Constructor & Destructor Documentation

◆ TrafficDataProvider()

Traffic::TrafficDataProvider::TrafficDataProvider ( QObject * parent = nullptr)
explicit

Default constructor.

Parameters
parentThe standard QObject parent pointer

Member Function Documentation

◆ addDataSource() [1/2]

Q_INVOKABLE QString Traffic::TrafficDataProvider::addDataSource ( const Traffic::ConnectionInfo & connectionInfo)

Add an additional data source.

This method adds an additional data source to this TrafficDataProvider, typically a Bluetooth device.

Parameters
connectionInfoDescription of the new connection.
Returns
An empty string on success, and a human-readable, translated error message on failure.

◆ addDataSource() [2/2]

void Traffic::TrafficDataProvider::addDataSource ( Traffic::TrafficDataSource_Abstract * source)

Add an additional data source.

This method adds an additional data source to this TrafficDataProvider, typically a simulator source used for debugging purposes. The TrafficDataProvider takes ownership of the source.

Parameters
sourceNew TrafficDataSource that is to be added.

◆ addDataSource_OGN()

Q_INVOKABLE QString Traffic::TrafficDataProvider::addDataSource_OGN ( )

Add an additional data source.

This method adds an additional OGN data source to this TrafficDataProvider.

Returns
An empty string on success, and a human-readable, translated error message on failure.

◆ addDataSource_SerialPort()

Q_INVOKABLE QString Traffic::TrafficDataProvider::addDataSource_SerialPort ( const QString & portNameOrDescription,
ConnectionInfo::BaudRate baudRate,
ConnectionInfo::StopBits stopBits,
ConnectionInfo::FlowControl flowControl )

Add an additional data source.

This method adds an additional serial port data source to this TrafficDataProvider.

Parameters
portNameOrDescriptionName of the serial port or a description string by which the port can be identified.
baudRateBaud Rate
stopBitsStop Bits
flowControlFlow Control
Returns
An empty string on success, and a human-readable, translated error message on failure.

◆ addDataSource_TCP()

Q_INVOKABLE QString Traffic::TrafficDataProvider::addDataSource_TCP ( const QString & host,
quint16 port )

Add an additional data source.

This method adds an additional TCP data source to this TrafficDataProvider.

Parameters
hostInternet address
portTCP Port.
Returns
An empty string on success, and a human-readable, translated error message on failure.

◆ addDataSource_UDP()

Q_INVOKABLE QString Traffic::TrafficDataProvider::addDataSource_UDP ( quint16 port)

Add an additional data source.

This method adds an additional UDP data source to this TrafficDataProvider.

Parameters
portUDP Port.
Returns
An empty string on success, and a human-readable, translated error message on failure.

◆ bindableConnectionInfos()

QBindable< QList< Traffic::ConnectionInfo > > Traffic::TrafficDataProvider::bindableConnectionInfos ( )
inlinenodiscard

Getter method for property with the same name.

Returns
Property currentSourceIsInternetService

Definition at line 192 of file TrafficDataProvider.h.

◆ bindableCurrentSourceIsInternetService()

QBindable< bool > Traffic::TrafficDataProvider::bindableCurrentSourceIsInternetService ( )
inlinenodiscard

Getter method for property with the same name.

Returns
Property currentSourceIsInternetService

Definition at line 204 of file TrafficDataProvider.h.

◆ bindablePositionInfo()

QBindable< Positioning::PositionInfo > Traffic::TrafficDataProvider::bindablePositionInfo ( )
inlinenodiscard

Getter method for property with the same name.

Returns
Property positionInfo

Definition at line 225 of file TrafficDataProvider.h.

◆ bindablePressureAltitude()

QBindable< Units::Distance > Traffic::TrafficDataProvider::bindablePressureAltitude ( )
inlinenodiscard

Getter method for property with the same name.

Returns
Property pressureAltitude

Definition at line 237 of file TrafficDataProvider.h.

◆ bindableReceivingHeartbeat()

QBindable< bool > Traffic::TrafficDataProvider::bindableReceivingHeartbeat ( )
inlinenodiscard

Getter method for property with the same name.

Returns
Property receiving

Definition at line 252 of file TrafficDataProvider.h.

◆ bindableStatusString()

QBindable< QString > Traffic::TrafficDataProvider::bindableStatusString ( )
inlinenodiscard

Getter method for property with the same name.

Returns
Property statusString

Definition at line 267 of file TrafficDataProvider.h.

◆ connectionInfos()

QList< Traffic::ConnectionInfo > Traffic::TrafficDataProvider::connectionInfos ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property connectionInfos

Definition at line 186 of file TrafficDataProvider.h.

◆ connectToTrafficReceiver

void Traffic::TrafficDataProvider::connectToTrafficReceiver ( )
slot

Start attempt to connect to traffic receiver.

If this class is connected to a traffic receiver, this method does nothing. Otherwise, it stops any ongoing connection attempt and starts a new attempt to connect to a potential receiver, via all available channels simultaneously.

◆ currentSourceIsInternetService()

bool Traffic::TrafficDataProvider::currentSourceIsInternetService ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property currentSourceIsInternetService

Definition at line 198 of file TrafficDataProvider.h.

◆ dataSources()

QList< Traffic::TrafficDataSource_Abstract * > Traffic::TrafficDataProvider::dataSources ( ) const
nodiscard

Getter method for property with the same name.

Returns
Property dataSources

◆ disconnectFromTrafficReceiver

void Traffic::TrafficDataProvider::disconnectFromTrafficReceiver ( )
slot

Disconnect from traffic receiver.

This method stops any ongoing connection or connection attempt.

◆ hasDataSource_SerialPort()

Q_INVOKABLE bool Traffic::TrafficDataProvider::hasDataSource_SerialPort ( const QString & portNameOrDescription)

Check if serial port connection already exists.

Parameters
portNameOrDescriptionPort name or description string by which the port can be identified.
Returns
True if a connection to that port already exists.

◆ passwordRequest

void Traffic::TrafficDataProvider::passwordRequest ( const QString & SSID)
signal

Password request.

This signal is emitted whenever one of the traffic data sources requires asks for a password. Note that this is not the WiFi-Password.

Parameters
SSIDName of the WiFi network that is currently in use.

◆ passwordStorageRequest

void Traffic::TrafficDataProvider::passwordStorageRequest ( const QString & SSID,
const QString & password )
signal

Password storage request.

This signal is emitted whenever one of the traffic data sources has verified a password that was not yet in the database. The GUI should connect to this signal and open a "Store Password …?" dialogn.

◆ positionInfo()

Positioning::PositionInfo Traffic::TrafficDataProvider::positionInfo ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property positionInfo

Definition at line 216 of file TrafficDataProvider.h.

◆ pressureAltitude()

Units::Distance Traffic::TrafficDataProvider::pressureAltitude ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property pressureAltitude

Definition at line 231 of file TrafficDataProvider.h.

◆ receivingHeartbeat()

bool Traffic::TrafficDataProvider::receivingHeartbeat ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property receiving

Definition at line 243 of file TrafficDataProvider.h.

◆ removeDataSource()

Q_INVOKABLE void Traffic::TrafficDataProvider::removeDataSource ( Traffic::TrafficDataSource_Abstract * source)

Remove data sources.

This method removes a data source from this TrafficDataProvider. Canonical data sources cannot be removed

Parameters
sourceNew TrafficDataSource that is to be removed.

◆ setPassword

void Traffic::TrafficDataProvider::setPassword ( const QString & SSID,
const QString & password )
slot

Send password to the traffic data sources.

This method will send a password/ssid combination to all traffic data source. If a source is waiting for a password with the given SSID, then it will send the password to the traffic data receiver.

Parameters
SSIDNetwork where the receiver should be connected
passwordPassword that is sent to the receiver

◆ statusString()

QString Traffic::TrafficDataProvider::statusString ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property statusString

Definition at line 258 of file TrafficDataProvider.h.

◆ trafficObjects()

QList< Traffic::TrafficFactor_WithPosition * > Traffic::TrafficDataProvider::trafficObjects ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property trafficObjects

Definition at line 273 of file TrafficDataProvider.h.

◆ trafficObjectWithoutPosition()

Traffic::TrafficFactor_DistanceOnly * Traffic::TrafficDataProvider::trafficObjectWithoutPosition ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property trafficObjectWithoutPosition

Definition at line 282 of file TrafficDataProvider.h.

◆ trafficReceiverRuntimeError()

QString Traffic::TrafficDataProvider::trafficReceiverRuntimeError ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property trafficReceiverRuntimeError

Definition at line 291 of file TrafficDataProvider.h.

◆ trafficReceiverSelfTestError()

QString Traffic::TrafficDataProvider::trafficReceiverSelfTestError ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property trafficReceiverSelfTestError

Definition at line 300 of file TrafficDataProvider.h.

◆ warning()

Traffic::Warning Traffic::TrafficDataProvider::warning ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property Warning

Definition at line 309 of file TrafficDataProvider.h.

Property Documentation

◆ connectionInfos

QList<Traffic::ConnectionInfo> Traffic::TrafficDataProvider::connectionInfos
read

Connection Infos.

This property holds connection infos for all non-canonical connections currently in use.

Definition at line 84 of file TrafficDataProvider.h.

◆ currentSourceIsInternetService

bool Traffic::TrafficDataProvider::currentSourceIsInternetService
read

Internet service flag.

This property is true if the data source currently in use is an internet service rather than a proper traffic receiver. This can be used by the GUI to warn the user that data might not be reliable.

Definition at line 91 of file TrafficDataProvider.h.

◆ dataSources

QList<Traffic::TrafficDataSource_Abstract*> Traffic::TrafficDataProvider::dataSources
read

Traffic data sources.

This property holds a list of all traffic data sources currently in use. The items are owned by this class.

Definition at line 98 of file TrafficDataProvider.h.

◆ positionInfo

Positioning::PositionInfo Traffic::TrafficDataProvider::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 107 of file TrafficDataProvider.h.

◆ pressureAltitude

Units::Distance Traffic::TrafficDataProvider::pressureAltitude
read

Pressure altitude.

This property holds information about the pressure altitude reported by the traffic data receiver.

Definition at line 114 of file TrafficDataProvider.h.

◆ receivingHeartbeat

bool Traffic::TrafficDataProvider::receivingHeartbeat
read

Heartbeat indicator.

When active, traffic receivers send regular heartbeat messages. These can be used to verify that the connection to the receiver works, even in times when no traffic is reported. This property indicates if the class receives heartbeat messages from at least one of the known receivers.

Definition at line 123 of file TrafficDataProvider.h.

◆ statusString

QString Traffic::TrafficDataProvider::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 131 of file TrafficDataProvider.h.

◆ trafficObjects

QList<Traffic::TrafficFactor_WithPosition*> Traffic::TrafficDataProvider::trafficObjects
read

Traffic objects whose position is known.

This property holds a list of the most relevant traffic objects, as a QQmlListProperty for better cooperation with QML. Note that only the valid items in this list pertain to actual traffic. Invalid items should be ignored. The list is not sorted in any way. The items themselves are owned by this class.

Definition at line 141 of file TrafficDataProvider.h.

◆ trafficObjectWithoutPosition

Traffic::TrafficFactor_DistanceOnly* Traffic::TrafficDataProvider::trafficObjectWithoutPosition
read

Most relevant traffic object whose position is not known.

This property holds a pointer to the most relevant traffic object whose position is not known. This item should be ignored if invalid. The item is owned by this class.

Definition at line 149 of file TrafficDataProvider.h.

◆ trafficReceiverRuntimeError

QString Traffic::TrafficDataProvider::trafficReceiverRuntimeError
read

String describing the current traffic data receiver errors.

This property holds a translated, human-readable string that describes the current errors reported by the traffic receiver, or an empty string when there is no error. The string is cleared when a new connection attempt is started.

Definition at line 158 of file TrafficDataProvider.h.

◆ trafficReceiverSelfTestError

QString Traffic::TrafficDataProvider::trafficReceiverSelfTestError
read

String describing the traffic data receiver errors found in self-test.

This property holds a translated, human-readable string that describes the errors reported by the traffic receiver during self-test, or an empty string when there is no error. The string is cleared when a new connection attempt is started.

Definition at line 167 of file TrafficDataProvider.h.

◆ warning

Traffic::Warning Traffic::TrafficDataProvider::warning
read

Current traffic warning.

This property holds the current traffic warning. The traffic warning is updated regularly and set to an invalid warning (i.e. one with alarmLevel == -1) after a certain period.

Definition at line 175 of file TrafficDataProvider.h.


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