Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Tests/Test10.h@66:6b00a764e549, 2012-11-01 (annotated)
- Committer:
- ashleymills
- Date:
- Thu Nov 01 11:19:47 2012 +0000
- Revision:
- 66:6b00a764e549
- Parent:
- 44:6d0ac4747f5b
Renamed tests in sequential order to make it easier to manage and cleaner to follow.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashleymills | 24:8f0f9551122a | 1 | #pragma once |
ashleymills | 24:8f0f9551122a | 2 | #include "VodafoneTestCase.h" |
ashleymills | 66:6b00a764e549 | 3 | |
ashleymills | 66:6b00a764e549 | 4 | extern const char* gTest10Description; |
ashleymills | 24:8f0f9551122a | 5 | |
ashleymills | 24:8f0f9551122a | 6 | class Test10 : public VodafoneTestCase { |
ashleymills | 24:8f0f9551122a | 7 | public: |
ashleymills | 66:6b00a764e549 | 8 | Test10(VodafoneUSBModem *m) : VodafoneTestCase(m) {} |
ashleymills | 66:6b00a764e549 | 9 | |
ashleymills | 44:6d0ac4747f5b | 10 | private: |
ashleymills | 66:6b00a764e549 | 11 | |
ashleymills | 66:6b00a764e549 | 12 | virtual void setupTest() { |
ashleymills | 66:6b00a764e549 | 13 | |
ashleymills | 66:6b00a764e549 | 14 | } |
ashleymills | 66:6b00a764e549 | 15 | |
ashleymills | 66:6b00a764e549 | 16 | virtual bool executeTest() { |
ashleymills | 66:6b00a764e549 | 17 | LOG(gTest10Description); |
ashleymills | 66:6b00a764e549 | 18 | for(int count=0; count<30; count++) { |
ashleymills | 66:6b00a764e549 | 19 | LOG("Iteration %d of 30",count); |
ashleymills | 66:6b00a764e549 | 20 | int rssi = -1000; |
ashleymills | 66:6b00a764e549 | 21 | LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN; |
ashleymills | 66:6b00a764e549 | 22 | LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN; |
ashleymills | 66:6b00a764e549 | 23 | |
ashleymills | 66:6b00a764e549 | 24 | if(_modem->getLinkState(&rssi, ®State, &bearer)==0) { |
ashleymills | 66:6b00a764e549 | 25 | if(rssi==-1000) { |
ashleymills | 66:6b00a764e549 | 26 | LOG("RSSI: Error."); |
ashleymills | 66:6b00a764e549 | 27 | return false; |
ashleymills | 66:6b00a764e549 | 28 | } else { |
ashleymills | 66:6b00a764e549 | 29 | LOG("RSSI: %d",rssi); |
ashleymills | 66:6b00a764e549 | 30 | } |
ashleymills | 66:6b00a764e549 | 31 | |
ashleymills | 66:6b00a764e549 | 32 | switch(regState) { |
ashleymills | 66:6b00a764e549 | 33 | case LinkMonitor::REGISTRATION_STATE_UNKNOWN: |
ashleymills | 66:6b00a764e549 | 34 | LOG("regState: UNKNOWN. Failing."); |
ashleymills | 66:6b00a764e549 | 35 | return false; |
ashleymills | 66:6b00a764e549 | 36 | case LinkMonitor::REGISTRATION_STATE_REGISTERING: |
ashleymills | 66:6b00a764e549 | 37 | LOG("regState: REGISTERING"); |
ashleymills | 66:6b00a764e549 | 38 | break; |
ashleymills | 66:6b00a764e549 | 39 | case LinkMonitor::REGISTRATION_STATE_DENIED: |
ashleymills | 66:6b00a764e549 | 40 | LOG("regState: DENIED"); |
ashleymills | 66:6b00a764e549 | 41 | break; |
ashleymills | 66:6b00a764e549 | 42 | case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL: |
ashleymills | 66:6b00a764e549 | 43 | LOG("regState: NO SIGNAL"); |
ashleymills | 66:6b00a764e549 | 44 | break; |
ashleymills | 66:6b00a764e549 | 45 | case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK: |
ashleymills | 66:6b00a764e549 | 46 | LOG("regState: HOME NETWORK"); |
ashleymills | 66:6b00a764e549 | 47 | break; |
ashleymills | 66:6b00a764e549 | 48 | case LinkMonitor::REGISTRATION_STATE_ROAMING: |
ashleymills | 66:6b00a764e549 | 49 | LOG("regState: ROAMING"); |
ashleymills | 66:6b00a764e549 | 50 | break; |
ashleymills | 66:6b00a764e549 | 51 | default: |
ashleymills | 66:6b00a764e549 | 52 | LOG("regState: ERROR. Failing."); |
ashleymills | 66:6b00a764e549 | 53 | return false; |
ashleymills | 66:6b00a764e549 | 54 | } |
ashleymills | 66:6b00a764e549 | 55 | |
ashleymills | 66:6b00a764e549 | 56 | switch(bearer) { |
ashleymills | 66:6b00a764e549 | 57 | case LinkMonitor::BEARER_UNKNOWN: |
ashleymills | 66:6b00a764e549 | 58 | LOG("bearer: UNKNOWN. Failing."); |
ashleymills | 66:6b00a764e549 | 59 | return false; |
ashleymills | 66:6b00a764e549 | 60 | case LinkMonitor::BEARER_GSM: |
ashleymills | 66:6b00a764e549 | 61 | LOG("bearer: GSM"); |
ashleymills | 66:6b00a764e549 | 62 | break; |
ashleymills | 66:6b00a764e549 | 63 | case LinkMonitor::BEARER_EDGE: |
ashleymills | 66:6b00a764e549 | 64 | LOG("bearer: EDGE"); |
ashleymills | 66:6b00a764e549 | 65 | break; |
ashleymills | 66:6b00a764e549 | 66 | case LinkMonitor::BEARER_UMTS: |
ashleymills | 66:6b00a764e549 | 67 | LOG("bearer: UMTS"); |
ashleymills | 66:6b00a764e549 | 68 | break; |
ashleymills | 66:6b00a764e549 | 69 | case LinkMonitor::BEARER_HSPA: |
ashleymills | 66:6b00a764e549 | 70 | LOG("bearer: HSPA"); |
ashleymills | 66:6b00a764e549 | 71 | break; |
ashleymills | 66:6b00a764e549 | 72 | case LinkMonitor::BEARER_LTE: |
ashleymills | 66:6b00a764e549 | 73 | LOG("bearer: LTE"); |
ashleymills | 66:6b00a764e549 | 74 | break; |
ashleymills | 66:6b00a764e549 | 75 | default: |
ashleymills | 66:6b00a764e549 | 76 | LOG("bearer: ERROR. Failing."); |
ashleymills | 66:6b00a764e549 | 77 | return false; |
ashleymills | 66:6b00a764e549 | 78 | } |
ashleymills | 66:6b00a764e549 | 79 | } else { |
ashleymills | 66:6b00a764e549 | 80 | return false; |
ashleymills | 66:6b00a764e549 | 81 | } |
ashleymills | 66:6b00a764e549 | 82 | } |
ashleymills | 66:6b00a764e549 | 83 | |
ashleymills | 66:6b00a764e549 | 84 | return true; |
ashleymills | 66:6b00a764e549 | 85 | } |
ashleymills | 66:6b00a764e549 | 86 | |
ashleymills | 66:6b00a764e549 | 87 | virtual void endTest() { |
ashleymills | 66:6b00a764e549 | 88 | |
ashleymills | 66:6b00a764e549 | 89 | } |
ashleymills | 66:6b00a764e549 | 90 | |
ashleymills | 66:6b00a764e549 | 91 | }; |
ashleymills | 66:6b00a764e549 | 92 |