Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
ashleymills
Date:
Wed Sep 05 16:38:06 2012 +0000
Revision:
23:408199b5d2cb
Parent:
22:5b1feecf2aeb
Child:
25:55b865c41f21
Added internet test.

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