From 7634bcfed0ea186175e9f59672a38d2a86fbf025 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Tue, 16 Jun 2020 11:50:20 +0300 Subject: GP-654: Add SIM card-based carrier detection This commit adds implementation of the SIM-based carrier detection. The goal for this implementation is to replace various places in the firmware that previously relied on the ICCID-based carrier detection, provide some layer of abstraction and forward compatibility for such places. It is particularly useful for fwSwitch radios with AUTO firmware selection capability. --- include/mts/MTS_IO_CellularRadio.h | 4 ++++ include/mts/MTS_IO_ICellularRadio.h | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'include/mts') diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 7f4ed2b..e65eb4e 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -81,6 +81,7 @@ namespace MTS { CODE convertCellModesToString(CELLULAR_MODES eCellModes, std::string& sCellModes) override; CODE unlockSimCard(const Json::Value& jArgs) override; + CODE getMtsSimCarrierCode(std::string& sCarrier) override; CODE getMipProfile(Json::Value& jMipProfile) override; CODE validateMsl(const Json::Value& jArgs) override; @@ -164,6 +165,9 @@ namespace MTS { */ virtual CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) = 0; + //! Get MTS carrier code based on the SIM card ID (ICCID) + virtual CODE getMtsSimCarrierCode(const std::string& sIccid, std::string& sCarrier); + void initMipProfile(Json::Value& jData); bool splitAndAssign(const std::string& sLine, const std::string& sKey, Json::Value& jParent, const std::string& sJsonKey, Json::ValueType eType = Json::ValueType::stringValue); diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index c301191..98c886d 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -127,6 +127,7 @@ namespace MTS { static const char *KEY_ICCID; //!< Integrated Circuit Card Identifier static const char *KEY_MSL; //!< Master Subsidy Lock static const char *KEY_SUPPORTED_CELL_MODES; //!< Comma-separated list of all supported cellular modes (2g,3g,4g) + static const char *KEY_MTS_SIM_CARRIER_CODE; //!< MTS-specific carrier code fetched from the SIM card //Network Status Data @@ -200,6 +201,10 @@ namespace MTS { static const char *VALUE_ABND_DCS_1800; static const char *VALUE_ABND_PCS_1900; + //Values - MTS carrier code + static const char *VALUE_MTS_CARRIER_CODE_VERIZON; + static const char *VALUE_MTS_CARRIER_CODE_ATT; + static const std::vector DEFAULT_BAIL_STRINGS; virtual ~ICellularRadio() = 0; @@ -290,6 +295,22 @@ namespace MTS { */ virtual CODE unlockSimCard(const Json::Value& jArgs) = 0; + /** + * @brief getMtsSimCarrierCode - get MTS-specific carrier code from the SIM card. + * + * @param sCarrier - a string to be populated with one of the carrier codes: + * + * - VALUE_MTS_CARRIER_CODE_VERIZON - Verizon + * - VALUE_MTS_CARRIER_CODE_ATT - AT&T + * - VALUE_UNKNOWN - Unknown carrier + * - other values may be defined in the future + * + * @return CODE::SUCCESS when carrier name retrieved, + * CODE::ERROR otherwise (i.e. when modem is not responding, + * when SIM card is removed or on any other error). + */ + virtual CODE getMtsSimCarrierCode(std::string& sCarrier) = 0; + //! Gather details of the radio's Mobile IP Profile /*! \param Json::Value object that will be populated with MIP data -- cgit v1.2.3