From 5d81a9e8d2afc8d2f1dbf9ab29d9248dcb54378a Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Tue, 25 Feb 2020 14:53:39 +0200 Subject: [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. --- src/MTS_IO_CellularRadio.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/MTS_IO_CellularRadio.cpp') 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 +#include #include #include @@ -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()); -- cgit v1.2.3 From 85fc8d9a281b57cc356bf38ca72bd7880e4001d3 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Tue, 25 Feb 2020 15:27:18 +0200 Subject: [MTX-3239] Add "cellularMode" value to the radio-query --dynamic Added "cellularMode" value to the list dynamic (network stats) params --- src/MTS_IO_CellularRadio.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/MTS_IO_CellularRadio.cpp') diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 299ca19..d50f917 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -695,6 +695,14 @@ void CellularRadio::getCommonNetworkStats(Json::Value& jData) { jData[ICellularRadio::KEY_NETWORK_REG] = sNetworkReg; } } + + std::string sCurrentCellMode; + CELLULAR_MODES eModes; + if (getCellularMode(eModes) == SUCCESS) { + if (convertCellModesToString(eModes, sCurrentCellMode) == SUCCESS) { + jData[ICellularRadio::KEY_CELL_MODE] = sCurrentCellMode; + } + } } ICellularRadio::CODE CellularRadio::getSimLockStatus(std::string& sData) -- cgit v1.2.3 From 0b0059b2f99874133b9cc988ce9279b6a31be6ff Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Tue, 25 Feb 2020 18:28:23 +0200 Subject: [MTX-3239] Add "cellularMode" value to the radio-query --dynamic Removed unneeded include. Changes after code review. --- src/MTS_IO_CellularRadio.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/MTS_IO_CellularRadio.cpp') diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index d50f917..191299b 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -21,7 +21,6 @@ #include "mts/MTS_IO_CellularRadio.h" #include -#include #include #include -- cgit v1.2.3