Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
ashleymills
Date:
Thu Sep 06 15:13:38 2012 +0000
Revision:
27:0297dbc3252b
Parent:
26:9eefab9e28df
Child:
33:16126e029d58
Commended out dependency stuff. TestManager now prints numbers and descriptions of failed tests.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 22:5b1feecf2aeb 1 #pragma once
ashleymills 22:5b1feecf2aeb 2 #include "VodafoneTestCase.h"
ashleymills 27:0297dbc3252b 3 static const char* gTest25Description = "Retrieve signal strength and print it.";
ashleymills 27:0297dbc3252b 4 //const int gTest25Depends[] = {};
ashleymills 25:55b865c41f21 5
ashleymills 22:5b1feecf2aeb 6 class Test25 : public VodafoneTestCase {
ashleymills 22:5b1feecf2aeb 7 public:
ashleymills 22:5b1feecf2aeb 8 Test25(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
ashleymills 22:5b1feecf2aeb 9 }
ashleymills 22:5b1feecf2aeb 10
ashleymills 22:5b1feecf2aeb 11 virtual void setupTest() {
ashleymills 23:408199b5d2cb 12
ashleymills 22:5b1feecf2aeb 13 }
ashleymills 22:5b1feecf2aeb 14
ashleymills 22:5b1feecf2aeb 15 virtual bool runTest() {
ashleymills 22:5b1feecf2aeb 16
ashleymills 25:55b865c41f21 17 LOG(gTest25Description);
ashleymills 22:5b1feecf2aeb 18 int rssi = -1000;
ashleymills 22:5b1feecf2aeb 19 LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN;
ashleymills 22:5b1feecf2aeb 20 LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN;
ashleymills 22:5b1feecf2aeb 21
ashleymills 22:5b1feecf2aeb 22 if(_modem->getLinkState(&rssi, &regState, &bearer)==0) {
ashleymills 22:5b1feecf2aeb 23 if(rssi==-1000) {
ashleymills 22:5b1feecf2aeb 24 LOG("RSSI: Error.");
ashleymills 22:5b1feecf2aeb 25 return false;
ashleymills 22:5b1feecf2aeb 26 } else {
ashleymills 22:5b1feecf2aeb 27 LOG("RSSI: %d",rssi);
ashleymills 22:5b1feecf2aeb 28 }
ashleymills 22:5b1feecf2aeb 29
ashleymills 22:5b1feecf2aeb 30 switch(regState) {
ashleymills 22:5b1feecf2aeb 31 case LinkMonitor::REGISTRATION_STATE_UNKNOWN:
ashleymills 22:5b1feecf2aeb 32 LOG("regState: UNKNOWN. Failing.");
ashleymills 22:5b1feecf2aeb 33 return false;
ashleymills 22:5b1feecf2aeb 34 case LinkMonitor::REGISTRATION_STATE_REGISTERING:
ashleymills 22:5b1feecf2aeb 35 LOG("regState: REGISTERING");
ashleymills 22:5b1feecf2aeb 36 break;
ashleymills 22:5b1feecf2aeb 37 case LinkMonitor::REGISTRATION_STATE_DENIED:
ashleymills 22:5b1feecf2aeb 38 LOG("regState: DENIED");
ashleymills 22:5b1feecf2aeb 39 break;
ashleymills 22:5b1feecf2aeb 40 case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL:
ashleymills 22:5b1feecf2aeb 41 LOG("regState: NO SIGNAL");
ashleymills 22:5b1feecf2aeb 42 break;
ashleymills 22:5b1feecf2aeb 43 case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK:
ashleymills 22:5b1feecf2aeb 44 LOG("regState: HOME NETWORK");
ashleymills 22:5b1feecf2aeb 45 break;
ashleymills 22:5b1feecf2aeb 46 case LinkMonitor::REGISTRATION_STATE_ROAMING:
ashleymills 22:5b1feecf2aeb 47 LOG("regState: ROAMING");
ashleymills 22:5b1feecf2aeb 48 break;
ashleymills 22:5b1feecf2aeb 49 default:
ashleymills 22:5b1feecf2aeb 50 LOG("regState: ERROR. Failing.");
ashleymills 22:5b1feecf2aeb 51 return false;
ashleymills 22:5b1feecf2aeb 52 }
ashleymills 22:5b1feecf2aeb 53
ashleymills 22:5b1feecf2aeb 54 switch(bearer) {
ashleymills 22:5b1feecf2aeb 55 case LinkMonitor::BEARER_UNKNOWN:
ashleymills 22:5b1feecf2aeb 56 LOG("bearer: UNKNOWN. Failing.");
ashleymills 22:5b1feecf2aeb 57 return false;
ashleymills 22:5b1feecf2aeb 58 case LinkMonitor::BEARER_GSM:
ashleymills 22:5b1feecf2aeb 59 LOG("bearer: GSM");
ashleymills 22:5b1feecf2aeb 60 break;
ashleymills 22:5b1feecf2aeb 61 case LinkMonitor::BEARER_EDGE:
ashleymills 22:5b1feecf2aeb 62 LOG("bearer: EDGE");
ashleymills 22:5b1feecf2aeb 63 break;
ashleymills 22:5b1feecf2aeb 64 case LinkMonitor::BEARER_UMTS:
ashleymills 22:5b1feecf2aeb 65 LOG("bearer: UMTS");
ashleymills 22:5b1feecf2aeb 66 break;
ashleymills 22:5b1feecf2aeb 67 case LinkMonitor::BEARER_HSPA:
ashleymills 22:5b1feecf2aeb 68 LOG("bearer: HSPA");
ashleymills 22:5b1feecf2aeb 69 break;
ashleymills 22:5b1feecf2aeb 70 case LinkMonitor::BEARER_LTE:
ashleymills 22:5b1feecf2aeb 71 LOG("bearer: LTE");
ashleymills 22:5b1feecf2aeb 72 break;
ashleymills 22:5b1feecf2aeb 73 default:
ashleymills 22:5b1feecf2aeb 74 LOG("bearer: ERROR. Failing.");
ashleymills 22:5b1feecf2aeb 75 return false;
ashleymills 22:5b1feecf2aeb 76 }
ashleymills 22:5b1feecf2aeb 77
ashleymills 22:5b1feecf2aeb 78 } else {
ashleymills 22:5b1feecf2aeb 79 return false;
ashleymills 22:5b1feecf2aeb 80 }
ashleymills 22:5b1feecf2aeb 81
ashleymills 22:5b1feecf2aeb 82 return true;
ashleymills 22:5b1feecf2aeb 83 }
ashleymills 22:5b1feecf2aeb 84
ashleymills 22:5b1feecf2aeb 85 virtual void endTest() {
ashleymills 23:408199b5d2cb 86
ashleymills 22:5b1feecf2aeb 87 }
ashleymills 22:5b1feecf2aeb 88
ashleymills 22:5b1feecf2aeb 89 private:
ashleymills 23:408199b5d2cb 90
ashleymills 22:5b1feecf2aeb 91 };