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