aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms')
-rw-r--r--tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.cpp41
-rw-r--r--tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.h9
-rw-r--r--tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/ubloxusb/main.cpp21
3 files changed, 71 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 000000000..5a6393590
--- /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);
+ }
+}
+
diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.h b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.h
new file mode 100644
index 000000000..0d1ea80fc
--- /dev/null
+++ b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/common/smstest.h
@@ -0,0 +1,9 @@
+#ifndef SMSTEST_H_
+#define SMSTEST_H_
+
+#include "CellularModem.h"
+
+void smstest(CellularModem&);
+
+#endif
+
diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/ubloxusb/main.cpp b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/ubloxusb/main.cpp
new file mode 100644
index 000000000..a493be7bf
--- /dev/null
+++ b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/sms/ubloxusb/main.cpp
@@ -0,0 +1,21 @@
+#include "UbloxUSBGSMModem.h"
+#include "UbloxUSBCDMAModem.h"
+#include "smstest.h"
+
+#if !defined(MODEM_UBLOX_GSM) && !defined(MODEM_UBLOX_CDMA)
+#warning No modem defined, using GSM by default
+#define MODEM_UBLOX_GSM
+#endif
+
+int main()
+{
+#ifdef MODEM_UBLOX_GSM
+ UbloxUSBGSMModem modem;
+#else
+ UbloxUSBCDMAModem modem(p18, true, 1);
+#endif
+
+ smstest(modem);
+ while (true);
+}
+