summaryrefslogtreecommitdiff
path: root/src/MTS_IO_TelitRadio.cpp
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2019-06-11 16:30:23 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2019-06-11 16:30:23 +0300
commitbce73d000b64fc8ecaf7a25041e97a1ef57a848e (patch)
tree9d6993aadb04a45d68bf483a119a2a1189ccd959 /src/MTS_IO_TelitRadio.cpp
parentea4e0213f94a1014a0b4f0e0e43c3222eddc177a (diff)
downloadlibmts-io-bce73d000b64fc8ecaf7a25041e97a1ef57a848e.tar.gz
libmts-io-bce73d000b64fc8ecaf7a25041e97a1ef57a848e.tar.bz2
libmts-io-bce73d000b64fc8ecaf7a25041e97a1ef57a848e.zip
[MTS-MTQ] QuectelRadio implementation
Moved Telit-specific conversion between RSSI and dBm into the TelitRadio class. Quectel has MOSTLY the same conversion logic but in the case of TD-SCDMA the RSSI values may be uncompatible.
Diffstat (limited to 'src/MTS_IO_TelitRadio.cpp')
-rw-r--r--src/MTS_IO_TelitRadio.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp
index 7f9de63..bfcb42e 100644
--- a/src/MTS_IO_TelitRadio.cpp
+++ b/src/MTS_IO_TelitRadio.cpp
@@ -449,6 +449,47 @@ std::string TelitRadio::queryCGREGstring() {
return cmdResult;
}
+CellularRadio::CODE TelitRadio::convertSignalStrengthTodBm(const int32_t& iRssi, int32_t& iDbm) {
+
+ //Telit Conversion
+ if(iRssi < 0 || iRssi == 99) {
+ return FAILURE;
+ }
+
+ if(iRssi == 0) {
+ iDbm = -113;
+ } else if(iRssi == 1) {
+ iDbm = -111;
+ } else if(iRssi <= 30) {
+ //28 steps between 2 and 30
+ //54 dbm between 53 and 109
+ float stepSize = 54.0 / 28.0;
+ iDbm = -109 + (int)(stepSize * (iRssi-2));
+ } else {
+ iDbm = -51;
+ }
+
+ return SUCCESS;
+}
+
+CellularRadio::CODE TelitRadio::convertdBmToSignalStrength(const int32_t& iDBm, int32_t& iRssi) {
+ //Telit Conversion
+ if(iDBm <= -113) {
+ iRssi = 0;
+ } else if(iDBm <= -111) {
+ iRssi = 1;
+ } else if(iDBm <= -53) {
+ //54 dbm between -109 and -53
+ //28 steps between 2 and 30
+ float stepSize = 28.0/54.0;
+ iRssi = ((iDBm + 109)*stepSize) + 2;
+ } else {
+ iRssi = 31;
+ }
+
+ return SUCCESS;
+}
+
CellularRadio::CODE TelitRadio::setMdn(const Json::Value& jArgs) {
printTrace("%s| Set MDN", getName().c_str());