Udplistener start/stop during runtime (#56)

* start implementening runtime start/stop for udplistener

* add signal slots for start/stop/statusChanged for better connectivity with other qt stuff

* fix typo
This commit is contained in:
redPanther
2016-06-27 09:27:11 +02:00
committed by brindosch
parent de39ff8997
commit b9634e57d6
3 changed files with 88 additions and 41 deletions

View File

@@ -6,6 +6,7 @@
// Qt includes
#include <QUdpSocket>
#include <QSet>
#include <QHostAddress>
// Hyperion includes
#include <hyperion/Hyperion.h>
@@ -33,6 +34,25 @@ public:
/// @return the port number on which this UDP listens for incoming connections
///
uint16_t getPort() const;
///
/// @return true if server is active (bind to a port)
///
bool active() { return _isActive; };
public slots:
///
/// bind server to network
///
void start();
///
/// close server
///
void stop();
signals:
void statusChanged(bool isActive);
private slots:
///
@@ -41,7 +61,6 @@ private slots:
void readPendingDatagrams();
void processTheDatagram(const QByteArray * _datagram);
private:
/// Hyperion instance
Hyperion * _hyperion;
@@ -58,9 +77,17 @@ private:
/// hyperion priority
int _timeout;
/// The latest led color data
std::vector<ColorRgb> _ledColors;
/// The latest led color data
std::vector<ColorRgb> _ledColors;
/// Logger instance
Logger * _log;
/// state of connection
bool _isActive;
/// address to bind
QHostAddress _listenAddress;
quint16 _listenPort;
QAbstractSocket::BindFlag _bondage;
};