Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Revision:
66:6b00a764e549
Parent:
65:ef3357b6ce97
Child:
67:a61d60fa342c
--- a/Tests/Test50.h	Tue Oct 30 15:51:53 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-#pragma once
-#include "VodafoneTestCase.h"
-
-extern const char* gTest50Description;
-
-class Test50 : public VodafoneTestCase {
-   public:
-      Test50(VodafoneUSBModem *m) : VodafoneTestCase(m) {
-         _smsLen = 32;
-         _smsMaxSize = 160;     // max size of SMS using 
-         _numberLen = 16;
-      }
-      
-   private:
-      
-      virtual void setupTest() {
-         allocStorage();
-      }
-      
-      virtual void endTest() {
-         freeStorage();
-      }
-      
-      virtual bool executeTest() {
-         LOG(gTest50Description);
-         int numIterations = 10;
-         size_t smCount;
-              
-         // Clear out the SMS mail box before we run this test.
-         // loop 3 times with a 1/2 second break in between each
-         LOG("... Clearing out SMS mail box first");
-         for(int j=0; j<3; j++) {
-            if(_modem->getSMCount(&smCount)!=0) {
-               LOG("Faiure getting SM count");
-               return false;
-            }
-         
-            for(int i=0; i<smCount; i++) {
-               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.");
-            }
-            Thread::wait(500);
-         }
-
-         LOG("Getting MSISDN");
-         _modem->sendUSSD("*#100#",_ownNumber,_numberLen);
-         LOG("Got  MSISDN %s",_ownNumber);
-         for(int i=0; i<numIterations; i++) {
-            createRandomString(_smsOut,_smsLen);
-            if(_modem->sendSM(_ownNumber,_smsOut)!=0) {
-               LOG("Error sending short message");
-            }
-            LOG("Created: %s",_smsOut);
-            bool gotMessage = false;
-            Timer t;
-            t.start();
-            while(!gotMessage && t.read_ms()<25000) {
-               if(_modem->getSMCount(&smCount)!=0) {
-                  LOG("Faiure getting SM count");
-                  return false;
-               }
-               
-               if(smCount>0) {
-                  if(_modem->getSM(_senderNumber,_smsIn,_smsLen)!=0) {
-                     LOG("Failure getting SM");
-                     return false;
-                  }
-                  LOG("Got SMS: %s",_smsIn);
-                  if(strcmp(_smsIn,_smsOut)!=0) {
-                     LOG("FAIL: strings did not match");
-                     return false;
-                  }
-                  gotMessage = true;
-               }
-               Thread::wait(50);
-            }
-            if(!gotMessage) {
-               LOG("FAIL: timeout on waiting for SMS");
-               return false;
-            }
-         }
-         
-         return true;
-      }
-      
-      void createRandomString(char *target, int len) {
-         for(int i=0; i<len; i++) {
-            target[i] = 65+rand()%16;
-         }
-         target[len-1] = 0x00;
-      }
-      
-      void allocStorage() {
-         _ownNumber    = (char*)malloc(_numberLen*sizeof(char));
-         _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() {
-         free(_ownNumber);
-         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