From 42d384984b2f760bc8f7a69c7ea3464c73f4d892 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Tue, 2 Jun 2020 17:19:03 +0300 Subject: [GP-651] LNA7: Allow to start the OMA DM procedure when it is required This commits adds support for the Quectel-specific OMA DM commands. This allows to trigger OMA DM procedure om Verizon to fetch the corrent APN values and other settings from the network. Expected radio output on success: ``` +QODM: "DME",0,DM Start +QODM: "DME",0,DM End ``` Other +QODM URC codes are also possible according to information from Quectel forum: https://forums.quectel.com/t/what-is-the-meaning-of-qodm-fumo-report-failed/2444/5. But only "DM Start" and "DM End" responses are expected, supported and treated as correct in the libmts-io. --- src/MTS_IO_CellularRadio.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/MTS_IO_CellularRadio.cpp') diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 50fdf5c..648894f 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -1020,6 +1020,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()); -- cgit v1.2.3 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. --- src/MTS_IO_CellularRadio.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/MTS_IO_CellularRadio.cpp') diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 648894f..bef15e9 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::getMtsSimCarrierCode(std::string& sCarrierCode) { + std::string sIccid; + CODE rc; + + printTrace("%s| Get MTS 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 = getMtsSimCarrierCode(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()); + return rc; +} + +ICellularRadio::CODE CellularRadio::getMtsSimCarrierCode(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; + } else if (sIccid.find(ICCID_PREFIX_ATT) == 0) { + printTrace("%s| AT&T SIM detected", m_sName.c_str()); + sCarrierCode = VALUE_MTS_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()); -- cgit v1.2.3 From 747b898f36c4764475e61f20847ba4bbb3a81404 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Tue, 16 Jun 2020 15:37:02 +0300 Subject: [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. --- src/MTS_IO_CellularRadio.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/MTS_IO_CellularRadio.cpp') 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()); -- cgit v1.2.3