summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2021-05-28 15:18:47 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2021-05-29 12:44:04 +0300
commit51484668683c5e10bda111c08a300af1834a59d2 (patch)
tree036272b226f64e02f8ab3084458ead1492f1c45c /include
parent3589be0c1b394c33abac98c2de98a5c56d595eb3 (diff)
downloadlibmts-io-51484668683c5e10bda111c08a300af1834a59d2.tar.gz
libmts-io-51484668683c5e10bda111c08a300af1834a59d2.tar.bz2
libmts-io-51484668683c5e10bda111c08a300af1834a59d2.zip
[GP-1111] mPower R. Apr 2021: +CEMODE shall be set to CEMODE=2
Added an ability to read the PLMN ID (MCC/MNC combination) of the home carrier from the SIM. SIM PLMN ID is a part of the IMSI that contains identifier of the home network. PLMN ID in turn consists of 3-digit MCC (country code) and 2-or-3-digit MNC (network code). The length of the MNC is stored in the SIM Elementary File called "Administrative Data" (EFad for short). The purpose of the new functions is to extract PLMN ID from the SIM if this information is available.
Diffstat (limited to 'include')
-rw-r--r--include/mts/MTS_IO_CdmaRadio.h3
-rw-r--r--include/mts/MTS_IO_CellularRadio.h34
-rw-r--r--include/mts/MTS_IO_ICellularRadio.h15
3 files changed, 52 insertions, 0 deletions
diff --git a/include/mts/MTS_IO_CdmaRadio.h b/include/mts/MTS_IO_CdmaRadio.h
index 7cdba02..3b23937 100644
--- a/include/mts/MTS_IO_CdmaRadio.h
+++ b/include/mts/MTS_IO_CdmaRadio.h
@@ -75,6 +75,9 @@ namespace MTS {
virtual CODE getNetworkStatus(Json::Value& jData);
+ CODE getSimMccMnc(std::string& sMccMnc) override;
+ CODE getSimMccMnc(std::string& sMcc, std::string& sMnc) override;
+
protected:
CdmaRadio(const std::string& sName, const std::string& sRadioPort);
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h
index 7e7454b..3783705 100644
--- a/include/mts/MTS_IO_CellularRadio.h
+++ b/include/mts/MTS_IO_CellularRadio.h
@@ -137,6 +137,9 @@ namespace MTS {
CODE setUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION mode) override;
CODE getUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION& mode) override;
+ CODE getSimMccMnc(std::string& sMccMnc) override;
+ CODE getSimMccMnc(std::string& sMcc, std::string& sMnc) override;
+
protected:
CellularRadio(const std::string& sName, const std::string& sRadioPort);
@@ -183,6 +186,37 @@ namespace MTS {
//! Get carrier code based on the SIM card ID (ICCID)
virtual CODE getSimCarrierCode(const std::string& sIccid, std::string& sCarrierCode);
+ /**
+ * @brief simAccessReadBinary - Read a string of bytes from the SIM Elementary File.
+ * Please see ETSI TS 102 221 v16.4.0 and ETSI TS 127 007 v16.6.0 for the details.
+ *
+ * @param iFiledId - identifier of the Elementary File to read from.
+ * @param iP1 - offset (ETSI TS 102 221 v16.4.0, Section 11.1.3.2).
+ * @param iP2 - offset low (ETSI TS 102 221 v16.4.0, Section 11.1.3.2).
+ * @param iLe - number of bytes to be read (ETSI TS 102 221 v16.4.0, Section 11.1.3.2).
+ * @param sResult - container for the hex-encoded result string,
+ * example for EFpnn: "004F474F21FFFFFFFFFFFFFFFFFFFFFFFF".
+ * @return CODE::SUCCESS when the read is completed successfully,
+ * CODE::NOT_APPLICABLE when the modem doesn't support this feature,
+ * CODE::NO_RESPONSE when the modem doesn't respond,
+ * CODE::ERROR when the radio returns "ERROR" (SIM card removed, SIM card locked etc),
+ * CODE::FAILURE otherwise (unexpected response, no data in SIM etc).
+ */
+ virtual CODE simAccessReadBinary(uint16_t iFiledId, uint8_t iP1, uint8_t iP2, uint8_t iLe, std::string& sResult);
+
+ /**
+ * @brief getSimMncLength - Read the length of the MNC from SIM EFad.
+ * Please see ETSI TS 131 102 V16.4.0, Section 4.2.18 for the details.
+ *
+ * @param iLength - container for the number of digits in SIM MNC.
+ * @return CODE::SUCCESS when the read is completed successfully,
+ * CODE::NOT_APPLICABLE when the modem doesn't support this feature,
+ * CODE::NO_RESPONSE when the modem doesn't respond,
+ * CODE::ERROR when the radio returns "ERROR" (SIM card removed, SIM card locked etc),
+ * CODE::FAILURE otherwise (unexpected response, no data in SIM etc).
+ */
+ virtual CODE getSimMncLength(uint8_t& iLength);
+
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 e638e8b..bed4dab 100644
--- a/include/mts/MTS_IO_ICellularRadio.h
+++ b/include/mts/MTS_IO_ICellularRadio.h
@@ -151,6 +151,7 @@ namespace MTS {
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_SIM_CARRIER_CODE; //!< Unique carrier identifier based on the SIM card information.
+ static const char *KEY_SIM_MCC_MNC; //!< MCC/MNC of the home network from the SIM.
//Network Status Data
@@ -576,6 +577,20 @@ namespace MTS {
virtual CODE setUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION mode) = 0;
virtual CODE getUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION& mode) = 0;
+
+ /**
+ * @brief getSimMccMnc - get MCC/MNC (PLMN code) of the home network from the SIM.
+ *
+ * @param sPlmnId - a string to be filled with the MCC/MNC combination,
+ * example: "310410" (for AT&T), "90118" (for WMS).
+ * @return CODE::SUCCESS when fetched successfully,
+ * CODE::NOT_APPLICABLE when the modem doesn't support this feature,
+ * CODE::NO_RESPONSE when the modem doesn't respond,
+ * CODE::ERROR when the radio returns "ERROR" (SIM card removed, SIM card locked etc),
+ * CODE::FAILURE otherwise (unexpected response, no data in SIM etc).
+ */
+ virtual CODE getSimMccMnc(std::string& sMccMnc) = 0;
+ virtual CODE getSimMccMnc(std::string& sMcc, std::string& sMnc) = 0;
};
}
}