From 417049f51180b3b4be84fbc0d86a3c690972fb3b Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Thu, 6 Jun 2019 18:06:43 +0300 Subject: [MTS-MTQ] refactoring: moved common consts and static methods to ICellularRadio --- src/MTS_IO_ICellularRadio.cpp | 280 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 src/MTS_IO_ICellularRadio.cpp (limited to 'src/MTS_IO_ICellularRadio.cpp') diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp new file mode 100644 index 0000000..343480a --- /dev/null +++ b/src/MTS_IO_ICellularRadio.cpp @@ -0,0 +1,280 @@ +#include "mts/MTS_IO_ICellularRadio.h" + +const char MTS::IO::ICellularRadio::ETX = 0x03; //Ends socket connection +const char MTS::IO::ICellularRadio::DLE = 0x10; //Escapes ETX and DLE within Payload +const char MTS::IO::ICellularRadio::CR = 0x0D; +const char MTS::IO::ICellularRadio::NL = 0x0A; +const char MTS::IO::ICellularRadio::CTRL_Z = 0x1A; + +const std::string MTS::IO::ICellularRadio::RSP_ERROR("ERROR"); +const std::string MTS::IO::ICellularRadio::RSP_OK("OK"); + + +const std::string MTS::IO::ICellularRadio::DEFAULT_RADIO_PORT("/dev/modem_at1"); +const std::string MTS::IO::ICellularRadio::DEFAULT_RADIO_DIR("/var/run/radio/"); +const std::string MTS::IO::ICellularRadio::VALUE_UNKNOWN("Unknown"); +const std::string MTS::IO::ICellularRadio::VALUE_UNAVAILABLE("Unavailable"); +const std::string MTS::IO::ICellularRadio::VALUE_NOT_SUPPORTED("Not Supported"); + +const std::string MTS::IO::ICellularRadio::VALUE_NOT_REGISTERED("NOT REGISTERED"); +const std::string MTS::IO::ICellularRadio::VALUE_REGISTERED("REGISTERED"); +const std::string MTS::IO::ICellularRadio::VALUE_SEARCHING("SEARCHING"); +const std::string MTS::IO::ICellularRadio::VALUE_DENIED("DENIED"); +const std::string MTS::IO::ICellularRadio::VALUE_ROAMING("ROAMING"); + +//Static Data +const std::string MTS::IO::ICellularRadio::KEY_TYPE("type"); //!< GSM or CDMA +const std::string MTS::IO::ICellularRadio::KEY_CODE("code"); //!< Product Code : H5, H6, C2, EV3, G3 +const std::string MTS::IO::ICellularRadio::KEY_MODEL("model"); //!< Model : HE910, LE910, CE910, DE910, GE910 +const std::string MTS::IO::ICellularRadio::KEY_MANUFACTURER("manufacturer"); //!< Manufacturer: Telit +const std::string MTS::IO::ICellularRadio::KEY_HARDWARE("hardware"); //!< Radio Hardware Version +const std::string MTS::IO::ICellularRadio::KEY_FIRMWARE("firmware"); //!< Radio Firmware Version +const std::string MTS::IO::ICellularRadio::KEY_FIRMWARE_BUILD("firmwarebuild"); //!< Radio Firmware Build + +const std::string MTS::IO::ICellularRadio::KEY_CARRIER("carrier"); //!< Cellular Service Provider (Home Network) +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_VERIZON("Verizon"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_AERIS("Aeris"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_SPRINT("Sprint"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_USCELLULAR("U.S. Cellular"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_ATT("AT&T"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_TMOBILE("T-Mobile"); + +const std::string MTS::IO::ICellularRadio::KEY_IMEI("imei"); //!< International Mobile Station Equipment Identity +const std::string MTS::IO::ICellularRadio::KEY_MEID("meid"); //!< Mobile Equipment Identifier +const std::string MTS::IO::ICellularRadio::KEY_IMSI("imsi"); //!< International Mobile Subscriber Identity +const std::string MTS::IO::ICellularRadio::KEY_MSID("msid"); //!< Mobil Station ID / Mobile Identification Number (MSID/MIN) (CDMA-Only) +const std::string MTS::IO::ICellularRadio::KEY_MDN("mdn"); //!< Mobile Directory Number : Actual phone number dialed to reach radio +const std::string MTS::IO::ICellularRadio::KEY_ICCID("iccid"); //!< Integrated Circuit Card Identifier +const std::string MTS::IO::ICellularRadio::KEY_MSL("msl"); //!< Master Subsidy Lock + +//Dynamic Data +const std::string MTS::IO::ICellularRadio::KEY_ROAMING("roaming"); //!< Indicates whether or not using Home Network +const std::string MTS::IO::ICellularRadio::KEY_DATETIME("datetime"); //!< Date and Time from tower +const std::string MTS::IO::ICellularRadio::KEY_SERVICE("service"); //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] +const std::string MTS::IO::ICellularRadio::KEY_NETWORK("network"); //!< Cellular Service Provider +const std::string MTS::IO::ICellularRadio::KEY_NETWORK_REG("netreg"); //!< Network Registration +const std::string MTS::IO::ICellularRadio::KEY_CID("cid"); //!< Cellular ID (Tower) in HEX +const std::string MTS::IO::ICellularRadio::KEY_LAC("lac"); //!< Location Area Code in HEX +const std::string MTS::IO::ICellularRadio::KEY_RAC("rac"); //!< Routing Area Code in HEX +const std::string MTS::IO::ICellularRadio::KEY_RSSI("rssi"); //!< Signal Strength +const std::string MTS::IO::ICellularRadio::KEY_RSSIDBM("rssidBm"); //!< Signal Strength in dBm +const std::string MTS::IO::ICellularRadio::KEY_MCC("mcc"); //!< Country Code +const std::string MTS::IO::ICellularRadio::KEY_MNC("mnc"); //!< Operator Code +const std::string MTS::IO::ICellularRadio::KEY_CHANNEL("channel"); //!< ARFCN or UARFCN Assigned Radio Channel +const std::string MTS::IO::ICellularRadio::KEY_TXPWR("txpwr"); //!< Transmit Power +const std::string MTS::IO::ICellularRadio::KEY_PSC("psc"); //!< Active Primary Synchronization Code (PSC) +const std::string MTS::IO::ICellularRadio::KEY_ECIO("ecio"); //!< Active Ec/Io (chip energy per total wideband power in dBm) +const std::string MTS::IO::ICellularRadio::KEY_RSCP("rscp"); //!< Active RSCP (Received Signal Code Power in dBm) +const std::string MTS::IO::ICellularRadio::KEY_DRX("drx"); //!< Discontinuous reception cycle length (ms) +const std::string MTS::IO::ICellularRadio::KEY_MM("mm"); //!< Mobility Management State +const std::string MTS::IO::ICellularRadio::KEY_RR("rr"); //!< Radio Resource State +const std::string MTS::IO::ICellularRadio::KEY_NOM("nom"); //!< Network Operator Mode +const std::string MTS::IO::ICellularRadio::KEY_ABND("abnd"); //!< Active Band +const std::string MTS::IO::ICellularRadio::KEY_BLER("bler"); //!< Block Error Rate (percentage) +const std::string MTS::IO::ICellularRadio::KEY_SD("sd"); //!< Service Domain +const std::string MTS::IO::ICellularRadio::KEY_DEBUG("debug"); //!< Debug Information + +const std::string MTS::IO::ICellularRadio::KEY_MIP("mipProfile"); //!< Mobile IP Information +const std::string MTS::IO::ICellularRadio::KEY_MIP_ID("id"); //!< Mobile IP ID +const std::string MTS::IO::ICellularRadio::KEY_MIP_ENABLED("enabled"); //!< Mobile IP Enabled/Disabled +const std::string MTS::IO::ICellularRadio::KEY_MIP_NAI("nai"); //!< Network Access Identifier +const std::string MTS::IO::ICellularRadio::KEY_MIP_HOMEADDRESS("homeAddress"); //!< Home Address +const std::string MTS::IO::ICellularRadio::KEY_MIP_PRIMARYHA("primaryAddress"); //!< Primary Home Agent +const std::string MTS::IO::ICellularRadio::KEY_MIP_SECONDARYHA("secondaryAddress"); //!< Secondary Home Agent +const std::string MTS::IO::ICellularRadio::KEY_MIP_MNAAASPI("mnAaaSpi"); //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index +const std::string MTS::IO::ICellularRadio::KEY_MIP_MNHASPI("mnHaSpi"); //!< Mobile Node Home Agent Security Server Parameter Index +const std::string MTS::IO::ICellularRadio::KEY_MIP_REVTUN("revTun"); //!< Reverse Tunneling Enabled +const std::string MTS::IO::ICellularRadio::KEY_MIP_MNAAASS("mnAaaSs"); //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret +const std::string MTS::IO::ICellularRadio::KEY_MIP_MNHASS("mnHaSs"); //!< Mobile Node Home Agent Shared Secret + +const std::string MTS::IO::ICellularRadio::VALUE_TYPE_GSM("GSM"); +const std::string MTS::IO::ICellularRadio::VALUE_TYPE_LTE("LTE"); +const std::string MTS::IO::ICellularRadio::VALUE_TYPE_CDMA("CDMA"); + +const std::string MTS::IO::ICellularRadio::VALUE_SD_NO_SERVICE("NO SERVICE"); +const std::string MTS::IO::ICellularRadio::VALUE_SD_CS_ONLY("CS ONLY"); +const std::string MTS::IO::ICellularRadio::VALUE_SD_PS_ONLY("PS ONLY"); +const std::string MTS::IO::ICellularRadio::VALUE_SD_CSPS("CS+PS"); + +const std::string MTS::IO::ICellularRadio::VALUE_ABND_GSM_850("GSM 850"); +const std::string MTS::IO::ICellularRadio::VALUE_ABND_GSM_900("GSM 900"); +const std::string MTS::IO::ICellularRadio::VALUE_ABND_DCS_1800("DCS 1800"); +const std::string MTS::IO::ICellularRadio::VALUE_ABND_PCS_1900("PCS 1900"); + +const std::vector MTS::IO::ICellularRadio::DEFAULT_BAIL_STRINGS = { MTS::IO::ICellularRadio::RSP_OK, MTS::IO::ICellularRadio::RSP_ERROR }; + +MTS::IO::ICellularRadio::~ICellularRadio() +{ +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, MTS::IO::ICellularRadio *radioObject) { + CODE eCode = FAILURE; + + if(sModel.find("HE910-D") == 0) { + sCode = "H5"; + eCode = SUCCESS; + } else if (sModel.find("HE910-EUD") == 0) { + sCode = "H6"; + eCode = SUCCESS; + } else if (sModel.find("LE910-JN1") == 0) { + sCode = "LDC3"; + eCode = SUCCESS; + } else if (sModel.find("LE866A1-JS") == 0) { + sCode = "LSB3"; + eCode = SUCCESS; + } else if (sModel.find("LE910-NAG") == 0) { + sCode = "LAT1"; + eCode = SUCCESS; + } else if (sModel.find("LE910C4-NF") == 0) { + sCode = "L4N1"; + eCode = SUCCESS; + } else if (sModel.find("LE910-NA1") == 0) { + if (NULL == radioObject) { + sCode = VALUE_NOT_SUPPORTED; + eCode = ERROR; + } else { + std::string sValue; + eCode = radioObject->getActiveFirmware(sValue); + if (eCode == SUCCESS) { + sCode = "LNA3"; + } else { + sCode = "LAT3"; + } + } + eCode = SUCCESS; + } else if (sModel.find("LE910-SVG") == 0) { + sCode = "LVW2"; + eCode = SUCCESS; + } else if (sModel.find("LE910C1-NS") == 0) { + sCode = "LSP3"; + eCode = SUCCESS; + } else if (sModel.find("LE910C1-AP") == 0) { + sCode = "LAP3"; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-NA") == 0) { + sCode = "MAT1"; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-NV") == 0) { + sCode = "MVW1"; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-WW") == 0) { + sCode = "MNG2"; + eCode = SUCCESS; + } else if (sModel.find("LE910-EUG") == 0) { + sCode = "LEU1"; + eCode = SUCCESS; + } else if (sModel.find("LE910C4-EU") == 0) { + sCode = "L4E1"; + eCode = SUCCESS; + } else if (sModel.find("LE910-EU1") == 0) { + sCode = "LEU3"; + eCode = SUCCESS; + } else if (sModel.find("GE910") == 0) { + sCode = "G3"; + eCode = SUCCESS; + } else if (sModel.find("CE910") == 0) { + sCode = "C2"; + eCode = SUCCESS; + } else if (sModel.find("DE910") == 0) { + sCode = "EV3"; + eCode = SUCCESS; + } else { + sCode = VALUE_NOT_SUPPORTED; + //printError("RADIO| Could not identify MTS short code from model. [%s]", sModel.c_str()); + eCode = ERROR; + } + return eCode; +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd) { + CODE eCode = FAILURE; + switch(eSd) { + case NO_SERVICE: sSd = VALUE_SD_NO_SERVICE; eCode = SUCCESS; break; + case CS_ONLY: sSd = VALUE_SD_CS_ONLY; eCode = SUCCESS; break; + case PS_ONLY: sSd = VALUE_SD_PS_ONLY; eCode = SUCCESS; break; + case CSPS: sSd = VALUE_SD_CSPS; eCode = SUCCESS; break; + default: sSd = VALUE_UNKNOWN; eCode = FAILURE; break; + } + return eCode; +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand) { + CODE eCode = FAILURE; + switch(eBand) { + case GSM_850: sBand = VALUE_ABND_GSM_850; eCode = SUCCESS; break; + case GSM_900: sBand = VALUE_ABND_GSM_900; eCode = SUCCESS; break; + case DCS_1800: sBand = VALUE_ABND_DCS_1800; eCode = SUCCESS; break; + case PCS_1900: sBand = VALUE_ABND_PCS_1900; eCode = SUCCESS; break; + default: sBand = VALUE_UNKNOWN; eCode = FAILURE; break; + } + return eCode; +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertModelToType(const std::string& sModel, std::string& sType) { + CODE eCode = FAILURE; + sType = VALUE_NOT_SUPPORTED; + + if(sModel.find("HE910-D") == 0) { + sType = VALUE_TYPE_GSM; + eCode = SUCCESS; + } else if (sModel.find("HE910-EUD") == 0) { + sType = VALUE_TYPE_GSM; + eCode = SUCCESS; + } else if (sModel.find("LE910-JN1") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE866A1-JS") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-NAG") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910C4-NF") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-NA1") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-SVG") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-EUG") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910C4-EU") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-EU1") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910C1-NS") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910C1-AP") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-NA") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-NV") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-WW") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("GE910") == 0) { + sType = VALUE_TYPE_GSM; + eCode = SUCCESS; + } else if (sModel.find("CE910") == 0) { + sType = VALUE_TYPE_CDMA; + eCode = SUCCESS; + } else if (sModel.find("DE910") == 0) { + sType = VALUE_TYPE_CDMA; + eCode = SUCCESS; + } else { + sType = VALUE_TYPE_GSM; + eCode = ERROR; + //printError("RADIO| Could not identify type from model. [%s]. Assuming [%s]", sModel.c_str(), sType.c_str()); + } + return eCode; +} -- cgit v1.2.3 From 5a7d8772ea898b3567685431b5a6be13015e5887 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Mon, 10 Jun 2019 11:27:27 +0300 Subject: [MTS-MTQ] refactoring: static function moved to ICellularRadio --- src/MTS_IO_ICellularRadio.cpp | 164 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 2 deletions(-) (limited to 'src/MTS_IO_ICellularRadio.cpp') diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp index 343480a..e206a59 100644 --- a/src/MTS_IO_ICellularRadio.cpp +++ b/src/MTS_IO_ICellularRadio.cpp @@ -1,5 +1,8 @@ #include "mts/MTS_IO_ICellularRadio.h" +#include +#include + const char MTS::IO::ICellularRadio::ETX = 0x03; //Ends socket connection const char MTS::IO::ICellularRadio::DLE = 0x10; //Escapes ETX and DLE within Payload const char MTS::IO::ICellularRadio::CR = 0x0D; @@ -180,7 +183,7 @@ MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertModelToMtsShortCod eCode = SUCCESS; } else { sCode = VALUE_NOT_SUPPORTED; - //printError("RADIO| Could not identify MTS short code from model. [%s]", sModel.c_str()); + printError("RADIO| Could not identify MTS short code from model. [%s]", sModel.c_str()); eCode = ERROR; } return eCode; @@ -274,7 +277,164 @@ MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertModelToType(const } else { sType = VALUE_TYPE_GSM; eCode = ERROR; - //printError("RADIO| Could not identify type from model. [%s]. Assuming [%s]", sModel.c_str(), sType.c_str()); + printError("RADIO| Could not identify type from model. [%s]. Assuming [%s]", sModel.c_str(), sType.c_str()); } return eCode; } + +std::string MTS::IO::ICellularRadio::sendCommand(MTS::AutoPtr& apIo, const std::string& sCmd, + const std::vector& vBail, int32_t timeoutMillis, const char& ESC) { + IsNeedMoreData isNeedMoreData = [&vBail](const std::string&, const std::string& allData)->bool { + for(size_t i = 0; i < vBail.size(); i++) { + const std::string& sBail = vBail[i]; + if(sBail.size() > 0) { + if(allData.find(sBail) != std::string::npos) { + //Return when bail string is found + printTrace("RADIO| Found bail string [%s]", sBail.c_str()); + return false; + } + } + } + return true; + }; + + return sendCommand(apIo, sCmd, isNeedMoreData, timeoutMillis, ESC); +} + +std::string MTS::IO::ICellularRadio::sendCommand(MTS::AutoPtr& apIo, const std::string& sCmd, + IsNeedMoreData& isNeedMoreData, int32_t timeoutMillis, const char& ESC) { + if(MTS::Logger::getPrintLevel() >= MTS::Logger::PrintLevel::TRACE_LEVEL) { + printTrace("RADIO| Sending command [%s]", sCmd.c_str()); + } + if(apIo.isNull()) { + printError("RADIO| IO is not set in sendCommand"); + return ""; + } + + int32_t iResult; + if(ESC == 0x00) { + iResult = apIo->write(sCmd.data(), sCmd.size()); + } else { + std::string sNewCmd(sCmd); + sNewCmd.push_back(ESC); + iResult = apIo->write(sNewCmd.data(), sNewCmd.size()); + } + + if(iResult == -1) { + printError("RADIO| Failed to send command to radio"); + return ""; + } + + bool done = false; + const uint32_t capacity = 1024; + char buffer[capacity]; + std::string sResult; + Timer timer; + timer.start(); + do { + int32_t iterationTimeout = 100; + int bytesRead = apIo->read((char*)buffer, capacity, iterationTimeout); + if(bytesRead == -1) { + printError("RADIO| Failed to read from radio"); + break; + } + + std::string sIteration((char*)buffer, bytesRead); + sResult += sIteration; + + if(isNeedMoreData && !isNeedMoreData(sIteration, sResult)) { + printTrace("RADIO| No more data needed"); + return sResult; + } + if(timeoutMillis >= 0) { + done = (timer.getMillis() >= (uint64_t)timeoutMillis); + } else { + //Do not stop looping until bail string is found + } + } while(!done); + + //Timed out + return sResult; +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::test(MTS::AutoPtr& apIo, uint32_t timeoutSeconds) { + printTrace("RADIO| Basic Test"); + uint32_t count = 0; + std::string sCmd("AT"); + do { + std::string sResult = sendCommand(apIo, sCmd); + if (sResult.find(RSP_OK) == std::string::npos) { + printTrace("RADIO| Waiting for basic radio communication [%s] ...", sResult.c_str()); + } else { + break; + } + count++; + } while (count < timeoutSeconds); + + if(count == timeoutSeconds) { + printWarning("RADIO| Basic radio communication FAILED"); + return NO_RESPONSE; + } + return SUCCESS; +} + +std::string MTS::IO::ICellularRadio::extractModelFromResult(const std::string& sResult) { + std::string sModel(VALUE_NOT_SUPPORTED); + + if(sResult.find("HE910-D") != std::string::npos) { + sModel = "HE910-D"; + } else if(sResult.find("HE910-EUD") != std::string::npos) { + sModel = "HE910-EUD"; + } else if(sResult.find("LE910-JN1") != std::string::npos) { + sModel = "LE910-JN1"; + } else if(sResult.find("LE866A1-JS") != std::string::npos) { + sModel = "LE866A1-JS"; + } else if(sResult.find("LE910-NAG") != std::string::npos) { + sModel = "LE910-NAG"; + } else if(sResult.find("LE910C4-NF") != std::string::npos) { + sModel = "LE910C4-NF"; + } else if(sResult.find("LE910-NA1") != std::string::npos) { + sModel = "LE910-NA1"; + } else if(sResult.find("ME910C1-NA") != std::string::npos) { + sModel = "ME910C1-NA"; + } else if(sResult.find("ME910C1-NV") != std::string::npos) { + sModel = "ME910C1-NV"; + } else if(sResult.find("ME910C1-WW") != std::string::npos) { + sModel = "ME910C1-WW"; + } else if(sResult.find("LE910-SVG") != std::string::npos) { + sModel = "LE910-SVG"; + } else if(sResult.find("LE910-EUG") != std::string::npos) { + sModel = "LE910-EUG"; + } else if(sResult.find("LE910C4-EU") != std::string::npos) { + sModel = "LE910C4-EU"; + } else if(sResult.find("LE910-EU1") != std::string::npos) { + sModel = "LE910-EU1"; + } else if(sResult.find("LE910C1-NS") != std::string::npos) { + sModel = "LE910C1-NS"; + } else if(sResult.find("LE910C1-AP") != std::string::npos) { + sModel = "LE910C1-AP"; + } else if(sResult.find("GE910") != std::string::npos) { + sModel = "GE910"; + } else if(sResult.find("DE910-DUAL") != std::string::npos) { + sModel = "DE910-DUAL"; + } else if(sResult.find("CE910") != std::string::npos) { + sModel = "CE910"; + } + return sModel; +} + +std::string MTS::IO::ICellularRadio::getCodeAsString(CODE eCode) { + switch(eCode) { + case SUCCESS: + return "SUCCESS"; + case ERROR: + return "ERROR"; + case FAILURE: + return "FAILURE"; + case NO_RESPONSE: + return "NO RESPONSE"; + default: + return "UNKNOWN"; + } +} + -- cgit v1.2.3 From 07b7b63b15bf5f7cb94f32a5fb45acdf1cb3edfc Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 11 Jun 2019 11:20:50 +0300 Subject: [MTS-MTQ] refactoring: performance optimization strings replaced by const-char pointer --- src/MTS_IO_ICellularRadio.cpp | 174 +++++++++++++++++++++--------------------- 1 file changed, 87 insertions(+), 87 deletions(-) (limited to 'src/MTS_IO_ICellularRadio.cpp') diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp index e206a59..58ccb2b 100644 --- a/src/MTS_IO_ICellularRadio.cpp +++ b/src/MTS_IO_ICellularRadio.cpp @@ -9,100 +9,100 @@ const char MTS::IO::ICellularRadio::CR = 0x0D; const char MTS::IO::ICellularRadio::NL = 0x0A; const char MTS::IO::ICellularRadio::CTRL_Z = 0x1A; -const std::string MTS::IO::ICellularRadio::RSP_ERROR("ERROR"); -const std::string MTS::IO::ICellularRadio::RSP_OK("OK"); +const char *MTS::IO::ICellularRadio::RSP_ERROR = "ERROR"; +const char *MTS::IO::ICellularRadio::RSP_OK = "OK"; -const std::string MTS::IO::ICellularRadio::DEFAULT_RADIO_PORT("/dev/modem_at1"); -const std::string MTS::IO::ICellularRadio::DEFAULT_RADIO_DIR("/var/run/radio/"); -const std::string MTS::IO::ICellularRadio::VALUE_UNKNOWN("Unknown"); -const std::string MTS::IO::ICellularRadio::VALUE_UNAVAILABLE("Unavailable"); -const std::string MTS::IO::ICellularRadio::VALUE_NOT_SUPPORTED("Not Supported"); +const char *MTS::IO::ICellularRadio::DEFAULT_RADIO_PORT = "/dev/modem_at1"; +const char *MTS::IO::ICellularRadio::DEFAULT_RADIO_DIR = "/var/run/radio/"; +const char *MTS::IO::ICellularRadio::VALUE_UNKNOWN = "Unknown"; +const char *MTS::IO::ICellularRadio::VALUE_UNAVAILABLE = "Unavailable"; +const char *MTS::IO::ICellularRadio::VALUE_NOT_SUPPORTED = "Not Supported"; -const std::string MTS::IO::ICellularRadio::VALUE_NOT_REGISTERED("NOT REGISTERED"); -const std::string MTS::IO::ICellularRadio::VALUE_REGISTERED("REGISTERED"); -const std::string MTS::IO::ICellularRadio::VALUE_SEARCHING("SEARCHING"); -const std::string MTS::IO::ICellularRadio::VALUE_DENIED("DENIED"); -const std::string MTS::IO::ICellularRadio::VALUE_ROAMING("ROAMING"); +const char *MTS::IO::ICellularRadio::VALUE_NOT_REGISTERED = "NOT REGISTERED"; +const char *MTS::IO::ICellularRadio::VALUE_REGISTERED = "REGISTERED"; +const char *MTS::IO::ICellularRadio::VALUE_SEARCHING = "SEARCHING"; +const char *MTS::IO::ICellularRadio::VALUE_DENIED = "DENIED"; +const char *MTS::IO::ICellularRadio::VALUE_ROAMING = "ROAMING"; //Static Data -const std::string MTS::IO::ICellularRadio::KEY_TYPE("type"); //!< GSM or CDMA -const std::string MTS::IO::ICellularRadio::KEY_CODE("code"); //!< Product Code : H5, H6, C2, EV3, G3 -const std::string MTS::IO::ICellularRadio::KEY_MODEL("model"); //!< Model : HE910, LE910, CE910, DE910, GE910 -const std::string MTS::IO::ICellularRadio::KEY_MANUFACTURER("manufacturer"); //!< Manufacturer: Telit -const std::string MTS::IO::ICellularRadio::KEY_HARDWARE("hardware"); //!< Radio Hardware Version -const std::string MTS::IO::ICellularRadio::KEY_FIRMWARE("firmware"); //!< Radio Firmware Version -const std::string MTS::IO::ICellularRadio::KEY_FIRMWARE_BUILD("firmwarebuild"); //!< Radio Firmware Build - -const std::string MTS::IO::ICellularRadio::KEY_CARRIER("carrier"); //!< Cellular Service Provider (Home Network) -const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_VERIZON("Verizon"); -const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_AERIS("Aeris"); -const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_SPRINT("Sprint"); -const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_USCELLULAR("U.S. Cellular"); -const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_ATT("AT&T"); -const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_TMOBILE("T-Mobile"); - -const std::string MTS::IO::ICellularRadio::KEY_IMEI("imei"); //!< International Mobile Station Equipment Identity -const std::string MTS::IO::ICellularRadio::KEY_MEID("meid"); //!< Mobile Equipment Identifier -const std::string MTS::IO::ICellularRadio::KEY_IMSI("imsi"); //!< International Mobile Subscriber Identity -const std::string MTS::IO::ICellularRadio::KEY_MSID("msid"); //!< Mobil Station ID / Mobile Identification Number (MSID/MIN) (CDMA-Only) -const std::string MTS::IO::ICellularRadio::KEY_MDN("mdn"); //!< Mobile Directory Number : Actual phone number dialed to reach radio -const std::string MTS::IO::ICellularRadio::KEY_ICCID("iccid"); //!< Integrated Circuit Card Identifier -const std::string MTS::IO::ICellularRadio::KEY_MSL("msl"); //!< Master Subsidy Lock +const char *MTS::IO::ICellularRadio::KEY_TYPE = "type"; //!< GSM or CDMA +const char *MTS::IO::ICellularRadio::KEY_CODE = "code"; //!< Product Code : H5, H6, C2, EV3, G3 +const char *MTS::IO::ICellularRadio::KEY_MODEL = "model"; //!< Model : HE910, LE910, CE910, DE910, GE910 +const char *MTS::IO::ICellularRadio::KEY_MANUFACTURER = "manufacturer"; //!< Manufacturer: Telit +const char *MTS::IO::ICellularRadio::KEY_HARDWARE = "hardware"; //!< Radio Hardware Version +const char *MTS::IO::ICellularRadio::KEY_FIRMWARE = "firmware"; //!< Radio Firmware Version +const char *MTS::IO::ICellularRadio::KEY_FIRMWARE_BUILD = "firmwarebuild"; //!< Radio Firmware Build + +const char *MTS::IO::ICellularRadio::KEY_CARRIER = "carrier"; //!< Cellular Service Provider = Home Network +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_VERIZON = "Verizon"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_AERIS = "Aeris"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_SPRINT = "Sprint"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_USCELLULAR = "U.S. Cellular"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_ATT = "AT&T"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_TMOBILE = "T-Mobile"; + +const char *MTS::IO::ICellularRadio::KEY_IMEI = "imei"; //!< International Mobile Station Equipment Identity +const char *MTS::IO::ICellularRadio::KEY_MEID = "meid"; //!< Mobile Equipment Identifier +const char *MTS::IO::ICellularRadio::KEY_IMSI = "imsi"; //!< International Mobile Subscriber Identity +const char *MTS::IO::ICellularRadio::KEY_MSID = "msid"; //!< Mobil Station ID / Mobile Identification Number = MSID/MIN = CDMA-Only +const char *MTS::IO::ICellularRadio::KEY_MDN = "mdn"; //!< Mobile Directory Number : Actual phone number dialed to reach radio +const char *MTS::IO::ICellularRadio::KEY_ICCID = "iccid"; //!< Integrated Circuit Card Identifier +const char *MTS::IO::ICellularRadio::KEY_MSL = "msl"; //!< Master Subsidy Lock //Dynamic Data -const std::string MTS::IO::ICellularRadio::KEY_ROAMING("roaming"); //!< Indicates whether or not using Home Network -const std::string MTS::IO::ICellularRadio::KEY_DATETIME("datetime"); //!< Date and Time from tower -const std::string MTS::IO::ICellularRadio::KEY_SERVICE("service"); //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] -const std::string MTS::IO::ICellularRadio::KEY_NETWORK("network"); //!< Cellular Service Provider -const std::string MTS::IO::ICellularRadio::KEY_NETWORK_REG("netreg"); //!< Network Registration -const std::string MTS::IO::ICellularRadio::KEY_CID("cid"); //!< Cellular ID (Tower) in HEX -const std::string MTS::IO::ICellularRadio::KEY_LAC("lac"); //!< Location Area Code in HEX -const std::string MTS::IO::ICellularRadio::KEY_RAC("rac"); //!< Routing Area Code in HEX -const std::string MTS::IO::ICellularRadio::KEY_RSSI("rssi"); //!< Signal Strength -const std::string MTS::IO::ICellularRadio::KEY_RSSIDBM("rssidBm"); //!< Signal Strength in dBm -const std::string MTS::IO::ICellularRadio::KEY_MCC("mcc"); //!< Country Code -const std::string MTS::IO::ICellularRadio::KEY_MNC("mnc"); //!< Operator Code -const std::string MTS::IO::ICellularRadio::KEY_CHANNEL("channel"); //!< ARFCN or UARFCN Assigned Radio Channel -const std::string MTS::IO::ICellularRadio::KEY_TXPWR("txpwr"); //!< Transmit Power -const std::string MTS::IO::ICellularRadio::KEY_PSC("psc"); //!< Active Primary Synchronization Code (PSC) -const std::string MTS::IO::ICellularRadio::KEY_ECIO("ecio"); //!< Active Ec/Io (chip energy per total wideband power in dBm) -const std::string MTS::IO::ICellularRadio::KEY_RSCP("rscp"); //!< Active RSCP (Received Signal Code Power in dBm) -const std::string MTS::IO::ICellularRadio::KEY_DRX("drx"); //!< Discontinuous reception cycle length (ms) -const std::string MTS::IO::ICellularRadio::KEY_MM("mm"); //!< Mobility Management State -const std::string MTS::IO::ICellularRadio::KEY_RR("rr"); //!< Radio Resource State -const std::string MTS::IO::ICellularRadio::KEY_NOM("nom"); //!< Network Operator Mode -const std::string MTS::IO::ICellularRadio::KEY_ABND("abnd"); //!< Active Band -const std::string MTS::IO::ICellularRadio::KEY_BLER("bler"); //!< Block Error Rate (percentage) -const std::string MTS::IO::ICellularRadio::KEY_SD("sd"); //!< Service Domain -const std::string MTS::IO::ICellularRadio::KEY_DEBUG("debug"); //!< Debug Information - -const std::string MTS::IO::ICellularRadio::KEY_MIP("mipProfile"); //!< Mobile IP Information -const std::string MTS::IO::ICellularRadio::KEY_MIP_ID("id"); //!< Mobile IP ID -const std::string MTS::IO::ICellularRadio::KEY_MIP_ENABLED("enabled"); //!< Mobile IP Enabled/Disabled -const std::string MTS::IO::ICellularRadio::KEY_MIP_NAI("nai"); //!< Network Access Identifier -const std::string MTS::IO::ICellularRadio::KEY_MIP_HOMEADDRESS("homeAddress"); //!< Home Address -const std::string MTS::IO::ICellularRadio::KEY_MIP_PRIMARYHA("primaryAddress"); //!< Primary Home Agent -const std::string MTS::IO::ICellularRadio::KEY_MIP_SECONDARYHA("secondaryAddress"); //!< Secondary Home Agent -const std::string MTS::IO::ICellularRadio::KEY_MIP_MNAAASPI("mnAaaSpi"); //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index -const std::string MTS::IO::ICellularRadio::KEY_MIP_MNHASPI("mnHaSpi"); //!< Mobile Node Home Agent Security Server Parameter Index -const std::string MTS::IO::ICellularRadio::KEY_MIP_REVTUN("revTun"); //!< Reverse Tunneling Enabled -const std::string MTS::IO::ICellularRadio::KEY_MIP_MNAAASS("mnAaaSs"); //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret -const std::string MTS::IO::ICellularRadio::KEY_MIP_MNHASS("mnHaSs"); //!< Mobile Node Home Agent Shared Secret - -const std::string MTS::IO::ICellularRadio::VALUE_TYPE_GSM("GSM"); -const std::string MTS::IO::ICellularRadio::VALUE_TYPE_LTE("LTE"); -const std::string MTS::IO::ICellularRadio::VALUE_TYPE_CDMA("CDMA"); - -const std::string MTS::IO::ICellularRadio::VALUE_SD_NO_SERVICE("NO SERVICE"); -const std::string MTS::IO::ICellularRadio::VALUE_SD_CS_ONLY("CS ONLY"); -const std::string MTS::IO::ICellularRadio::VALUE_SD_PS_ONLY("PS ONLY"); -const std::string MTS::IO::ICellularRadio::VALUE_SD_CSPS("CS+PS"); - -const std::string MTS::IO::ICellularRadio::VALUE_ABND_GSM_850("GSM 850"); -const std::string MTS::IO::ICellularRadio::VALUE_ABND_GSM_900("GSM 900"); -const std::string MTS::IO::ICellularRadio::VALUE_ABND_DCS_1800("DCS 1800"); -const std::string MTS::IO::ICellularRadio::VALUE_ABND_PCS_1900("PCS 1900"); +const char *MTS::IO::ICellularRadio::KEY_ROAMING = "roaming"; //!< Indicates whether or not using Home Network +const char *MTS::IO::ICellularRadio::KEY_DATETIME = "datetime"; //!< Date and Time from tower +const char *MTS::IO::ICellularRadio::KEY_SERVICE = "service"; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] +const char *MTS::IO::ICellularRadio::KEY_NETWORK = "network"; //!< Cellular Service Provider +const char *MTS::IO::ICellularRadio::KEY_NETWORK_REG = "netreg"; //!< Network Registration +const char *MTS::IO::ICellularRadio::KEY_CID = "cid"; //!< Cellular ID = Tower in HEX +const char *MTS::IO::ICellularRadio::KEY_LAC = "lac"; //!< Location Area Code in HEX +const char *MTS::IO::ICellularRadio::KEY_RAC = "rac"; //!< Routing Area Code in HEX +const char *MTS::IO::ICellularRadio::KEY_RSSI = "rssi"; //!< Signal Strength +const char *MTS::IO::ICellularRadio::KEY_RSSIDBM = "rssidBm"; //!< Signal Strength in dBm +const char *MTS::IO::ICellularRadio::KEY_MCC = "mcc"; //!< Country Code +const char *MTS::IO::ICellularRadio::KEY_MNC = "mnc"; //!< Operator Code +const char *MTS::IO::ICellularRadio::KEY_CHANNEL = "channel"; //!< ARFCN or UARFCN Assigned Radio Channel +const char *MTS::IO::ICellularRadio::KEY_TXPWR = "txpwr"; //!< Transmit Power +const char *MTS::IO::ICellularRadio::KEY_PSC = "psc"; //!< Active Primary Synchronization Code = PSC +const char *MTS::IO::ICellularRadio::KEY_ECIO = "ecio"; //!< Active Ec/Io = chip energy per total wideband power in dBm +const char *MTS::IO::ICellularRadio::KEY_RSCP = "rscp"; //!< Active RSCP = Received Signal Code Power in dBm +const char *MTS::IO::ICellularRadio::KEY_DRX = "drx"; //!< Discontinuous reception cycle length = ms +const char *MTS::IO::ICellularRadio::KEY_MM = "mm"; //!< Mobility Management State +const char *MTS::IO::ICellularRadio::KEY_RR = "rr"; //!< Radio Resource State +const char *MTS::IO::ICellularRadio::KEY_NOM = "nom"; //!< Network Operator Mode +const char *MTS::IO::ICellularRadio::KEY_ABND = "abnd"; //!< Active Band +const char *MTS::IO::ICellularRadio::KEY_BLER = "bler"; //!< Block Error Rate = percentage +const char *MTS::IO::ICellularRadio::KEY_SD = "sd"; //!< Service Domain +const char *MTS::IO::ICellularRadio::KEY_DEBUG = "debug"; //!< Debug Information + +const char *MTS::IO::ICellularRadio::KEY_MIP = "mipProfile"; //!< Mobile IP Information +const char *MTS::IO::ICellularRadio::KEY_MIP_ID = "id"; //!< Mobile IP ID +const char *MTS::IO::ICellularRadio::KEY_MIP_ENABLED = "enabled"; //!< Mobile IP Enabled/Disabled +const char *MTS::IO::ICellularRadio::KEY_MIP_NAI = "nai"; //!< Network Access Identifier +const char *MTS::IO::ICellularRadio::KEY_MIP_HOMEADDRESS = "homeAddress"; //!< Home Address +const char *MTS::IO::ICellularRadio::KEY_MIP_PRIMARYHA = "primaryAddress"; //!< Primary Home Agent +const char *MTS::IO::ICellularRadio::KEY_MIP_SECONDARYHA = "secondaryAddress"; //!< Secondary Home Agent +const char *MTS::IO::ICellularRadio::KEY_MIP_MNAAASPI = "mnAaaSpi"; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index +const char *MTS::IO::ICellularRadio::KEY_MIP_MNHASPI = "mnHaSpi"; //!< Mobile Node Home Agent Security Server Parameter Index +const char *MTS::IO::ICellularRadio::KEY_MIP_REVTUN = "revTun"; //!< Reverse Tunneling Enabled +const char *MTS::IO::ICellularRadio::KEY_MIP_MNAAASS = "mnAaaSs"; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret +const char *MTS::IO::ICellularRadio::KEY_MIP_MNHASS = "mnHaSs"; //!< Mobile Node Home Agent Shared Secret + +const char *MTS::IO::ICellularRadio::VALUE_TYPE_GSM = "GSM"; +const char *MTS::IO::ICellularRadio::VALUE_TYPE_LTE = "LTE"; +const char *MTS::IO::ICellularRadio::VALUE_TYPE_CDMA = "CDMA"; + +const char *MTS::IO::ICellularRadio::VALUE_SD_NO_SERVICE = "NO SERVICE"; +const char *MTS::IO::ICellularRadio::VALUE_SD_CS_ONLY = "CS ONLY"; +const char *MTS::IO::ICellularRadio::VALUE_SD_PS_ONLY = "PS ONLY"; +const char *MTS::IO::ICellularRadio::VALUE_SD_CSPS = "CS+PS"; + +const char *MTS::IO::ICellularRadio::VALUE_ABND_GSM_850 = "GSM 850"; +const char *MTS::IO::ICellularRadio::VALUE_ABND_GSM_900 = "GSM 900"; +const char *MTS::IO::ICellularRadio::VALUE_ABND_DCS_1800 = "DCS 1800"; +const char *MTS::IO::ICellularRadio::VALUE_ABND_PCS_1900 = "PCS 1900"; const std::vector MTS::IO::ICellularRadio::DEFAULT_BAIL_STRINGS = { MTS::IO::ICellularRadio::RSP_OK, MTS::IO::ICellularRadio::RSP_ERROR }; -- cgit v1.2.3 From 2fe0784ab57aa5571e5cd70c1776eecda635b3c0 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 11 Jun 2019 16:49:09 +0300 Subject: [MTS-MTQ] cellular factory: quectel eg95 instance creation --- src/MTS_IO_ICellularRadio.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/MTS_IO_ICellularRadio.cpp') diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp index 58ccb2b..2f19f3a 100644 --- a/src/MTS_IO_ICellularRadio.cpp +++ b/src/MTS_IO_ICellularRadio.cpp @@ -419,6 +419,8 @@ std::string MTS::IO::ICellularRadio::extractModelFromResult(const std::string& s sModel = "DE910-DUAL"; } else if(sResult.find("CE910") != std::string::npos) { sModel = "CE910"; + } else if(sResult.find("EG95") != std::string::npos) { + sModel = "EG95"; } return sModel; } -- cgit v1.2.3 From 5649cebb23edc7ef20456e76b959e4a217a08594 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Wed, 12 Jun 2019 09:51:50 +0300 Subject: [MTS-MTQ] QuectelRadio implementation Updated the following functions to support Quectel radios: - CellularRadioFactory::createEG95Radio - fixed to build a EG95Radio instance; - ICellularRadio::extractModelFromResult - returning EG95 for EG95 radios; - ICellularRadio::convertModelToType - returning VALUE_TYPE_LTE for EG95. --- src/MTS_IO_ICellularRadio.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/MTS_IO_ICellularRadio.cpp') diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp index 2f19f3a..7f216d0 100644 --- a/src/MTS_IO_ICellularRadio.cpp +++ b/src/MTS_IO_ICellularRadio.cpp @@ -181,6 +181,27 @@ MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertModelToMtsShortCod } else if (sModel.find("DE910") == 0) { sCode = "EV3"; eCode = SUCCESS; + } else if (sModel.find("EG95") == 0) { + if (NULL == radioObject) { + sCode = VALUE_NOT_SUPPORTED; + eCode = ERROR; + } else { + std::string sValue; + eCode = radioObject->getFirmware(sValue); + if (eCode != SUCCESS) { + sCode = VALUE_NOT_SUPPORTED; + eCode = ERROR; + } else if (sValue.find("EG95E") != std::string::npos) { + sCode = "LEU7"; + eCode = SUCCESS; + } else if (sValue.find("EG95NA") != std::string::npos) { + sCode = "LNA7"; + eCode = SUCCESS; + } else { + sCode = VALUE_NOT_SUPPORTED; + eCode = ERROR; + } + } } else { sCode = VALUE_NOT_SUPPORTED; printError("RADIO| Could not identify MTS short code from model. [%s]", sModel.c_str()); @@ -274,6 +295,9 @@ MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertModelToType(const } else if (sModel.find("DE910") == 0) { sType = VALUE_TYPE_CDMA; eCode = SUCCESS; + } else if (sModel.find("EG95") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; } else { sType = VALUE_TYPE_GSM; eCode = ERROR; -- cgit v1.2.3 From da53c2f6955e748862066f727997965f7b9c6849 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Sat, 22 Jun 2019 10:51:06 +0300 Subject: [MTS-MTQ] SIM status and PIN unlock procedures Defined the JSON object fields for SIM Status Summary data --- src/MTS_IO_ICellularRadio.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/MTS_IO_ICellularRadio.cpp') diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp index 7f216d0..4e7809e 100644 --- a/src/MTS_IO_ICellularRadio.cpp +++ b/src/MTS_IO_ICellularRadio.cpp @@ -94,6 +94,12 @@ const char *MTS::IO::ICellularRadio::VALUE_TYPE_GSM = "GSM"; const char *MTS::IO::ICellularRadio::VALUE_TYPE_LTE = "LTE"; const char *MTS::IO::ICellularRadio::VALUE_TYPE_CDMA = "CDMA"; +const char *MTS::IO::ICellularRadio::KEY_IS_SIM_INSERTED = "isSimInserted"; //!< SIM card insertion indicator. True when a SIM card is inserted +const char *MTS::IO::ICellularRadio::KEY_IS_SIM_LOCKED = "isSimLocked"; //!< SIM card lock status indicator. True when a SIM card is locked by PIN / PUK / other code +const char *MTS::IO::ICellularRadio::KEY_SIM_LOCK_STATUS = "lockStatus"; //!< SIM card lock status string. Either "READY", "SIM PIN", "SIM PUK" or other state +const char *MTS::IO::ICellularRadio::KEY_ATTEMPTS_PIN = "attemptsPin"; //!< The number of attempts left to unlock the SIM card using PIN code +const char *MTS::IO::ICellularRadio::KEY_ATTEMPTS_PUK = "attemptsPuk"; //!< The number of attempts left to unlock the SIM card using PUK code + const char *MTS::IO::ICellularRadio::VALUE_SD_NO_SERVICE = "NO SERVICE"; const char *MTS::IO::ICellularRadio::VALUE_SD_CS_ONLY = "CS ONLY"; const char *MTS::IO::ICellularRadio::VALUE_SD_PS_ONLY = "PS ONLY"; -- cgit v1.2.3