summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2023-02-02 10:01:47 -0600
committerJeff Hatch <jhatch@multitech.com>2023-02-02 10:01:47 -0600
commit5c3e9d188bfd1309d366d755a70a37d5291d290a (patch)
treedb5428ea1c2cc66fb02d8d01051015768fd537e4
parent2d2125802eab522905d55c03aa96f1b0065efb29 (diff)
parent56e1c4654f6efbef8fe5661165d65c20ff7ee496 (diff)
downloadlibmts-io-5c3e9d188bfd1309d366d755a70a37d5291d290a.tar.gz
libmts-io-5c3e9d188bfd1309d366d755a70a37d5291d290a.tar.bz2
libmts-io-5c3e9d188bfd1309d366d755a70a37d5291d290a.zip
Merge branch 'ym/GP-1733/refactoring_sequans' into 'master'
[GP-1733] mPower R.6: L6G1 (Sequans CB610L) Radio Support See merge request !54
-rw-r--r--src/MTS_IO_SequansRadio.cpp24
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;