Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Test05.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 00012 extern const char *gTest05Description; 00013 00014 class Test05 : public VodafoneTestCase { 00015 public: 00016 00017 00018 Test05(VodafoneUSBModem *m) : VodafoneTestCase(m) {} 00019 00020 private: 00021 00022 virtual bool executeTest() { 00023 LOG(gTest05Description); 00024 LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN; 00025 LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN; 00026 int rssi = -1000; 00027 if(_modem->getLinkState(&rssi, ®State, &bearer)==0) 00028 { 00029 if(rssi==-1000) 00030 { LOG("Checking signal strength - RSSI: Error."); return false;} 00031 else 00032 { LOG("Signal strength is: RSSI: %d",rssi);} 00033 00034 00035 switch(regState) { 00036 case LinkMonitor::REGISTRATION_STATE_UNKNOWN: 00037 LOG("regState: UNKNOWN. Failing."); 00038 return false; 00039 case LinkMonitor::REGISTRATION_STATE_REGISTERING: 00040 LOG("regState: REGISTERING"); 00041 break; 00042 case LinkMonitor::REGISTRATION_STATE_DENIED: 00043 LOG("regState: DENIED"); 00044 return false; 00045 case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL: 00046 LOG("regState: NO SIGNAL"); 00047 return false; 00048 case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK: 00049 LOG("regState: HOME NETWORK"); 00050 break; 00051 case LinkMonitor::REGISTRATION_STATE_ROAMING: 00052 LOG("regState: ROAMING"); 00053 break; 00054 default: 00055 LOG("regState: ERROR. Failing."); 00056 return false; 00057 } 00058 } 00059 00060 00061 LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", gAlphabetNumbersMessage, gTestPhoneNumber); 00062 00063 int ret = _modem->sendSM(gTestPhoneNumber, gAlphabetNumbersMessage); 00064 00065 if (ret) 00066 { 00067 LOG("Error in sending the SMS message. The return values is: %d", ret); 00068 00069 switch(ret){ 00070 case(NET_INVALID): LOG("Error message is: 'phone number is invalid size, must be less than 16 digits'.");break; 00071 case(NET_PROTOCOL): LOG("Error message is: 'protocol error from the modem'.");break; 00072 default: LOG("Undefined error message."); 00073 00074 } 00075 return false; 00076 } 00077 return true; 00078 } 00079 };
Generated on Sun Jul 17 2022 01:04:13 by
1.7.2