summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2019-12-05 15:18:46 +0200
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2019-12-05 15:35:59 +0200
commit22485f557fe57459ef2822e39a41d9c6a0c49b47 (patch)
tree8fb7a9cd02822c76f2b577718fcca69e1d002541
parent7152de5483b6257f87a7ead5c29e4e768a4bab39 (diff)
downloadradio-query-22485f557fe57459ef2822e39a41d9c6a0c49b47.tar.gz
radio-query-22485f557fe57459ef2822e39a41d9c6a0c49b47.tar.bz2
radio-query-22485f557fe57459ef2822e39a41d9c6a0c49b47.zip
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.
-rw-r--r--main.cpp13
1 files changed, 13 insertions, 0 deletions
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");