Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Diff: Tests/Test50.h
- Revision:
- 58:8b63f4c3a5a5
- Parent:
- 44:6d0ac4747f5b
- Child:
- 60:7efce4a3c26f
--- a/Tests/Test50.h Mon Oct 15 16:02:24 2012 +0000 +++ b/Tests/Test50.h Wed Oct 17 16:25:51 2012 +0000 @@ -7,6 +7,7 @@ public: Test50(VodafoneUSBModem *m) : VodafoneTestCase(m) { _smsLen = 32; + _smsMaxSize = 160; // max size of SMS using _numberLen = 16; _description = gTest50Description; _testCaseNumber = 50; @@ -26,7 +27,32 @@ LOG(gTest50Description); int numIterations = 10; size_t smCount; - LOG("...", _testCaseNumber); + LOG("... Test case: %d", _testCaseNumber); + + // Clear out the SMS mail box before we run this test. + LOG("... Clearing out SMS mail box first"); + if(_modem->getSMCount(&smCount)!=0) + { + LOG("Faiure getting SM count"); + return false; + } + + + for (int i=0; i<smCount; i++) + { + if(_modem->getSMCount(&smCount)!=0) { + LOG("Faiure getting SM count"); + return false; + } + if(_modem->getSM(_senderNumber,_smsJunkBuffer,_smsMaxSize)!=0) + { + LOG("Strange! The SMS count is bigger than zero but I can't fetch the SMS?"); + return false; + } + LOG("Got SMS: %s",_smsJunkBuffer); + LOG("Clearing that out before running the test."); + } + LOG("Getting MSISDN"); _modem->sendUSSD("*#100#",_ownNumber,_numberLen); LOG("Got MSISDN %s",_ownNumber); @@ -80,6 +106,7 @@ _senderNumber = (char*)malloc(_numberLen*sizeof(char)); _smsOut = (char*)malloc(_smsLen*sizeof(char)); _smsIn = (char*)malloc(_smsLen*sizeof(char)); + _smsJunkBuffer= (char*)malloc(_smsMaxSize*sizeof(char)); } void freeStorage() { @@ -87,12 +114,15 @@ free(_senderNumber); free(_smsOut); free(_smsIn); + free(_smsJunkBuffer); } char* _ownNumber; char* _senderNumber; char* _smsOut; char* _smsIn; + char* _smsJunkBuffer; int _smsLen; + int _smsMaxSize; int _numberLen; }; \ No newline at end of file