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

Connection to a traffic data receiver. More...

#include <ConnectionInfo.h>

Classes

struct  OgnInfo
 Constructor parameter for OGN connections. More...

Public Types

enum  Type : quint8 {
  Invalid , BluetoothClassic , BluetoothLowEnergy , TCP ,
  UDP , Serial , FLARMFile , OGN
}
 Connection Type. More...

Public Member Functions

 ConnectionInfo ()=default
 Default constructor.
 ConnectionInfo (const QBluetoothDeviceInfo &info, bool canonical=false)
 Constructor for Bluetooth Device Connections.
 ConnectionInfo (quint16 port, bool canonical=false)
 Constructor for UDP Connections.
 ConnectionInfo (const QString &host, quint16 port, bool canonical=false)
 Constructor for TCP Connections.
 ConnectionInfo (const OgnInfo &info)
 Constructor for OGN Connections.
bool canConnect () const
 Getter function for the property with the same name.
bool canonical () const
 Getter function for the property with the same name.
QString description () const
 Getter function for the property with the same name.
QString host () const
 Getter function for the property with the same name.
QString icon () const
 Getter function for the property with the same name.
QString name () const
 Getter function for the property with the same name.
Traffic::ConnectionInfo::Type type () const
 Getter function for the property with the same name.
QBluetoothDeviceInfo bluetoothDeviceInfo () const
 Bluetooth Device Info.
bool operator== (const Traffic::ConnectionInfo &other) const =default
 Equality of ConnectionInfos.
quint16 port () const
 Port.
bool sameConnectionAs (const Traffic::ConnectionInfo &other) const
 Equality of connection.
bool operator< (const Traffic::ConnectionInfo &other) const
 Comparison.

Properties

bool canConnect
 Connectability.
bool canonical
 Canonicity.
QString description
 Description.
QString hostn
 Host.
QString icon
 Icon.
QString name
 Name.
Traffic::ConnectionInfo::Type type
 Type.

Friends

QDataStream & operator<< (QDataStream &stream, const Traffic::ConnectionInfo &connectionInfo)
 Serialization.
QDataStream & operator>> (QDataStream &stream, Traffic::ConnectionInfo &connectionInfo)
 Deserialization.

Detailed Description

Connection to a traffic data receiver.

This class describes a connection to a traffic data receiver. It exposes connection properties in a format that is suitable for QML.

Definition at line 41 of file ConnectionInfo.h.

Member Enumeration Documentation

◆ Type

Connection Type.

Enumerator
Invalid 

Invalid connection

BluetoothClassic 

Bluetooth Classic

BluetoothLowEnergy 

Bluetooth LE

TCP 

TCP Connection

UDP 

UDP Connection

Serial 

Serial Port Connection

FLARMFile 

FLARM Simulator File

OGN 

OGN glidernet.org internet connection

Definition at line 50 of file ConnectionInfo.h.

Constructor & Destructor Documentation

◆ ConnectionInfo() [1/5]

Traffic::ConnectionInfo::ConnectionInfo ( )
default

Default constructor.

This method constructs an invalid ConnectionInfo

◆ ConnectionInfo() [2/5]

Traffic::ConnectionInfo::ConnectionInfo ( const QBluetoothDeviceInfo & info,
bool canonical = false )
explicit

Constructor for Bluetooth Device Connections.

This method constructs a ConnectionInfo for a connection to a Bluetooth device. The type will either be BluetoothClassic or BluetoothLowEnergy.

Parameters
infoQBluetoothDeviceInfo that describes the Bluetooth device
canonicalProperty 'canonical', as described below.

◆ ConnectionInfo() [3/5]

Traffic::ConnectionInfo::ConnectionInfo ( quint16 port,
bool canonical = false )
explicit

Constructor for UDP Connections.

This method constructs a ConnectionInfo for a UDP connection.

Parameters
portPort number
canonicalProperty 'canonical', as described below.

◆ ConnectionInfo() [4/5]

Traffic::ConnectionInfo::ConnectionInfo ( const QString & host,
quint16 port,
bool canonical = false )
explicit

Constructor for TCP Connections.

This method constructs a ConnectionInfo for a TCP connection.

Parameters
hostHost name or IP Address
portPort number
canonicalProperty 'canonical', as described below.

◆ ConnectionInfo() [5/5]

Traffic::ConnectionInfo::ConnectionInfo ( const OgnInfo & info)
explicit

Constructor for OGN Connections.

This method constructs a ConnectionInfo for a OGN connection.

Parameters
infoInfo about the connection

Member Function Documentation

◆ bluetoothDeviceInfo()

QBluetoothDeviceInfo Traffic::ConnectionInfo::bluetoothDeviceInfo ( ) const
inlinenodiscard

