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 (const QString &serialPortNameOrDescription, ConnectionInfo::BaudRate baudRate=ConnectionInfo::BaudRate::Baud9600, ConnectionInfo::StopBits stopBits=ConnectionInfo::StopBits::OneStop, ConnectionInfo::FlowControl flowControl=ConnectionInfo::FlowControl::NoFlowControl, 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.
BaudRate baudRate () const
 Baud Rate.
QBluetoothDeviceInfo bluetoothDeviceInfo () const
 Bluetooth Device Info.
FlowControl flowControl () const
 Flow Control.
quint16 port () const
 Port.
bool sameConnectionAs (const Traffic::ConnectionInfo &other) const
 Equality of connection.
StopBits stopBits () const
 Stop Bits.
bool operator== (const Traffic::ConnectionInfo &other) const =default
 Equality of ConnectionInfos.
bool operator< (const Traffic::ConnectionInfo &other) const
 Comparison.

Properties

bool canConnect
 Connectability.
bool canonical
 Canonicity.
QString description
 Description.
QString host
 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 42 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 51 of file ConnectionInfo.h.

Constructor & Destructor Documentation

◆ ConnectionInfo() [1/6]

Traffic::ConnectionInfo::ConnectionInfo ( )
default

Default constructor.

This method constructs an invalid ConnectionInfo

◆ ConnectionInfo() [2/6]

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/6]

Traffic::ConnectionInfo::ConnectionInfo ( const QString & serialPortNameOrDescription,
ConnectionInfo::BaudRate baudRate = ConnectionInfo::BaudRate::Baud9600,
ConnectionInfo::StopBits stopBits = ConnectionInfo::StopBits::OneStop,
ConnectionInfo::FlowControl flowControl = ConnectionInfo::FlowControl::NoFlowControl,
bool canonical = false )
explicit

Constructor for Bluetooth Device Connections.

This method constructs a ConnectionInfo for a connection to a serial port.

Parameters
serialPortNameOrDescriptionSerial port name or description by which the port can be identified
baudRateBaud Rate
stopBitsNumber of Stop Bits
flowControlFlow Control
canonicalProperty 'canonical', as described below.

◆ ConnectionInfo() [4/6]

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() [5/6]

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() [6/6]

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

◆ baudRate()

BaudRate Traffic::ConnectionInfo::baudRate ( ) const
inlinenodiscard

Baud Rate.

Returns
In the connection is of type SerialPort, this method returns the baud rate.

Definition at line 247 of file ConnectionInfo.h.

◆ 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 257 of file ConnectionInfo.h.

◆ flowControl()

FlowControl Traffic::ConnectionInfo::flowControl ( ) const
inlinenodiscard

Flow Control.

Returns
In the connection is of type SerialPort, this method returns the flow control.

Definition at line 264 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 272 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.

◆ stopBits()

StopBits Traffic::ConnectionInfo::stopBits ( ) const
inlinenodiscard

Stop Bits.

Returns
In the connection is of type SerialPort, this method returns the stop bits.

Definition at line 294 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 182 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 192 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 201 of file ConnectionInfo.h.

◆ host

QString Traffic::ConnectionInfo::host
read

Host.

For TCP connections, this property holds the host name.

Definition at line 209 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 218 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 226 of file ConnectionInfo.h.

◆ type

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

Type.

This property holds the type of the connection.

Definition at line 234 of file ConnectionInfo.h.


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