Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
nherriot
Date:
Thu Aug 30 14:06:22 2012 +0000
Revision:
16:c89d426c6175
Child:
26:9eefab9e28df
Child:
28:c630a04a7198
started working on other tc's.... small typos on log files .... still all works

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