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
ashleymills 66:6b00a764e549 12 extern const char *gTest05Description;
ashleymills 66:6b00a764e549 13
ashleymills 66:6b00a764e549 14 class Test05 : public VodafoneTestCase {
ashleymills 66:6b00a764e549 15 public:
ashleymills 66:6b00a764e549 16
ashleymills 66:6b00a764e549 17
ashleymills 66:6b00a764e549 18 Test05(VodafoneUSBModem *m) : VodafoneTestCase(m) {}
ashleymills 66:6b00a764e549 19
ashleymills 66:6b00a764e549 20 private:
ashleymills 66:6b00a764e549 21
ashleymills 66:6b00a764e549 22 virtual bool executeTest() {
ashleymills 66:6b00a764e549 23 LOG(gTest05Description);
ashleymills 66:6b00a764e549 24 LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN;
ashleymills 66:6b00a764e549 25 LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN;
ashleymills 66:6b00a764e549 26 int rssi = -1000;
ashleymills 66:6b00a764e549 27 if(_modem->getLinkState(&rssi, &regState, &bearer)==0)
ashleymills 66:6b00a764e549 28 {
ashleymills 66:6b00a764e549 29 if(rssi==-1000)
ashleymills 66:6b00a764e549 30 { LOG("Checking signal strength - RSSI: Error."); return false;}
ashleymills 66:6b00a764e549 31 else
ashleymills 66:6b00a764e549 32 { LOG("Signal strength is: RSSI: %d",rssi);}
ashleymills 66:6b00a764e549 33
ashleymills 66:6b00a764e549 34
ashleymills 66:6b00a764e549 35 switch(regState) {
ashleymills 66:6b00a764e549 36 case LinkMonitor::REGISTRATION_STATE_UNKNOWN:
ashleymills 66:6b00a764e549 37 LOG("regState: UNKNOWN. Failing.");
ashleymills 66:6b00a764e549 38 return false;
ashleymills 66:6b00a764e549 39 case LinkMonitor::REGISTRATION_STATE_REGISTERING:
ashleymills 66:6b00a764e549 40 LOG("regState: REGISTERING");
ashleymills 66:6b00a764e549 41 break;
ashleymills 66:6b00a764e549 42 case LinkMonitor::REGISTRATION_STATE_DENIED:
ashleymills 66:6b00a764e549 43 LOG("regState: DENIED");
ashleymills 66:6b00a764e549 44 return false;
ashleymills 66:6b00a764e549 45 case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL:
ashleymills 66:6b00a764e549 46 LOG("regState: NO SIGNAL");
ashleymills 66:6b00a764e549 47 return false;
ashleymills 66:6b00a764e549 48 case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK:
ashleymills 66:6b00a764e549 49 LOG("regState: HOME NETWORK");
ashleymills 66:6b00a764e549 50 break;
ashleymills 66:6b00a764e549 51 case LinkMonitor::REGISTRATION_STATE_ROAMING:
ashleymills 66:6b00a764e549 52 LOG("regState: ROAMING");
ashleymills 66:6b00a764e549 53 break;
ashleymills 66:6b00a764e549 54 default:
ashleymills 66:6b00a764e549 55 LOG("regState: ERROR. Failing.");
ashleymills 66:6b00a764e549 56 return false;
ashleymills 66:6b00a764e549 57 }
ashleymills 66:6b00a764e549 58 }
ashleymills 66:6b00a764e549 59
ashleymills 66:6b00a764e549 60
ashleymills 66:6b00a764e549 61 LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", gAlphabetNumbersMessage, gTestPhoneNumber);
ashleymills 66:6b00a764e549 62
ashleymills 66:6b00a764e549 63 int ret = _modem->sendSM(gTestPhoneNumber, gAlphabetNumbersMessage);
ashleymills 66:6b00a764e549 64
ashleymills 66:6b00a764e549 65 if (ret)
ashleymills 66:6b00a764e549 66 {
ashleymills 66:6b00a764e549 67 LOG("Error in sending the SMS message. The return values is: %d", ret);
ashleymills 66:6b00a764e549 68
ashleymills 66:6b00a764e549 69 switch(ret){
ashleymills 66:6b00a764e549 70 case(NET_INVALID): LOG("Error message is: 'phone number is invalid size, must be less than 16 digits'.");break;
ashleymills 66:6b00a764e549 71 case(NET_PROTOCOL): LOG("Error message is: 'protocol error from the modem'.");break;
ashleymills 66:6b00a764e549 72 default: LOG("Undefined error message.");
ashleymills 66:6b00a764e549 73
ashleymills 66:6b00a764e549 74 }
ashleymills 66:6b00a764e549 75 return false;
ashleymills 66:6b00a764e549 76 }
ashleymills 66:6b00a764e549 77 return true;
ashleymills 66:6b00a764e549 78 }
ashleymills 66:6b00a764e549 79 };