diff options
-rw-r--r-- | src/MTS_IO_SequansRadio.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/MTS_IO_SequansRadio.cpp b/src/MTS_IO_SequansRadio.cpp index 369f778..a48a309 100644 --- a/src/MTS_IO_SequansRadio.cpp +++ b/src/MTS_IO_SequansRadio.cpp @@ -193,7 +193,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusSQN(Json::Value& jData, Json: rc = sendBasicQuery(sCmd, sPrefix, sResult, 200); if (SUCCESS != rc) { printDebug("%s| Network Status command returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str()); - printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); return rc; } @@ -232,7 +231,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusSignal(Json::Value& jData, Js rc = sendBasicQuery(sCmd, sPrefix, sResult, 200); if (SUCCESS != rc) { printDebug("%s| Network Status command returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str()); - printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); return rc; } @@ -242,7 +240,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusSignal(Json::Value& jData, Js if (vParts.size() < 6) { printDebug("%s| Network Status command response is an unknown format: [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str()); - printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); return FAILURE; } @@ -254,7 +251,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusSignal(Json::Value& jData, Js } if (iValue > 97 || iValue < 0) { printDebug("%s| Network Status command returned unexpected value of RSRP: [%s][%d]", getName().c_str(), sCmd.c_str(), iValue); - printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); break; } // converting value to rsrp dBm according to documentation @@ -269,7 +265,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusSignal(Json::Value& jData, Js } if (iValue > 34 || iValue < 0) { printDebug("%s| Network Status command returned unexpected value of RSRQ: [%s][%d]", getName().c_str(), sCmd.c_str(), iValue); - printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); break; } // converting value to rsrq in dBm according to documentation @@ -299,7 +294,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusTxPower(Json::Value& jData, J rc = sendBasicQuery(sCmd, sPrefix, sResult, 200); if (SUCCESS != rc) { printDebug("%s| Network Status command returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str()); - printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); return rc; } // <txPower>,<maxTxPower> @@ -308,7 +302,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusTxPower(Json::Value& jData, J if (vParts.size() < 2) { printDebug("%s| Network Status command response is an unknown format: [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str()); - printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); return FAILURE; } @@ -320,7 +313,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusTxPower(Json::Value& jData, J } if (fTxPow < -255 || fTxPow > 99) { printDebug("%s| Network Status command returned unexpected value of txPower: [%s][%d]", getName().c_str(), sCmd.c_str(), iValue); - printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); break; } jDebug[ICellularRadio::KEY_TXPWR] = vParts[0]; @@ -337,16 +329,13 @@ ICellularRadio::CODE SequansRadio::getNetworkStatus(Json::Value& jData) { Json::Value jDebug; std::string sResult; + CODE rcMainStatus; getCommonNetworkStats(jData); - getNetworkStatusSQN(jData, jDebug); + rcMainStatus = getNetworkStatusSQN(jData, jDebug); getNetworkStatusSignal(jData, jDebug); getNetworkStatusTxPower(jData, jDebug); - if (jData.isMember(ICellularRadio::KEY_RSSIDBM)) { - jDebug[ICellularRadio::KEY_RSSIDBM] = jData[ICellularRadio::KEY_RSSIDBM]; - } - if (SUCCESS == getImsi(sResult)) { jData[ICellularRadio::KEY_IMSI] = sResult; } @@ -355,9 +344,12 @@ ICellularRadio::CODE SequansRadio::getNetworkStatus(Json::Value& jData) { jData[ICellularRadio::KEY_NETWORK] = sResult; } - jDebug[ICellularRadio::KEY_SD] = "PS"; - - jData[ICellularRadio::KEY_DEBUG] = jDebug; + // Fill the debug information only if the main tower information was fetched successfully. + if (SUCCESS == rcMainStatus) { + jDebug[ICellularRadio::KEY_RSSIDBM] = jData[ICellularRadio::KEY_RSSIDBM]; + jDebug[ICellularRadio::KEY_SD] = "PS"; + jData[ICellularRadio::KEY_DEBUG] = jDebug; + } printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); return SUCCESS; |