diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-06-16 15:37:02 +0300 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-06-16 15:37:02 +0300 |
commit | 747b898f36c4764475e61f20847ba4bbb3a81404 (patch) | |
tree | b104891745ea1206f5ae5e6d8728228583441112 /src | |
parent | 7634bcfed0ea186175e9f59672a38d2a86fbf025 (diff) | |
download | libmts-io-747b898f36c4764475e61f20847ba4bbb3a81404.tar.gz libmts-io-747b898f36c4764475e61f20847ba4bbb3a81404.tar.bz2 libmts-io-747b898f36c4764475e61f20847ba4bbb3a81404.zip |
[GP-654] Add SIM card-based carrier detection
Changes after a code review:
- renamed "MTS Carrier Code" to the "Carrier Code";
- fixed descriptions for the new field and methods.
Diffstat (limited to 'src')
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 14 | ||||
-rw-r--r-- | src/MTS_IO_ICellularRadio.cpp | 7 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index bef15e9..b18478e 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -912,11 +912,11 @@ ICellularRadio::CODE CellularRadio::unlockSimCard(const Json::Value& jArgs) { return SUCCESS; } -ICellularRadio::CODE CellularRadio::getMtsSimCarrierCode(std::string& sCarrierCode) { +ICellularRadio::CODE CellularRadio::getSimCarrierCode(std::string& sCarrierCode) { std::string sIccid; CODE rc; - printTrace("%s| Get MTS carrier code from the SIM card installed", m_sName.c_str()); + printTrace("%s| Get carrier code from the SIM card installed", m_sName.c_str()); rc = getIccid(sIccid); if (rc != SUCCESS) { @@ -926,26 +926,26 @@ ICellularRadio::CODE CellularRadio::getMtsSimCarrierCode(std::string& sCarrierCo printTrace("%s| Fetched ICCID: [%s]", m_sName.c_str(), sIccid.c_str()); - rc = getMtsSimCarrierCode(sIccid, sCarrierCode); + rc = getSimCarrierCode(sIccid, sCarrierCode); if (rc != SUCCESS) { printError("%s| Unable to determine SIM carrier: Unable to extract carrier from the SIM identifier", m_sName.c_str()); return rc; } - printTrace("%s| Detected MTS carrier code: [%s]", m_sName.c_str(), sCarrierCode.c_str()); + printTrace("%s| Detected carrier code: [%s]", m_sName.c_str(), sCarrierCode.c_str()); return rc; } -ICellularRadio::CODE CellularRadio::getMtsSimCarrierCode(const std::string& sIccid, std::string& sCarrierCode) { +ICellularRadio::CODE CellularRadio::getSimCarrierCode(const std::string& sIccid, std::string& sCarrierCode) { const char* ICCID_PREFIX_VZW = "891480"; const char* ICCID_PREFIX_ATT = "8901410"; if (sIccid.find(ICCID_PREFIX_VZW) == 0) { printTrace("%s| Verizon SIM detected", m_sName.c_str()); - sCarrierCode = VALUE_MTS_CARRIER_CODE_VERIZON; + sCarrierCode = VALUE_CARRIER_CODE_VERIZON; } else if (sIccid.find(ICCID_PREFIX_ATT) == 0) { printTrace("%s| AT&T SIM detected", m_sName.c_str()); - sCarrierCode = VALUE_MTS_CARRIER_CODE_ATT; + sCarrierCode = VALUE_CARRIER_CODE_ATT; } else { // All other carriers for which ICCID prefixes are not defined printWarning("%s| Carrier is unknown for this SIM ID: [%s]", m_sName.c_str(), sIccid.c_str()); diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp index e83ce80..12d7916 100644 --- a/src/MTS_IO_ICellularRadio.cpp +++ b/src/MTS_IO_ICellularRadio.cpp @@ -50,8 +50,7 @@ const char *MTS::IO::ICellularRadio::KEY_MDN = "mdn"; //!< Mobile Dir const char *MTS::IO::ICellularRadio::KEY_ICCID = "iccid"; //!< Integrated Circuit Card Identifier const char *MTS::IO::ICellularRadio::KEY_MSL = "msl"; //!< Master Subsidy Lock const char *MTS::IO::ICellularRadio::KEY_SUPPORTED_CELL_MODES = "supportedCellularModes"; //!< Comma-separated list of all supported cellular modes (2g,3g,4g) -const char *MTS::IO::ICellularRadio::KEY_MTS_SIM_CARRIER_CODE = "mtsSimCarrierCode"; //!< MTS-specific carrier code fetched from the SIM card - +const char *MTS::IO::ICellularRadio::KEY_SIM_CARRIER_CODE = "simCarrierCode"; //!< Unique carrier identifier based on the SIM card information. //Dynamic Data 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 @@ -113,8 +112,8 @@ 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 char *MTS::IO::ICellularRadio::VALUE_MTS_CARRIER_CODE_VERIZON = "vz"; -const char *MTS::IO::ICellularRadio::VALUE_MTS_CARRIER_CODE_ATT = "att"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_CODE_VERIZON = "vz"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_CODE_ATT = "att"; const std::vector<std::string> MTS::IO::ICellularRadio::DEFAULT_BAIL_STRINGS = { MTS::IO::ICellularRadio::RSP_OK, MTS::IO::ICellularRadio::RSP_ERROR }; |