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.

Fork of C027_Support by u-blox

Revision:
123:66cef6353b13
Parent:
121:8da935c2c08c
Child:
124:65eb7d58f2da
--- a/MDM.h	Thu Mar 12 17:29:29 2015 +0000
+++ b/MDM.h	Thu Aug 20 07:53:34 2015 +0000
@@ -6,7 +6,7 @@
 #include "Pipe.h"
 #include "SerialPipe.h"
 
-#ifdef TARGET_UBLOX_C027
+#if 0//def TARGET_UBLOX_C027
  #define MDM_IF(onboard,shield) onboard
 #else
  #define MDM_IF(onboard,shield) shield
@@ -31,8 +31,10 @@
     // Types 
     // ----------------------------------------------------------------
     //! MT Device Types 
-    typedef enum { DEV_UNKNOWN, DEV_SARA_G350, DEV_LISA_U200, DEV_LISA_C200, 
-                   DEV_SARA_U260, DEV_SARA_U270, DEV_LEON_G200 } Dev; 
+    typedef enum { DEV_UNKNOWN, 
+                   DEV_SARA_G350, DEV_LISA_U200, DEV_LISA_C200, 
+                   DEV_SARA_U260, DEV_SARA_U270, DEV_LEON_G200, 
+                   DEV_TOBY_L200, DEV_TOBY_L201, DEV_TOBY_L210,  } Dev; 
     //! SIM Status
     typedef enum { SIM_UNKNOWN, SIM_MISSING, SIM_PIN, SIM_READY } Sim;
     //! SIM Status
@@ -53,11 +55,12 @@
     //! Registration Status
     typedef enum { REG_UNKNOWN, REG_DENIED, REG_NONE, REG_HOME, REG_ROAMING } Reg; 
     //! Access Technology
-    typedef enum { ACT_UNKNOWN, ACT_GSM, ACT_EDGE, ACT_UTRAN, ACT_CDMA } AcT; 
+    typedef enum { ACT_UNKNOWN, ACT_GSM, ACT_EDGE, ACT_UTRAN, ACT_CDMA, ACT_LTE } AcT; 
     //! Network Status
     typedef struct { 
         Reg csd;        //!< CSD Registration Status (Circuit Switched Data)
         Reg psd;        //!< PSD Registration status (Packet Switched Data)
+        Reg eps;        //!< EPS Registration status
         AcT act;        //!< Access Technology
         int rssi;       //!< Received Signal Strength Indication (in dBm, range -113..-51)
         int ber;        //!< Bit Error Rate (BER), see 3GPP TS 45.008 [20] subclause 8.2.4
@@ -105,8 +108,10 @@
         \param status an optional struture to with device information 
         \return true if successful, false otherwise
     */
-    bool init(const char* simpin = NULL, DevStatus* status = NULL, 
+    virtual bool init(const char* simpin = NULL, DevStatus* status = NULL, 
                 PinName pn MDM_IF( = MDMPWRON, = D4));
+
+    void getDevStatus(MDMParser::DevStatus* dev) { memcpy(dev, &_dev, sizeof(DevStatus)); }
     
     /** register to the network 
         \param status an optional structure to with network information 
@@ -152,6 +157,8 @@
     */
     MDMParser::IP gethostbyname(const char* host);
     
+    MDMParser::IP getIpAddress(void) { return _ip; }
+
     // ----------------------------------------------------------------
     // Sockets
     // ----------------------------------------------------------------
@@ -507,6 +514,8 @@
     virtual void lock(void)        { } 
     //! override the unlock in a rtos system
     virtual void unlock(void)      { } 
+    //! wakeup the modem
+    bool _wakeup(PinName pn);
 protected:
     // parsing callbacks for different AT commands and their parameter arguments
     static int _cbString(int type, const char* buf, int len, char* str);
@@ -593,7 +602,7 @@
               int txSize    = 128 );
     //! Destructor          
     virtual ~MDMSerial(void);
-    
+     
     /** Get a line from the physical interface. 
         \param buf the buffer to store it
         \param buf size of the buffer