QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
UdpForwarder.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QLoggingCategory>
4#include <QtCore/QObject>
5#include <QtNetwork/QHostAddress>
6#include <QtNetwork/QUdpSocket>
7
8Q_DECLARE_LOGGING_CATEGORY(UdpForwarderLog)
9
10class UdpForwarder : public QObject
11{
12 Q_OBJECT
13
14public:
15 explicit UdpForwarder(QObject* parent = nullptr);
16
17 bool configure(const QString& address, quint16 port);
18 qint64 forward(const QByteArray& data);
19 void stop();
20
21 bool isEnabled() const { return _port != 0; }
22
23 QString address() const { return _address.toString(); }
24
25 quint16 port() const { return _port; }
26
27private:
28 QUdpSocket _socket{this};
29 QHostAddress _address;
30 quint16 _port = 0;
31};
bool isEnabled() const
QString address() const
quint16 port() const