Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Test02.h
00001 #pragma once 00002 #include "VodafoneTestCase.h" 00003 00004 // this test case will wait to receive an SMS from the modem. 00005 // if the method that reports a message waiting returns an error it will fail. 00006 // if the method that returns the message from the mailbox returns an error it will fai. 00007 // it will report the test as failed if any of the above happens. 00008 // it waits forever for an SMS. 00009 // TODO: this should wait for a set time before failing. 00010 00011 extern const char *gTest02Description; 00012 extern const char *gAlphabetNumbersMessage; 00013 00014 class Test02 : public VodafoneTestCase { 00015 public: 00016 00017 char num[17]; 00018 char msg[160]; 00019 size_t count; 00020 00021 Test02(VodafoneUSBModem *m) : VodafoneTestCase(m) {} 00022 00023 private: 00024 00025 virtual bool executeTest() { 00026 LOG(gTest02Description); 00027 LOG("Receiving SMS from test phone, waiting for response."); 00028 00029 while(true) 00030 { 00031 LOG("Waiting for an SMS message..."); 00032 int ret = _modem->getSMCount(&count); 00033 if(ret) 00034 { 00035 LOG("getSMCount returned %d", ret); 00036 Thread::wait(3000); 00037 continue; 00038 } 00039 00040 if( count > 0) 00041 { 00042 LOG("%d SMS to read", count); 00043 ret = _modem->getSM(num, msg, 64); 00044 if(ret) 00045 { 00046 LOG("Error receiving sms. The method getSMS returned %d", ret); 00047 return false; 00048 } 00049 LOG("The message is from number: %s and the message is: \"%s\"", num, msg); 00050 if (strcmp (msg, gAlphabetNumbersMessage) ==0) 00051 { 00052 LOG("Success receiving alphabet message matches the sent message"); 00053 return true; 00054 } 00055 00056 return false; 00057 } 00058 Thread::wait(500); 00059 } 00060 00061 } 00062 };
Generated on Sun Jul 17 2022 01:04:13 by 1.7.2