Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Test10.h Source File

Test10.h

00001 #pragma once
00002 #include "VodafoneTestCase.h"
00003 
00004 extern const char* gTest10Description;
00005 
00006 class Test10 : public VodafoneTestCase {
00007    public: 
00008       Test10(VodafoneUSBModem *m) : VodafoneTestCase(m) {}
00009    
00010    private:
00011       
00012       virtual void setupTest() {
00013          
00014       }
00015    
00016       virtual bool executeTest() {
00017          LOG(gTest10Description);
00018          for(int count=0; count<30; count++) {
00019             LOG("Iteration %d of 30",count);
00020             int rssi = -1000;
00021             LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN;
00022             LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN;
00023         
00024             if(_modem->getLinkState(&rssi, &regState, &bearer)==0) {
00025                if(rssi==-1000) {
00026                   LOG("RSSI: Error.");
00027                   return false;
00028                } else {
00029                   LOG("RSSI: %d",rssi);
00030                }
00031             
00032                switch(regState) {
00033                   case LinkMonitor::REGISTRATION_STATE_UNKNOWN:
00034                      LOG("regState: UNKNOWN. Failing.");
00035                      return false;
00036                   case LinkMonitor::REGISTRATION_STATE_REGISTERING:
00037                      LOG("regState: REGISTERING");
00038                      break;
00039                   case LinkMonitor::REGISTRATION_STATE_DENIED:
00040                      LOG("regState: DENIED");
00041                      break;
00042                   case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL:
00043                      LOG("regState: NO SIGNAL");
00044                      break;
00045                   case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK:
00046                      LOG("regState: HOME NETWORK");
00047                      break;
00048                   case LinkMonitor::REGISTRATION_STATE_ROAMING:
00049                      LOG("regState: ROAMING");
00050                      break;
00051                   default:
00052                      LOG("regState: ERROR. Failing.");
00053                      return false;
00054                }
00055             
00056                switch(bearer) {
00057                   case LinkMonitor::BEARER_UNKNOWN:
00058                      LOG("bearer: UNKNOWN. Failing.");
00059                      return false;
00060                   case LinkMonitor::BEARER_GSM:
00061                      LOG("bearer: GSM");
00062                      break;
00063                   case LinkMonitor::BEARER_EDGE:
00064                      LOG("bearer: EDGE");
00065                      break;
00066                   case LinkMonitor::BEARER_UMTS:
00067                      LOG("bearer: UMTS");
00068                      break;
00069                   case LinkMonitor::BEARER_HSPA:
00070                      LOG("bearer: HSPA");
00071                      break;
00072                   case LinkMonitor::BEARER_LTE:
00073                      LOG("bearer: LTE");
00074                      break;
00075                   default:
00076                      LOG("bearer: ERROR. Failing.");
00077                      return false;
00078                }
00079             } else {
00080                return false;
00081             }
00082          }
00083          
00084          return true;
00085       }
00086       
00087       virtual void endTest() {
00088          
00089       }
00090       
00091 };
00092