aboutsummaryrefslogtreecommitdiff
path: root/libraries/WiFi/utility/server_drv.h
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-04-03 13:51:04 +0200
committerCristian Maglie <c.maglie@bug.st>2013-04-03 13:51:04 +0200
commitee90e68e86dd61d86f5d17b69080338328765b22 (patch)
treee620c0edc2690ab789b665e567910640597aa6fe /libraries/WiFi/utility/server_drv.h
parent0ecdc5ebc96ad4c7c548c438a03d9ce00679db8b (diff)
parentf50c307be280dc6ece9e70c43b301c1db36291a0 (diff)
Merged 1.0.5
Merge remote-tracking branch 'arduino/master' into ide-1.5.x Conflicts: app/src/processing/app/Base.java build/shared/revisions.txt hardware/arduino/avr/cores/arduino/malloc.c hardware/arduino/cores/arduino/avr-libc/malloc.c hardware/arduino/cores/arduino/malloc.c todo.txt
Diffstat (limited to 'libraries/WiFi/utility/server_drv.h')
-rw-r--r--libraries/WiFi/utility/server_drv.h75
1 files changed, 41 insertions, 34 deletions
diff --git a/libraries/WiFi/utility/server_drv.h b/libraries/WiFi/utility/server_drv.h
index 69ba593..50ba7e3 100644
--- a/libraries/WiFi/utility/server_drv.h
+++ b/libraries/WiFi/utility/server_drv.h
@@ -1,34 +1,41 @@
-#ifndef Server_Drv_h
-#define Server_Drv_h
-
-#include <inttypes.h>
-#include "wifi_spi.h"
-
-class ServerDrv
-{
-public:
- // Start server TCP on port specified
- static void startServer(uint16_t port, uint8_t sock);
-
- static void startClient(uint32_t ipAddress, uint16_t port, uint8_t sock);
-
- static void stopClient(uint8_t sock);
-
- static uint8_t getServerState(uint8_t sock);
-
- static uint8_t getClientState(uint8_t sock);
-
- static bool getData(uint8_t sock, uint8_t *data, uint8_t peek = 0);
-
- static bool getDataBuf(uint8_t sock, uint8_t *data, uint16_t *len);
-
- static bool sendData(uint8_t sock, const uint8_t *data, uint16_t len);
-
- static uint8_t availData(uint8_t sock);
-
- static uint8_t checkDataSent(uint8_t sock);
-};
-
-extern ServerDrv serverDrv;
-
-#endif
+#ifndef Server_Drv_h
+#define Server_Drv_h
+
+#include <inttypes.h>
+#include "wifi_spi.h"
+
+typedef enum eProtMode {TCP_MODE, UDP_MODE}tProtMode;
+
+class ServerDrv
+{
+public:
+
+ // Start server TCP on port specified
+ static void startServer(uint16_t port, uint8_t sock, uint8_t protMode=TCP_MODE);
+
+ static void startClient(uint32_t ipAddress, uint16_t port, uint8_t sock, uint8_t protMode=TCP_MODE);
+
+ static void stopClient(uint8_t sock);
+
+ static uint8_t getServerState(uint8_t sock);
+
+ static uint8_t getClientState(uint8_t sock);
+
+ static bool getData(uint8_t sock, uint8_t *data, uint8_t peek = 0);
+
+ static bool getDataBuf(uint8_t sock, uint8_t *data, uint16_t *len);
+
+ static bool insertDataBuf(uint8_t sock, const uint8_t *_data, uint16_t _dataLen);
+
+ static bool sendData(uint8_t sock, const uint8_t *data, uint16_t len);
+
+ static bool sendUdpData(uint8_t sock);
+
+ static uint16_t availData(uint8_t sock);
+
+ static uint8_t checkDataSent(uint8_t sock);
+};
+
+extern ServerDrv serverDrv;
+
+#endif