Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems
Dependents: mtsas mtsas mtsas mtsas
Diff: Cellular/EasyIP.cpp
- Revision:
- 82:5b33b670adb7
- Parent:
- 81:2e12915f892e
diff -r 2e12915f892e -r 5b33b670adb7 Cellular/EasyIP.cpp --- a/Cellular/EasyIP.cpp Wed Nov 15 16:53:29 2017 -0600 +++ b/Cellular/EasyIP.cpp Mon Feb 19 14:25:58 2018 -0600 @@ -52,7 +52,7 @@ } // Shorten data sending timeout from 5s to 100ms // Some servers won't handle a timeout that long - snprintf(buf, sizeof(buf), "AT#SCFG=1,%d,300,90,600,1", type == MTSMC_LVW2 ? 3 : 1); + snprintf(buf, sizeof(buf), "AT#SCFG=1,%d,300,90,600,1", (type == MTSMC_LVW2 || type == MTQ_LVW3) ? 3 : 1); if (sendBasicCommand(string(buf), 2000) != MTS_SUCCESS) { logWarning("Failed to reconfigure socket timeout parameters"); } @@ -112,7 +112,7 @@ logDebug("Making PPP Connection Attempt"); } char buf[64]; - snprintf(buf, sizeof(buf), "AT#SGACT=%d,1", type == MTSMC_LVW2 ? 3 : 1); + snprintf(buf, sizeof(buf), "AT#SGACT=%d,1", (type == MTSMC_LVW2 || type == MTQ_LVW3) ? 3 : 1); std::string pppResult = sendCommand(string(buf), 15000); std::vector<std::string> parts; if(pppResult.find("OK") != std::string::npos) { @@ -127,7 +127,7 @@ pppConnected = true; } else { - snprintf(buf, sizeof(buf), "%d,1", type == MTSMC_LVW2 ? 3 : 1); + snprintf(buf, sizeof(buf), "%d,1", (type == MTSMC_LVW2 || type == MTQ_LVW3) ? 3 : 1); pppResult = sendCommand("AT#SGACT?", 2000); if(pppResult.find(string(buf)) != std::string::npos) { logDebug("Radio is already connected"); @@ -155,7 +155,7 @@ //Sends AT#SGACT=1,0 command for (int y = 0; y < 5; y++) { char buf[64]; - snprintf(buf, sizeof(buf), "AT#SGACT=%d,0", type == MTSMC_LVW2 ? 3 : 1); + snprintf(buf, sizeof(buf), "AT#SGACT=%d,0", (type == MTSMC_LVW2 || type == MTQ_LVW3) ? 3 : 1); Code code = sendBasicCommand(string(buf), 1000); if (code == MTS_SUCCESS) { logDebug("Successfully closed PPP Connection"); @@ -169,7 +169,7 @@ tmr.start(); while(tmr.read() < 30) { char buf[16]; - snprintf(buf, sizeof(buf), "%d,0", type == MTSMC_LVW2 ? 3 : 1); + snprintf(buf, sizeof(buf), "%d,0", (type == MTSMC_LVW2 || type == MTQ_LVW3) ? 3 : 1); result = sendCommand("AT#SGACT?", 1000); if(result.find(string(buf)) != std::string::npos) { break; @@ -222,7 +222,7 @@ } string reply = sendCommand("AT#SGACT?", 1000); - snprintf(buf, sizeof(buf), "%d,1", type == MTSMC_LVW2 ? 3 : 1); + snprintf(buf, sizeof(buf), "%d,1", (type == MTSMC_LVW2 || type == MTQ_LVW3) ? 3 : 1); if (reply.find(string(buf)) != std::string::npos) { active = true; } else { @@ -526,7 +526,7 @@ } this->apn = apn; return code; - } else if (type == MTSMC_LAT1 || type == MTSMC_LEU1) { + } else if (type == MTSMC_LAT1 || type == MTSMC_LEU1 || type == MTQ_LAT3) { //CGDCONT has options: IP,PPP,IPv6 Code code = sendBasicCommand("AT+CGDCONT=1,\"IP\",\"" + apn + "\"", 1000); if (code != MTS_SUCCESS) { @@ -541,11 +541,11 @@ } this->apn = apn; return code; - } else if (type == MTQ_MVW1) { - logInfo("MTQ_MVW1 does not need an APN"); + } else if (type == MTQ_MVW1 || type == MTQ_LVW3) { + logInfo("Radio does not need an APN"); return MTS_SUCCESS; } else { - logInfo("CDMA radios don't need an APN"); + logInfo("CDMA radios do not need an APN"); return MTS_SUCCESS; } }