Simple detection for LE910-NA1 modules
Fork of MTS-Cellular by
Diff: Cellular/Cellular.cpp
- Revision:
- 45:b9ead235ab7c
- Parent:
- 41:8b9b5098696f
- Child:
- 48:3f9d82915e83
--- a/Cellular/Cellular.cpp Thu Jul 31 21:04:28 2014 +0000 +++ b/Cellular/Cellular.cpp Fri Aug 01 15:51:49 2014 +0000 @@ -211,31 +211,39 @@ result.append(tmp, size); } - //If there is a response, check that the response is not finished with a response code + //Check for a response to signify the completion of the AT command //OK, ERROR, CONNECT are the 3 most likely responses if(result.size() > (command.size() + 2)) { - if(result.find("OK") != std::string::npos) { - //Found OK - done = true; - } else if(result.find("ERROR") != std::string::npos) { - //Found ERROR - done = true; - } else if(result.find("CONNECT") != std::string::npos) { - //Found CONNECT] - ////Could add socketOpened flag check here if CONNECT is found - done = true; - } else if(result.find("NO CARRIER") != std::string::npos) { - //Found NO CARRIER - done = true; - } else if(result.find("RING") != std::string::npos) { - done = true; - } else if(result.find("NO DIALTONE") != std::string::npos) { - done = true; - } else if(result.find("BUSY") != std::string::npos) { - done = true; - } else if(result.find("NO ANSWER") != std::string::npos) { - done = true; - } + if(result.find("OK") != std::string::npos) { + //Found OK + done = true; + } else if (result.find("ERROR") != std::string::npos) { + //Found ERROR + done = true; + } else if (result.find("NO CARRIER") != std::string::npos) { + //Found NO CARRIER + done = true; + } else if (result.find("RING") != std::string::npos) { + done = true; + } else if (result.find("BUSY") != std::string::npos) { + done = true; + } else if (result.find("NO ANSWER") != std::string::npos) { + done = true; + } + + if(type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_EV3 || type == MTSMC_C2) { + if (result.find("CONNECT") != std::string::npos) { + //Found CONNECT + //Could add socketOpened flag check here if CONNECT is found + done = true; + } else if(result.find("NO DIALTONE") != std::string::npos) { + done = true; + } + } else if (type == MTSMC_H5_IP || type == MTSMC_EV3_IP || type == MTSMC_C2_IP) { + if (result.find("Ok_Info_")) { + done = true; + } + } } if(tmr.read_ms() >= timeoutMillis) {