Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Files at this revision

API Documentation at this revision

Comitter:
nherriot
Date:
Wed Oct 17 16:25:51 2012 +0000
Parent:
57:b76b3bdbe533
Child:
59:b091324302b4
Commit message:
adding part to test to clear out old SMS from the Inbox.

Changed in this revision

Tests/Test50.h Show annotated file Show diff for this revision Revisions of this file
Tests/Tests.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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
--- a/Tests/Tests.h	Mon Oct 15 16:02:24 2012 +0000
+++ b/Tests/Tests.h	Wed Oct 17 16:25:51 2012 +0000
@@ -17,8 +17,8 @@
 const int gNumAllTests = 10;
 const int gAutomatedTests[] = {8,10,21,22,23,25,26,50};
 const int gNumAutomatedTests = 8;
-const int gInteractiveTests[] = {16,12,14,13};
-const int gNumInteractiveTests = 4;
+const int gInteractiveTests[] = {50};
+const int gNumInteractiveTests = 1;
 const int gSoakTests[] = {50};
 const int gNumSoakTests = 1;
 
--- a/main.cpp	Mon Oct 15 16:02:24 2012 +0000
+++ b/main.cpp	Wed Oct 17 16:25:51 2012 +0000
@@ -50,7 +50,7 @@
   LOG("Constructing TestManager");
   LOG("Running tests.");
   TestManager *m = new TestManager(&modem);
-  m->runTestProfile(TESTS_AUTOMATED);
+  m->runTestProfile(TESTS_MANUAL);
   //m->runTest(10);