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.

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Tue Jul 01 06:41:26 2014 +0000
Parent:
100:5e8b69232ea2
Child:
102:fb982ff9da82
Commit message:
improve purge at wakeup

Changed in this revision

MDM.cpp Show annotated file Show diff for this revision Revisions of this file
MDM.h Show annotated file Show diff for this revision Revisions of this file
Pipe.h Show annotated file Show diff for this revision Revisions of this file
--- a/MDM.cpp	Tue Jul 01 05:46:06 2014 +0000
+++ b/MDM.cpp	Tue Jul 01 06:41:26 2014 +0000
@@ -309,12 +309,11 @@
             pin = 1; ::wait_ms(100);
             
             // purge any messages 
-            while (WAIT != waitFinalResp(NULL,NULL,0))
-                /* nothing */;
+            purge();
             
-            // check interface and disable local echo
+            // check interface
             sendFormated("AT\r\n");
-            int r = waitFinalResp(NULL,NULL,500);
+            int r = waitFinalResp(NULL,NULL,1000);
             if(RESP_OK == r) break;
         }
         if (i < 0) {
--- a/MDM.h	Tue Jul 01 05:46:06 2014 +0000
+++ b/MDM.h	Tue Jul 01 06:41:26 2014 +0000
@@ -409,6 +409,10 @@
     */ 
     virtual int getLine(char* buf, int len) = 0; 
     
+    /* clear the pending input data
+    */
+    virtual void purge(void) = 0;
+    
     /** Write data to the device 
         \param buf the buffer to write
         \param buf size of the buffer to write
@@ -596,6 +600,13 @@
                 NOT_FOUND if nothing was found
     */ 
     virtual int getLine(char* buffer, int length);
+    
+    /* clear the pending input data */
+    virtual void purge(void) 
+    { 
+        while (readable())
+            getc();
+    }
 protected:
     /** Write bytes to the physical interface.
         \param buf the buffer to write
@@ -617,6 +628,7 @@
     //! Destructor          
     virtual ~MDMUsb(void);
     virtual int getLine(char* buffer, int length);
+    virtual void purge(void) { }
 protected:
     virtual int _send(const void* buf, int len);
 };
--- a/Pipe.h	Tue Jul 01 05:46:06 2014 +0000
+++ b/Pipe.h	Tue Jul 01 06:41:26 2014 +0000
@@ -212,13 +212,13 @@
         return t; 
     }
     
-    /** commit the index, mrk the current parsing index as consumed data.
+    /** commit the index, mark the current parsing index as consumed data.
     */
     void done(void) 
     {
         _r = _o; 
     } 
-    
+
 private:
     /** increment the index
         \param i index to increment