From e68fa064ad6414e57d0d7244f2c9fcdd3f502f84 Mon Sep 17 00:00:00 2001 From: Jeff Hatch Date: Thu, 23 Feb 2017 11:03:57 -0600 Subject: [IN002306] Radio Status Current Network incorrect on new Telit hardware. The format of AT#FRSTS command was slightly changed within the new Telit firmware and this causes parsing issues. --- src/MTS_IO_CellularRadio.cpp | 37 ++++++++++++++++++++++++++----------- 1 file 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: + // + // ,,,,,,[],,,,,,[],,, + // Ex 1: #RFSTS: "310 260",2300,-98,-63,-14,AA06,,128,19,0,0501D02,"310260754792598","T-Mobile",3,4,197 + // + // ,,,,,,,[],,,,,,[],, + // Ex 2: #RFSTS:"310 410",5780,-105,-73,-14,4603,255,,128,19,0,0000098,"310410536498694","AT&T",3,17 + // + // Additional 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 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; } -- cgit v1.2.3