Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Files at this revision

API Documentation at this revision

Comitter:
ashleymills
Date:
Thu Aug 23 13:32:32 2012 +0000
Parent:
2:ea883307d02f
Child:
4:1f8e079924ba
Child:
5:b68400bd0738
Commit message:
Added multiple tests

Changed in this revision

ExampleTest.h Show diff for this revision Revisions of this file
TestManager.cpp Show annotated file Show diff for this revision Revisions of this file
TestManager.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
VodafoneTestCase.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/ExampleTest.h	Wed Aug 22 13:27:34 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#pragma once
-#include "VodafoneTestCase.h"
-class ExampleTest : public VodafoneTestCase {
-   public: 
-      ExampleTest(VodafoneUSBModem *m) : VodafoneTestCase(m) {
-      }
-   
-      virtual bool runTest() {
-         LOG("Running USSD test 1212");
-         char ussdResponse[64];
-         if(_modem->sendUSSD("*#100#",ussdResponse,64)!=0) {
-            LOG("Error sending USSD");
-            return false;
-         }
-         
-         LOG("Received USSD response: \"%s\"",ussdResponse);
-         return true;
-      }
-};
\ No newline at end of file
--- a/TestManager.cpp	Wed Aug 22 13:27:34 2012 +0000
+++ b/TestManager.cpp	Thu Aug 23 13:32:32 2012 +0000
@@ -1,7 +1,8 @@
 #include "TestManager.h"
-#include "ExampleTest.h"
+#include "Tests.h"
 TestManager::TestManager(VodafoneUSBModem *m) : _modem(m) { 
-   _tests.push_back((VodafoneTestCase*)new ExampleTest(_modem));
+   _tests.push_back((VodafoneTestCase*)new Test20(_modem));
+   _tests.push_back((VodafoneTestCase*)new Test50(_modem));
 }
 
 int TestManager::runAll() {
--- a/TestManager.h	Wed Aug 22 13:27:34 2012 +0000
+++ b/TestManager.h	Thu Aug 23 13:32:32 2012 +0000
@@ -2,6 +2,12 @@
 #include "VodafoneUSBModem.h"
 #include "VodafoneTestCase.h"
 #include <vector>
+
+enum TestNames {
+   TEST0_SMSSHORT=0,
+   TEST1_SMSLONG
+};
+
 class TestManager {
 
    public:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Test20.h	Thu Aug 23 13:32:32 2012 +0000
@@ -0,0 +1,23 @@
+#pragma once
+#include "VodafoneTestCase.h"
+class Test20 : public VodafoneTestCase {
+   public: 
+      Test20(VodafoneUSBModem *m) : VodafoneTestCase(m) {
+      }
+   
+      virtual bool runTest() {
+         _lastRunTime = time(NULL);
+         LOG("Sending USSD, waiting for response.");
+         char ussdResponse[64];
+         if(_modem->sendUSSD("*#100#",ussdResponse,64)!=0) {
+            LOG("Error sending USSD");
+            _lastRunOutcome = false;
+            
+            return false;
+         }
+         
+         LOG("Received USSD response: \"%s\"",ussdResponse);
+         _lastRunOutcome = true;
+         return true;
+      }
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Test50.h	Thu Aug 23 13:32:32 2012 +0000
@@ -0,0 +1,19 @@
+#pragma once
+#include "VodafoneUSBModem.h"
+#include "LogHeader.h"
+class Test50 : public VodafoneTestCase {
+   public:
+      Test50(VodafoneUSBModem *m) : VodafoneTestCase(m) {
+         
+      }
+      
+      virtual bool runTest() {
+         LOG("Starting SMS-Socket loop soak test.");
+         
+         return true; 
+      }
+      
+   protected:
+      VodafoneUSBModem *_modem;
+      
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Tests.h	Thu Aug 23 13:32:32 2012 +0000
@@ -0,0 +1,3 @@
+#pragma once
+#include "Test20.h"
+#include "Test50.h"
\ No newline at end of file
--- a/VodafoneTestCase.h	Wed Aug 22 13:27:34 2012 +0000
+++ b/VodafoneTestCase.h	Thu Aug 23 13:32:32 2012 +0000
@@ -4,12 +4,14 @@
 class VodafoneTestCase {
    public:
       VodafoneTestCase(VodafoneUSBModem *m) : _modem(m) {
-         
+         _lastRunTime = -1;
+         _lastRunOutcome = false;
       }
       
       virtual bool runTest() { LOG("Base class runTest called!"); return true; }
       
    protected:
       VodafoneUSBModem *_modem;
-      
+      time_t _lastRunTime;
+      bool _lastRunOutcome;
 };
\ No newline at end of file
--- a/main.cpp	Wed Aug 22 13:27:34 2012 +0000
+++ b/main.cpp	Thu Aug 23 13:32:32 2012 +0000
@@ -10,7 +10,7 @@
 #include "rtos.h"
 #include "VodafoneUSBModem.h"
 #include "VodafoneTestCase.h"
-#include "ExampleTest.h"
+#include "Tests.h"
 #include "TestManager.h"
 
 DigitalOut led1(LED1);
@@ -32,12 +32,32 @@
   }
 }
 
+time_t startTime = 0;
+
+void setTime() {
+  struct tm t;
+  t.tm_year  = 2012;
+  t.tm_mon   = 8;
+  t.tm_mday  = 23;
+  t.tm_hour  = 9;
+  t.tm_min   = 19;
+  t.tm_sec   = 0;
+  t.tm_year -= 1900;
+  t.tm_mon  -= 1;
+  set_time(mktime(&t));
+}
+
 int main() {
 
   DBG_INIT();
   DBG_SET_SPEED(115200);
   DBG_SET_NEWLINE("\r\n");
 
+  //setTime();
+  size_t currentTime = time(NULL);
+  fprintf(stdout,"Invocation time: %s\r\n",ctime(&currentTime));
+  
+
   Thread testTask(test, NULL, osPriorityNormal, 1024 * 5);
   // this thread just waits and blinks leds periodically
   while(1) {