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:
80:34985b4d821e
Parent:
79:291df065e345
Child:
81:3966a5c17037
--- a/MDM.h	Mon May 26 11:55:16 2014 +0000
+++ b/MDM.h	Tue May 27 08:21:53 2014 +0000
@@ -84,16 +84,19 @@
     // Device 
     // ----------------------------------------------------------------
     
+    typedef enum { AUTH_NONE, AUTH_PAP, AUTH_CHAP, AUTH_DETECT } Auth; 
+    
     /** Combined Init, checkNetStatus, join suitable for simple applications
         \param simpin a optional pin of the SIM card
         \param apn  the of the network provider e.g. "internet" or "apn.provider.com"
         \param username is the user name text string for the authentication phase
         \param password is the password text string for the authentication phase
-        \param dump set to true if you like to dump the status if successful
+        \param auth is the authentication mode (CHAP,PAP,NONE or DETECT)
         \return true if successful, false otherwise
     */
     bool connect(const char* simpin, 
-            const char* apn, const char* username, const char* password,
+            const char* apn, const char* username, 
+            const char* password, Auth auth = AUTH_DETECT,
             PinName pn MDM_IF( = MDMPWRON, = D4));    
 
     /** register (Attach) the MT to the GPRS service. 
@@ -127,13 +130,11 @@
     // Data Connection (GPRS)
     // ----------------------------------------------------------------
     
-    typedef enum { AUTH_NONE, AUTH_PAP, AUTH_CHAP, AUTH_DETECT } Auth; 
-    
     /** register (Attach) the MT to the GPRS service. 
         \param apn  the of the network provider e.g. "internet" or "apn.provider.com"
         \param username is the user name text string for the authentication phase
         \param password is the password text string for the authentication phase
-        \param dump set to true if you like to dump the status if successful
+        \param auth is the authentication mode (CHAP,PAP,NONE or DETECT)
         \return the ip that is assigned 
     */
     MDMParser::IP join(const char* apn = NULL, const char* username = NULL, 
@@ -290,6 +291,32 @@
     bool ussdCommand(const char* cmd, char* buf);
     
     // ----------------------------------------------------------------
+    // FILE 
+    // ----------------------------------------------------------------
+    
+    /** Delete a file in the local file system
+        \param filename the name of the file 
+        \return true if successful, false otherwise
+    */
+    bool delFile(const char* filename);
+    
+    /** Write some data to a file in the local file system
+        \param filename the name of the file 
+        \param buf the data to write 
+        \param len the size of the data to write
+        \return the number of bytes written
+    */
+    int writeFile(const char* filename, const char* buf, int len);
+    
+    /** REad a file from the local file system
+        \param filename the name of the file 
+        \param buf a buffer to hold the data 
+        \param len the size to read
+        \return the number of bytes read
+    */
+    int readFile(const char* filename, char* buf, int len);
+    
+    // ----------------------------------------------------------------
     // DEBUG/DUMP status to standard out (printf)
     // ----------------------------------------------------------------
     
@@ -492,6 +519,9 @@
     typedef struct { int* ix; int num; } CMGLparam;
     static int _cbCMGL(int type, const char* buf, int len, CMGLparam* param);
     static int _cbCMGR(int type, const char* buf, int len, CMGRparam* param);
+    // file
+    typedef struct { const char* filename; char* buf; int sz; int len; } URDFILEparam;
+    static int _cbURDFILE(int type, const char* buf, int len, URDFILEparam* param);
     // variables
     DevStatus   _dev; //!< collected device information
     NetStatus   _net; //!< collected network information