support library for C027 helper functions for Buffer Pipes, Buffered Serial Port (rtos capable) and GPS parsing. It includes modem APIs for USSD, SMS and Sockets.

Dependents:   HTTPClient_Cellular_HelloWorld Cellular_HelloMQTT MbedSmartRestMain Car_Bon_car_module ... more

This library is intended to be used with u-blox products such as the C027 or a shield with u-blox cellular and GPS modules like the cellular and positioning shield from Embedded Artist.

For 2G/GSM and 3G/UMTS you need to:

  • have a SIM card and know its PIN number
  • need to know you network operators APN setting These setting should be passed to the connect or init and join functions. You can also extend the APN database in MDMAPN.h.

For CDMA products you need to make sure that you have provisioned and activated the modem with either Sprint or Verizon.

Revision:
26:07be5faf8925
Parent:
25:4045d02e44f1
Child:
28:4d9509e3b1cf
--- a/MDM.h	Tue Apr 08 11:59:28 2014 +0000
+++ b/MDM.h	Tue Apr 08 13:52:07 2014 +0000
@@ -52,9 +52,18 @@
     virtual int getLine(char* buf, int len) = 0; 
     virtual int send(const char* buf, int len);
     int sendFormated(const char* format, ...);
-    typedef int (*_CB)(int type, const char* buf, int len, void* param);
-    int waitFinalResp(_CB cb = NULL, void* param = NULL, int timeout_ms = 5000);
-
+    
+    typedef int (*_CALLBACKPTR)(int type, const char* buf, int len, void* param);
+    int waitFinalResp(_CALLBACKPTR = NULL, 
+                      void* param = NULL, 
+                      int timeout_ms = 5000);
+    template<class T>
+    int waitFinalResp(int (*cb)(int type, const char* buf, int len, 
+                      T* param), 
+                      T* param, int timeout_ms = 5000) 
+    {
+        return waitFinalResp((_CALLBACKPTR)cb, (void*)param, timeout_ms);
+    }
     // network
     bool init(const char* pin = NULL);
     bool checkNetStatus(Status* info = NULL);
@@ -89,6 +98,7 @@
     typedef enum { MODEL_UNKNOWN, MODEL_SARA_G350, MODEL_LISA_U200, MODEL_LISA_C200 } Model; 
     typedef enum { SIM_UNKNOWN, SIM_PIN, SIM_READY } Sim; 
     static int _cbATI(int type, const char* buf, int len, Model* model);
+    static int _cbCIMI(int type, const char* buf, int len, char* imsi);
     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 _cbUSORD(int type, const char* buf, int len, char* out);
@@ -97,6 +107,9 @@
     typedef struct { char* buf; char* num; } CMGRparam;
     static int _cbCUSD(int type, const char* buf, int len, char* buf);
     static int _cbCMGR(int type, const char* buf, int len, CMGRparam* param);
+    static int _cbCGSN(int type, const char* buf, int len, char* imei);
+    static int _cbGSN(int type, const char* buf, int len, char* imei);
+    static int _cbCCID(int type, const char* buf, int len, char* ccid);
     static IP strToIp(const char* str);
     IP _ip;
     Model _model;
@@ -106,6 +119,9 @@
     char _num[32];
     char _opr[32];
     int _rssi;
+    char _imsi[32];
+    char _imei[32];
+    char _ccid[32];
 private:
     typedef enum { SOCK_FREE, SOCK_CREATED, SOCK_CONNECTED } SockState;
     typedef struct { SockState state; int pending; } SockCtrl;