Add a bunch of APNs

Fork of C027_Support by Xinlei Cao

Revision:
44:9d12223b78ff
Parent:
38:e6cab4632d84
Child:
51:e7b81c31baec
diff -r a89a7a505991 -r 9d12223b78ff MDM.h
--- a/MDM.h	Fri Apr 11 20:10:28 2014 +0000
+++ b/MDM.h	Thu Apr 17 20:41:30 2014 +0000
@@ -22,6 +22,8 @@
 public:
     //! Constructor 
     MDMParser();
+    //! get static instance
+    static MDMParser* getInstance() { return inst; };
     
     // ----------------------------------------------------------------
     // Types 
@@ -142,6 +144,19 @@
     */
     bool socketConnect(int socket, const char* host, int port);
         
+    /** make a socket connection
+        \param socket the socket handle
+        \return true if connected, false otherwise
+    */
+    bool socketIsConnected(int socket);
+     
+    /** Get the number of bytes pending for reading for this socket
+        \param socket the socket handle
+        \param timeout_ms -1 blocking, else non blocking timeout in ms
+        \return 0 if successful or SOCKET_ERROR on failure 
+    */
+    bool socketSetBlocking(int socket, unsigned int timeout_ms);
+    
     /** Write socket data 
         \param socket the socket handle
         \param buf the buffer to write
@@ -398,8 +413,9 @@
     IP          _ip;  //!< assigned ip address
     // management struture for sockets
     typedef enum { SOCK_FREE, SOCK_CREATED, SOCK_CONNECTED } SockState;
-    typedef struct { SockState state; int pending; } SockCtrl;
+    typedef struct { SockState state; int pending; unsigned int timeout_ms; } SockCtrl;
     SockCtrl _sockets[16];
+    static MDMParser* inst;
 };
 
 // -----------------------------------------------------------------------