2011-03-08 22:13:54 +01:00
|
|
|
#ifndef Server_Drv_h
|
|
|
|
#define Server_Drv_h
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "wifi_spi.h"
|
|
|
|
|
|
|
|
class ServerDrv
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Start server TCP on port specified
|
2012-02-04 12:29:12 +01:00
|
|
|
static void startServer(uint16_t port, uint8_t sock);
|
2011-04-24 00:45:47 +02:00
|
|
|
|
2012-02-04 12:29:12 +01:00
|
|
|
static void startClient(uint32_t ipAddress, uint16_t port, uint8_t sock);
|
|
|
|
|
|
|
|
static void stopClient(uint8_t sock);
|
2011-03-08 22:13:54 +01:00
|
|
|
|
2012-02-04 12:29:12 +01:00
|
|
|
static uint8_t getServerState(uint8_t sock);
|
|
|
|
|
|
|
|
static uint8_t getClientState(uint8_t sock);
|
2011-03-08 22:13:54 +01:00
|
|
|
|
|
|
|
static bool getData(uint8_t sock, uint8_t *data);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-02-10 00:49:42 +01:00
|
|
|
static uint8_t checkDataSent(uint8_t sock);
|
2011-03-08 22:13:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern ServerDrv serverDrv;
|
|
|
|
|
|
|
|
#endif
|