Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Revision:
72:0e8e769fcf76
Parent:
66:6b00a764e549
--- a/Tests/Test12.h	Thu Jun 27 13:09:14 2013 +0000
+++ b/Tests/Test12.h	Fri Sep 20 12:36:03 2013 +0000
@@ -1,6 +1,7 @@
 #pragma once
 #include "VodafoneTestCase.h"
 
+// Test 12: x2 -> Send 25 SMS, wait for recv, read them quickly.
 extern const char* gTest12Description;
 
 class Test12 : public VodafoneTestCase {
@@ -24,6 +25,7 @@
       virtual bool executeTest() {
          // locals
          int smsToSend = 50, mailBoxSize = 25;
+         int tries = 0, sent = 0;
          size_t smCount, oldSMCount;
          Timer t;
          
@@ -34,7 +36,7 @@
          LOG("... Clearing out SMS mail box first");
          for(int j=0; j<3; j++) {
             if(_modem->getSMCount(&smCount)!=0) {
-               LOG("Faiure getting SM count");
+               LOG("Failure getting SM count");
                return false;
             }
          
@@ -61,18 +63,31 @@
             } else {
                sprintf(_smsOut,"B SMS %d",i);
             }
-            if(_modem->sendSM(_ownNumber,_smsOut)!=0) {
+            tries = 3;
+            sent = 0;
+            while(tries--) {
+               if(_modem->sendSM(_ownNumber,_smsOut)==0) {
+                  sent = 1;
+                  break;
+               }
+               LOG("Error sending SM, trying again.");
+            }
+            
+            if(!sent) {
                LOG("Error sending short message");
                return false;
             } else {
                LOG("Sent %d/%d: \"%s\"",i,smsToSend,_smsOut);
             }
+            Thread::wait(50);
          }
          Thread::wait(5000);
          
          // wait for 25 to arrive and then read them as quickly as possible
          smCount = 0, oldSMCount = 0;
          t.start();
+         LOG("waiting for messages");
+         
          // wait a maximum of 10 minutes
          while(smCount<mailBoxSize&&t.read_ms()<600000) {
             if(_modem->getSMCount(&smCount)!=0) {
@@ -91,6 +106,7 @@
             return false;
          }
          
+         
          LOG("dumping SMS");
          for(int i=0; i<mailBoxSize; i++) {
             if(_modem->getSM(_senderNumber,_smsIn,_smsLen)!=0) {
@@ -105,6 +121,8 @@
          smCount = 0, oldSMCount = 0;
          t.start();
          // wait a maximum of 10 minutes
+         LOG("Waiting for messages");
+      
          while(smCount<mailBoxSize&&t.read_ms()<600000) {
             if(_modem->getSMCount(&smCount)!=0) {
                LOG("Failure getting SM count");