diff options
| author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2019-06-13 10:32:08 +0300 |
|---|---|---|
| committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2019-06-13 10:32:08 +0300 |
| commit | c0e937f5a2a31b09f2736f1aeda782ba4ad121e2 (patch) | |
| tree | d1218d23cd3eab04c10bac711fe312ff650566a0 /src | |
| parent | acb40ca0033a48cedfeb118dcc216f60e4dd8c45 (diff) | |
| parent | 123aed7c4be0b88a4726cae5d722d74ebdf93782 (diff) | |
| download | libmts-io-c0e937f5a2a31b09f2736f1aeda782ba4ad121e2.tar.gz libmts-io-c0e937f5a2a31b09f2736f1aeda782ba4ad121e2.tar.bz2 libmts-io-c0e937f5a2a31b09f2736f1aeda782ba4ad121e2.zip | |
Merge branch 'quectel-radio' into quectel-specific
Ported the recent changes made by Maksym
Diffstat (limited to 'src')
| -rw-r--r-- | src/MTS_IO_CdmaRadio.cpp | 128 | ||||
| -rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 136 | ||||
| -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 | 122 |
7 files changed, 197 insertions, 197 deletions
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 c6ff5af..dbb64a5 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; @@ -636,7 +636,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") @@ -646,13 +646,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 "+CGREG:" 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], '"'); } @@ -676,7 +676,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; } @@ -685,48 +685,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) { @@ -767,12 +767,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; } @@ -893,7 +893,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; } @@ -902,9 +902,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; @@ -959,7 +959,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) @@ -971,7 +971,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) @@ -983,22 +983,22 @@ const char *CellularRadio::RadioBandMap::getGSMBand(const int channel) return GSMband[ii].name; } } - return VALUE_UNKNOWN; + return ICellularRadio |
