Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Tests/Test20.h@4:1f8e079924ba, 2012-08-23 (annotated)
- Committer:
- ashleymills
- Date:
- Thu Aug 23 15:41:20 2012 +0000
- Revision:
- 4:1f8e079924ba
- Parent:
- 3:28336c2e94e4
- Child:
- 8:6c30647f75d7
Added setup and teardown code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashleymills | 3:28336c2e94e4 | 1 | #pragma once |
ashleymills | 3:28336c2e94e4 | 2 | #include "VodafoneTestCase.h" |
ashleymills | 3:28336c2e94e4 | 3 | class Test20 : public VodafoneTestCase { |
ashleymills | 3:28336c2e94e4 | 4 | public: |
ashleymills | 3:28336c2e94e4 | 5 | Test20(VodafoneUSBModem *m) : VodafoneTestCase(m) { |
ashleymills | 3:28336c2e94e4 | 6 | } |
ashleymills | 3:28336c2e94e4 | 7 | |
ashleymills | 3:28336c2e94e4 | 8 | virtual bool runTest() { |
ashleymills | 4:1f8e079924ba | 9 | char* ussdResponse = (char*)malloc(16*sizeof(char)); |
ashleymills | 3:28336c2e94e4 | 10 | _lastRunTime = time(NULL); |
ashleymills | 3:28336c2e94e4 | 11 | LOG("Sending USSD, waiting for response."); |
ashleymills | 4:1f8e079924ba | 12 | |
ashleymills | 4:1f8e079924ba | 13 | if(_modem->sendUSSD("*#100#",ussdResponse,16)!=0) { |
ashleymills | 3:28336c2e94e4 | 14 | LOG("Error sending USSD"); |
ashleymills | 3:28336c2e94e4 | 15 | _lastRunOutcome = false; |
ashleymills | 4:1f8e079924ba | 16 | free(ussdResponse); |
ashleymills | 3:28336c2e94e4 | 17 | return false; |
ashleymills | 3:28336c2e94e4 | 18 | } |
ashleymills | 3:28336c2e94e4 | 19 | |
ashleymills | 3:28336c2e94e4 | 20 | LOG("Received USSD response: \"%s\"",ussdResponse); |
ashleymills | 3:28336c2e94e4 | 21 | _lastRunOutcome = true; |
ashleymills | 4:1f8e079924ba | 22 | free(ussdResponse); |
ashleymills | 3:28336c2e94e4 | 23 | return true; |
ashleymills | 3:28336c2e94e4 | 24 | } |
ashleymills | 3:28336c2e94e4 | 25 | }; |