Simple detection for LE910-NA1 modules
Fork of MTS-Cellular by
Diff: Cellular/Cellular.cpp
- Revision:
- 76:6eeffc10739d
- Parent:
- 69:93dace69ee98
- Child:
- 78:fc9d2b983744
--- a/Cellular/Cellular.cpp Wed Mar 25 17:59:46 2015 +0000 +++ b/Cellular/Cellular.cpp Thu Jun 25 08:27:35 2015 -0500 @@ -74,9 +74,9 @@ case MTSMC_LAT1: return "MTSMC_LAT1"; case MTSMC_LEU1: - return "MTSMC_LEU"; - case MTSMC_VW2: - return "MTSMC_VW2"; + return "MTSMC_LEU1"; + case MTSMC_LVW2: + return "MTSMC_LVW2"; default: return "UNKNOWN ENUM"; } @@ -223,7 +223,7 @@ done = true; } - if(type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_EV3 || type == MTSMC_C2 || type == MTSMC_LAT1) { + if(type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_EV3 || type == MTSMC_C2 || type == MTSMC_LAT1 || type == MTSMC_LEU1 || type == MTSMC_LVW2) { if (result.find("CONNECT\r\n") != std::string::npos) { done = true; } @@ -255,9 +255,9 @@ { string csmp; - if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) { + if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1 || type == MTSMC_LEU1) { csmp = "AT+CSMP=17,167,0,0"; - } else if (type == MTSMC_EV3_IP || type == MTSMC_EV3 || type == MTSMC_C2_IP || type == MTSMC_C2) { + } else if (type == MTSMC_EV3_IP || type == MTSMC_EV3 || type == MTSMC_C2_IP || type == MTSMC_C2 || type == MTSMC_LVW2) { csmp = "AT+CSMP=,4098,0,2"; } else { logError("unknown radio type [%d]", type); @@ -326,7 +326,7 @@ } //Start of SMS message std::vector<std::string> vSmsParts = Text::split(line, ','); - if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) { + if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1 || type == MTSMC_LEU1) { /* format for H5 and H5-IP radios * <index>, <status>, <oa>, <alpha>, <scts> * scts contains a comma, so splitting on commas should give us 6 items @@ -338,7 +338,7 @@ sms.phoneNumber = vSmsParts[2]; sms.timestamp = vSmsParts[4] + ", " + vSmsParts[5]; - } else if (type == MTSMC_EV3_IP || type == MTSMC_EV3 || type == MTSMC_C2_IP || type == MTSMC_C2) { + } else if (type == MTSMC_EV3_IP || type == MTSMC_EV3 || type == MTSMC_C2_IP || type == MTSMC_C2 || type == MTSMC_LVW2) { /* format for EV3 and EV3-IP radios * <index>, <status>, <oa>, <callback>, <date> * splitting on commas should give us 5 items @@ -354,8 +354,12 @@ * nobody wants to try and decipher that, so format it nicely * YY/MM/DD,HH:MM:SS */ - string s = vSmsParts[4]; - sms.timestamp = s.substr(2,2) + "/" + s.substr(4,2) + "/" + s.substr(6,2) + ", " + s.substr(8,2) + ":" + s.substr(10,2) + ":" + s.substr(12,2); + string s = vSmsParts[4]; + if (type == MTSMC_LVW2) { + sms.timestamp = s.substr(3,2) + "/" + s.substr(5,2) + "/" + s.substr(7,2) + ", " + s.substr(9,2) + ":" + s.substr(11,2) + ":" + s.substr(13,2); + } else { + sms.timestamp = s.substr(2,2) + "/" + s.substr(4,2) + "/" + s.substr(6,2) + ", " + s.substr(8,2) + ":" + s.substr(10,2) + ":" + s.substr(12,2); + } } if(pos == std::string::npos) { @@ -421,6 +425,11 @@ return equipmentIdentifier; } +std::string Cellular::getRadioType() +{ + return getRadioNames(type); +} + unsigned int Cellular::writeable() { if(io == NULL) {