From b66c9a18a9e61911ca87ba7364d74d15b0756797 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Tue, 25 Feb 2020 15:29:54 +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. Please see libmts-io commit 242be3d1f4e34df2cb0fea6fa661d0e27d2b421d for the new implementaion on libmts-io side. --- main.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/main.cpp b/main.cpp index f6aa1ae..d0da2a2 100644 --- a/main.cpp +++ b/main.cpp @@ -302,16 +302,24 @@ int main(int argc, char** argv) { printf("%s", sValue.c_str()); } } else if(g_iOptions & OPT_SUPPORTED_CELL_MODE) { + std::string sValue; ICellularRadio::CELLULAR_MODES networks; result = g_apRadio->getSupportedCellularModes(networks); if (result == ICellularRadio::SUCCESS) { - printf("%s", cellularModeStr(networks).c_str()); + result = g_apRadio->convertCellModesToString(networks, sValue); + if(result == ICellularRadio::SUCCESS) { + printf("%s", sValue.c_str()); + } } } else if(g_iOptions & OPT_CELL_MODE) { + std::string sValue; ICellularRadio::CELLULAR_MODES networks; result = g_apRadio->getCellularMode(networks); if (result == ICellularRadio::SUCCESS) { - printf("%s", cellularModeStr(networks).c_str()); + result = g_apRadio->convertCellModesToString(networks, sValue); + if(result == ICellularRadio::SUCCESS) { + printf("%s", sValue.c_str()); + } } } @@ -520,7 +528,7 @@ Json::Value getStaticData() { ICellularRadio::CELLULAR_MODES supportedCellModes; if(g_apRadio->getSupportedCellularModes(supportedCellModes) == ICellularRadio::SUCCESS) { - sSupportedCellModes = cellularModeStr(supportedCellModes).c_str(); + g_apRadio->convertCellModesToString(supportedCellModes, sSupportedCellModes); } jData[MTS::IO::ICellularRadio::KEY_SUPPORTED_CELL_MODES] = sSupportedCellModes; @@ -690,19 +698,3 @@ void printHelp(const std::string& sApp) { printf("\tSupported Radios:\n"); printf("\t\tHE910, GE910, DE910, CE910, LE910, ME910\n"); } - -std::string cellularModeStr(MTS::IO::ICellularRadio::CELLULAR_MODES networks) -{ - using namespace MTS::IO; - std::string result; - for (size_t i = 0; i