Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of VodafoneUSBModem by
Diff: link/LinkMonitor.cpp
- Revision:
- 49:978bffab17a8
- Parent:
- 47:47d6101eebeb
- Child:
- 51:54ca82a7644c
--- a/link/LinkMonitor.cpp Wed Sep 26 17:19:43 2012 +0000 +++ b/link/LinkMonitor.cpp Thu Sep 27 10:13:44 2012 +0000 @@ -38,6 +38,17 @@ int LinkMonitor::init() { + // 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->execute("AT+COPS=0,2", this, 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; } @@ -126,7 +137,7 @@ m_rssi = 0; m_registrationState = REGISTRATION_STATE_UNKNOWN; m_bearer = BEARER_UNKNOWN; - int ret = m_pIf->execute("AT+CREG=2;+CREG?;+CREG=0;+COPS?;+CSQ", this, NULL, DEFAULT_TIMEOUT); //Configure to get registration info & get it; get signal quality + int ret = m_pIf->execute("AT+CREG=0;+CREG?;+COPS?;+CSQ", this, NULL, DEFAULT_TIMEOUT); //Configure to get registration info & get it; get signal quality if(ret != OK) { return NET_PROTOCOL;