Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Diff: Tests/Test56.h
- Revision:
- 29:c0e6f198db84
- Child:
- 31:9231acdde9ff
diff -r c630a04a7198 -r c0e6f198db84 Tests/Test56.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Tests/Test56.h Wed Sep 12 09:53:40 2012 +0000 @@ -0,0 +1,96 @@ +#pragma once +#include "VodafoneTestCase.h" +//#define __DEBUG__ 1 + +// this test case will wait to send an SMS from the modem. +// if the method that sends a message returns an error it will fail. +// it will report the test as failed if any of the above happens. +// it does not wait after it has succesfully sent an SMS. + + +class Test56 : public VodafoneTestCase { + public: + + + Test56(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { + } + + + virtual bool runTest() { + + LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN; + LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN; + int rssi = -1000; + if(_modem->getLinkState(&rssi, ®State, &bearer)==0) + { + if(rssi==-1000) + { LOG("Checking signal strength - RSSI: Error."); return false;} + else + { LOG("Signal strength is: RSSI: %d",rssi);} + + + switch(regState) { + case LinkMonitor::REGISTRATION_STATE_UNKNOWN: + LOG("regState: UNKNOWN. Failing."); + return false; + case LinkMonitor::REGISTRATION_STATE_REGISTERING: + LOG("regState: REGISTERING"); + break; + case LinkMonitor::REGISTRATION_STATE_DENIED: + LOG("regState: DENIED"); + return false; + case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL: + LOG("regState: NO SIGNAL"); + return false; + case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK: + LOG("regState: HOME NETWORK"); + break; + case LinkMonitor::REGISTRATION_STATE_ROAMING: + LOG("regState: ROAMING"); + break; + default: + LOG("regState: ERROR. Failing."); + return false; + } + } + + LOG("Creating GSM test buffer"); + LOG("Test %d sending an SMS message...", _testCaseNumber); + LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", allCharsMessage, testPhoneNumber); + + // create a buffer and send each character until you can send them all + char shortBuffer[30]; + + for (int i=0; i < sizeof(irregularMessage); i++) + { + shortBuffer[i] = irregularMessage[i]; + LOG("Buffer is now: %s", shortBuffer); + LOG("Irregular message is %s", irregularMessage); + + + } + + int ret = _modem->sendSM(testPhoneNumber, irregularMessage); + + if (ret) + { + LOG("Error in sending the SMS message. The return values is: %d", ret); + + switch(ret){ + case(NET_INVALID): LOG("Error message is: 'phone number is invalid size, must be less than 16 digits'.");break; + case(NET_PROTOCOL): LOG("Error message is: 'protocol error from the modem'.");break; + default: LOG("Undefined error message."); + + } + return false; + } + LOG("Test %d passed...", _testCaseNumber); + return true; + + } + + private: + char gsm03dot38CharacterSet[127]; + + +}; \ No newline at end of file