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

Revision:
27:8e6188cbcfd4
Parent:
17:2d7c4ea7491b
Child:
36:bb6b293c7495
Child:
39:6e94520a3217
Child:
41:81d035fb0b6a
--- a/io/IPStack.h	Tue Dec 17 18:49:06 2013 +0000
+++ b/io/IPStack.h	Tue Dec 17 23:56:20 2013 +0000
@@ -3,6 +3,9 @@
 
 #include <string>
 
+/** IP Stack... //TODO
+*
+*/
 class IPStack
 {
 public:
@@ -10,26 +13,74 @@
         TCP, UDP
     };
 
-    // Used to setup device
-    virtual bool connect() = 0; // Required configurations should be set before this call!!!
+    /** This method is used to connect the physical layer of the interface. Required
+    * configurations and settings should be done in other calls or an init function.
+    *
+    * @returns true if the physical connection was successfully established, otherwise false.
+    */
+    virtual bool connect() = 0;
+
+    /** This method is used to disconnect the physical layer of the interface. This includes
+    * any cleanup required before another connection can be made.
+    */
     virtual void disconnect() = 0;
+
+    /** This method is used to check if the physical layer of the interface is currently connected.
+    *
+    * @returns true if currently connected, otherwise false.
+    */
     virtual bool isConnected() = 0;
 
-    // Used for TCPSocketConnection & UDPSocketConnection
+    /** This method is used to set the local port for the UDP or TCP socket connection.
+    * The connection can be made using the open method.
+    *
+    * @param port the local port of the socket as an int.
+    */
     virtual bool bind(unsigned int port) = 0;
+    
+    /** This method is used to open a socket connection with the given parameters.
+    * This socket connection is established using the devices built in IP stack.
+    *
+    * @param address is the address you want to connect to in the form of xxx.xxx.xxx.xxx.
+    * @param port the remote port you want to connect to.
+    * @param mode an enum that specifies whether this socket connection is TCP or UDP type.
+    * @returns true if the connection was successfully opened, otherwise false.
+    */
     virtual bool open(const std::string& address, unsigned int port, Mode mode) = 0;
+    
+    /** This method is used to determine is a socket connection is currently open.
+    *
+    * @returns true if the socket is currently open, otherwise false.
+    */
     virtual bool isOpen() = 0;
+    
+    /** This method is used to close a socket connection that is currently open.
+    *
+    * @returns true if successfully closed, otherwise returns false on an error.
+    */
     virtual bool 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
+
+    /** This method is used to get the number of bytes available to read off the
+    * socket.
+    *
+    * @returns the number of bytes available, 0 if there are no bytes to read.
+    */
     virtual unsigned int readable() = 0;
+    
+    /** This method is used to get the space available to write bytes to the socket.
+    *
+    * @returns the number of bytes that can be written, 0 if write buffer is full.
+    */
     virtual unsigned int writeable() = 0;
-    
-    //Other
+
+    /** This method is used to reset the physical device that provides the physical
+    * connection and IP stack. This call blocks until the device has returned to
+    * an operational state from being reset.
+    */
     virtual void reset() = 0;
 };