Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
ashleymills
Date:
Wed Jan 29 16:34:38 2014 +0000
Revision:
74:e52ac9624f7f
Parent:
66:6b00a764e549
Updated dependencies to latest versions.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 66:6b00a764e549 1 #pragma once
ashleymills 66:6b00a764e549 2 #include "VodafoneTestCase.h"
ashleymills 66:6b00a764e549 3 //#define __DEBUG__ 1
ashleymills 66:6b00a764e549 4
ashleymills 66:6b00a764e549 5 // this test case will wait to send an SMS from the modem.
ashleymills 66:6b00a764e549 6 // if the method that sends a message returns an error it will fail.
ashleymills 66:6b00a764e549 7 // it will report the test as failed if any of the above happens.
ashleymills 66:6b00a764e549 8 // it does not wait after it has succesfully sent an SMS.
ashleymills 66:6b00a764e549 9 // this test basic characters and numbers can be sent via SMS.
ashleymills 66:6b00a764e549 10
ashleymills 66:6b00a764e549 11 extern const char *gTest04Description;
ashleymills 66:6b00a764e549 12 extern const char *gTestPhoneNumber;
ashleymills 66:6b00a764e549 13 extern const char *gAlphabetNumbersMessage;
ashleymills 66:6b00a764e549 14
ashleymills 66:6b00a764e549 15 class Test04 : public VodafoneTestCase {
ashleymills 66:6b00a764e549 16 public:
ashleymills 66:6b00a764e549 17
ashleymills 66:6b00a764e549 18 Test04(VodafoneUSBModem *m) : VodafoneTestCase(m) {}
ashleymills 66:6b00a764e549 19
ashleymills 66:6b00a764e549 20 private:
ashleymills 66:6b00a764e549 21 virtual bool executeTest() {
ashleymills 66:6b00a764e549 22 LOG(gTest04Description);
ashleymills 66:6b00a764e549 23 LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN;
ashleymills 66:6b00a764e549 24 LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN;
ashleymills 66:6b00a764e549 25 int rssi = -1000;
ashleymills 66:6b00a764e549 26 if(_modem->getLinkState(&rssi, &regState, &bearer)==0)
ashleymills 66:6b00a764e549 27 {
ashleymills 66:6b00a764e549 28 if(rssi==-1000)
ashleymills 66:6b00a764e549 29 { LOG("Checking signal strength - RSSI: Error."); return false;}
ashleymills 66:6b00a764e549 30 else
ashleymills 66:6b00a764e549 31 { LOG("Signal strength is: RSSI: %d",rssi);}
ashleymills 66:6b00a764e549 32
ashleymills 66:6b00a764e549 33
ashleymills 66:6b00a764e549 34 switch(regState) {
ashleymills 66:6b00a764e549 35 case LinkMonitor::REGISTRATION_STATE_UNKNOWN:
ashleymills 66:6b00a764e549 36 LOG("regState: UNKNOWN. Failing.");
ashleymills 66:6b00a764e549 37 return false;
ashleymills 66:6b00a764e549 38 case LinkMonitor::REGISTRATION_STATE_REGISTERING:
ashleymills 66:6b00a764e549 39 LOG("regState: REGISTERING");
ashleymills 66:6b00a764e549 40 break;
ashleymills 66:6b00a764e549 41 case LinkMonitor::REGISTRATION_STATE_DENIED:
ashleymills 66:6b00a764e549 42 LOG("regState: DENIED");
ashleymills 66:6b00a764e549 43 return false;
ashleymills 66:6b00a764e549 44 case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL:
ashleymills 66:6b00a764e549 45 LOG("regState: NO SIGNAL");
ashleymills 66:6b00a764e549 46 return false;
ashleymills 66:6b00a764e549 47 case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK:
ashleymills 66:6b00a764e549 48 LOG("regState: HOME NETWORK");
ashleymills 66:6b00a764e549 49 break;
ashleymills 66:6b00a764e549 50 case LinkMonitor::REGISTRATION_STATE_ROAMING:
ashleymills 66:6b00a764e549 51 LOG("regState: ROAMING");
ashleymills 66:6b00a764e549 52 break;
ashleymills 66:6b00a764e549 53 default:
ashleymills 66:6b00a764e549 54 LOG("regState: ERROR. Failing.");
ashleymills 66:6b00a764e549 55 return false;
ashleymills 66:6b00a764e549 56 }
ashleymills 66:6b00a764e549 57 }
ashleymills 66:6b00a764e549 58
ashleymills 66:6b00a764e549 59
ashleymills 66:6b00a764e549 60 LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", gIrregularMessage, gTestPhoneNumber);
ashleymills 66:6b00a764e549 61
ashleymills 66:6b00a764e549 62 int ret = _modem->sendSM(gTestPhoneNumber, gIrregularMessage);
ashleymills 66:6b00a764e549 63
ashleymills 66:6b00a764e549 64 if (ret)
ashleymills 66:6b00a764e549 65 {
ashleymills 66:6b00a764e549 66 LOG("Error in sending the SMS message. The return values is: %d", ret);
ashleymills 66:6b00a764e549 67
ashleymills 66:6b00a764e549 68 switch(ret){
ashleymills 66:6b00a764e549 69 case(NET_INVALID): LOG("Error message is: 'phone number is invalid size, must be less than 16 digits'.");break;
ashleymills 66:6b00a764e549 70 case(NET_PROTOCOL): LOG("Error message is: 'protocol error from the modem'.");break;
ashleymills 66:6b00a764e549 71 default: LOG("Undefined error message.");
ashleymills 66:6b00a764e549 72
ashleymills 66:6b00a764e549 73 }
ashleymills 66:6b00a764e549 74 return false;
ashleymills 66:6b00a764e549 75 }
ashleymills 66:6b00a764e549 76 return true;
ashleymills 66:6b00a764e549 77 }
ashleymills 66:6b00a764e549 78 };