Own fork of C027_Support

Dependents:   MbedSmartRestMain MbedSmartRestMain

Fork of C027_Support by u-blox

Revision:
103:197fa7920ad8
Parent:
101:edfeb8af206e
Child:
115:d8d94b73c725
diff -r fb982ff9da82 -r 197fa7920ad8 MDM.h
--- a/MDM.h	Thu Jul 03 18:44:32 2014 +0000
+++ b/MDM.h	Thu Jul 03 21:00:22 2014 +0000
@@ -526,7 +526,7 @@
     static int _cbUPSND(int type, const char* buf, int len, int* act);
     static int _cbUPSND(int type, const char* buf, int len, IP* ip);
     static int _cbUDNSRN(int type, const char* buf, int len, IP* ip);
-    static int _cbUSOCR(int type, const char* buf, int len, int* socket);
+    static int _cbUSOCR(int type, const char* buf, int len, int* handle);
     static int _cbUSORD(int type, const char* buf, int len, char* out);
     typedef struct { char* buf; IP ip; int port; } USORFparam;
     static int _cbUSORF(int type, const char* buf, int len, USORFparam* param);
@@ -544,11 +544,11 @@
     NetStatus   _net; //!< collected network information 
     IP          _ip;  //!< assigned ip address
     // management struture for sockets
-    typedef enum { SOCK_FREE, SOCK_CREATED, SOCK_CONNECTED } SockState;
-    typedef struct { volatile SockState state; volatile int pending; int timeout_ms; } SockCtrl;
-    // LISA-C has 6 TCP and 6 UDP sockets starting at index 18
-    // LISA-U and SARA-G have 7 sockets starting at index 1
-    SockCtrl _sockets[32];
+    typedef struct { int handle; int timeout_ms; volatile bool connected; volatile int pending; } SockCtrl;
+    // LISA-C has 6 TCP and 6 UDP sockets 
+    // LISA-U and SARA-G have 7 sockets
+    SockCtrl _sockets[12];
+    int _findSocket(int handle = SOCKET_ERROR/* = CREATE*/);
     static MDMParser* inst;
     bool _init;
 #ifdef TARGET_UBLOX_C027