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: sms/SMSInterface.cpp
- Revision:
- 39:85dc5ca10b7f
- Parent:
- 28:c94ffb45a848
- Child:
- 42:daa4dd282103
--- a/sms/SMSInterface.cpp Wed Sep 19 09:36:28 2012 +0000 +++ b/sms/SMSInterface.cpp Thu Sep 20 08:02:30 2012 +0000 @@ -17,7 +17,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define __DEBUG__ 0 +#define __DEBUG__ 4 #ifndef __MODULE__ #define __MODULE__ "SMSInterface.cpp" #endif @@ -119,7 +119,9 @@ m_inboxMtx.lock(); if(m_msgRefListCount == 0 && m_needsUpdate) { + DBG("Message list count is 0 and needs updating. Running updateInbox."); ret = updateInbox(); + if (ret) { m_inboxMtx.unlock(); @@ -130,6 +132,7 @@ if(m_msgRefListCount == 0) { m_inboxMtx.unlock(); + DBG("Message list count is 0, I think it's empty and returning."); return NET_EMPTY; //No message to read } @@ -154,6 +157,7 @@ if (m_state != SMS_CMD_PROCESSED) { + WARN(" State variable is not 'SMS_CMD_PROCESSED' - returning 'NET_EMPTY'"); m_state = SMS_IDLE; m_inboxMtx.unlock(); return NET_EMPTY; @@ -161,7 +165,7 @@ m_state = SMS_IDLE; - DBG("Deleting message"); + DBG("Deleting message from index number: d%", m_msgRefList[0] ); //Delete message from outbox std::sprintf(cmd, "AT+CMGD=%d", m_msgRefList[0]); ret = m_pIf->executeSimple(cmd, NULL, DEFAULT_TIMEOUT); @@ -170,11 +174,12 @@ m_inboxMtx.unlock(); WARN("Could not delete message"); } - + else + { //Remove message from list std::memmove(m_msgRefList, m_msgRefList+1, m_msgRefListCount-1); m_msgRefListCount--; - + } m_inboxMtx.unlock(); return OK;