diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-02-25 14:53:39 +0200 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-02-25 15:42:32 +0200 |
commit | 5d81a9e8d2afc8d2f1dbf9ab29d9248dcb54378a (patch) | |
tree | cbe52d51503f4c221b6ad90119c7aae3fd716bb5 /src | |
parent | cdd3fbe0f999546b3f39843f6f742f185781edd7 (diff) | |
download | libmts-io-5d81a9e8d2afc8d2f1dbf9ab29d9248dcb54378a.tar.gz libmts-io-5d81a9e8d2afc8d2f1dbf9ab29d9248dcb54378a.tar.bz2 libmts-io-5d81a9e8d2afc8d2f1dbf9ab29d9248dcb54378a.zip |
[MTX-3239] Add "cellularMode" value to the radio-query --dynamic
Ported "cellularModeStr" function to MTS::IO::CellularRadio class. This function
converts integer bitmap to comma-separated list of cellular modes.
Diffstat (limited to 'src')
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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()); |