summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/MTS_IO_CellularRadio.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp
index fc1e74d..46a3aa9 100644
--- a/src/MTS_IO_CellularRadio.cpp
+++ b/src/MTS_IO_CellularRadio.cpp
@@ -1054,21 +1054,36 @@ CellularRadio::CODE CellularRadio::getNetworkStatus(Json::Value& jData) {
//Parse as LTE Network Format
+ //
+ // MD: It is noticed that LTE Network format may vary depending on the firmware version:
+ //
+ // <PLMN>,<EARFCN>,<RSRP>,<RSSI>,<RSRQ>,<TAC>,[<TXPWR>],<DRX>,<MM>,<RRC>,<CID>,<IMSI>,[<NetNameAsc>],<SD>,<ABND>,<SINR>
+ // Ex 1: #RFSTS: "310 260",2300,-98,-63,-14,AA06,,128,19,0,0501D02,"310260754792598","T-Mobile",3,4,197
+ //
+ // <PLMN>,<EARFCN>,<RSRP>,<RSSI>,<RSRQ>,<TAC>,<RAC>,[<TXPWR>],<DRX>,<MM>,<RRC>,<CID>,<IMSI>,[<NetNameAsc>],<SD>,<ABND>
+ // Ex 2: #RFSTS:"310 410",5780,-105,-73,-14,4603,255,,128,19,0,0000098,"310410536498694","AT&T",3,17
+ //
+ // Additional <RAC> parameter in the second example shifts the rest of the parameters. Here we are trying to figure out
+ // which format is currently produced based on <IMSI> field position which always has double quotation marks.
+ //
+ if (vParts[11].find("\"") == std::string::npos) {
+ // read the RAC and remove it from the vector
+ jData[KEY_RAC] = vParts[6];
+ vParts.erase(vParts.begin() + 6);
+ }
+
jDebug["rsrp"] = vParts[2];
jDebug[KEY_RSSIDBM] = vParts[3];
jDebug["rsrq"] = vParts[4];
jData["tac"] = vParts[5];
- jData[KEY_RAC] = vParts[6];
- jDebug[KEY_TXPWR] = vParts[7];
- //Odd empty index at 7
- jData[KEY_DRX] = vParts[8];
-
- jDebug[KEY_MM] = vParts[9];
- jDebug["rrc"] = vParts[10];
- jData[KEY_CID] = vParts[11];
- jData[KEY_IMSI] = MTS::Text::strip(vParts[12], '"');
- jData[KEY_NETWORK] = MTS::Text::strip(vParts[13], '"');
+ jDebug[KEY_TXPWR] = vParts[6];
+ jData[KEY_DRX] = vParts[7];
+ jDebug[KEY_MM] = vParts[8];
+ jDebug["rrc"] = vParts[9];
+ jData[KEY_CID] = vParts[10];
+ jData[KEY_IMSI] = MTS::Text::strip(vParts[11], '"');
+ jData[KEY_NETWORK] = MTS::Text::strip(vParts[12], '"');
// Get the radio band given the channel (EARFCN)
RadioBandMap radioBandMap(vParts[1], CellularRadio::VALUE_TYPE_LTE);
@@ -1076,7 +1091,7 @@ CellularRadio::CODE CellularRadio::getNetworkStatus(Json::Value& jData) {
jData[KEY_LAC] = queryLteLac();
- if(MTS::Text::parse(iValue, vParts[14]) && convertServiceDomainToString((SERVICEDOMAIN)iValue, sValue) == SUCCESS) {
+ if(MTS::Text::parse(iValue, vParts[13]) && convertServiceDomainToString((SERVICEDOMAIN)iValue, sValue) == SUCCESS) {
jDebug[KEY_SD] = sValue;
}