joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers smstest.cpp Source File

smstest.cpp

00001 #include "CellularModem.h"
00002 #include "smstest.h"
00003 
00004 void smstest(CellularModem& modem)
00005 {
00006     modem.power(true);
00007     Thread::wait(1000);
00008 
00009 #ifdef DESTINATION_NUMBER
00010     modem.sendSM(DESINATION_NUMBER, "Hello from mbed:)");
00011 #endif
00012 
00013     while(true)
00014     {
00015         char num[17];
00016         char msg[64];
00017         size_t count;
00018         int ret = modem.getSMCount(&count);
00019         if(ret)
00020         {
00021           printf("getSMCount returned %d\n", ret);
00022           Thread::wait(3000);
00023           continue;
00024         }
00025         if( count > 0)
00026         {
00027           printf("%d SMS to read\n", count);
00028           ret = modem.getSM(num, msg, 64);
00029           if(ret)
00030           {
00031             printf("getSM returned %d\n", ret);
00032             Thread::wait(3000);
00033             continue;
00034           }
00035 
00036           printf("%s : %s\n", num, msg);
00037         }
00038         Thread::wait(3000);
00039     }
00040 }
00041