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.
Diff: at/ATCommandsInterface.cpp
- Revision:
- 4:3fc75e611736
- Parent:
- 1:4a23efdf0da9
- Child:
- 7:0fd95907b5b3
--- a/at/ATCommandsInterface.cpp Thu Oct 17 16:50:41 2013 +0300 +++ b/at/ATCommandsInterface.cpp Mon Dec 16 09:00:24 2013 +0000 @@ -63,30 +63,33 @@ } //Initialize AT link & start events processing -int ATCommandsInterface::init() +int ATCommandsInterface::init(bool reset /* = true*/) { - DBG("Sending ATZ E1 V1"); //Lock transaction mutex m_transactionMtx.lock(); - //Should we flush m_pStream at this point ??? - int err; - int tries = 5; - do + if (reset) { - err = executeInternal("ATZ E1 V1", this, NULL, 3000); //Enable echo and verbosity - if(err && tries) + DBG("Sending ATZ E1 V1"); + //Should we flush m_pStream at this point ??? + int err; + int tries = 5; + do { - WARN("No response, trying again"); - Thread::wait(1000); //Give dongle time to recover + err = executeInternal("ATZ E1 V1", this, NULL, 3000); //Enable echo and verbosity + if(err && tries) + { + WARN("No response, trying again"); + Thread::wait(1000); //Give dongle time to recover + } + } while(err && tries--); + if( err ) + { + ERR("Sending ATZ E1 V1 returned with err code %d", err); + m_transactionMtx.unlock(); + return err; } - } while(err && tries--); - if( err ) - { - ERR("Sending ATZ E1 V1 returned with err code %d", err); - m_transactionMtx.unlock(); - return err; } //Enable events handling and execute events enabling commands