ATT_SMS_System for home security system

Dependencies:   FXOS8700CQ MODSERIAL mbed-rtos mbed

Fork of ATT_Cellular_IOT_Button by Richard Finn

Revision:
32:1e052a3e73fe
Parent:
31:da32581b4507
Child:
33:fa964b8b3b19
diff -r da32581b4507 -r 1e052a3e73fe main.cpp
--- a/main.cpp	Fri Jul 22 15:09:31 2016 +0000
+++ b/main.cpp	Fri Jul 22 16:22:17 2016 +0000
@@ -85,7 +85,7 @@
                 break;
             }
         }
-        wait_ms(1);
+//        wait_ms(1);
     }
     buff[len] = (char)NULL;
     
@@ -93,13 +93,17 @@
 }
 
 int mdm_sendAtCmd(const char *cmd, const char **rsp_list, int timeout_ms) {
+    // Per WNC wait:
+    wait_ms(20);
+
     if (cmd && strlen(cmd) > 0) {
         if (mdm_dbgmask & MDM_DBG_AT_CMDS) {
             printf(MAG "ATCMD: " DEF "--> " GRN "%s" DEF "\n", cmd);
         }
-        mdm.printf("%s\r\n", cmd);
+        mdm.puts(cmd);
+        mdm.puts("\r\n");
     }
-    
+
     if (rsp_list) {
         Timer   timer;
         char    rsp[MAX_AT_RSP_LEN+1];
@@ -173,8 +177,6 @@
     timer.start();
     while (timer.read() < 60) {
         const char * rsp_lst[] = { ok_str, error_str, NULL };
-        // Per WNC wait:
-        wait_ms(20);
         int rc = mdm_sendAtCmd("AT", rsp_lst, 500);
         if (rc == 0)
             return true; //timer.read();
@@ -187,18 +189,24 @@
 int mdm_sendAtCmdRsp(const char *cmd, const char **rsp_list, int timeout_ms, string * rsp, int * len) {
     static char cmd_buf[3200];  // Need enough room for the WNC sockreads (over 3000 chars)
     size_t n = strlen(cmd);
+
+    // Per WNC wait:
+    wait_ms(20);
+
     if (cmd && n > 0) {
         if (mdm_dbgmask & MDM_DBG_AT_CMDS) {
             printf(MAG "ATCMD: " DEF "--> " GRN "%s" DEF "\n", cmd);
         }
-        while (n--) {
-            mdm.putc(*cmd++);
-            wait_ms(1);
-        };
-        mdm.putc('\r');
-        wait_ms(1);
-        mdm.putc('\n');
-        wait_ms(1);
+        mdm.puts(cmd);
+        mdm.puts("\r\n");
+//        while (n--) {
+//            mdm.putc(*cmd++);
+//            wait_ms(1);
+//        };
+//        mdm.putc('\r');
+//        wait_ms(1);
+//        mdm.putc('\n');
+//        wait_ms(1);
     }
 
     if (rsp_list) {