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
7Q_DECLARE_LOGGING_CATEGORY(UdpForwarderLog)
8
9class QUdpSocket;
10
11class UdpForwarder : public QObject
12{
13 Q_OBJECT
14
15public:
16 explicit UdpForwarder(QObject* parent = nullptr);
17 ~UdpForwarder() override;
18
19 bool configure(const QString& address, quint16 port);
20 void forward(const QByteArray& data);
21 void stop();
22
23 bool isEnabled() const { return _enabled; }
24
25 QString address() const { return _address.toString(); }
26
27 quint16 port() const { return _port; }
28
29private:
30 QUdpSocket* _socket = nullptr;
31 QHostAddress _address;
32 quint16 _port = 0;
33 bool _enabled = false;
34};
~UdpForwarder() override
bool isEnabled() const
QString address() const
bool configure(const QString &address, quint16 port)
quint16 port() const
void forward(const QByteArray &data)