Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
ashleymills
Date:
Wed Sep 05 14:47:44 2012 +0000
Revision:
22:5b1feecf2aeb
Child:
23:408199b5d2cb
Modified test suite for proper profiling. Added two more tests for signal strength.

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 Test25 : public VodafoneTestCase {
ashleymills 22:5b1feecf2aeb 4 public:
ashleymills 22:5b1feecf2aeb 5 Test25(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
ashleymills 22:5b1feecf2aeb 6 }
ashleymills 22:5b1feecf2aeb 7
ashleymills 22:5b1feecf2aeb 8 virtual void setupTest() {
ashleymills 22:5b1feecf2aeb 9 _ussdResponse = (char*)malloc(16*sizeof(char));
ashleymills 22:5b1feecf2aeb 10 }
ashleymills 22:5b1feecf2aeb 11
ashleymills 22:5b1feecf2aeb 12 virtual bool runTest() {
ashleymills 22:5b1feecf2aeb 13
ashleymills 22:5b1feecf2aeb 14 LOG("Test %d, getting signal strength.", _testCaseNumber);
ashleymills 22:5b1feecf2aeb 15 int rssi = -1000;
ashleymills 22:5b1feecf2aeb 16 LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN;
ashleymills 22:5b1feecf2aeb 17 LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN;
ashleymills 22:5b1feecf2aeb 18
ashleymills 22:5b1feecf2aeb 19 if(_modem->getLinkState(&rssi, &regState, &bearer)==0) {
ashleymills 22:5b1feecf2aeb 20 if(rssi==-1000) {
ashleymills 22:5b1feecf2aeb 21 LOG("RSSI: Error.");
ashleymills 22:5b1feecf2aeb 22 return false;
ashleymills 22:5b1feecf2aeb 23 } else {
ashleymills 22:5b1feecf2aeb 24 LOG("RSSI: %d",rssi);
ashleymills 22:5b1feecf2aeb 25 }
ashleymills 22:5b1feecf2aeb 26
ashleymills 22:5b1feecf2aeb 27 switch(regState) {
ashleymills 22:5b1feecf2aeb 28 case LinkMonitor::REGISTRATION_STATE_UNKNOWN:
ashleymills 22:5b1feecf2aeb 29 LOG("regState: UNKNOWN. Failing.");
ashleymills 22:5b1feecf2aeb 30 return false;
ashleymills 22:5b1feecf2aeb 31 break;
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 break;
ashleymills 22:5b1feecf2aeb 51 }
ashleymills 22:5b1feecf2aeb 52
ashleymills 22:5b1feecf2aeb 53 switch(bearer) {
ashleymills 22:5b1feecf2aeb 54 case LinkMonitor::BEARER_UNKNOWN:
ashleymills 22:5b1feecf2aeb 55 LOG("bearer: UNKNOWN. Failing.");
ashleymills 22:5b1feecf2aeb 56 return false;
ashleymills 22:5b1feecf2aeb 57 break;
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 break;
ashleymills 22:5b1feecf2aeb 77 }
ashleymills 22:5b1feecf2aeb 78
ashleymills 22:5b1feecf2aeb 79 } else {
ashleymills 22:5b1feecf2aeb 80 return false;
ashleymills 22:5b1feecf2aeb 81 }
ashleymills 22:5b1feecf2aeb 82
ashleymills 22:5b1feecf2aeb 83 return true;
ashleymills 22:5b1feecf2aeb 84 }
ashleymills 22:5b1feecf2aeb 85
ashleymills 22:5b1feecf2aeb 86 virtual void endTest() {
ashleymills 22:5b1feecf2aeb 87 free(_ussdResponse);
ashleymills 22:5b1feecf2aeb 88 }
ashleymills 22:5b1feecf2aeb 89
ashleymills 22:5b1feecf2aeb 90 private:
ashleymills 22:5b1feecf2aeb 91 char *_ussdResponse;
ashleymills 22:5b1feecf2aeb 92 };