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:
133:57b208dd96fb
Parent:
132:de505da3aadf
Child:
134:2fbd5723e063
diff -r de505da3aadf -r 57b208dd96fb MDM.h
--- a/MDM.h	Wed Nov 11 16:26:19 2015 +0000
+++ b/MDM.h	Thu Nov 26 09:42:01 2015 +0000
@@ -33,7 +33,7 @@
     // ----------------------------------------------------------------
     //! MT Device Types 
     typedef enum { DEV_UNKNOWN, 
-                   DEV_SARA_G35, DEV_LISA_U2, DEV_LISA_C2, 
+                   DEV_SARA_G35, DEV_LISA_U2, DEV_LISA_U2_03S, DEV_LISA_C2, 
                    DEV_SARA_U2, DEV_LEON_G2, DEV_TOBY_L2, DEV_MPCI_L2 } Dev; 
     //! SIM Status
     typedef enum { SIM_UNKNOWN, SIM_MISSING, SIM_PIN, SIM_READY } Sim;
@@ -69,6 +69,21 @@
         unsigned short lac;  //!< location area code in hexadecimal format (2 bytes in hex)
         unsigned int ci;     //!< Cell ID in hexadecimal format (2 to 4 bytes in hex)
     } NetStatus;
+   //! 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
+       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
+       int svUsed;          //!< number of satellite used
+   }CellLocData;
+
     //! An IP v4 address
     typedef uint32_t IP;
     #define NOIP ((MDMParser::IP)0) //!< No IP address
@@ -329,6 +344,55 @@
         \return the number of bytes read
     */
     int readFile(const char* filename, char* buf, int len);
+    // ----------------------------------------------------------------
+    // Cell Locate
+    // ----------------------------------------------------------------
+
+     /** Configures CellLocate Http 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
+        \days       The number of days into the future the Offline data for the u-blox 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", \
+            const char* server_2 = "cell-live2.services.u-blox.com", int days = 14, int period = 4, int resolution = 1);
+
+    /** Configures  CellLocate Udp Aiding server
+        \server_1   Host name of the primary MGA server
+        \port       Server port
+        \latency    Expected network latency in seconds from 0 to 10000ms
+        \mode       Assist now management, mode of operation: 0 data downloaded at GNSS power up,
+                    1 automatically kept alive, manual download
+    */
+    int cellLocSrvUdp(const char* server_1 = "cell-live1.services.u-blox.com", int port = 46434, int latency = 1000, int mode = 0);
+
+    /** Configures CellLocate URCs in the case of +ULOC operations
+        \mode       Urc configuration: 0 disabled, 1 enabled
+     */
+    int cellLocUnsolIndication(int mode);
+
+    /**  Configures CellLocate location sensor 
+         \scanMode Network scan mode: 0 normal, 1 deep scan
+     */
+    int cellLocConfigSensor(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
+         \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)
+     */
+    int cellLocRequest(int sensor, int timeout, int accuracy, int numHypotesis =1);
+
+    /** Check if a position is available
+        \data pointer to a CellLocData struct where the location will be copied in
+        \return 1 if data is available, 0 otherwise
+    */
+    int cellLocGet(CellLocData *data);
     
     // ----------------------------------------------------------------
     // DEBUG/DUMP status to standard out (printf)
@@ -561,6 +625,7 @@
     DevStatus   _dev; //!< collected device information
     NetStatus   _net; //!< collected network information 
     IP          _ip;  //!< assigned ip address
+    CellLocData _loc; //!< 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