|
RSeries astromech firmware
|
|
Go to the documentation of this file. 1 #ifndef WifiMarcduinoReceiver_h
2 #define WifiMarcduinoReceiver_h
6 #include <WiFiClient.h>
8 #ifndef JAWALITE_IDLE_TIMEOUT
9 #define JAWALITE_IDLE_TIMEOUT 5000
37 template<
unsigned maxClients = 1, u
int16_t BUFFER_SIZE = 64>
58 fCommandHandler = commandHandler;
84 for (
unsigned i = 0; i < maxClients; i++)
105 ::printf(
"HAS CLIENT\n");
106 for (i = 0; i < maxClients; i++)
132 for (i = 0; i < maxClients; i++)
144 fBuffer[i][fPos[i]] =
'\0';
146 if (fCommandHandler !=
nullptr && fBuffer[i][0] !=
'\0')
148 fCommandHandler(fBuffer[i]);
152 else if (fPos[i] < BUFFER_SIZE-1)
154 fBuffer[i][fPos[i]++] = ch;
179 bool fStarted =
false;
180 bool fEnabled =
true;
181 void (*fCommandHandler)(
const char* cmd) =
nullptr;
182 unsigned fPos[maxClients] = {};
183 char fBuffer[maxClients][BUFFER_SIZE];
WifiMarcduinoReceiverBase(WifiAccess &wifiAccess, uint16_t port=2000)
Constructor.
Definition: WifiMarcduinoReceiver.h:50
void setCommandHandler(void(*commandHandler)(const char *cmd))
Definition: WifiMarcduinoReceiver.h:56
Definition: WifiAccess.h:25
#define DEBUG_PRINT(s)
Definition: ReelTwo.h:189
Base class for all animated devices. AnimatedEvent::animate() is called for each device once through ...
Definition: AnimatedEvent.h:18
WiFiClient fClients[maxClients]
Definition: WifiMarcduinoReceiver.h:41
virtual void animate() override
Dispatch any received i2c event to CommandEvent.
Definition: WifiMarcduinoReceiver.h:97
Definition: WifiAccess.h:166
#define DEBUG_PRINTLN(s)
Definition: ReelTwo.h:188
virtual void wifiDisconnected(WifiAccess &access) override
Definition: WifiMarcduinoReceiver.h:81
Base template of Marcduino receiver over WiFi.
Definition: WifiMarcduinoReceiver.h:38
void addNotify(WifiAccess::Notify *client)
Definition: WifiAccess.h:173
WifiMarcduinoReceiverBase WifiMarcduinoReceiver
Definition: WifiMarcduinoReceiver.h:202
#define JAWALITE_IDLE_TIMEOUT
Definition: WifiMarcduinoReceiver.h:9
virtual void wifiConnected(WifiAccess &access) override
Definition: WifiMarcduinoReceiver.h:71
void setEnabled(bool enabled)
Definition: WifiMarcduinoReceiver.h:61
bool enabled()
Definition: WifiMarcduinoReceiver.h:66
uint32_t fClientLastMsg[maxClients]
Definition: WifiMarcduinoReceiver.h:42