mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
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:
@@ -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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user