From 22485f557fe57459ef2822e39a41d9c6a0c49b47 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Thu, 5 Dec 2019 15:18:46 +0200 Subject: Added support for the "radio-query --code" option The new option allows to fetch MTS short code for the radio without calling the whole "radio-query --static" instead. --- main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.cpp b/main.cpp index 7617c4a..fdb7cd8 100644 --- a/main.cpp +++ b/main.cpp @@ -86,6 +86,7 @@ const uint32_t OPT_ACTIVEFIRMWARE = 0x00008000; const uint32_t OPT_LOCATION = 0x00010000; const uint32_t OPT_FIRMWAREBUILD = 0x00020000; const uint32_t OPT_SIM_STATUS = 0x00040000; +const uint32_t OPT_RADIO_CODE = 0x00080000; const uint32_t OPT_SUMMARY_STATIC = 0x01000000; const uint32_t OPT_SUMMARY_NETWORK = 0x02000000; @@ -261,6 +262,16 @@ int main(int argc, char** argv) { if(result == ICellularRadio::SUCCESS) { printf("%s", sValue.c_str()); } + } else if(g_iOptions & OPT_RADIO_CODE) { + std::string sValue; + std::string sCode; + result = g_apRadio->getModel(sValue); + if(result == ICellularRadio::SUCCESS) { + result = g_apRadio->convertModelToMtsShortCode(g_sModel, sCode, g_apRadio.get()); + if(result == ICellularRadio::SUCCESS) { + printf("%s", sCode.c_str()); + } + } } else if(g_iOptions & OPT_TYPE) { std::string sValue; std::string sType; @@ -552,6 +563,7 @@ void parseOptions(int argc, char** argv) { { "datetime", no_argument, &iOption, OPT_DATETIME }, { "active-firmware", no_argument, &iOption, OPT_ACTIVEFIRMWARE }, { "sim-status", no_argument, &iOption, OPT_SIM_STATUS }, + { "code", no_argument, &iOption, OPT_RADIO_CODE }, { "static", no_argument, &iOption, OPT_SUMMARY_STATIC }, { "dynamic", no_argument, &iOption, OPT_SUMMARY_NETWORK }, { "cellular-mode",no_argument, &iOption, OPT_CELL_MODE }, @@ -648,6 +660,7 @@ void printHelp(const std::string& sApp) { printf("\t--imsi\n"); printf("\t--lac\n"); printf("\t--model\n"); + printf("\t--code\n"); printf("\t--netreg\n"); printf("\t--network\n"); printf("\t--phonenumber\n"); -- cgit v1.2.3