summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Bayer <bbayer@multitech.com>2016-05-18 16:14:08 -0500
committerBrandon Bayer <bbayer@multitech.com>2016-05-19 09:00:18 -0500
commit4df714d95f33006ee1d38b6719e3548b98355984 (patch)
treeb974f76d8b48dac38eb73cdab3b9c3897843cc36
parent7d5bce8a0ca06d4c1178e837f107ac2771dd1df7 (diff)
downloadlibmts-io-4df714d95f33006ee1d38b6719e3548b98355984.tar.gz
libmts-io-4df714d95f33006ee1d38b6719e3548b98355984.tar.bz2
libmts-io-4df714d95f33006ee1d38b6719e3548b98355984.zip
[IN1892] fix: return basic stats instead of null on LTE without signal
Response on LTE without signal will now be: { "datetime" : "01/06/80 00:01:31 GMT+5", "roaming" : false, "rssi" : 99, "service" : "Unknown" } instead of null
-rw-r--r--src/MTS_IO_CellularRadio.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp
index c5b503d..cb1a59c 100644
--- a/src/MTS_IO_CellularRadio.cpp
+++ b/src/MTS_IO_CellularRadio.cpp
@@ -959,6 +959,16 @@ CellularRadio::CODE CellularRadio::getNetworkStatus(Json::Value& jData) {
sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 200);
if (sResult.find("#RFSTS:") == std::string::npos) {
printDebug("%s| Network Status command returned unexpected response: [%s][%s]", m_sName.c_str(), sCmd.c_str(), sResult.c_str());
+
+ if (sResult.find(CellularRadio::RSP_OK) < 3) {
+ //Command returns only "OK". Actual response is usually "\r\nOK", so check index < 3
+ //This will happen when LTE radios don't have a signal
+ //Since AT#RFSTS failed, just get common network stats and return
+ //This will update RSSI which'll show that signal is gone
+ getCommonNetworkStats(jData);
+ printTrace("%s| Network Status:\n%s\n", m_sName.c_str(), jData.toStyledString().c_str());
+ return SUCCESS;
+ }
return FAILURE;
}