Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
ashleymills
Date:
Thu Sep 06 14:28:01 2012 +0000
Revision:
26:9eefab9e28df
Parent:
16:c89d426c6175
Child:
27:0297dbc3252b
Started changing test framework to add dependencies.;

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 26:9eefab9e28df 13 const int gTest13Depends[] = {};
nherriot 16:c89d426c6175 14
nherriot 16:c89d426c6175 15 class Test13 : public VodafoneTestCase {
nherriot 16:c89d426c6175 16 public:
nherriot 16:c89d426c6175 17
nherriot 16:c89d426c6175 18 char num[17];
nherriot 16:c89d426c6175 19 char msg[64];
nherriot 16:c89d426c6175 20 size_t count;
nherriot 16:c89d426c6175 21
nherriot 16:c89d426c6175 22
nherriot 16:c89d426c6175 23 Test13(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
nherriot 16:c89d426c6175 24 }
nherriot 16:c89d426c6175 25
nherriot 16:c89d426c6175 26 virtual bool runTest() {
nherriot 16:c89d426c6175 27 LOG("Test %d waiting for an SMS message...", _testCaseNumber);
nherriot 16:c89d426c6175 28 LOG("Receiving SMS from test phone, waiting for response.");
nherriot 16:c89d426c6175 29
nherriot 16:c89d426c6175 30 while(true)
nherriot 16:c89d426c6175 31 {
nherriot 16:c89d426c6175 32 LOG("Waiting for an SMS message...");
nherriot 16:c89d426c6175 33 int ret = _modem->getSMCount(&count);
nherriot 16:c89d426c6175 34 if(ret)
nherriot 16:c89d426c6175 35 {
nherriot 16:c89d426c6175 36 LOG("getSMCount returned %d", ret);
nherriot 16:c89d426c6175 37 Thread::wait(3000);
nherriot 16:c89d426c6175 38 continue;
nherriot 16:c89d426c6175 39 }
nherriot 16:c89d426c6175 40
nherriot 16:c89d426c6175 41 if( count > 0)
nherriot 16:c89d426c6175 42 {
nherriot 16:c89d426c6175 43 LOG("%d SMS to read", count);
nherriot 16:c89d426c6175 44 ret = _modem->getSM(num, msg, 64);
nherriot 16:c89d426c6175 45 if(ret)
nherriot 16:c89d426c6175 46 {
nherriot 16:c89d426c6175 47 LOG("Error receiving sms. The method getSMS returned %d", ret);
nherriot 16:c89d426c6175 48 return false;
nherriot 16:c89d426c6175 49 }
nherriot 16:c89d426c6175 50 LOG("The message is from number: %s and the message is: \"%s\"", num, msg);
nherriot 16:c89d426c6175 51 return true;
nherriot 16:c89d426c6175 52 }
nherriot 16:c89d426c6175 53 Thread::wait(500);
nherriot 16:c89d426c6175 54 }
nherriot 16:c89d426c6175 55
nherriot 16:c89d426c6175 56 }
nherriot 16:c89d426c6175 57
nherriot 16:c89d426c6175 58 private:
nherriot 16:c89d426c6175 59 char gsm03dot38CharacterSet[127];
nherriot 16:c89d426c6175 60 // gsm03dot38CharacterSet="@£$¥èéùìòÇØøÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !“#¤%&‘()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà";
nherriot 16:c89d426c6175 61
nherriot 16:c89d426c6175 62
nherriot 16:c89d426c6175 63
nherriot 16:c89d426c6175 64
nherriot 16:c89d426c6175 65
nherriot 16:c89d426c6175 66 };