summaryrefslogtreecommitdiff
path: root/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.cpp')
-rw-r--r--tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.cpp b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.cpp
new file mode 100644
index 0000000000..5a6393590f
--- /dev/null
+++ b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.cpp
@@ -0,0 +1,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);
+ }
+}
+