28#include "traffic/TrafficDataSource_AbstractSocket.h"
32using namespace Qt::Literals::StringLiterals;
88 [[nodiscard]] QString
dataFormat()
const override {
return u
"APRS-IS"_s; }
94 [[nodiscard]] QString
host()
const
106 [[nodiscard]] QString
icon()
const override {
return u
"/icons/material/ic_wifi.svg"_s; }
117 return tr(
"Open Glider Network-Connection");
124 [[nodiscard]] quint16
port()
const
153 void sendPosition(
const QGeoCoordinate& coordinate,
double course,
double speed,
double altitude);
165 QTextStream m_textStream;
173 bool m_connectionDesired =
false;
175 QString m_lineBuffer;
176 Ogn::OgnMessage m_ognMessage;
177 Ogn::OgnFilter m_ognFilter;
189 QGeoCoordinate m_currentPosition;
190 bool m_usingGps =
true;
193 std::u16string m_ownAircraftName;
194 std::vector<std::string> m_ownTransponderCodes;
197 QGeoCoordinate m_lastFilterPosition;
198 qint64 m_lastFilterUpdateTime = 0;
199 static constexpr qint64 MIN_FILTER_UPDATE_INTERVAL_MS = 1000;
200 static constexpr double MIN_FILTER_UPDATE_DISTANCE_KM = 5.0;
203 void setFilter(
const QGeoCoordinate& coordinate);
206 void updateCurrentCoordinate();
209 void updateOwnshipFilterData();
212 void periodicUpdate();
215 void processOgnMessage(
const QString& data);
218 void sendKeepAlive();
221 void verifyConnection();
TrafficDataSource_AbstractSocket(bool isCanonical, QObject *parent)
Default constructor.
void connectToTrafficReceiver() override
Start attempt to connect to traffic receiver.
QString dataFormat() const override
Getter function for the property with the same name.
void sendPosition(const QGeoCoordinate &coordinate, double course, double speed, double altitude)
Send position report to APRS-IS server.
void disconnectFromTrafficReceiver() override
Disconnect from traffic receiver.
quint16 port() const
Getter function for the property with the same name.
quint16 port
TCP port of the OGN/APRS-IS server (e.g. 14580).
QString host
Hostname of the OGN/APRS-IS server (e.g. aprs.glidernet.org).
TrafficDataSource_Ogn(bool isCanonical, QString hostName, quint16 port, QObject *parent=nullptr)
Default constructor.
QString host() const
Getter function for the property with the same name.
QString icon() const override
Getter function for the property with the same name.
auto sourceName() const -> QString override
Getter function for the property with the same name.
Convenience class for distance computations.
static Q_INVOKABLE constexpr Units::Distance fromNM(double distanceInNM)
Constructs a distance.