summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2021-11-22 12:51:03 -0600
committerJeff Hatch <jhatch@multitech.com>2021-11-22 12:51:03 -0600
commit284fc51a10273fb020bba3470b04b3c3483f9279 (patch)
tree56da9264602c9adcad63c0360f7c0272ded4b5fc
parent2d456650291528049a36030fa21022c596738aad (diff)
parent4e8bb625fbd9db99ecf8b5e33fbee79cf7702f7b (diff)
downloadradio-query-284fc51a10273fb020bba3470b04b3c3483f9279.tar.gz
radio-query-284fc51a10273fb020bba3470b04b3c3483f9279.tar.bz2
radio-query-284fc51a10273fb020bba3470b04b3c3483f9279.zip
Merge branch 'ad/MTX-4190/update_modbus_slave' into 'master'
[MTX-4190] mPower R.6.0: Update MODBUS slave feature to support Quectel and newer Telit radios See merge request !14
-rw-r--r--main.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/main.cpp b/main.cpp
index f30a417..f7e919f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -97,6 +97,7 @@ const uint32_t OPT_SUMMARY_STATIC = 0x01000000;
const uint32_t OPT_SUMMARY_NETWORK = 0x02000000;
const uint32_t OPT_CELL_MODE = 0x04000000;
const uint32_t OPT_SUPPORTED_CELL_MODE = 0x08000000;
+const uint32_t OPT_SELECTED_BANDS = 0x20000000;
int32_t g_iAuxOptions = 0;
const uint32_t AOPT_VOICE_SUPPORT = 0x00000001;
@@ -112,6 +113,8 @@ std::string cellularModeStr(MTS::IO::ICellularRadio::CELLULAR_MODES networks);
Json::Value getStaticData();
Json::Value getNetworkData();
+std::string toCompactStyledString(const Json::Value& jData);
+
bool g_bIstty = false;
int main(int argc, char** argv) {
@@ -166,14 +169,14 @@ int main(int argc, char** argv) {
ICellularRadio::CODE result = ICellularRadio::CODE::SUCCESS;
if(g_iOptions & OPT_SUMMARY_NETWORK) {
- printf("%s", getNetworkData().toStyledString().c_str());
+ printf("%s", toCompactStyledString(getNetworkData()).c_str());
} else if(g_iOptions & OPT_SUMMARY_STATIC) {
- printf("%s", getStaticData().toStyledString().c_str());
+ printf("%s", toCompactStyledString(getStaticData()).c_str());
} else if(g_iOptions & OPT_SIM_STATUS) {
Json::Value jValue;
result = g_apRadio->getSimStatusSummary(jValue);
if(result == ICellularRadio::SUCCESS) {
- printf("%s", jValue.toStyledString().c_str());
+ printf("%s", toCompactStyledString(jValue).c_str());
}
} else if(g_iOptions & OPT_RSSI) {
int32_t iValue;
@@ -359,13 +362,19 @@ int main(int argc, char** argv) {
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());
+ printf("%s", toCompactStyledString(jValue).c_str());
}
} else if (g_iAuxOptions & AOPT_VOICE_SUPPORT) {
Json::Value jValue;
result = g_apRadio->getVoiceSupport(jValue);
if (result == ICellularRadio::SUCCESS) {
- printf("%s", jValue.toStyledString().c_str());
+ printf("%s", toCompactStyledString(jValue).c_str());
+ }
+ } else if (g_iOptions & OPT_SELECTED_BANDS) {
+ Json::Value jValue;
+ result = g_apRadio->getSelectedBands(jValue);
+ if (result == ICellularRadio::SUCCESS) {
+ printf("%s", toCompactStyledString(jValue).c_str());
}
}
@@ -401,7 +410,7 @@ void initializeCache() {
//Gather Static Information
const Json::Value jData = getStaticData();
- printTrace("Static Data:\n%s\n", jData.toStyledString().c_str());
+ printTrace("Static Data:\n%s\n", toCompactStyledString(jData).c_str());
//Save to radio cache directory
std::ofstream ofile;
@@ -660,6 +669,7 @@ void parseOptions(int argc, char** argv) {
{ "ue-mode-of-operation", no_argument,&iOption, OPT_UE_MODE_OF_OPERATION },
{ "sim-mcc-mnc", no_argument, &iOption, OPT_SIM_MCC_MNC },
{ "voice-support",no_argument, &iAuxOption, AOPT_VOICE_SUPPORT },
+ { "selected-bands", no_argument, &iOption, OPT_SELECTED_BANDS },
{ 0, 0, 0, 0 } };
/* getopt_long stores the option index here. */
@@ -774,9 +784,21 @@ void printHelp(const std::string& sApp) {
printf("\t--ue-mode-of-operation\n");
printf("\t--sim-mcc-mnc\n");
printf("\t--voice-support\n");
+ printf("\t--selected-bands\n");
// Applicable for LTE910-NA1 dual FW images only
// printf("\t--active-firmware\n");
printf("\n");
printf("\tSupported Radios:\n");
printf("\t\tHE910, GE910, DE910, CE910, LE910, ME910, EG95, EG25\n");
}
+
+std::string toCompactStyledString(const Json::Value& jData) {
+ Json::StreamWriterBuilder builder;
+ builder["indentation"] = "\t";
+ builder["commentStyle"] = "None";
+
+ std::string sOut = Json::writeString(builder, jData);
+ sOut += '\n';
+
+ return sOut;
+}