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: VodafoneUSBModem.cpp
- Revision:
- 27:37d3ac289e86
- Parent:
- 26:d37501dc6c61
- Child:
- 33:f505faeda8e7
diff -r d37501dc6c61 -r 37d3ac289e86 VodafoneUSBModem.cpp --- a/VodafoneUSBModem.cpp Wed Aug 29 16:28:13 2012 +0000 +++ b/VodafoneUSBModem.cpp Thu Aug 30 09:16:05 2012 +0000 @@ -455,25 +455,15 @@ { return NET_INVALID; //A pin name has not been provided in the constructor } - - if(!enable && m_ppp.isConnected()) + + if(!enable) //Will force components to re-init { - WARN("Data connection is still open"); //Try to encourage good behaviour from the user - m_ppp.disconnect(); + cleanup(); } DigitalOut powerGatingOut(m_powerGatingPin); powerGatingOut = enable; - if(!enable) //Will force components to re-init - { - m_dongleConnected = false; - m_smsInit = false; - m_ussdInit = false; - m_linkMonitorInit = false; - m_atOpen = false; - //We don't reset m_ipInit as PPPIPInterface::init() only needs to be called once - } - + return OK; } @@ -589,4 +579,28 @@ return OK; } +int VodafoneUSBModem::cleanup() +{ + if(m_ppp.isConnected()) + { + WARN("Data connection is still open"); //Try to encourage good behaviour from the user + m_ppp.disconnect(); + } + + m_smsInit = false; + m_ussdInit = false; + m_linkMonitorInit = false; + //We don't reset m_ipInit as PPPIPInterface::init() only needs to be called once + + if(m_atOpen) + { + m_at.close(); + m_atOpen = false; + } + + m_dongle.disconnect(); + m_dongleConnected = false; + + return OK; +}