Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Test04.h
00001 #pragma once 00002 #include "VodafoneTestCase.h" 00003 //#define __DEBUG__ 1 00004 00005 // this test case will wait to send an SMS from the modem. 00006 // if the method that sends a message returns an error it will fail. 00007 // it will report the test as failed if any of the above happens. 00008 // it does not wait after it has succesfully sent an SMS. 00009 // this test basic characters and numbers can be sent via SMS. 00010 00011 extern const char *gTest04Description; 00012 extern const char *gTestPhoneNumber; 00013 extern const char *gAlphabetNumbersMessage; 00014 00015 class Test04 : public VodafoneTestCase { 00016 public: 00017 00018 Test04(VodafoneUSBModem *m) : VodafoneTestCase(m) {} 00019 00020 private: 00021 virtual bool executeTest() { 00022 LOG(gTest04Description); 00023 LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN; 00024 LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN; 00025 int rssi = -1000; 00026 if(_modem->getLinkState(&rssi, ®State, &bearer)==0) 00027 { 00028 if(rssi==-1000) 00029 { LOG("Checking signal strength - RSSI: Error."); return false;} 00030 else 00031 { LOG("Signal strength is: RSSI: %d",rssi);} 00032 00033 00034 switch(regState) { 00035 case LinkMonitor::REGISTRATION_STATE_UNKNOWN: 00036 LOG("regState: UNKNOWN. Failing."); 00037 return false; 00038 case LinkMonitor::REGISTRATION_STATE_REGISTERING: 00039 LOG("regState: REGISTERING"); 00040 break; 00041 case LinkMonitor::REGISTRATION_STATE_DENIED: 00042 LOG("regState: DENIED"); 00043 return false; 00044 case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL: 00045 LOG("regState: NO SIGNAL"); 00046 return false; 00047 case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK: 00048 LOG("regState: HOME NETWORK"); 00049 break; 00050 case LinkMonitor::REGISTRATION_STATE_ROAMING: 00051 LOG("regState: ROAMING"); 00052 break; 00053 default: 00054 LOG("regState: ERROR. Failing."); 00055 return false; 00056 } 00057 } 00058 00059 00060 LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", gIrregularMessage, gTestPhoneNumber); 00061 00062 int ret = _modem->sendSM(gTestPhoneNumber, gIrregularMessage); 00063 00064 if (ret) 00065 { 00066 LOG("Error in sending the SMS message. The return values is: %d", ret); 00067 00068 switch(ret){ 00069 case(NET_INVALID): LOG("Error message is: 'phone number is invalid size, must be less than 16 digits'.");break; 00070 case(NET_PROTOCOL): LOG("Error message is: 'protocol error from the modem'.");break; 00071 default: LOG("Undefined error message."); 00072 00073 } 00074 return false; 00075 } 00076 return true; 00077 } 00078 };
Generated on Sun Jul 17 2022 01:04:13 by 1.7.2