Base library for cellular modem implementations

Dependencies:   Socket lwip-sys lwip

Dependents:   CellularUSBModem CellularUSBModem

Deprecated

This is an mbed 2 networking library. For mbed 5, the networking libraries have been revised to better support additional network stacks and thread safety here.

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Tue Dec 17 14:30:17 2013 +0000
Parent:
4:3fc75e611736
Child:
6:6e0ca3539adf
Commit message:
Synchronized with git revision 8ec31ead8026189df63512b6d5ae69081b0aaf18

Full URL: https://github.com/mbedmicro/mbed/commit/8ec31ead8026189df63512b6d5ae69081b0aaf18/

Detection of modem when using serial port, CDMA version of linkmonitor

Changed in this revision

link/LinkMonitor.cpp Show annotated file Show diff for this revision Revisions of this file
link/LinkMonitor.h Show annotated file Show diff for this revision Revisions of this file
--- a/link/LinkMonitor.cpp	Mon Dec 16 09:00:24 2013 +0000
+++ b/link/LinkMonitor.cpp	Tue Dec 17 14:30:17 2013 +0000
@@ -33,20 +33,24 @@
 
 LinkMonitor::LinkMonitor(ATCommandsInterface* pIf) : m_pIf(pIf), m_rssi(0), m_registrationState(REGISTRATION_STATE_UNKNOWN), m_bearer(BEARER_UNKNOWN)
 {
-
+  m_gsm = true;
 }
 
-int LinkMonitor::init()
+int LinkMonitor::init(bool gsm)
 {
-  // we need to make sure that we setup the operator selection to be in 'numeric' format.
-  // i.e. it is made up of a network and country code when returned by the modem e.g. Operator = 23415. This allows easy logic parsing for
-  // setting up other network parameters in future.
-  DBG("LinkMonitor::init() being called. This should only happen once: executinging AT+COPS=0,2");  
-  int ret = m_pIf->executeSimple("AT+COPS=0,2", NULL, DEFAULT_TIMEOUT); //Configure to set the operator string to Country Code and mobile network code
-  if(ret != OK)
+  m_gsm = gsm;
+  if (m_gsm)
   {
-    WARN(" NET_PROTOCOL error from sending the AT+COPS command to the modem. ");
-    return NET_PROTOCOL;
+    // we need to make sure that we setup the operator selection to be in 'numeric' format.
+    // i.e. it is made up of a network and country code when returned by the modem e.g. Operator = 23415. This allows easy logic parsing for
+    // setting up other network parameters in future.
+    DBG("LinkMonitor::init() being called. This should only happen once: executinging AT+COPS=0,2");  
+    int ret = m_pIf->executeSimple("AT+COPS=0,2", NULL, DEFAULT_TIMEOUT); //Configure to set the operator string to Country Code and mobile network code
+    if(ret != OK)
+    {
+      WARN(" NET_PROTOCOL error from sending the AT+COPS command to the modem. ");
+      return NET_PROTOCOL;
+    }
   }
   return OK;
 }
@@ -136,7 +140,7 @@
   m_rssi = 0;
   m_registrationState = REGISTRATION_STATE_UNKNOWN;
   m_bearer = BEARER_UNKNOWN;
-  int ret = m_pIf->execute("AT+CREG?;+COPS?;+CSQ", this, NULL, DEFAULT_TIMEOUT); //Configure to get registration info & get it; get signal quality
+  int ret = m_pIf->execute(m_gsm ? "AT+CREG?;+COPS?;+CSQ" : "AT+CREG?;+CSQ", this, NULL, DEFAULT_TIMEOUT); //Configure to get registration info & get it; get signal quality
   if(ret != OK)
   {
     return NET_PROTOCOL;
--- a/link/LinkMonitor.h	Mon Dec 16 09:00:24 2013 +0000
+++ b/link/LinkMonitor.h	Tue Dec 17 14:30:17 2013 +0000
@@ -39,7 +39,7 @@
 
   /** Initialize monitor
    */
-  int init();
+  int init(bool gsm = true);
 
   /** Registration State
   */  
@@ -82,6 +82,7 @@
   ATCommandsInterface* m_pIf;
   
   int m_rssi;
+  bool m_gsm;
   REGISTRATION_STATE m_registrationState;
   BEARER m_bearer;