summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2021-06-02 14:56:03 -0500
committerJeff Hatch <jhatch@multitech.com>2021-06-02 14:56:03 -0500
commite172671f2d6eb8757dfa7e1b8a7acb3688ff4d62 (patch)
tree0800e4fe1f380269e8a505eb0d13fbb5d60a7230
parent0b0453bfed849170b23b7adadaab6e660dc46452 (diff)
parentaca0bbf5f1b0b0c9d0fc72272ac6d6254f64802f (diff)
downloadradio-query-e172671f2d6eb8757dfa7e1b8a7acb3688ff4d62.tar.gz
radio-query-e172671f2d6eb8757dfa7e1b8a7acb3688ff4d62.tar.bz2
radio-query-e172671f2d6eb8757dfa7e1b8a7acb3688ff4d62.zip
Merge branch 'sk/GP-1111-carrier-detection' into 'master' 1.1
[GP-1111] mPower R. Apr 2021: +CEMODE shall be set to CEMODE=2 See merge request !11
-rw-r--r--main.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/main.cpp b/main.cpp
index c82a3ae..ee30668 100644
--- a/main.cpp
+++ b/main.cpp
@@ -90,7 +90,8 @@ const uint32_t OPT_SIM_STATUS = 0x00040000;
const uint32_t OPT_RADIO_CODE = 0x00080000;
const uint32_t OPT_SIM_CARRIER_CODE = 0x00100000;
const uint32_t OPT_VENDORFIRMWARE = 0x00200000;
-const uint32_t OPT_UE_MODE_OF_OPERATION = 0x00400000;
+const uint32_t OPT_UE_MODE_OF_OPERATION= 0x00400000;
+const uint32_t OPT_SIM_MCC_MNC = 0x00800000;
const uint32_t OPT_SUMMARY_STATIC = 0x01000000;
const uint32_t OPT_SUMMARY_NETWORK = 0x02000000;
@@ -338,17 +339,25 @@ int main(int argc, char** argv) {
if (result == ICellularRadio::SUCCESS) {
printf("%s", sValue.c_str());
}
- }
- else if (g_iOptions & OPT_UE_MODE_OF_OPERATION) {
+ } else if (g_iOptions & OPT_UE_MODE_OF_OPERATION) {
std::string sValue;
ICellularRadio::UE_MODES_OF_OPERATION mode;
result = g_apRadio->getUeModeOfOperation(mode);
if (result == ICellularRadio::SUCCESS) {
result = g_apRadio->convertUeModeToString(mode, sValue);
- if(result == ICellularRadio::SUCCESS) {
+ if (result == ICellularRadio::SUCCESS) {
printf("%s", sValue.c_str());
}
}
+ } else if (g_iOptions & OPT_SIM_MCC_MNC) {
+ std::string sMcc, sMnc;
+ Json::Value jValue;
+ result = g_apRadio->getSimMccMnc(sMcc, sMnc);
+ if (result == ICellularRadio::SUCCESS) {
+ jValue[MTS::IO::ICellularRadio::KEY_SIM_MCC] = sMcc;
+ jValue[MTS::IO::ICellularRadio::KEY_SIM_MNC] = sMnc;
+ printf("%s", jValue.toStyledString().c_str());
+ }
}
if (g_bIstty && result == ICellularRadio::CODE::SUCCESS)
@@ -576,6 +585,14 @@ Json::Value getStaticData() {
}
jData[MTS::IO::ICellularRadio::KEY_SIM_CARRIER_CODE] = sCarrierCode;
+ std::string sSimMcc(ICellularRadio::VALUE_UNKNOWN);
+ std::string sSimMnc(ICellularRadio::VALUE_UNKNOWN);
+ if(g_apRadio->getSimMccMnc(sSimMcc, sSimMnc) != ICellularRadio::SUCCESS) {
+ printWarning("SIM carrier MCC/MNC information not found");
+ }
+ jData[MTS::IO::ICellularRadio::KEY_SIM_MCC] = sSimMcc;
+ jData[MTS::IO::ICellularRadio::KEY_SIM_MNC] = sSimMnc;
+
return jData;
}
@@ -631,6 +648,7 @@ void parseOptions(int argc, char** argv) {
{ "supported-cellular-modes", no_argument, &iOption, OPT_SUPPORTED_CELL_MODE },
{ "sim-carrier-code", no_argument, &iOption, OPT_SIM_CARRIER_CODE },
{ "ue-mode-of-operation", no_argument,&iOption, OPT_UE_MODE_OF_OPERATION },
+ { "sim-mcc-mnc", no_argument, &iOption, OPT_SIM_MCC_MNC },
{ 0, 0, 0, 0 } };
/* getopt_long stores the option index here. */
@@ -742,6 +760,7 @@ void printHelp(const std::string& sApp) {
printf("\t--supported-cellular-modes\n");
printf("\t--sim-carrier-code\n");
printf("\t--ue-mode-of-operation\n");
+ printf("\t--sim-mcc-mnc\n");
// Applicable for LTE910-NA1 dual FW images only
// printf("\t--active-firmware\n");
printf("\n");