diff options
-rw-r--r-- | include/mts/MTS_IO_CellularRadio.h | 2 | ||||
-rw-r--r-- | include/mts/MTS_IO_ICellularRadio.h | 2 | ||||
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 25 |
3 files changed, 29 insertions, 0 deletions
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 4b53382..56506af 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -78,6 +78,8 @@ namespace MTS { CODE getRegistration(REGISTRATION& eRegistration) override; CODE convertRegistrationToString(REGISTRATION eRegistration, std::string& sRegistration) override; + CODE convertCellModesToString(CELLULAR_MODES eCellModes, std::string& sCellModes) override; + CODE unlockSimCard(const Json::Value& jArgs) override; CODE getMipProfile(Json::Value& jMipProfile) override; diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index f03bd2e..b9ac36f 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -267,6 +267,8 @@ namespace MTS { virtual CODE getRegistration(REGISTRATION& eRegistration) = 0; virtual CODE convertRegistrationToString(REGISTRATION eRegistration, std::string& sRegistration) = 0; + virtual CODE convertCellModesToString(CELLULAR_MODES eCellModes, std::string& sCellModes) = 0; + /** * @brief unlockSimCard - unlock the SIM card using PIN code provided * diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 8bdd00e..299ca19 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -21,6 +21,7 @@ #include "mts/MTS_IO_CellularRadio.h" #include <unistd.h> +#include <limits.h> #include <mts/MTS_IO_MccMncTable.h> #include <mts/MTS_Thread.h> @@ -851,6 +852,30 @@ ICellularRadio::CODE CellularRadio::convertRegistrationToString(REGISTRATION eRe return eCode; } +ICellularRadio::CODE CellularRadio::convertCellModesToString(ICellularRadio::CELLULAR_MODES eCellModes, std::string& sCellModes) { + std::string sResult; + + if (eCellModes & CELLULAR_MODE_2G) { + sResult += "2g,"; + } + if (eCellModes & CELLULAR_MODE_3G) { + sResult += "3g,"; + } + if (eCellModes & CELLULAR_MODE_4G) { + sResult += "4g,"; + } + if (eCellModes & CELLULAR_MODE_5G) { + sResult += "5g,"; + } + + if (!sResult.empty()) { + sResult.pop_back(); // remove trailing comma + } + + sCellModes = sResult; + return SUCCESS; +} + ICellularRadio::CODE CellularRadio::unlockSimCard(const Json::Value& jArgs) { printTrace("%s| Unlock the SIM card using PIN code", m_sName.c_str()); |