Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
ashleymills
Date:
Thu Sep 06 15:13:38 2012 +0000
Revision:
27:0297dbc3252b
Parent:
26:9eefab9e28df
Child:
30:dd2beda340c6
Commended out dependency stuff. TestManager now prints numbers and descriptions of failed tests.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nherriot 16:c89d426c6175 1 #pragma once
nherriot 16:c89d426c6175 2 #include "VodafoneTestCase.h"
nherriot 16:c89d426c6175 3
nherriot 16:c89d426c6175 4 #define TEST_PHONE_NUMBER "+447717275049"
nherriot 16:c89d426c6175 5
nherriot 16:c89d426c6175 6 // this test case will wait to receive an SMS from the modem.
nherriot 16:c89d426c6175 7 // if the method that reports a message waiting returns an error it will fail.
nherriot 16:c89d426c6175 8 // if the method that returns the message from the mailbox returns an error it will fai.
nherriot 16:c89d426c6175 9 // it will report the test as failed if any of the above happens.
nherriot 16:c89d426c6175 10 // it waits forever for an SMS.
nherriot 16:c89d426c6175 11 // TODO: this should wait for a set time before failing.
nherriot 16:c89d426c6175 12
ashleymills 27:0297dbc3252b 13 static const char *gTest13Description = "Waiting for an SMS message...";
ashleymills 27:0297dbc3252b 14 //const int gTest13Depends[] = {};
nherriot 16:c89d426c6175 15
nherriot 16:c89d426c6175 16 class Test13 : public VodafoneTestCase {
nherriot 16:c89d426c6175 17 public:
nherriot 16:c89d426c6175 18
nherriot 16:c89d426c6175 19 char num[17];
nherriot 16:c89d426c6175 20 char msg[64];
nherriot 16:c89d426c6175 21 size_t count;
nherriot 16:c89d426c6175 22
nherriot 16:c89d426c6175 23
nherriot 16:c89d426c6175 24 Test13(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
nherriot 16:c89d426c6175 25 }
nherriot 16:c89d426c6175 26
nherriot 16:c89d426c6175 27 virtual bool runTest() {
nherriot 16:c89d426c6175 28 LOG("Test %d waiting for an SMS message...", _testCaseNumber);
nherriot 16:c89d426c6175 29 LOG("Receiving SMS from test phone, waiting for response.");
nherriot 16:c89d426c6175 30
nherriot 16:c89d426c6175 31 while(true)
nherriot 16:c89d426c6175 32 {
nherriot 16:c89d426c6175 33 LOG("Waiting for an SMS message...");
nherriot 16:c89d426c6175 34 int ret = _modem->getSMCount(&count);
nherriot 16:c89d426c6175 35 if(ret)
nherriot 16:c89d426c6175 36 {
nherriot 16:c89d426c6175 37 LOG("getSMCount returned %d", ret);
nherriot 16:c89d426c6175 38 Thread::wait(3000);
nherriot 16:c89d426c6175 39 continue;
nherriot 16:c89d426c6175 40 }
nherriot 16:c89d426c6175 41
nherriot 16:c89d426c6175 42 if( count > 0)
nherriot 16:c89d426c6175 43 {
nherriot 16:c89d426c6175 44 LOG("%d SMS to read", count);
nherriot 16:c89d426c6175 45 ret = _modem->getSM(num, msg, 64);
nherriot 16:c89d426c6175 46 if(ret)
nherriot 16:c89d426c6175 47 {
nherriot 16:c89d426c6175 48 LOG("Error receiving sms. The method getSMS returned %d", ret);
nherriot 16:c89d426c6175 49 return false;
nherriot 16:c89d426c6175 50 }
nherriot 16:c89d426c6175 51 LOG("The message is from number: %s and the message is: \"%s\"", num, msg);
nherriot 16:c89d426c6175 52 return true;
nherriot 16:c89d426c6175 53 }
nherriot 16:c89d426c6175 54 Thread::wait(500);
nherriot 16:c89d426c6175 55 }
nherriot 16:c89d426c6175 56
nherriot 16:c89d426c6175 57 }
nherriot 16:c89d426c6175 58
nherriot 16:c89d426c6175 59 private:
nherriot 16:c89d426c6175 60 char gsm03dot38CharacterSet[127];
nherriot 16:c89d426c6175 61 // gsm03dot38CharacterSet="@£$¥èéùìòÇØøÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !“#¤%&‘()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà";
nherriot 16:c89d426c6175 62
nherriot 16:c89d426c6175 63
nherriot 16:c89d426c6175 64
nherriot 16:c89d426c6175 65
nherriot 16:c89d426c6175 66
nherriot 16:c89d426c6175 67 };