2019-11-17 17:57:21 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <WiFiUdp.h>
|
|
|
|
|
|
|
|
class Fader;
|
|
|
|
|
|
|
|
class UDPProto
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
SET_COLOUR = 0,
|
|
|
|
FADE_COLOUR = 1,
|
|
|
|
ADD_COLOUR = 2,
|
2019-12-30 12:19:00 +01:00
|
|
|
SET_FADESTEP = 3,
|
2020-04-14 21:03:39 +02:00
|
|
|
END_OF_UPDATE = 254,
|
2019-12-30 12:19:00 +01:00
|
|
|
ACK_REQUEST = 255
|
2019-11-17 17:57:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
UDPProto(Fader *fader);
|
|
|
|
|
2019-12-09 23:25:04 +01:00
|
|
|
|
2019-11-17 17:57:21 +01:00
|
|
|
bool start(uint16_t port);
|
2019-12-09 23:25:04 +01:00
|
|
|
|
|
|
|
bool check(void);
|
2019-11-17 17:57:21 +01:00
|
|
|
bool loop(void);
|
|
|
|
|
|
|
|
private:
|
2020-04-14 21:03:39 +02:00
|
|
|
const static uint32_t MAX_PACKETS_PER_UPDATE = 3;
|
|
|
|
|
2019-11-17 17:57:21 +01:00
|
|
|
WiFiUDP m_udpServer;
|
|
|
|
Fader *m_fader;
|
2019-12-09 23:25:04 +01:00
|
|
|
};
|