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 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 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 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 break;
ashleymills 22:5b1feecf2aeb 33 case LinkMonitor::REGISTRATION_STATE_REGISTERING:
ashleymills 22:5b1feecf2aeb 34 LOG("regState: REGISTERING");
ashleymills 22:5b1feecf2aeb 35 break;
ashleymills 22:5b1feecf2aeb 36 case LinkMonitor::REGISTRATION_STATE_DENIED:
ashleymills 22:5b1feecf2aeb 37 LOG("regState: DENIED");
ashleymills 22:5b1feecf2aeb 38 break;
ashleymills 22:5b1feecf2aeb 39 case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL:
ashleymills 22:5b1feecf2aeb 40 LOG("regState: NO SIGNAL");
ashleymills 22:5b1feecf2aeb 41 break;
ashleymills 22:5b1feecf2aeb 42 case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK:
ashleymills 22:5b1feecf2aeb 43 LOG("regState: HOME NETWORK");
ashleymills 22:5b1feecf2aeb 44 break;
ashleymills 22:5b1feecf2aeb 45 case LinkMonitor::REGISTRATION_STATE_ROAMING:
ashleymills 22:5b1feecf2aeb 46 LOG("regState: ROAMING");
ashleymills 22:5b1feecf2aeb 47 break;
ashleymills 22:5b1feecf2aeb 48 default:
ashleymills 22:5b1feecf2aeb 49 LOG("regState: ERROR. Failing.");
ashleymills 22:5b1feecf2aeb 50 return false;
ashleymills 22:5b1feecf2aeb 51 break;
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 break;
ashleymills 22:5b1feecf2aeb 59 case LinkMonitor::BEARER_GSM:
ashleymills 22:5b1feecf2aeb 60 LOG("bearer: GSM");
ashleymills 22:5b1feecf2aeb 61 break;
ashleymills 22:5b1feecf2aeb 62 case LinkMonitor::BEARER_EDGE:
ashleymills 22:5b1feecf2aeb 63 LOG("bearer: EDGE");
ashleymills 22:5b1feecf2aeb 64 break;
ashleymills 22:5b1feecf2aeb 65 case LinkMonitor::BEARER_UMTS:
ashleymills 22:5b1feecf2aeb 66 LOG("bearer: UMTS");
ashleymills 22:5b1feecf2aeb 67 break;
ashleymills 22:5b1feecf2aeb 68 case LinkMonitor::BEARER_HSPA:
ashleymills 22:5b1feecf2aeb 69 LOG("bearer: HSPA");
ashleymills 22:5b1feecf2aeb 70 break;
ashleymills 22:5b1feecf2aeb 71 case LinkMonitor::BEARER_LTE:
ashleymills 22:5b1feecf2aeb 72 LOG("bearer: LTE");
ashleymills 22:5b1feecf2aeb 73 break;
ashleymills 22:5b1feecf2aeb 74 default:
ashleymills 22:5b1feecf2aeb 75 LOG("bearer: ERROR. Failing.");
ashleymills 22:5b1feecf2aeb 76 return false;
ashleymills 22:5b1feecf2aeb 77 break;
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
ashleymills 22:5b1feecf2aeb 84 return true;
ashleymills 22:5b1feecf2aeb 85 }
ashleymills 22:5b1feecf2aeb 86
ashleymills 22:5b1feecf2aeb 87 virtual void endTest() {
ashleymills 22:5b1feecf2aeb 88 free(_ussdResponse);
ashleymills 22:5b1feecf2aeb 89 }
ashleymills 22:5b1feecf2aeb 90
ashleymills 22:5b1feecf2aeb 91 private:
ashleymills 22:5b1feecf2aeb 92 char *_ussdResponse;
ashleymills 22:5b1feecf2aeb 93 };
ashleymills 22:5b1feecf2aeb 94