summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp30
1 files 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<sizeof(networks)*CHAR_BIT; ++i){
- switch (1<<i & networks) {
- case ICellularRadio::CELLULAR_MODE_2G: result += "2g,"; break;
- case ICellularRadio::CELLULAR_MODE_3G: result += "3g,"; break;
- case ICellularRadio::CELLULAR_MODE_4G: result += "4g,"; break;
- case ICellularRadio::CELLULAR_MODE_5G: result += "5g,"; break;
- }
- }
- result.pop_back();
- return result;
-}