summaryrefslogtreecommitdiff
path: root/src/MTS_IO_CellularRadio.cpp
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-06-30 17:43:11 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-06-30 17:43:11 +0300
commit69d7eb13bdda92a92b381f58a8ba9ec6fc29888f (patch)
tree342c06babde7a1e1aa355e0aab12f794af845224 /src/MTS_IO_CellularRadio.cpp
parent24ed390ceb584fadfd428a6e9019371550931094 (diff)
parent343e662b6224cf03fea5ebfd419c7cf990528b53 (diff)
downloadlibmts-io-69d7eb13bdda92a92b381f58a8ba9ec6fc29888f.tar.gz
libmts-io-69d7eb13bdda92a92b381f58a8ba9ec6fc29888f.tar.bz2
libmts-io-69d7eb13bdda92a92b381f58a8ba9ec6fc29888f.zip
Merge remote-tracking branch 'origin/master' into sk/quectel-delta-fwu
Diffstat (limited to 'src/MTS_IO_CellularRadio.cpp')
-rw-r--r--src/MTS_IO_CellularRadio.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp
index 26d9f43..55f719f 100644
--- a/src/MTS_IO_CellularRadio.cpp
+++ b/src/MTS_IO_CellularRadio.cpp
@@ -912,6 +912,49 @@ ICellularRadio::CODE CellularRadio::unlockSimCard(const Json::Value& jArgs) {
return SUCCESS;
}
+ICellularRadio::CODE CellularRadio::getSimCarrierCode(std::string& sCarrierCode) {
+ std::string sIccid;
+ CODE rc;
+
+ printTrace("%s| Get carrier code from the SIM card installed", m_sName.c_str());
+
+ rc = getIccid(sIccid);
+ if (rc != SUCCESS) {
+ printError("%s| Unable to determine SIM carrier: Failed to fetch SIM identifier", m_sName.c_str());
+ return rc;
+ }
+
+ printTrace("%s| Fetched ICCID: [%s]", m_sName.c_str(), sIccid.c_str());
+
+ 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 carrier code: [%s]", m_sName.c_str(), sCarrierCode.c_str());
+ return rc;
+}
+
+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_CARRIER_CODE_VERIZON;
+ } else if (sIccid.find(ICCID_PREFIX_ATT) == 0) {
+ printTrace("%s| AT&T SIM detected", m_sName.c_str());
+ 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());
+ sCarrierCode = VALUE_UNKNOWN;
+ }
+
+ return SUCCESS; // no error cases for now
+}
+
ICellularRadio::CODE CellularRadio::validateMsl(const Json::Value&) {
printTrace("%s| Validate MSL", m_sName.c_str());
@@ -1038,6 +1081,12 @@ ICellularRadio::CODE CellularRadio::activate(const Json::Value&, UpdateCb&) {
return NOT_APPLICABLE;
}
+ICellularRadio::CODE CellularRadio::startOmaDm(ICellularRadio::UpdateCb&) {
+ printTrace("%s| Start OMA DM procedure: not applicable", m_sName.c_str());
+
+ return NOT_APPLICABLE;
+}
+
ICellularRadio::CODE CellularRadio::setActiveFirmware(const Json::Value&) {
printTrace("%s| Set Active Firmware Image Number: not applicable", m_sName.c_str());