Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
nherriot
Date:
Wed Sep 12 09:53:40 2012 +0000
Revision:
29:c0e6f198db84
Parent:
28:c630a04a7198
Child:
30:dd2beda340c6
adding some 'error' scenario test cases and many small changes to the test suite

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nherriot 28:c630a04a7198 1 #pragma once
nherriot 28:c630a04a7198 2 #include "VodafoneTestCase.h"
nherriot 28:c630a04a7198 3
nherriot 28:c630a04a7198 4
nherriot 28:c630a04a7198 5 // this test case will wait to receive an SMS from the modem.
nherriot 28:c630a04a7198 6 // if the method that reports a message waiting returns an error it will fail.
nherriot 28:c630a04a7198 7 // if the method that returns the message from the mailbox returns an error it will fai.
nherriot 28:c630a04a7198 8 // it will report the test as failed if any of the above happens.
nherriot 28:c630a04a7198 9 // it waits forever for an SMS.
nherriot 28:c630a04a7198 10 // TODO: this should wait for a set time before failing.
nherriot 28:c630a04a7198 11
nherriot 28:c630a04a7198 12
nherriot 28:c630a04a7198 13 class Test13 : public VodafoneTestCase {
nherriot 28:c630a04a7198 14 public:
nherriot 28:c630a04a7198 15
nherriot 28:c630a04a7198 16 char num[17];
nherriot 28:c630a04a7198 17 char msg[64];
nherriot 28:c630a04a7198 18 size_t count;
nherriot 28:c630a04a7198 19
nherriot 28:c630a04a7198 20
nherriot 28:c630a04a7198 21 Test13(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
nherriot 28:c630a04a7198 22 }
nherriot 28:c630a04a7198 23
nherriot 28:c630a04a7198 24 virtual bool runTest() {
nherriot 28:c630a04a7198 25 LOG("Creating GSM test buffer");
nherriot 28:c630a04a7198 26 LOG("Test %d waiting for an SMS message...", _testCaseNumber);
nherriot 28:c630a04a7198 27 LOG("Receiving SMS from test phone, waiting for response.");
nherriot 28:c630a04a7198 28
nherriot 28:c630a04a7198 29 while(true)
nherriot 28:c630a04a7198 30 {
nherriot 28:c630a04a7198 31 LOG("Waiting for an SMS message...");
nherriot 28:c630a04a7198 32 int ret = _modem->getSMCount(&count);
nherriot 28:c630a04a7198 33 if(ret)
nherriot 28:c630a04a7198 34 {
nherriot 28:c630a04a7198 35 LOG("getSMCount returned %d", ret);
nherriot 28:c630a04a7198 36 Thread::wait(3000);
nherriot 28:c630a04a7198 37 continue;
nherriot 28:c630a04a7198 38 }
nherriot 28:c630a04a7198 39
nherriot 28:c630a04a7198 40 if( count > 0)
nherriot 28:c630a04a7198 41 {
nherriot 28:c630a04a7198 42 LOG("%d SMS to read", count);
nherriot 28:c630a04a7198 43 ret = _modem->getSM(num, msg, 64);
nherriot 28:c630a04a7198 44 if(ret)
nherriot 28:c630a04a7198 45 {
nherriot 28:c630a04a7198 46 LOG("Error receiving sms. The method getSMS returned %d", ret);
nherriot 28:c630a04a7198 47 LOG("THE MESSAGE IS: %S", testMessage);
nherriot 28:c630a04a7198 48 LOG("THE MESSAGE IS: %S", myMessage);
nherriot 28:c630a04a7198 49 return false;
nherriot 28:c630a04a7198 50 }
nherriot 29:c0e6f198db84 51 LOG("The message is from number: %s and the message is: \"%s\"", num, msg);
nherriot 28:c630a04a7198 52 return true;
nherriot 28:c630a04a7198 53 }
nherriot 28:c630a04a7198 54 Thread::wait(500);
nherriot 28:c630a04a7198 55 }
nherriot 28:c630a04a7198 56
nherriot 28:c630a04a7198 57 }
nherriot 28:c630a04a7198 58
nherriot 28:c630a04a7198 59 private:
nherriot 28:c630a04a7198 60 char gsm03dot38CharacterSet[127];
nherriot 28:c630a04a7198 61 // gsm03dot38CharacterSet="@�$�����������&#916;_&#934;&#915;&#923;&#937;&#928;&#936;&#931;&#920;&#926;���� !�#�%&�()*+,-./0123456789:;<=>?�ABCDEFGHIJKLMNOPQRSTUVWXYZ���ܧ�abcdefghijklmnopqrstuvwxyz�����";
nherriot 28:c630a04a7198 62
nherriot 28:c630a04a7198 63
nherriot 28:c630a04a7198 64
nherriot 28:c630a04a7198 65
nherriot 28:c630a04a7198 66
nherriot 16:c89d426c6175 67 };