Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Revision:
5:b68400bd0738
Child:
7:ec0db221f897
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Test12.h	Thu Aug 23 15:43:14 2012 +0000
@@ -0,0 +1,50 @@
+#pragma once
+#include "VodafoneTestCase.h"
+
+#define TEST_PHONE_NUMBER "+447717275049"
+
+class Test12 : public VodafoneTestCase {
+   public: 
+      int test_number = 12;
+      char num[17];
+      char msg[64];
+      size_t count;
+
+      Test12(VodafoneUSBModem *m) : VodafoneTestCase(m) {
+      }
+   
+      virtual bool runTest() {
+         _lastRunTime = time(NULL);
+         LOG("Receiving SMS from test phone, waiting for response.");
+         char smsResponse[64];
+      
+         while(TRUE)
+            {
+             LOG("Test %d waiting for an SMS message...", test_number);
+             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);
+                        _lastRunOutcome = true;
+                        return false;
+                    }
+                LOG("The message is from number: %s and the message is: \"%s\"", num, msg);
+                _lastRunOutcome = true;
+                return true;
+                }
+                Thread::wait(500);
+            }
+                  
+      }
+};
\ No newline at end of file