23#include <QElapsedTimer>
29#include "traffic/TrafficDataSource_AbstractSocket.h"
33using namespace Qt::Literals::StringLiterals;
89 [[nodiscard]] QString
dataFormat()
const override {
return u
"APRS-IS"_s; }
95 [[nodiscard]] QString
host()
const
107 [[nodiscard]] QString
icon()
const override {
return u
"/icons/material/ic_wifi.svg"_s; }
118 return tr(
"Open Glider Network-Connection");
125 [[nodiscard]] quint16
port()
const
155 QTextStream m_textStream;
163 bool m_connectionDesired =
false;
170 QElapsedTimer m_lastConnectionAttempt;
171 static constexpr qint64 reconnectBackoffMs = 10'000;
173 QString m_lineBuffer;
174 Ogn::OgnMessage m_ognMessage;
175 Ogn::OgnFilter m_ognFilter;
184 QGeoCoordinate m_currentPosition;
185 bool m_usingGps =
true;
188 std::u16string m_ownAircraftName;
189 std::vector<std::string> m_ownTransponderCodes;
192 QGeoCoordinate m_lastFilterPosition;
193 qint64 m_lastFilterUpdateTime = 0;
194 static constexpr qint64 MIN_FILTER_UPDATE_INTERVAL_MS = 1000;
195 static constexpr double MIN_FILTER_UPDATE_DISTANCE_KM = 5.0;
198 void setFilter(
const QGeoCoordinate& coordinate);
201 void updateCurrentCoordinate();
204 void updateOwnshipFilterData();
207 void periodicUpdate();
210 void processOgnMessage(
const QString& data);
213 void sendKeepAlive();
216 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 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.