A library for talking to Multi-Tech's Cellular SocketModem Devices.
Dependents: M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more
Diff: io/IPStack.h
- Revision:
- 11:134435d8a2d5
- Child:
- 17:2d7c4ea7491b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/io/IPStack.h Fri Dec 13 20:18:47 2013 +0000 @@ -0,0 +1,36 @@ +#ifndef IPSTACK_H +#define IPSTACK_H + +#include <string> + +class IPStack +{ +public: + enum Mode { + TCP, UDP + }; + + // Used to setup device + virtual bool connect() = 0; // Required configurations should be set before this call!!! + virtual void disconnect() = 0; + virtual bool isConnected() = 0; + + // Used for TCPSocketConnection & UDPSocketConnection + virtual bool bind(unsigned int port) = 0; + virtual bool open(const std::string& address, unsigned int port, Mode mode) = 0; + virtual bool isOpen() = 0; + virtual void close() = 0; + + //Error code => -1, Timeout == -1 for blocking + virtual int read(char* data, int max, int timeout = -1) = 0; + virtual int write(char* data, int length, int timeout = -1) = 0; + + //return 0 for false + virtual unsigned int readable() = 0; + virtual unsigned int writeable() = 0; + + //Other + virtual void reset() = 0; +}; + +#endif /* IPSTACK_H */ \ No newline at end of file