Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Files at this revision

API Documentation at this revision

Comitter:
nherriot
Date:
Thu Aug 30 14:06:22 2012 +0000
Parent:
13:8b69853966f8
Child:
17:28443b768f1c
Commit message:
started working on other tc's.... small typos on log files .... still all works

Changed in this revision

TestManager.cpp Show annotated file Show diff for this revision Revisions of this file
Tests/Test13.h Show annotated file Show diff for this revision Revisions of this file
Tests/Test20.h Show annotated file Show diff for this revision Revisions of this file
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
--- a/TestManager.cpp	Wed Aug 29 14:13:49 2012 +0000
+++ b/TestManager.cpp	Thu Aug 30 14:06:22 2012 +0000
@@ -3,6 +3,7 @@
 TestManager::TestManager(VodafoneUSBModem *m) : _modem(m) { 
    _tests.push_back((VodafoneTestCase*)new Test20(_modem, 20));
    _tests.push_back((VodafoneTestCase*)new Test12(_modem, 12));
+   _tests.push_back((VodafoneTestCase*)new Test13(_modem, 13));
    // _tests.push_back((VodafoneTestCase*)new Test50(_modem, 50));
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Test13.h	Thu Aug 30 14:06:22 2012 +0000
@@ -0,0 +1,65 @@
+#pragma once
+#include "VodafoneTestCase.h"
+
+#define TEST_PHONE_NUMBER "+447717275049"
+
+// this test case will wait to receive an SMS from the modem.
+// if the method that reports a message waiting returns an error it will fail.
+// if the method that returns the message from the mailbox returns an error it will fai.
+// it will report the test as failed if any of the above happens.
+// it waits forever for an SMS.
+// TODO: this should wait for a set time before failing.
+
+
+class Test13 : public VodafoneTestCase {
+   public: 
+
+      char num[17];
+      char msg[64];
+      size_t count;
+      
+
+      Test13(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
+      }
+   
+      virtual bool runTest() {
+         LOG("Test %d waiting for an SMS message...", _testCaseNumber);
+         LOG("Receiving SMS from test phone, waiting for response.");
+      
+         while(true)
+            {
+             LOG("Waiting for an SMS message...");
+             int ret = _modem->getSMCount(&count);
+             if(ret)
+                {
+                    LOG("getSMCount returned %d", ret);
+                    Thread::wait(3000);
+                    continue;
+                }
+    
+             if( count > 0)
+                {
+                    LOG("%d SMS to read", count);
+                    ret = _modem->getSM(num, msg, 64);
+                if(ret)
+                    {
+                        LOG("Error receiving sms. The method getSMS  returned %d", ret);
+                        return false;
+                    }
+                LOG("The message is from number: %s and the message is: \"%s\"", num, msg);
+                return true;
+                }
+                Thread::wait(500);
+            }
+                  
+      }
+
+   private:
+      char gsm03dot38CharacterSet[127];
+      // gsm03dot38CharacterSet="@£$¥èéùìòÇØøÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !“#¤%&‘()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà";
+            
+
+
+
+
+};
\ No newline at end of file
--- a/Tests/Test20.h	Wed Aug 29 14:13:49 2012 +0000
+++ b/Tests/Test20.h	Thu Aug 30 14:06:22 2012 +0000
@@ -10,7 +10,7 @@
       }
    
       virtual bool runTest() {
-         LOG("Test %d waiting for an SMS message...", _testCaseNumber);
+         LOG("Test %d sending *#100# USSD message...", _testCaseNumber);
          LOG("Sending USSD, waiting for response.");
          
          if(_modem->sendUSSD("*#100#",_ussdResponse,16)!=0) {
--- a/Tests/Test50.h	Wed Aug 29 14:13:49 2012 +0000
+++ b/Tests/Test50.h	Thu Aug 30 14:06:22 2012 +0000
@@ -18,7 +18,7 @@
       virtual bool runTest() {
          int numIterations = 10;
          size_t smCount;
-         LOG("Test %d waiting for an SMS message...", _testCaseNumber);
+         LOG("Test %d getting MSISDN and sending SMS to myself...", _testCaseNumber);
          LOG("Getting MSISDN");
          _modem->sendUSSD("*#100#",_ownNumber,_numberLen);
          LOG("Got  MSISDN %s",_ownNumber);
--- a/Tests/Tests.h	Wed Aug 29 14:13:49 2012 +0000
+++ b/Tests/Tests.h	Thu Aug 30 14:06:22 2012 +0000
@@ -1,4 +1,5 @@
 #pragma once
 #include "Test12.h"
+#include "Test13.h"
 #include "Test20.h"
 #include "Test50.h"
\ No newline at end of file