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.

Revision:
5:9a57892f206c
Parent:
1:4a23efdf0da9
Child:
7:0fd95907b5b3
--- 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;