QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ADSBTCPLink.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QObject>
4#include <QtCore/QString>
5#include <QtCore/QStringList>
6
7#include "ADSB.h"
8
9class QTcpSocket;
10
17
18class ADSBTCPLink : public QObject
19{
20 Q_OBJECT
21
22public:
27 explicit ADSBTCPLink(const QString &hostAddress, quint16 port = 30003, QObject *parent = nullptr);
28
31
33 bool init();
34
35signals:
38 void adsbVehicleUpdate(const ADSB::VehicleInfo_t &vehicleInfo);
39
42 void errorOccurred(const QString &errorMsg, bool stopped = false);
43
44private slots:
46 void _readBytes();
47
48private:
51 void _parseLine(const QString &line);
52
56 void _parseAndEmitCallsign(ADSB::VehicleInfo_t &adsbInfo, const QStringList &values);
57
61 void _parseAndEmitLocation(ADSB::VehicleInfo_t &adsbInfo, const QStringList &values);
62
66 void _parseAndEmitHeading(ADSB::VehicleInfo_t &adsbInfo, const QStringList &values);
67
68 QString _hostAddress;
69 quint16 _port = 30003;
70
71 QTcpSocket *_socket = nullptr;
72};