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:
136:8dc8f48275fc
Parent:
135:cbccf4052d45
Child:
137:6a7a5c4f35f6
--- a/MDM.h	Thu Jan 21 15:59:42 2016 +0000
+++ b/MDM.h	Fri Jan 22 15:28:39 2016 +0000
@@ -72,21 +72,25 @@
         unsigned int ci;     //!< Cell ID in hexadecimal format (2 to 4 bytes in hex)
         CopsMode regStatus;    //!< Cops mode
     } NetStatus;
+    typedef enum { CELL_LAST = 0, CELL_GNSS, CELL_LOCATE, CELL_HYBRID} CellSensType;
+    typedef enum { CELL_DETAILED = 1, CELL_MULTIHYP = 2} CellRespType;
+    #define CELL_MAX_HYP    (16 + 1)
+    int _locRcvPos;     //!< Received positions
+    int _locExpPos;     //!< Expected positions
    //! Cell Locate Data
    typedef struct {
        bool validData;      //!< Flag for indicating if data is valid
        struct tm time;      //!< GPS Timestamp
        float longitude;     //!< Estimated longitude, in degrees
-       float  latitue;      //!< Estimated latitude, in degrees
+       float latitude;      //!< Estimated latitude, in degrees
        int altitutude;      //!< Estimated altitude, in meters^2
        int uncertainty;     //!< Maximum possible error, in meters
        int speed;           //!< Speed over ground m/s^2
        int direction;       //!< Course over ground in degrees
        int verticalAcc;     //!< Vertical accuracy, in meters^2
-       int sensorUsed;      //!< Sensor used for last calculation
+       CellSensType sensor;      //!< Sensor used for last calculation
        int svUsed;          //!< number of satellite used
-   }CellLocData;
-
+   }CellLocData;    
     //! An IP v4 address
     typedef uint32_t IP;
     #define NOIP ((MDMParser::IP)0) //!< No IP address
@@ -440,10 +444,10 @@
     int infoFile(const char* filename);
     
     // ----------------------------------------------------------------
-    // Cell Locate
+    // CellLocate
     // ----------------------------------------------------------------
 
-     /** Configures CellLocate Http Aiding server
+     /** Configures CellLocate Tcp Aiding server
         \server_1   Host name of the primary MGA server
         \server_2   Host name of the secondary MGA server
         \token      Authentication Token for MGA server access
@@ -451,7 +455,7 @@
         \period     The number of weeks into the future the Offline data for u-blox M8
         \resolution Resolution of offline data for u-blox M8: 1 everyday, 0 every other day
     */
-    int cellLocSrvHttp(const char* token, const char* server_1 = "cell-live1.services.u-blox.com", \
+    int cellLocSrvTcp(const char* token, const char* server_1 = "cell-live1.services.u-blox.com", \
             const char* server_2 = "cell-live2.services.u-blox.com", int days = 14, int period = 4, int resolution = 1);
 
     /** Configures  CellLocate Udp Aiding server
@@ -466,28 +470,38 @@
     /** Configures CellLocate URCs in the case of +ULOC operations
         \mode       Urc configuration: 0 disabled, 1 enabled
      */
-    int cellLocUnsolIndication(int mode);
+    int cellLocUnsol(int mode);
 
     /**  Configures CellLocate location sensor 
          \scanMode Network scan mode: 0 normal, 1 deep scan
      */
-    int cellLocConfigSensor(int scanMode);
+    int cellLocConfig(int scanMode);
 
     /** Request CellLocate 
         This function is not blocking, the result has to be retrived using cellLocGet
-         \cb            Call back function called when position is available
-         \sensor        Sensor selection: 0: use last fix and stop GNSS receiver, 1: use GNSS, 2: CellLocate, 3: Hybrid
+         \sensor        Sensor selection: 
          \timeout       Timeout period in seconds (1 - 999)
          \accuracy      Target accuracy in meters (1 - 999999)
-         \numHypotesis  Maximum desired number of responses from CellLocate® (up to 16)
+         \type
+         \hypotesis  Maximum desired number of responses from CellLocate® (up to 16)
      */
-    int cellLocRequest(int sensor, int timeout, int accuracy, int numHypotesis =1);
+    int cellLocRequest(CellSensType sensor, int timeout, int accuracy, CellRespType type = CELL_DETAILED,int hypotesis = 1);
 
-    /** Check if a position is available
+    /** Get a position record
         \data pointer to a CellLocData struct where the location will be copied in
-        \return 1 if data is available, 0 otherwise
+        \index of the position to retrive
+        \return 1 if data has been retrived and copied, 0 otherwise
     */
-    int cellLocGet(CellLocData *data);
+    int cellLocGetData(CellLocData *data, int index =0);
+    
+    /** Get number of position records received       
+        \return number of position received
+    */
+    int cellLocGetRes();
+    /** Get expected number of position to be received       
+        \return number of expected position to be received
+    */
+    int cellLocGetExpRes();
     
     // ----------------------------------------------------------------
     // DEBUG/DUMP status to standard out (printf)
@@ -724,7 +738,7 @@
     DevStatus   _dev; //!< collected device information
     NetStatus   _net; //!< collected network information 
     IP          _ip;  //!< assigned ip address
-    CellLocData _loc; //!< CellLocate data
+    CellLocData _loc[CELL_MAX_HYP]; //!< CellLocate data
     // management struture for sockets
     typedef struct { int handle; int timeout_ms; volatile bool connected; volatile int pending; } SockCtrl;
     // LISA-C has 6 TCP and 6 UDP sockets