summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/main.cpp b/main.cpp
index 310d6fd..f7e919f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -113,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) {
@@ -167,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;
@@ -360,19 +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", jValue.toStyledString().c_str());
+ printf("%s", toCompactStyledString(jValue).c_str());
}
}
@@ -408,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;
@@ -789,3 +791,14 @@ void printHelp(const std::string& sApp) {
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;
+}