mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
a23735d1ef
* Fixed compile error when no grabbers are defined * Remove stupid avahi warning... * Started on the new integrated UDP listener to replace the python effect. Cloned boblight server and rename it to be UDP listener It compiles!, It starts! it seems to work as a second boblight protocol server... * moving from the exsting TCP to UDP. i can catch packets now.. need to consider ditching the connection handling * It kinda works right now. UDP packets are received, led data is sent and hyperion displays them. .... for a moment before going back to what it was doing * It works! looks like the default priority of 900 was fighting with something else that was also 900 commented out some udp packet debugging * oops, forgot to add the changes the the previous commit * resolving merge conflicts
63 lines
1.2 KiB
C++
63 lines
1.2 KiB
C++
#pragma once
|
|
|
|
// system includes
|
|
#include <cstdint>
|
|
|
|
// Qt includes
|
|
#include <QUdpSocket>
|
|
#include <QSet>
|
|
|
|
// Hyperion includes
|
|
#include <hyperion/Hyperion.h>
|
|
|
|
class UDPClientConnection;
|
|
|
|
///
|
|
/// This class creates a UDP server which accepts connections from boblight clients.
|
|
///
|
|
class UDPListener : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
///
|
|
/// UDPListener constructor
|
|
/// @param hyperion Hyperion instance
|
|
/// @param port port number on which to start listening for connections
|
|
///
|
|
UDPListener(Hyperion * hyperion, const int priority, const int timeout, uint16_t port = 2801);
|
|
~UDPListener();
|
|
|
|
///
|
|
/// @return the port number on which this UDP listens for incoming connections
|
|
///
|
|
uint16_t getPort() const;
|
|
|
|
private slots:
|
|
///
|
|
/// Slot which is called when a client tries to create a new connection
|
|
///
|
|
void readPendingDatagrams();
|
|
void processTheDatagram(const QByteArray * _datagram);
|
|
|
|
|
|
private:
|
|
/// Hyperion instance
|
|
Hyperion * _hyperion;
|
|
|
|
/// The UDP server object
|
|
QUdpSocket * _server;
|
|
|
|
/// List with open connections
|
|
QSet<UDPClientConnection *> _openConnections;
|
|
|
|
/// hyperion priority
|
|
int _priority;
|
|
|
|
/// hyperion priority
|
|
int _timeout;
|
|
|
|
/// The latest led color data
|
|
std::vector<ColorRgb> _ledColors;
|
|
};
|