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:
75:ce6e12067d0c
Parent:
74:208e3e32d263
Child:
76:f7c3dd568dae
--- a/MDM.h	Thu May 15 22:20:42 2014 +0000
+++ b/MDM.h	Fri May 16 14:13:00 2014 +0000
@@ -7,9 +7,9 @@
 #include "SerialPipe.h"
 
 #ifdef TARGET_UBLOX_C027
- #define _IF(onboard,shield) onboard
+ #define MDM_IF(onboard,shield) onboard
 #else
- #define _IF(onboard,shield) shield
+ #define MDM_IF(onboard,shield) shield
 #endif
 
 //! include debug capabilty on more powerful targets with a dedicated debug port 
@@ -35,7 +35,7 @@
     //! MT Device Types 
     typedef enum { DEV_UNKNOWN, DEV_SARA_G350, DEV_LISA_U200, DEV_LISA_C200 } Dev; 
     //! SIM Status
-    typedef enum { SIM_UNKNOWN, SIM_PIN, SIM_READY } Sim;
+    typedef enum { SIM_UNKNOWN, SIM_MISSING, SIM_PIN, SIM_READY } Sim;
     //! SIM Status
     typedef enum { LPM_DISABLED, LPM_ENABLED, LPM_ACTIVE, LPM_SLEEP } Lpm; 
     //! Device status
@@ -98,7 +98,7 @@
     */
     bool connect(const char* simpin, 
             const char* apn, const char* username, const char* password,
-            PinName pn _IF( = MDMPWRON, = D4));    
+            PinName pn MDM_IF( = MDMPWRON, = D4));    
 
     /** register (Attach) the MT to the GPRS service. 
         \param simpin a optional pin of the SIM card
@@ -106,7 +106,14 @@
         \return true if successful, false otherwise
     */
     bool init(const char* simpin = NULL, DevStatus* status = NULL, 
-                PinName pn _IF( = MDMPWRON, = D4));
+                PinName pn MDM_IF( = MDMPWRON, = D4));
+    
+    /** register to the network 
+        \param status an optional structure to with network information 
+        \param timeout_ms -1 blocking, else non blocking timeout in ms
+        \return true if successful and connected to network, false otherwise
+    */
+    bool registerNet(NetStatus* status = NULL, int timeout_ms = 180000);
     
     /** check if the network is available 
         \param status an optional structure to with network information 
@@ -527,12 +534,12 @@
         \param rxSize the size of the serial rx buffer
         \param txSize the size of the serial tx buffer
     */
-    MDMSerial(PinName tx    _IF( = MDMTXD,  = D1 ), 
-              PinName rx    _IF( = MDMRXD,  = D2 ), 
-              int baudrate  _IF( = MDMBAUD, = 115200 ),
+    MDMSerial(PinName tx    MDM_IF( = MDMTXD,  = D1 ), 
+              PinName rx    MDM_IF( = MDMRXD,  = D0 ), 
+              int baudrate  MDM_IF( = MDMBAUD, = 115200 ),
  #if DEVICE_SERIAL_FC
-              PinName rts   _IF( = MDMRTS,  = NC ), 
-              PinName cts   _IF( = MDMCTS,  = NC ),
+              PinName rts   MDM_IF( = MDMRTS,  = NC /* D2 resistor R62 on shield not mounted */ ), 
+              PinName cts   MDM_IF( = MDMCTS,  = NC /* D3 resistor R63 on shield not mounted */ ),
  #endif
               int rxSize    = 256 , 
               int txSize    = 128 );
@@ -553,6 +560,7 @@
     virtual int _send(const void* buf, int len);
 };
 
+ 
 // -----------------------------------------------------------------------
 
 //#define HAVE_MDMUSB