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