blob: 5a6393590f8b17d653bff9f1e8b50d7af5e4d2a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "CellularModem.h"
#include "smstest.h"
void smstest(CellularModem& modem)
{
modem.power(true);
Thread::wait(1000);
#ifdef DESTINATION_NUMBER
modem.sendSM(DESINATION_NUMBER, "Hello from mbed:)");
#endif
while(true)
{
char num[17];
char msg[64];
size_t count;
int ret = modem.getSMCount(&count);
if(ret)
{
printf("getSMCount returned %d\n", ret);
Thread::wait(3000);
continue;
}
if( count > 0)
{
printf("%d SMS to read\n", count);
ret = modem.getSM(num, msg, 64);
if(ret)
{
printf("getSM returned %d\n", ret);
Thread::wait(3000);
continue;
}
printf("%s : %s\n", num, msg);
}
Thread::wait(3000);
}
}
|