diff options
author | Maksym Telychko <maksym.telychko@globallogic.com> | 2019-06-12 15:22:41 +0300 |
---|---|---|
committer | Maksym Telychko <maksym.telychko@globallogic.com> | 2019-06-12 15:22:41 +0300 |
commit | 123aed7c4be0b88a4726cae5d722d74ebdf93782 (patch) | |
tree | 7923c2bd930ebd879e6d8e6f43dc988a409320c4 | |
parent | 5c8318bea803966f5b883c986919787e77e514a5 (diff) | |
download | libmts-io-123aed7c4be0b88a4726cae5d722d74ebdf93782.tar.gz libmts-io-123aed7c4be0b88a4726cae5d722d74ebdf93782.tar.bz2 libmts-io-123aed7c4be0b88a4726cae5d722d74ebdf93782.zip |
[MTS-MTQ] refactoring: using full qualified names for consts
-rw-r--r-- | include/mts/MTS_IO_CellularRadio.h | 10 | ||||
-rw-r--r-- | src/MTS_IO_CdmaRadio.cpp | 128 | ||||
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 150 | ||||
-rw-r--r-- | src/MTS_IO_LE910NA1Radio.cpp | 2 | ||||
-rw-r--r-- | src/MTS_IO_ME910C1NVRadio.cpp | 2 | ||||
-rw-r--r-- | src/MTS_IO_ME910C1WWRadio.cpp | 2 | ||||
-rw-r--r-- | src/MTS_IO_ME910Radio.cpp | 2 | ||||
-rw-r--r-- | src/MTS_IO_TelitRadio.cpp | 126 |
8 files changed, 211 insertions, 211 deletions
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 0410e0d..acb235b 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -101,19 +101,19 @@ namespace MTS { CODE getEcho(bool& bEnabled) override; CODE setEcho(bool bEnabled = true) override; CODE getStaticInformation(Json::Value& jData) override; - CODE sendBasicCommand(const std::string& sCmd, int32_t timeoutMillis = 100, const char& ESC = CR) override; + CODE sendBasicCommand(const std::string& sCmd, int32_t timeoutMillis = 100, const char& ESC = ICellularRadio::CR) override; std::string sendCommand(const std::string& sCmd, const std::vector<std::string>& vBail = DEFAULT_BAIL_STRINGS, int32_t timeoutMillis = 100, - const char& ESC = CR) override; + const char& ESC = ICellularRadio::CR) override; std::string sendCommand(const std::string& sCmd, IsNeedMoreData& isNeedMoreData, int32_t timeoutMillis = 100, - const char& ESC = CR) override; + const char& ESC = ICellularRadio::CR) override; protected: @@ -130,9 +130,9 @@ namespace MTS { public: RadioBandMap() { - m_sChannel = CellularRadio::VALUE_UNKNOWN; + m_sChannel = ICellularRadio::VALUE_UNKNOWN; m_iChannel = 0; - m_sRadioType = CellularRadio::VALUE_UNKNOWN; + m_sRadioType = ICellularRadio::VALUE_UNKNOWN; } RadioBandMap(const std::string &channel, const std::string &radioType) : diff --git a/src/MTS_IO_CdmaRadio.cpp b/src/MTS_IO_CdmaRadio.cpp index 4ff5d63..09db89b 100644 --- a/src/MTS_IO_CdmaRadio.cpp +++ b/src/MTS_IO_CdmaRadio.cpp @@ -51,10 +51,10 @@ CdmaRadio::CODE CdmaRadio::getImei(std::string& sImei) { CdmaRadio::CODE CdmaRadio::getMeid(std::string& sMeid) { printTrace("%s| Get MEID", getName().c_str()); - sMeid = VALUE_NOT_SUPPORTED; + sMeid = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT#MEIDESN?"); std::string sResult = sendCommand(sCmd); - size_t pos = sResult.find(RSP_OK); + size_t pos = sResult.find(ICellularRadio::RSP_OK); if (pos == std::string::npos) { printWarning("%s| Unable to get MEID from radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -74,10 +74,10 @@ CdmaRadio::CODE CdmaRadio::getMeid(std::string& sMeid) { CdmaRadio::CODE CdmaRadio::getMsid(std::string& sMsid) { printTrace("%s| Get MSID", getName().c_str()); - sMsid = VALUE_NOT_SUPPORTED; + sMsid = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT$MSID?"); std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get MSID from radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -119,28 +119,28 @@ CdmaRadio::CODE CdmaRadio::getNetwork(std::string& sNetwork) { CdmaRadio::CODE CdmaRadio::getSimStatus(std::string& sSimStatus) { printTrace("%s| Get SIM Status", getName().c_str()); - sSimStatus = VALUE_NOT_SUPPORTED; + sSimStatus = ICellularRadio::VALUE_NOT_SUPPORTED; return NOT_APPLICABLE; } CdmaRadio::CODE CdmaRadio::getIccid(std::string& sIccid) { printTrace("%s| Get ICCID", getName().c_str()); - sIccid = VALUE_NOT_SUPPORTED; + sIccid = ICellularRadio::VALUE_NOT_SUPPORTED; return NOT_APPLICABLE; } CdmaRadio::CODE CdmaRadio::getLac(std::string& sLac) { printTrace("%s| Get LAC", getName().c_str()); - sLac = VALUE_NOT_SUPPORTED; + sLac = ICellularRadio::VALUE_NOT_SUPPORTED; return NOT_APPLICABLE; } CdmaRadio::CODE CdmaRadio::getService(std::string& sService) { printTrace("%s| Get Service", getName().c_str()); - sService = VALUE_NOT_SUPPORTED; + sService = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT+SERVICE?"); std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get Service from radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -159,7 +159,7 @@ CdmaRadio::CODE CdmaRadio::getService(std::string& sService) { case 2: sService = "EVDO"; break; //Release 0 case 3: sService = "EVDO"; break; //Release A case 4: sService = "GPRS"; break; - default: sService = VALUE_UNKNOWN; break; + default: sService = ICellularRadio::VALUE_UNKNOWN; break; } printDebug("%s| Service ID: [%d][%s]", getName().c_str(), iService, sService.c_str()); @@ -169,10 +169,10 @@ CdmaRadio::CODE CdmaRadio::getService(std::string& sService) { CdmaRadio::CODE CdmaRadio::getHardware(std::string& sHardware) { printTrace("%s| Get Hardware", getName().c_str()); - sHardware = VALUE_NOT_SUPPORTED; + sHardware = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT#HWREV"); std::string sResult = sendCommand(sCmd); - size_t pos = sResult.find(RSP_OK); + size_t pos = sResult.find(ICellularRadio::RSP_OK); if (pos == std::string::npos) { printWarning("%s| Unable to get hardware from radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -189,10 +189,10 @@ CdmaRadio::CODE CdmaRadio::getHardware(std::string& sHardware) { CdmaRadio::CODE CdmaRadio::getMdn(std::string& sMdn) { printTrace("%s| Get MDN", getName().c_str()); - sMdn = VALUE_NOT_SUPPORTED; + sMdn = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT+CNUM"); std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get MDN from radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -274,7 +274,7 @@ CdmaRadio::CODE CdmaRadio::setMdn(const Json::Value& jArgs) { sCmd += sMdn; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set MDN for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -309,7 +309,7 @@ CdmaRadio::CODE CdmaRadio::setMsid(const Json::Value& jArgs) { sCmd += jArgs["msid"].asString(); std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set MSID for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -329,7 +329,7 @@ CdmaRadio::CODE CdmaRadio::getMipProfile(Json::Value& jMipProfile) { if(sCarrier == "Aeris" || sCarrier == "Sprint") { std::string sCmd("AT$QCMIPGETP"); std::string sResult = MTS::Text::trim(sendCommand(sCmd)); - if (sResult.find(RSP_OK) == std::string::npos) { + if (sResult.find(ICellularRadio::RSP_OK) == std::string::npos) { printWarning("%s| Unable to get active MIP profile for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; } @@ -341,34 +341,34 @@ CdmaRadio::CODE CdmaRadio::getMipProfile(Json::Value& jMipProfile) { std::vector<std::string> vParts = MTS::Text::split(sLine, ':', 2); if(vParts.size() == 2 && vParts[0] == "Profile") { if(vParts[1].find("Enabled") != std::string::npos) { - jMipProfile[KEY_MIP_ENABLED] = true; + jMipProfile[ICellularRadio::KEY_MIP_ENABLED] = true; } else { - jMipProfile[KEY_MIP_ENABLED] = false; + jMipProfile[ICellularRadio::KEY_MIP_ENABLED] = false; } int32_t id; sscanf(vParts[1].c_str(), "%d", &id); - jMipProfile[KEY_MIP_ID] = id; + jMipProfile[ICellularRadio::KEY_MIP_ID] = id; } else { printWarning("%s| Unable to parse active MIP profile from line [%s]", getName().c_str(), sLine.c_str()); } - splitAndAssign(vLine[1], "NAI", jMipProfile, KEY_MIP_NAI); - splitAndAssign(vLine[2], "Home Addr", jMipProfile, KEY_MIP_HOMEADDRESS); - splitAndAssign(vLine[3], "Primary HA", jMipProfile, KEY_MIP_PRIMARYHA); - splitAndAssign(vLine[4], "Secondary HA", jMipProfile, KEY_MIP_SECONDARYHA); - splitAndAssign(vLine[5], "MN-AAA SPI", jMipProfile, KEY_MIP_MNAAASPI); - splitAndAssign(vLine[6], "MN-HA SPI", jMipProfile, KEY_MIP_MNHASPI); + splitAndAssign(vLine[1], "NAI", jMipProfile, ICellularRadio::KEY_MIP_NAI); + splitAndAssign(vLine[2], "Home Addr", jMipProfile, ICellularRadio::KEY_MIP_HOMEADDRESS); + splitAndAssign(vLine[3], "Primary HA", jMipProfile, ICellularRadio::KEY_MIP_PRIMARYHA); + splitAndAssign(vLine[4], "Secondary HA", jMipProfile, ICellularRadio::KEY_MIP_SECONDARYHA); + splitAndAssign(vLine[5], "MN-AAA SPI", jMipProfile, ICellularRadio::KEY_MIP_MNAAASPI); + splitAndAssign(vLine[6], "MN-HA SPI", jMipProfile, ICellularRadio::KEY_MIP_MNHASPI); //Reverse Tunneling sLine = vLine[7]; vParts = MTS::Text::split(sLine, ':', 2); if(vParts.size() == 2 && vParts[0] == "Rev Tun") { if(vParts[1] == "1") { - jMipProfile[KEY_MIP_REVTUN] = true; + jMipProfile[ICellularRadio::KEY_MIP_REVTUN] = true; } else { - jMipProfile[KEY_MIP_REVTUN] = false; + jMipProfile[ICellularRadio::KEY_MIP_REVTUN] = false; } } else { printWarning("%s| Unable to parse Reverse Tunneling from line [%s]", getName().c_str(), sLine.c_str()); @@ -379,9 +379,9 @@ CdmaRadio::CODE CdmaRadio::getMipProfile(Json::Value& jMipProfile) { vParts = MTS::Text::split(sLine, ':', 2); if(vParts.size() == 2 && vParts[0] == "MN-AAA SS") { if(vParts[1] == "Set") { - jMipProfile[KEY_MIP_MNAAASS] = true; + jMipProfile[ICellularRadio::KEY_MIP_MNAAASS] = true; } else { - jMipProfile[KEY_MIP_MNAAASS] = false; + jMipProfile[ICellularRadio::KEY_MIP_MNAAASS] = false; } } else { printWarning("%s| Unable to parse MN-AAA SS from line [%s]", getName().c_str(), sLine.c_str()); @@ -392,9 +392,9 @@ CdmaRadio::CODE CdmaRadio::getMipProfile(Json::Value& jMipProfile) { vParts = MTS::Text::split(sLine, ':', 2); if(vParts.size() == 2 && vParts[0] == "MN-HA SS") { if(vParts[1] == "Set") { - jMipProfile[KEY_MIP_MNHASS] = true; + jMipProfile[ICellularRadio::KEY_MIP_MNHASS] = true; } else { - jMipProfile[KEY_MIP_MNHASS] = false; + jMipProfile[ICellularRadio::KEY_MIP_MNHASS] = false; } } else { printWarning("%s| Unable to parse MN-HA SS from line [%s]", getName().c_str(), sLine.c_str()); @@ -417,7 +417,7 @@ CdmaRadio::CODE CdmaRadio::setMipActiveProfile(const Json::Value& jArgs) { sCmd += jArgs["activeProfile"].asString(); std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set Active profile for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -437,7 +437,7 @@ CdmaRadio::CODE CdmaRadio::setMipNai(const Json::Value& jArgs) { sCmd += jArgs["nai"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set NAI for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -457,7 +457,7 @@ CdmaRadio::CODE CdmaRadio::setMipHomeIp(const Json::Value& jArgs) { sCmd += jArgs["homeIp"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set Home IP profile for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -477,7 +477,7 @@ CdmaRadio::CODE CdmaRadio::setMipPrimaryHa(const Json::Value& jArgs) { sCmd += jArgs["primaryHa"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set Primary HA for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -497,7 +497,7 @@ CdmaRadio::CODE CdmaRadio::setMipSecondaryHa(const Json::Value& jArgs) { sCmd += jArgs["secondaryHa"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set Secondary HA for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -517,7 +517,7 @@ CdmaRadio::CODE CdmaRadio::setMipMnAaaSpi(const Json::Value& jArgs) { sCmd += jArgs["mnAaaSpi"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set MN-AAA SPI for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -537,7 +537,7 @@ CdmaRadio::CODE CdmaRadio::setMipMnHaSpi(const Json::Value& jArgs) { sCmd += jArgs["mnHaSpi"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set MN-HA SPI for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -557,7 +557,7 @@ CdmaRadio::CODE CdmaRadio::setMipRevTun(const Json::Value& jArgs) { sCmd += jArgs["revTun"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set Rev Tun for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -577,7 +577,7 @@ CdmaRadio::CODE CdmaRadio::setMipMnAaaSs(const Json::Value& jArgs) { sCmd += jArgs["mnAaaSs"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set MN-AAA SS for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -597,7 +597,7 @@ CdmaRadio::CODE CdmaRadio::setMipMnHaSs(const Json::Value& jArgs) { sCmd += jArgs["mnHaSs"].asString() + ",1"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set MN-HA SS for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -627,7 +627,7 @@ CdmaRadio::CODE CdmaRadio::updateDc(const Json::Value& jArgs, UpdateCb& stepCb) return true; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); printTrace("%s| Update DC Callback Started", this->getName().c_str()); while(end != std::string::npos) { @@ -683,7 +683,7 @@ CdmaRadio::CODE CdmaRadio::updateDc(const Json::Value& jArgs, UpdateCb& stepCb) stepCb(Json::Value("DC Error: update fails with other reasons")); } return false; - }else if(sLine == RSP_ERROR) { + }else if(sLine == ICellularRadio::RSP_ERROR) { result = ERROR; return false; } @@ -692,7 +692,7 @@ CdmaRadio::CODE CdmaRadio::updateDc(const Json::Value& jArgs, UpdateCb& stepCb) if(next != std::string::npos) { pos = next; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); } printTrace("%s| Update DC Callback Finished", this->getName().c_str()); @@ -724,7 +724,7 @@ CdmaRadio::CODE CdmaRadio::updatePrl(const Json::Value& jArgs, UpdateCb& stepCb) return true; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); printTrace("%s| Update PRL Callback Started", this->getName().c_str()); while(end != std::string::npos) { @@ -780,7 +780,7 @@ CdmaRadio::CODE CdmaRadio::updatePrl(const Json::Value& jArgs, UpdateCb& stepCb) stepCb(Json::Value("PRL Error: update fails with other reasons")); } return false; - } else if(sLine == RSP_ERROR) { + } else if(sLine == ICellularRadio::RSP_ERROR) { result = ERROR; return false; } @@ -789,7 +789,7 @@ CdmaRadio::CODE CdmaRadio::updatePrl(const Json::Value& jArgs, UpdateCb& stepCb) if(next != std::string::npos) { pos = next; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); } printTrace("%s| Update PRL Callback Finished", this->getName().c_str()); @@ -821,7 +821,7 @@ CdmaRadio::CODE CdmaRadio::updateFumo(const Json::Value& jArgs, UpdateCb& stepCb return true; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); printTrace("%s| Update FUMO Callback Started", this->getName().c_str()); while(end != std::string::npos) { @@ -937,7 +937,7 @@ CdmaRadio::CODE CdmaRadio::updateFumo(const Json::Value& jArgs, UpdateCb& stepCb if(stepCb) { stepCb(Json::Value("FUMO Info: reporting of firmware update result to server")); } - } else if(sLine == RSP_ERROR) { + } else if(sLine == ICellularRadio::RSP_ERROR) { result = ERROR; return false; } @@ -946,7 +946,7 @@ CdmaRadio::CODE CdmaRadio::updateFumo(const Json::Value& jArgs, UpdateCb& stepCb if(next != std::string::npos) { pos = next; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); } printTrace("%s| Update FUMO Callback Finished", this->getName().c_str()); @@ -992,7 +992,7 @@ CdmaRadio::CODE CdmaRadio::resetHfa(const Json::Value& jArgs, UpdateCb& stepCb) return true; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); printTrace("%s| HFA Reset Callback Started", this->getName().c_str()); while(end != std::string::npos) { @@ -1032,10 +1032,10 @@ CdmaRadio::CODE CdmaRadio::resetHfa(const Json::Value& jArgs, UpdateCb& stepCb) stepCb(Json::Value("RTN Done: Firmware DM - Session Completed Successfully")); } return false; - } else if(sLine == RSP_ERROR) { + } else if(sLine == ICellularRadio::RSP_ERROR) { result = ERROR; return false; - } else if(sLine == RSP_OK) { + } else if(sLine == ICellularRadio::RSP_OK) { //The Device will reboot now, so reset the connection if(stepCb) { stepCb(Json::Value("RTN Info: Resetting Radio")); @@ -1062,7 +1062,7 @@ CdmaRadio::CODE CdmaRadio::resetHfa(const Json::Value& jArgs, UpdateCb& stepCb) if(next != std::string::npos) { pos = next; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); } printTrace("%s| HFA Reset Callback Finished", this->getName().c_str()); @@ -1082,7 +1082,7 @@ CdmaRadio::CODE CdmaRadio::activate(const Json::Value& jArgs, UpdateCb& stepCb) std::string sCarrier; getCarrier(sCarrier); - if(sCarrier == VALUE_CARRIER_AERIS) { + if(sCarrier == ICellularRadio::VALUE_CARRIER_AERIS) { if(!jArgs["msid"].isString()) { printError("%s| Arguments missing \"msid\"", getName().c_str()); @@ -1122,9 +1122,9 @@ CdmaRadio::CODE CdmaRadio::activate(const Json::Value& jArgs, UpdateCb& stepCb) return SUCCESS; - } else if(sCarrier == VALUE_CARRIER_VERIZON) { + } else if(sCarrier == ICellularRadio::VALUE_CARRIER_VERIZON) { sActivationCmd = "AT+CDV*22899\r"; - } else if(sCarrier == VALUE_CARRIER_USCELLULAR) { + } else if(sCarrier == ICellularRadio::VALUE_CARRIER_USCELLULAR) { sActivationCmd = "AT+CDV*228\r"; } else { return NOT_APPLICABLE; @@ -1153,7 +1153,7 @@ CdmaRadio::CODE CdmaRadio::activate(const Json::Value& jArgs, UpdateCb& stepCb) return true; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); printTrace("%s| Activation Reset Callback Started", this->getName().c_str()); while(end != std::string::npos) { @@ -1162,7 +1162,7 @@ CdmaRadio::CODE CdmaRadio::activate(const Json::Value& jArgs, UpdateCb& stepCb) printTrace("%s| Line: [%s]", this->getName().c_str(), sLine.c_str()); - if(sLine == RSP_OK) { + if(sLine == ICellularRadio::RSP_OK) { if(stepCb) { stepCb(Json::Value("Activation Info: Over-the-Air Programming in Process")); } @@ -1194,7 +1194,7 @@ CdmaRadio::CODE CdmaRadio::activate(const Json::Value& jArgs, UpdateCb& stepCb) } result = ERROR; return false; - } else if(sLine == RSP_ERROR) { + } else if(sLine == ICellularRadio::RSP_ERROR) { result = ERROR; return false; } @@ -1203,7 +1203,7 @@ CdmaRadio::CODE CdmaRadio::activate(const Json::Value& jArgs, UpdateCb& stepCb) if(next != std::string::npos) { pos = next; } - end = allData.find(NL, pos); + end = allData.find(ICellularRadio::NL, pos); } printTrace("%s| Activation Callback Finished", this->getName().c_str()); @@ -1222,11 +1222,11 @@ CdmaRadio::CODE CdmaRadio::getNetworkStatus(Json::Value& jData) { std::string sCarrier; getCarrier(sCarrier); - if(sCarrier == VALUE_CARRIER_SPRINT) { + if(sCarrier == ICellularRadio::VALUE_CARRIER_SPRINT) { Json::Value& jDebug = jData["debug"]; std::string sCmd("AT$DEBUG?"); std::string sResult = MTS::Text::trim(sendCommand(sCmd)); - if (sResult.find(RSP_OK) != std::string::npos) { + if (sResult.find(ICellularRadio::RSP_OK) != std::string::npos) { std::vector<std::string> vCategories = MTS::Text::split(sResult, "\r\n\r\n"); for(size_t i = 0 ; i < vCategories.size(); i++) { std::vector<std::string> vLine = MTS::Text::split(vCategories[i], "\r\n"); diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 66d44a0..20cb93a 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -175,10 +175,10 @@ const std::string& CellularRadio::getName() const { CellularRadio::CODE CellularRadio::getFirmware(std::string& sFirmware) { printTrace("%s| Get Firmware", m_sName.c_str()); - sFirmware = VALUE_NOT_SUPPORTED; + sFirmware = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT+CGMR"); std::string sResult = sendCommand(sCmd); - size_t pos = sResult.find(RSP_OK); + size_t pos = sResult.find(ICellularRadio::RSP_OK); if (pos == std::string::npos) { printWarning("%s| Unable to get firmware from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); return FAILURE; @@ -196,13 +196,13 @@ CellularRadio::CODE CellularRadio::getFirmware(std::string& sFirmware) { } CellularRadio::CODE CellularRadio::getFirmwareBuild(std::string& sFirmwareBuild) { - sFirmwareBuild = VALUE_NOT_SUPPORTED; + sFirmwareBuild = ICellularRadio::VALUE_NOT_SUPPORTED; return FAILURE; } CellularRadio::CODE CellularRadio::getHardware(std::string& sHardware) { printTrace("%s| Get Hardware", m_sName.c_str()); - sHardware = VALUE_NOT_SUPPORTED; + sHardware = ICellularRadio::VALUE_NOT_SUPPORTED; if(m_sFirmware.size() == 0) { getFirmware(m_sFirmware); @@ -216,10 +216,10 @@ CellularRadio::CODE CellularRadio::getHardware(std::string& sHardware) { CellularRadio::CODE CellularRadio::getManufacturer(std::string& sManufacturer) { printTrace("%s| Get Manufacturer", m_sName.c_str()); - sManufacturer = VALUE_NOT_SUPPORTED; + sManufacturer = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT+GMI"); std::string sResult = sendCommand(sCmd); - size_t pos = sResult.find(RSP_OK); + size_t pos = sResult.find(ICellularRadio::RSP_OK); if (pos == std::string::npos) { printWarning("%s| Unable to get manufacturer from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); return FAILURE; @@ -236,10 +236,10 @@ CellularRadio::CODE CellularRadio::getManufacturer(std::string& sManufacturer) { CellularRadio::CODE CellularRadio::getImei(std::string& sImei) { printTrace("%s| Get IMEI", m_sName.c_str()); - sImei = VALUE_NOT_SUPPORTED; + sImei = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT+CGSN"); std::string sResult = sendCommand(sCmd); - size_t pos = sResult.find(RSP_OK); + size_t pos = sResult.find(ICellularRadio::RSP_OK); if (pos == std::string::npos) { printWarning("%s| Unable to get IMEI from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); return FAILURE; @@ -261,10 +261,10 @@ CellularRadio::CODE CellularRadio::getMeid(std::string& sMeid) { CellularRadio::CODE CellularRadio::getImsi(std::string& sImsi) { printTrace("%s| Get IMSI", m_sName.c_str()); - sImsi = VALUE_NOT_SUPPORTED; + sImsi = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT+CIMI"); std::string sResult = sendCommand(sCmd); - size_t pos = sResult.find(RSP_OK); + size_t pos = sResult.find(ICellularRadio::RSP_OK); if (pos == std::string::npos) { printWarning("%s| Unable to get IMSI from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); return FAILURE; @@ -281,7 +281,7 @@ CellularRadio::CODE CellularRadio::getImsi(std::string& sImsi) { CellularRadio::CODE CellularRadio::getSimStatus(std::string& sSimStatus) { printTrace("%s| Get SIM Status", getName().c_str()); - sSimStatus = VALUE_UNKNOWN; + sSimStatus = ICellularRadio::VALUE_UNKNOWN; return FAILURE; } @@ -289,11 +289,11 @@ CellularRadio::CODE CellularRadio::getLac(std::string& sLac) { Json::Value jData; printTrace("%s| Get LAC", m_sName.c_str()); - sLac = VALUE_NOT_SUPPORTED; + sLac = ICellularRadio::VALUE_NOT_SUPPORTED; if(getNetworkStatus(jData) == SUCCESS) { - if(jData.isMember(KEY_LAC)) { - sLac = jData[KEY_LAC].asString(); + if(jData.isMember(ICellularRadio::KEY_LAC)) { + sLac = jData[ICellularRadio::KEY_LAC].asString(); return SUCCESS; } } @@ -303,10 +303,10 @@ CellularRadio::CODE CellularRadio::getLac(std::string& sLac) { CellularRadio::CODE CellularRadio::getMdn(std::string& sMdn) { printTrace("%s| Get MDN", m_sName.c_str()); - sMdn = VALUE_NOT_SUPPORTED; + sMdn = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT+CNUM"); std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get MDN from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); return FAILURE; @@ -350,7 +350,7 @@ CellularRadio::CODE CellularRadio::getMsid(std::string& sMsid) { CellularRadio::CODE CellularRadio::getType(std::string& sType) { printTrace("%s| Get Type", m_sName.c_str()); - sType = VALUE_NOT_SUPPORTED; + sType = ICellularRadio::VALUE_NOT_SUPPORTED; return FAILURE; } @@ -359,14 +359,14 @@ CellularRadio::CODE CellularRadio::getCarrier(std::string& sCarrier) { if(m_sCarrier == "") { Json::Value jData; if(getNetworkStatus(jData) == SUCCESS) { - if(jData.isMember(KEY_MCC) && jData.isMember(KEY_MNC)) { - std::string sMcc = jData[KEY_MCC].asString(); - std::string sMnc = jData[KEY_MNC].asString(); + if(jData.isMember(ICellularRadio::KEY_MCC) && jData.isMember(ICellularRadio::KEY_MNC)) { + std::string sMcc = jData[ICellularRadio::KEY_MCC].asString(); + std::string sMnc = jData[ICellularRadio::KEY_MNC].asString(); Json::Value jLookup = MccMncTable::getInstance()->lookup(sMcc, sMnc); printTrace("%s| MCC-MNC Lookup: [%s][%s][%s]", m_sName.c_str(), sMcc.c_str(), sMnc.c_str(), jLookup.toStyledString().c_str()); - if(jLookup.isMember(KEY_CARRIER)) { - m_sCarrier = jLookup[KEY_CARRIER].asString(); + if(jLookup.isMember(ICellularRadio::KEY_CARRIER)) { + m_sCarrier = jLookup[ICellularRadio::KEY_CARRIER].asString(); } else { printWarning("%s| MCC-MNC Lookup did not contain carrier", m_sName.c_str()); return FAILURE; @@ -388,11 +388,11 @@ CellularRadio::CODE CellularRadio::getTower(std::string& sTower) { Json::Value jData; printTrace("%s| Get Tower", m_sName.c_str()); - sTower = VALUE_NOT_SUPPORTED; + sTower = ICellularRadio::VALUE_NOT_SUPPORTED; if(getNetworkStatus(jData) == SUCCESS) { - if(jData.isMember(KEY_CID)) { - sTower = jData[KEY_CID].asString(); + if(jData.isMember(ICellularRadio::KEY_CID)) { + sTower = jData[ICellularRadio::KEY_CID].asString(); return SUCCESS; } } @@ -409,7 +409,7 @@ CellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTim std::string sCmd("AT+CCLK?"); std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get Time from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); return FAILURE; @@ -492,11 +492,11 @@ CellularRadio::CODE CellularRadio::getNetwork(std::string& sNetwork) { Json::Value jData; printTrace("%s| Get Network", m_sName.c_str()); - sNetwork = VALUE_NOT_SUPPORTED; + sNetwork = ICellularRadio::VALUE_NOT_SUPPORTED; if(getNetworkStatus(jData) == SUCCESS) { - if(jData.isMember(KEY_NETWORK)) { - sNetwork = jData[KEY_NETWORK].asString(); + if(jData.isMember(ICellularRadio::KEY_NETWORK)) { + sNetwork = jData[ICellularRadio::KEY_NETWORK].asString(); return SUCCESS; } } @@ -692,7 +692,7 @@ std::string CellularRadio::queryLteLac() { std::string result; CGREGstring = queryCGREGstring(); - if (CGREGstring == RSP_ERROR) { + if (CGREGstring == ICellularRadio::RSP_ERROR) { originalCGREG = "0"; } else { originalCGREG = CGREGstring.at(CGREGstring.find(",") - 1); //Position right before first comma ("+CGREG: 0,1") @@ -702,13 +702,13 @@ std::string CellularRadio::queryLteLac() { setCGREG("2"); CGREGstring = queryCGREGstring(); - if (CGREGstring == RSP_ERROR) { - result = VALUE_UNKNOWN; + if (CGREGstring == ICellularRadio::RSP_ERROR) { + result = ICellularRadio::VALUE_UNKNOWN; } else { size_t start = CGREGstring.find(":") + 1; //Position right after "#RFSTS:" std::vector<std::string> vParts = MTS::Text::split(MTS::Text::trim(CGREGstring.substr(start)), ","); if(vParts.size() < 3) { - result = VALUE_UNAVAILABLE; + result = ICellularRadio::VALUE_UNAVAILABLE; } else { result = MTS::Text::strip(vParts[2], '"'); } @@ -732,7 +732,7 @@ std::string CellularRadio::queryCGREGstring() { std::string cmdResult(sendCommand(sCmd)); if (cmdResult.find("+CGREG:") == std::string::npos) { printDebug("%s| AT#CGREG? returned unexpected response: [%s][%s]", m_sName.c_str(), sCmd.c_str(), cmdResult.c_str()); - return RSP_ERROR; + return ICellularRadio::RSP_ERROR; } return cmdResult; } @@ -741,48 +741,48 @@ void CellularRadio::getCommonNetworkStats(Json::Value& jData) { bool bRoaming = false; if(getRoaming(bRoaming) == SUCCESS) { - jData[KEY_ROAMING] = bRoaming; + jData[ICellularRadio::KEY_ROAMING] = bRoaming; } int32_t iRssi; if(getSignalStrength(iRssi) == SUCCESS) { - jData[KEY_RSSI] = iRssi; + jData[ICellularRadio::KEY_RSSI] = iRssi; int32_t dBm; - if(!jData.isMember(KEY_RSSIDBM) && convertSignalStrengthTodBm(iRssi, dBm) == SUCCESS) { + if(!jData.isMember(ICellularRadio::KEY_RSSIDBM) && convertSignalStrengthTodBm(iRssi, dBm) == SUCCESS) { //Add RSSI in dBm format - jData[KEY_RSSIDBM] = MTS::Text::format(dBm); + jData[ICellularRadio::KEY_RSSIDBM] = MTS::Text::format(dBm); } } std::string sService; if(getService(sService) == SUCCESS) { - jData[KEY_SERVICE] = sService; + jData[ICellularRadio::KEY_SERVICE] = sService; } std::string sDate, sTime, sTimeZone; if(getTime(sDate, sTime, sTimeZone) == SUCCESS) { - jData[KEY_DATETIME] = sDate + " " + sTime + " GMT" + sTimeZone; + jData[ICellularRadio::KEY_DATETIME] = sDate + " " + sTime + " GMT" + sTimeZone; } std::string sNetworkReg; REGISTRATION eReg; if (getRegistration(eReg) == SUCCESS) { if (convertRegistrationToString(eReg, sNetworkReg) == SUCCESS) { - jData[KEY_NETWORK_REG] = sNetworkReg; + jData[ICellularRadio::KEY_NETWORK_REG] = sNetworkReg; } } } void CellularRadio::initMipProfile(Json::Value& jData) { - jData[KEY_MIP_ID] = 0; - jData[KEY_MIP_ENABLED] = false; - jData[KEY_MIP_NAI] = VALUE_UNKNOWN; - jData[KEY_MIP_HOMEADDRESS] = VALUE_UNKNOWN; - jData[KEY_MIP_PRIMARYHA] = VALUE_UNKNOWN; - jData[KEY_MIP_SECONDARYHA] = VALUE_UNKNOWN; - jData[KEY_MIP_MNAAASPI] = VALUE_UNKNOWN; - jData[KEY_MIP_MNHASPI] = VALUE_UNKNOWN; - jData[KEY_MIP_MNAAASS] = false; - jData[KEY_MIP_MNHASS] = false; + jData[ICellularRadio::KEY_MIP_ID] = 0; + jData[ICellularRadio::KEY_MIP_ENABLED] = false; + jData[ICellularRadio::KEY_MIP_NAI] = ICellularRadio::VALUE_UNKNOWN; + jData[ICellularRadio::KEY_MIP_HOMEADDRESS] = ICellularRadio::VALUE_UNKNOWN; + jData[ICellularRadio::KEY_MIP_PRIMARYHA] = ICellularRadio::VALUE_UNKNOWN; + jData[ICellularRadio::KEY_MIP_SECONDARYHA] = ICellularRadio::VALUE_UNKNOWN; + jData[ICellularRadio::KEY_MIP_MNAAASPI] = ICellularRadio::VALUE_UNKNOWN; + jData[ICellularRadio::KEY_MIP_MNHASPI] = ICellularRadio::VALUE_UNKNOWN; + jData[ICellularRadio::KEY_MIP_MNAAASS] = false; + jData[ICellularRadio::KEY_MIP_MNHASS] = false; } CellularRadio::CODE CellularRadio::getRegistration(REGISTRATION& eRegistration) { @@ -823,12 +823,12 @@ CellularRadio::CODE CellularRadio::convertRegistrationToString(REGISTRATION eReg CODE eCode = FAILURE; switch (eRegistration) { - case NOT_REGISTERED: sRegistration = VALUE_NOT_REGISTERED; eCode = SUCCESS; break; - case REGISTERED: sRegistration = VALUE_REGISTERED; eCode = SUCCESS; break; - case SEARCHING: sRegistration = VALUE_SEARCHING; eCode = SUCCESS; break; - case DENIED: sRegistration = VALUE_DENIED; eCode = SUCCESS; break; - case UNKNOWN: sRegistration = VALUE_UNKNOWN; eCode = SUCCESS; break; - case ROAMING: sRegistration = VALUE_ROAMING; eCode = SUCCESS; break; + case NOT_REGISTERED: sRegistration = ICellularRadio::VALUE_NOT_REGISTERED; eCode = SUCCESS; break; + case REGISTERED: sRegistration = ICellularRadio::VALUE_REGISTERED; eCode = SUCCESS; break; + case SEARCHING: sRegistration = ICellularRadio::VALUE_SEARCHING; eCode = SUCCESS; break; + case DENIED: sRegistration = ICellularRadio::VALUE_DENIED; eCode = SUCCESS; break; + case UNKNOWN: sRegistration = ICellularRadio::VALUE_UNKNOWN; eCode = SUCCESS; break; + case ROAMING: sRegistration = ICellularRadio::VALUE_ROAMING; eCode = SUCCESS; break; } return eCode; } @@ -949,7 +949,7 @@ CellularRadio::CODE CellularRadio::setActiveFirmware(const Json::Value&) { CellularRadio::CODE CellularRadio::getActiveFirmware(std::string& sFwId) { printTrace("%s| Get Active Firmware Image Number: not applicable", m_sName.c_str()); - sFwId = VALUE_NOT_SUPPORTED; + sFwId = ICellularRadio::VALUE_NOT_SUPPORTED; return NOT_APPLICABLE; } @@ -958,9 +958,9 @@ CellularRadio::CODE CellularRadio::sendBasicCommand(const std::string& sCmd, int std::string response = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, iTimeoutMillis, ESC); if (response.size() == 0) { return NO_RESPONSE; - } else if (response.find(RSP_OK) != std::string::npos) { + } else if (response.find(ICellularRadio::RSP_OK) != std::string::npos) { return SUCCESS; - } else if (response.find(RSP_ERROR) != std::string::npos) { + } else if (response.find(ICellularRadio::RSP_ERROR) != std::string::npos) { return ERROR; } else { return FAILURE; @@ -1032,19 +1032,19 @@ bool CellularRadio::getCarrierFromFirmware(const std::string& sFirmware, std::st //Good good if(cId == '0') { - sCarrier = VALUE_CARRIER_SPRINT; + sCarrier = ICellularRadio::VALUE_CARRIER_SPRINT; bResult = true; } else if(cId == '1') { - sCarrier = VALUE_CARRIER_AERIS; + sCarrier = ICellularRadio::VALUE_CARRIER_AERIS; bResult = true; } else if(cId == '2') { - sCarrier = VALUE_CARRIER_VERIZON; + sCarrier = ICellularRadio::VALUE_CARRIER_VERIZON; bResult = true; } else if(cId == '3') { - sCarrier = VALUE_CARRIER_USCELLULAR; + sCarrier = ICellularRadio::VALUE_CARRIER_USCELLULAR; bResult = true; } } @@ -1096,7 +1096,7 @@ const char *CellularRadio::RadioBandMap::getLTEBand(const int32_t channel) return EULTRAband[ii].name; } } - return VALUE_UNKNOWN; + return ICellularRadio::VALUE_UNKNOWN; } const char *CellularRadio::RadioBandMap::getCDMABand(const int channel) @@ -1108,7 +1108,7 @@ const char *CellularRadio::RadioBandMap::getCDMABand(const int channel) return WCDMAband[ii].name; } } - return VALUE_UNKNOWN; + return ICellularRadio::VALUE_UNKNOWN; } const char *CellularRadio::RadioBandMap::getGSMBand(const int channel) @@ -1120,22 +1120,22 @@ const char *CellularRadio::RadioBandMap::getGSMBand(const int channel) return GSMband[ii].name; } } - return VALUE_UNKNOWN; + return ICellularRadio::VALUE_UNKNOWN; } const char *CellularRadio::RadioBandMap::getRadioBandName() { - const char *band = CellularRadio::VALUE_UNKNOWN; + const char *band = ICellularRadio::VALUE_UNKNOWN; - if (m_sRadioType == VALUE_TYPE_LTE) + if (m_sRadioType == ICellularRadio::VALUE_TYPE_LTE) { band = getLTEBand(m_iChannel); } - else if (m_sRadioType == VALUE_TYPE_CDMA) + else if (m_sRadioType == ICellularRadio::VALUE_TYPE_CDMA) { band = getCDMABand(m_iChannel); } - else if (m_sRadioType == VALUE_TYPE_GSM) + else if (m_sRadioType == ICellularRadio::VALUE_TYPE_GSM) { band = getGSMBand(m_iChannel); } @@ -1145,17 +1145,17 @@ const char *CellularRadio::RadioBandMap::getRadioBandName() const char *CellularRadio::RadioBandMap::getRadioBandName(const std::string &channel, const std::string &radioType) { - const char *band = VALUE_UNKNOWN; + const char *band = ICellularRadio::VALUE_UNKNOWN; int32_t chan = strtol(channel.c_str(), NULL, 10); - if (radioType == VALUE_TYPE_LTE) + if (radioType == ICellularRadio::VALUE_TYPE_LTE) { band = getLTEBand(chan); } - else if (radioType == VALUE_TYPE_CDMA) + else if (radioType == ICellularRadio::VALUE_TYPE_CDMA) { band = getCDMABand(chan); } - else if (radioType == VALUE_TYPE_GSM) + else if (radioType == ICellularRadio::VALUE_TYPE_GSM) { band = getGSMBand(chan); } diff --git a/src/MTS_IO_LE910NA1Radio.cpp b/src/MTS_IO_LE910NA1Radio.cpp index 382432b..8ae15ad 100644 --- a/src/MTS_IO_LE910NA1Radio.cpp +++ b/src/MTS_IO_LE910NA1Radio.cpp @@ -108,7 +108,7 @@ LE910NA1Radio::CODE LE910NA1Radio::getActiveFirmware(std::string& sFwId) { sCmd = "AT#FWSWITCH?"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get active image number from radio using command [%s]", getName().c_str(), diff --git a/src/MTS_IO_ME910C1NVRadio.cpp b/src/MTS_IO_ME910C1NVRadio.cpp index 08c18e9..c7aae7b 100644 --- a/src/MTS_IO_ME910C1NVRadio.cpp +++ b/src/MTS_IO_ME910C1NVRadio.cpp @@ -419,7 +419,7 @@ ME910C1NVRadio::CODE ME910C1NVRadio::doFumoFtp(const Json::Value &jConfig, Updat printTrace("RADIO| AT#FTPMSG result [%s]", sResult.c_str()); - if (sResult.find(RSP_OK) == std::string::npos) { + if (sResult.find(ICellularRadio::RSP_OK) == std::string::npos) { rc = FAILURE; if(stepCb) { stepCb(Json::Value("FUMO Error: failed to download the firmware file")); diff --git a/src/MTS_IO_ME910C1WWRadio.cpp b/src/MTS_IO_ME910C1WWRadio.cpp index 2bc86a1..0228eda 100644 --- a/src/MTS_IO_ME910C1WWRadio.cpp +++ b/src/MTS_IO_ME910C1WWRadio.cpp @@ -101,7 +101,7 @@ ME910C1WWRadio::CODE ME910C1WWRadio::getActiveFirmware(std::string& sFwId) { sCmd = "AT#FWSWITCH?"; std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get active image number from radio using command [%s]", getName().c_str(), diff --git a/src/MTS_IO_ME910Radio.cpp b/src/MTS_IO_ME910Radio.cpp index 3ed9e50..4ae8a75 100644 --- a/src/MTS_IO_ME910Radio.cpp +++ b/src/MTS_IO_ME910Radio.cpp @@ -40,7 +40,7 @@ ME910Radio::CODE ME910Radio::getFirmwareBuild(std::string& sFirmwareBuild) { std::string sResult = sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get firmware build number [%s]", getName().c_str(), diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index ee96ff2..a2ade7c 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -74,10 +74,10 @@ CellularRadio::CODE TelitRadio::getModel(std::string& sModel) { CellularRadio::CODE TelitRadio::getIccid(std::string& sIccid) { printTrace("%s| Get ICCID", getName().c_str()); - sIccid = VALUE_NOT_SUPPORTED; + sIccid = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT#CCID"); std::string sResult = CellularRadio::sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get ICCID from radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -97,10 +97,10 @@ CellularRadio::CODE TelitRadio::getIccid(std::string& sIccid) { CellularRadio::CODE TelitRadio::getService(std::string& sService) { printTrace("%s| Get Service", getName().c_str()); - sService = VALUE_NOT_SUPPORTED; + sService = ICellularRadio::VALUE_NOT_SUPPORTED; std::string sCmd("AT#PSNT?"); std::string sResult = CellularRadio::sendCommand(sCmd); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to get Service from radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -119,7 +119,7 @@ CellularRadio::CODE TelitRadio::getService(std::string& sService) { case 2: sService = "WCDMA"; break; case 3: sService = "HSDPA"; break; case 4: sService = "LTE"; break; - default: sService = VALUE_UNKNOWN; break; + default: sService = ICellularRadio::VALUE_UNKNOWN; break; } printDebug("%s| Service ID: [%d][%s]", getName().c_str(), iService, sService.c_str()); @@ -256,30 +256,30 @@ CellularRadio::CODE TelitRadio::getNetworkStatus(Json::Value& jData) { //Country Code and Operator Code std::vector<std::string> vPLMN = MTS::Text::split(vParts[0], ' '); if(vPLMN.size() == 2) { - jData[KEY_MCC] = MTS::Text::strip(vPLMN[0], '"'); - jData[KEY_MNC] = MTS::Text::strip(vPLMN[1], '"'); + jData[ICellularRadio::KEY_MCC] = MTS::Text::strip(vPLMN[0], '"'); + jData[ICellularRadio::KEY_MNC] = MTS::Text::strip(vPLMN[1], '"'); } - jData[KEY_CHANNEL] = vParts[1]; + jData[ICellularRadio::KEY_CHANNEL] = vParts[1]; } if (vParts.size() == GSM_NETWORK_FORMAT ) { //Parse as GSM Network Format - jData[KEY_RSSIDBM] = vParts[2]; - jData[KEY_LAC] = vParts[3]; - jData[KEY_RAC] = vParts[4]; - jData[KEY_TXPWR] = vParts[5]; - jData[KEY_MM] = vParts[6]; - jData[KEY_RR] = vParts[7]; - jData[KEY_NOM] = vParts[8]; - jData[KEY_CID] = vParts[9]; - jData[KEY_IMSI] = MTS::Text::strip(vParts[10], '"'); - jData[KEY_NETWORK] = MTS::Text::strip(vParts[11], '"'); + jData[ICellularRadio::KEY_RSSIDBM] = vParts[2]; + jData[ICellularRadio::KEY_LAC] = vParts[3]; + jData[ICellularRadio::KEY_RAC] = vParts[4]; + jData[ICellularRadio::KEY_TXPWR] = vParts[5]; + jData[ICellularRadio::KEY_MM] = vParts[6]; + jData[ICellularRadio::KEY_RR] = vParts[7]; + jData[ICellularRadio::KEY_NOM] = vParts[8]; + jData[ICellularRadio::KEY_CID] = vParts[9]; + jData[ICellularRadio::KEY_IMSI] = MTS::Text::strip(vParts[10], '"'); + jData[ICellularRadio::KEY_NETWORK] = MTS::Text::strip(vParts[11], '"'); if(MTS::Text::parse(iValue, vParts[12]) && convertServiceDomainToString((SERVICEDOMAIN)iValue, sValue) == SUCCESS) { - jData[KEY_SD] = sValue; + jData[ICellularRadio::KEY_SD] = sValue; } if(MTS::Text::parse(iValue, vParts[13]) && convertActiveBandToString((ACTIVEBAND)iValue, sValue) == SUCCESS) { - jData[KEY_ABND] = sValue; + jData[ICellularRadio::KEY_ABND] = sValue; } // IN003567 ME910C1 radios have some odd behavior with regards to WCDMA. The ordering of the fields from #RFSTS are // the same as LTE up to the 16th field (for ME901C1-WW anyway). Drop into LTE parsing for ME910C1-WW. @@ -288,36 +288,36 @@ CellularRadio::CODE TelitRadio::getNetworkStatus(Json::Value& jData) { //Parse as WCDMA Network Format - jDebug[KEY_PSC] = vParts[2]; - jDebug[KEY_ECIO] = vParts[3]; - jDebug[KEY_RSCP] = vParts[4]; + jDebug[ICellularRadio::KEY_PSC] = vParts[2]; + jDebug[ICellularRadio::KEY_ECIO] = vParts[3]; + jDebug[ICellularRadio::KEY_RSCP] = vParts[4]; - jData[KEY_RSSIDBM] = vParts[5]; - jData[KEY_LAC] = vParts[6]; - jData[KEY_RAC] = vParts[7]; + jData[ICellularRadio::KEY_RSSIDBM] = vParts[5]; + jData[ICellularRadio::KEY_LAC] = vParts[6]; + jData[ICellularRadio::KEY_RAC] = vParts[7]; - jDebug[KEY_TXPWR] = vParts[8]; - jDebug[KEY_DRX] = vParts[9]; - jDebug[KEY_MM] = vParts[10]; - jDebug[KEY_RR] = vParts[11]; - jDebug[KEY_NOM] = vParts[12]; + jDebug[ICellularRadio::KEY_TXPWR] = vParts[8]; + jDebug[ICellularRadio::KEY_DRX] = vParts[9]; + jDebug[ICellularRadio::KEY_MM] = vParts[10]; + jDebug[ICellularRadio::KEY_RR] = vParts[11]; + jDebug[ICellularRadio::KEY_NOM] = vParts[12]; if(vParts[13].size() != 0) { - jDebug[KEY_BLER] = vParts[13]; + jDebug[ICellularRadio::KEY_BLER] = vParts[13]; } else { - jDebug[KEY_BLER] = "000"; + jDebug[ICellularRadio::KEY_BLER] = "000"; } - jData[KEY_CID] = vParts[14]; - jData[KEY_IMSI] = MTS::Text::strip(vParts[15], '"'); - jData[KEY_NETWORK] = MTS::Text::strip(vParts[16], '"'); + jData[ICellularRadio::KEY_CID] = vParts[14]; + jData[ICellularRadio::KEY_IMSI] = MTS::Text::strip(vParts[15], '"'); + jData[ICellularRadio::KEY_NETWORK] = MTS::Text::strip(vParts[16], '"'); // Get the radio band given the channel (UARFCN) - RadioBandMap radioBandMap(vParts[1], CellularRadio::VALUE_TYPE_CDMA); - jData[KEY_ABND] = radioBandMap.getRadioBandName(); + RadioBandMap radioBandMap(vParts[1], CellularRadio::ICellularRadio::VALUE_TYPE_CDMA); + jData[ICellularRadio::KEY_ABND] = radioBandMap.getRadioBandName(); if(MTS::Text::parse(iValue, vParts[17]) && convertServiceDomainToString((SERVICEDOMAIN)iValue, sValue) == SUCCESS) { - jDebug[KEY_SD] = sValue; + jDebug[ICellularRadio::KEY_SD] = sValue; } //Ignoring Active Set Values // <nAST> - Number of Active Set (Maximum 6) @@ -325,7 +325,7 @@ CellularRadio::CODE TelitRadio::getNetworkStatus(Json::Value& jData) { // <nPSC> - PSC of n th active set // <nEc/Io > - Ec/Io of n th active Set - jData[KEY_DEBUG] = jDebug; + jData[ICellularRadio::KEY_DEBUG] = jDebug; } else if(vParts.size() >= LTE_NETWORK_FORMAT) { Json::Value jDebug; @@ -347,34 +347,34 @@ CellularRadio::CODE TelitRadio::getNetworkStatus(Json::Value& jData) { // if (vParts[13].find("\"") != std::string::npos) { // parse the RAC and then remove it from the vector - jData[KEY_RAC] = vParts[6]; + jData[ICellularRadio::KEY_RAC] = vParts[6]; vParts.erase(vParts.begin() + 6); } jDebug["rsrp"] = vParts[2]; - jDebug[KEY_RSSIDBM] = vParts[3]; + jDebug[ICellularRadio::KEY_RSSIDBM] = vParts[3]; jDebug["rsrq"] = vParts[4]; jData["tac"] = vParts[5]; - jDebug[KEY_TXPWR] = vParts[6]; - jData[KEY_DRX] = vParts[7]; - jDebug[KEY_MM] = vParts[8]; + jDebug[ICellularRadio::KEY_TXPWR] = vParts[6]; + jData[ICellularRadio::KEY_DRX] = vParts[7]; + jDebug[ICellularRadio::KEY_MM] = vParts[8]; jDebug["rrc"] = vParts[9]; - jData[KEY_CID] = MTS::Text::strip(vParts[10], '"'); - jData[KEY_IMSI] = MTS::Text::strip(vParts[11], '"'); - jData[KEY_NETWORK] = MTS::Text::strip(vParts[12], '"'); + jData[ICellularRadio::KEY_CID] = MTS::Text::strip(vParts[10], '"'); + jData[ICellularRadio::KEY_IMSI] = MTS::Text::strip(vParts[11], '"'); + jData[ICellularRadio::KEY_NETWORK] = MTS::Text::strip(vParts[12], '"'); // Get the radio band given the channel (EARFCN) - RadioBandMap radioBandMap(vParts[1], CellularRadio::VALUE_TYPE_LTE); - jData[KEY_ABND] = radioBandMap.getRadioBandName(); + RadioBandMap radioBandMap(vParts[1], ICellularRadio::VALUE_TYPE_LTE); + jData[ICellularRadio::KEY_ABND] = radioBandMap.getRadioBandName(); - jData[KEY_LAC] = queryLteLac(); + jData[ICellularRadio::KEY_LAC] = queryLteLac(); if(MTS::Text::parse(iValue, vParts[13]) && convertServiceDomainToString((SERVICEDOMAIN)iValue, sValue) == SUCCESS) { - jDebug[KEY_SD] = sValue; + jDebug[ICellularRadio::KEY_SD] = sValue; } - jData[KEY_DEBUG] = jDebug; + jData[ICellularRadio::KEY_DEBUG] = jDebug; } printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); @@ -389,7 +389,7 @@ std::string TelitRadio::queryLteLac() { std::string result; CGREGstring = queryCGREGstring(); - if (CGREGstring == RSP_ERROR) { + if (CGREGstring == ICellularRadio::RSP_ERROR) { originalCGREG = "0"; } else { originalCGREG = CGREGstring.at(CGREGstring.find(",") - 1); //Position right before first comma ("+CGREG: 0,1") @@ -399,13 +399,13 @@ std::string TelitRadio::queryLteLac() { setCGREG("2"); CGREGstring = queryCGREGstring(); - if (CGREGstring == RSP_ERROR) { - result = CellularRadio::VALUE_UNKNOWN; + if (CGREGstring == ICellularRadio::RSP_ERROR) { + result = ICellularRadio::VALUE_UNKNOWN; } else { size_t start = CGREGstring.find(":") + 1; //Position right after "#RFSTS:" std::vector<std::string> vParts = MTS::Text::split(MTS::Text::trim(CGREGstring.substr(start)), ","); if(vParts.size() < 3) { - result = CellularRadio::VALUE_UNAVAILABLE; + result = ICellularRadio::VALUE_UNAVAILABLE; } else { result = MTS::Text::strip(vParts[2], '"'); } @@ -429,7 +429,7 @@ std::string TelitRadio::queryCGREGstring() { std::string cmdResult(sendCommand(sCmd)); if (cmdResult.find("+CGREG:") == std::string::npos) { printDebug("%s| AT#CGREG? returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str()); - return RSP_ERROR; + return ICellularRadio::RSP_ERROR; } return cmdResult; } @@ -445,7 +445,7 @@ CellularRadio::CODE TelitRadio::setMdn(const Json::Value& jArgs) { sCmd += jArgs["mdn"].asString() + "\""; std::string sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 1000); - size_t end = sResult.find(RSP_OK); + size_t end = sResult.find(ICellularRadio::RSP_OK); if (end == std::string::npos) { printWarning("%s| Unable to set MDN for radio using command [%s]", getName().c_str(), sCmd.c_str()); return FAILURE; @@ -480,19 +480,19 @@ bool TelitRadio::getCarrierFromFirmware(const std::string& sFirmware, std::strin //Good good if(cId == '0') { - sCarrier = VALUE_CARRIER_SPRINT; + sCarrier = ICellularRadio::VALUE_CARRIER_SPRINT; bResult = true; } else if(cId == '1') { - sCarrier = VALUE_CARRIER_AERIS; + sCarrier = ICellularRadio::VALUE_CARRIER_AERIS; bResult = true; } else if(cId == '2') { - sCarrier = VALUE_CARRIER_VERIZON; + sCarrier = ICellularRadio::VALUE_CARRIER_VERIZON; bResult = true; } else if(cId == '3') { - sCarrier = VALUE_CARRIER_USCELLULAR; + sCarrier = ICellularRadio::VALUE_CARRIER_USCELLULAR; bResult = true; } } |