Simple detection for LE910-NA1 modules
Fork of MTS-Cellular by
Diff: Cellular/EasyIP.cpp
- Revision:
- 69:93dace69ee98
- Parent:
- 67:7c705fe2acec
- Child:
- 70:c0c621f88330
--- a/Cellular/EasyIP.cpp Tue Oct 21 21:14:13 2014 +0000 +++ b/Cellular/EasyIP.cpp Tue Nov 11 17:54:06 2014 +0000 @@ -52,7 +52,7 @@ bool EasyIP::connect() { //Check if APN is not set, if it is not, connect will not work. - if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) { + if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) { if(apn.size() == 0) { logDebug("APN is not set"); return false; @@ -96,7 +96,7 @@ } while(tmr.read() < 30); //Make PPP connection - if (type == MTSMC_H5 || type == MTSMC_G3) { + if (type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) { logDebug("Making PPP Connection Attempt. APN[%s]", apn.c_str()); } else { logDebug("Making PPP Connection Attempt"); @@ -172,7 +172,7 @@ bool signal = false, regist = false, active = false; //1) Check if APN was set if we're on an HSPA radio - if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) { + if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) { if(apn.size() == 0) { logDebug("APN is not set"); return false; @@ -299,6 +299,11 @@ logDebug("Local port set to 1, port 0 not supported for MTSMC_EV3"); local_port = 1; } + } else if (type == MTSMC_LAT1) { + if(!local_port) { + logDebug("Local port set to 1, port 0 not supported for MTSMC_LAT1"); + local_port = 1; + } } //3) Check PPP connection @@ -332,7 +337,7 @@ } //5) Open Socket - sprintf(sOpenSocketCmd, "AT#SD=1,%d,%d,%s,%d,%d,0", typeSocket, port, address.c_str(),closeType , local_port); + sprintf(sOpenSocketCmd, "AT#SD=1,%d,%d,\"%s\",%d,%d,0", typeSocket, port, address.c_str(), closeType, local_port); std::string response = sendCommand(sOpenSocketCmd, 60000); if(response.find("CONNECT") != std::string::npos) { @@ -505,6 +510,14 @@ } this->apn = apn; return code; + } else if (type == MTSMC_LAT1) { + //CGDCONT has options: IP,PPP,IPv6 + Code code = sendBasicCommand("AT+CGDCONT=1,\"IP\",\"" + apn + "\"", 1000); + if (code != MTS_SUCCESS) { + return code; + } + this->apn = apn; + return code; } else { logInfo("CDMA radios don't need an APN"); return MTS_SUCCESS;