SMS test using a Sprint/Sierra Wireless 598U dongle

Dependencies:   SprintUSBModem mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Tue Oct 30 10:14:23 2012 +0000
Commit message:
Initial Commit

Changed in this revision

SprintUSBModem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 9488714d539f SprintUSBModem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SprintUSBModem.lib	Tue Oct 30 10:14:23 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/SprintUSBModem/#0fe5bc472b73
diff -r 000000000000 -r 9488714d539f main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 30 10:14:23 2012 +0000
@@ -0,0 +1,67 @@
+#include "mbed.h"
+#include "SprintUSBModem.h"
+
+#define MY_PHONE_NUMBER "+1xxxxxxxxx"
+
+void test(void const*) 
+{
+    SprintUSBModem modem(p18);
+
+    printf("Switching power on\r\n");
+    
+    modem.power(true);
+    
+    modem.sendSM(MY_PHONE_NUMBER, "Hello from mbed:)");
+
+    while(true)
+    {
+        char num[17];
+        char msg[128];
+        size_t count;
+        int ret = modem.getSMCount(&count);
+        if(ret)
+        {
+          printf("getSMCount returned %d\r\n", ret);
+          Thread::wait(3000);
+          continue;
+        }
+        if( count > 0)
+        {
+          printf("%d SMS to read\r\n", count);
+          ret = modem.getSM(num, msg, 128);
+          if(ret)
+          {
+            printf("getSM returned %d\r\n", ret);
+            Thread::wait(3000);
+            continue;
+          }
+    
+          printf("%s : %s\r\n", num, msg);
+        }
+        Thread::wait(3000);
+    }    
+    
+    modem.disconnect(); 
+    
+    modem.power(false); 
+
+    while(1) {
+    }
+}
+
+
+int main()
+{
+  DBG_INIT();
+  DBG_SET_SPEED(115200);
+  DBG_SET_NEWLINE("\r\n");
+  Thread testTask(test, NULL, osPriorityNormal, 1024 * 5);
+  DigitalOut led(LED1);
+  while(1)
+  {
+    led=!led;
+    Thread::wait(1000);  
+  }
+
+  return 0;
+}
diff -r 000000000000 -r 9488714d539f mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Tue Oct 30 10:14:23 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#9654a71f5a90
diff -r 000000000000 -r 9488714d539f mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 30 10:14:23 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ed12d17f06
\ No newline at end of file