Bluetooth Device Info.

Returns
If the connection is of type BluetoothClassic or BluetoothLowEnergy, this method returns a QBluetoothDeviceInfo describing the Bluetooth device. For all other connections, an invalid QBluetoothDeviceInfo is returned.

Definition at line 261 of file ConnectionInfo.h.

◆ canConnect()

bool Traffic::ConnectionInfo::canConnect ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property canConnect

Definition at line 203 of file ConnectionInfo.h.

◆ canonical()

bool Traffic::ConnectionInfo::canonical ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property canonical

Definition at line 210 of file ConnectionInfo.h.

◆ description()

QString Traffic::ConnectionInfo::description ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property description

Definition at line 217 of file ConnectionInfo.h.

◆ host()

QString Traffic::ConnectionInfo::host ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property host

Definition at line 224 of file ConnectionInfo.h.

◆ icon()

QString Traffic::ConnectionInfo::icon ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property icon

Definition at line 231 of file ConnectionInfo.h.

◆ name()

QString Traffic::ConnectionInfo::name ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property name

Definition at line 238 of file ConnectionInfo.h.

◆ operator<()

bool Traffic::ConnectionInfo::operator< ( const Traffic::ConnectionInfo & other) const

Comparison.

This operator can be used to sort ConnectionInfos in the GUI. Sorting is by connectability, type and name.

Parameters
otherOther ConnectionInfo to compare with.
Returns
True if the ConnectionInfo describe the same connection.

◆ operator==()

bool Traffic::ConnectionInfo::operator== ( const Traffic::ConnectionInfo & other) const
nodiscarddefault

Equality of ConnectionInfos.

Parameters
otherOther ConnectionInfo to compare with.
Returns
True if the ConnectionInfo describe the same connection.

◆ port()

quint16 Traffic::ConnectionInfo::port ( ) const
inlinenodiscard

Port.

Returns
If the connection is of type UDP, this method returns the port used in the UDP connection.

Definition at line 278 of file ConnectionInfo.h.

◆ sameConnectionAs()

bool Traffic::ConnectionInfo::sameConnectionAs ( const Traffic::ConnectionInfo & other) const
nodiscard

Equality of connection.

This test for equality is not strict. It returns 'true' if the two connection infos describe the same connection. Still, they can differ in aspects such as the connection name or description. This is possible, e.g., for Bluetooth devices whose name was not know when one of the ConnectionInfos was constructed.

Parameters
otherOther ConnectionInfo to compare with.
Returns
True if the ConnectionInfo describe the same connection.

◆ type()

Traffic::ConnectionInfo::Type Traffic::ConnectionInfo::type ( ) const
inlinenodiscard

Getter function for the property with the same name.

Returns
Property type

Definition at line 245 of file ConnectionInfo.h.

◆ operator<<

QDataStream & operator<< ( QDataStream & stream,
const Traffic::ConnectionInfo & connectionInfo )
friend

Serialization.

There are no checks for errors of any kind.

◆ operator>>

QDataStream & operator>> ( QDataStream & stream,
Traffic::ConnectionInfo & connectionInfo )
friend

Deserialization.

There are no checks for errors of any kind.

Property Documentation

◆ canConnect

bool Traffic::ConnectionInfo::canConnect
read

Connectability.

This property holds true if a connection is possible in principle. It does not guarantee that a connection attempt will be successful. Example: This property is 'false' for connections to Bluetooth Low Energy devices, which are currently unsupported.

Definition at line 144 of file ConnectionInfo.h.

◆ canonical

bool Traffic::ConnectionInfo::canonical
read

Canonicity.

This property holds true if the connection is canonical. Canonical connections are those that will always be in the connection library and cannot be edited or deleted in the GUI.

Definition at line 153 of file ConnectionInfo.h.

◆ description

QString Traffic::ConnectionInfo::description
read

Description.

This property holds a human-readable, translated, two-line description of the connection, in HTML format.

Definition at line 161 of file ConnectionInfo.h.

◆ hostn

QString Traffic::ConnectionInfo::hostn
read

Host.

For TCP connections, this property holds the host name.

Definition at line 168 of file ConnectionInfo.h.

◆ icon

QString Traffic::ConnectionInfo::icon
read

Icon.

This property holds the name of an icon file that can be used to represent the connection in the GUI.

Definition at line 176 of file ConnectionInfo.h.

◆ name

QString Traffic::ConnectionInfo::name
read

Name.

This property holds a human-readable, translated name of the connection.

Definition at line 183 of file ConnectionInfo.h.

◆ type

Traffic::ConnectionInfo::Type Traffic::ConnectionInfo::type
read

Type.

This property holds the type of the connection.

Definition at line 190 of file ConnectionInfo.h.


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