/* NetworkConnection High level socket instance wrapper Author: Philip Lindsay License: Copyright 2007-2008 // LGPL */ #ifndef _CONNECTION_H_ #define _CONNECTION_H_ // Required for use in Arduino environment #include // From original driver #include "types.h" #include "w5100.h" #include "socket.h" #include // TODO: Make this 'NetworkServerConnection'? Or just 'ServerConnection'? // TODO: Pull one-line methods into class definition to allow inlining? class NetworkConnection { // Essentially a Socket wrapper public: // TODO: Split into client/server connections? Subclass? NetworkConnection(uint16_t port); // TODO: Add UDP, TCP choice? // For servers NetworkConnection(); // For clients--is using the default constructor hide misuse? TODO: As above. int listen(); int connect(uint8 * addr, uint16 port); int isConnected(); int available(); int read(); void print(uint8_t); void print(const char * text); void close(); private: SOCKET _socket; static const int _MAX_SOCKETS = MAX_SOCK_NUM; // TODO: Use this. static int _nextSocket; }; #endif