Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Tests/Test12.h
- Committer:
- ashleymills
- Date:
- 2012-09-06
- Revision:
- 26:9eefab9e28df
- Parent:
- 25:55b865c41f21
- Child:
- 27:0297dbc3252b
File content as of revision 26:9eefab9e28df:
#pragma once #include "VodafoneTestCase.h" #define TEST_PHONE_NUMBER "+447717275049" // this test case will wait to receive an SMS from the modem. // if the method that reports a message waiting returns an error it will fail. // if the method that returns the message from the mailbox returns an error it will fai. // it will report the test as failed if any of the above happens. // it waits forever for an SMS. // TODO: this should wait for a set time before failing. static const char *gTest12Description = "Waiting for an SMS message...\0"; const int gTest12Depends[] = {}; class Test12 : public VodafoneTestCase { public: char num[17]; char msg[64]; size_t count; Test12(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { } virtual bool runTest() { LOG("Test: %d",_testCaseNumber); LOG(gTest12Description); LOG("Receiving SMS from test phone, waiting for response."); while(true) { LOG("Waiting for an SMS message..."); int ret = _modem->getSMCount(&count); if(ret) { LOG("getSMCount returned %d", ret); Thread::wait(3000); continue; } if( count > 0) { LOG("%d SMS to read", count); ret = _modem->getSM(num, msg, 64); if(ret) { LOG("Error receiving sms. The method getSMS returned %d", ret); return false; } LOG("The message is from number: %s and the message is: \"%s\"", num, msg); return true; } Thread::wait(500); } } };