Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems

Dependents:   mtsas mtsas mtsas mtsas

Revision:
36:948d06b3e23c
Parent:
35:257eb41405e1
Child:
37:14f819beeccf
--- a/Cellular/Cellular.cpp	Mon Jul 21 20:14:18 2014 +0000
+++ b/Cellular/Cellular.cpp	Wed Jul 23 15:44:54 2014 +0000
@@ -269,8 +269,12 @@
         return code;
     }
     string cmd = "AT+CMGS=\"";
+    //EasyIP radios do not include the +
+    if(type == MTSMC_H5_IP || type == MTSMC_EV3_IP || type ++ MTSMC_C2_IP) {
+        cmd.append("+");
+    }
     cmd.append(phoneNumber);
-    cmd.append("\"");
+    cmd.append("\",145");
     for (int i = 0; i < 5; i++) {
         string response1 = sendCommand(cmd, 1000);
         if (response1.find('>') != string::npos) {
@@ -286,7 +290,7 @@
     wait(.2);
     string  response2 = sendCommand(message, 4000, CTRL_Z);
     logInfo("SMS Response: [%s]", response2.c_str());
-    if (response2.find("+CMGS:") == string::npos) {
+    if ((response2.find("+CMGS:") == string::npos) || (response2.find("ERROR") != std::string::npos)) {
         logError("CMGS message failed");
         return MTS_FAILURE;
     }