summaryrefslogtreecommitdiff
path: root/src/MTS_IO_CellularRadio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MTS_IO_CellularRadio.cpp')
-rw-r--r--src/MTS_IO_CellularRadio.cpp145
1 files changed, 4 insertions, 141 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp
index 20cb93a..dbb64a5 100644
--- a/src/MTS_IO_CellularRadio.cpp
+++ b/src/MTS_IO_CellularRadio.cpp
@@ -488,21 +488,6 @@ CellularRadio::CODE CellularRadio::getRoaming(bool& bRoaming) {
return FAILURE;
}
-CellularRadio::CODE CellularRadio::getNetwork(std::string& sNetwork) {
- Json::Value jData;
-
- printTrace("%s| Get Network", m_sName.c_str());
- sNetwork = ICellularRadio::VALUE_NOT_SUPPORTED;
-
- if(getNetworkStatus(jData) == SUCCESS) {
- if(jData.isMember(ICellularRadio::KEY_NETWORK)) {
- sNetwork = jData[ICellularRadio::KEY_NETWORK].asString();
- return SUCCESS;
- }
- }
- return FAILURE;
-}
-
CellularRadio::CODE CellularRadio::getSignalStrength(int32_t& rssi) {
printTrace("%s| Get Signal Strength", m_sName.c_str());
std::string sCmd("AT+CSQ");
@@ -531,47 +516,6 @@ CellularRadio::CODE CellularRadio::getModemLocation(std::string&) {
return FAILURE;
}
-CellularRadio::CODE CellularRadio::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 CellularRadio::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 CellularRadio::getEcho(bool& bEnabled) {
printTrace("%s| Echo Test", m_sName.c_str());
std::string sResult = sendCommand("AT");
@@ -685,7 +629,7 @@ CellularRadio::CODE CellularRadio::getStaticInformation(Json::Value& jData) {
<ABND> -
*/
-// Get the LAC for the LTE radio that's not in the #RFSTS response
+// Get the LAC for the LTE radio that's not in the #RFSTS or +QENG response
std::string CellularRadio::queryLteLac() {
std::string CGREGstring;
std::string originalCGREG;
@@ -705,7 +649,7 @@ std::string CellularRadio::queryLteLac() {
if (CGREGstring == ICellularRadio::RSP_ERROR) {
result = ICellularRadio::VALUE_UNKNOWN;
} else {
- size_t start = CGREGstring.find(":") + 1; //Position right after "#RFSTS:"
+ size_t start = CGREGstring.find(":") + 1; //Position right after "+CGREG:"
std::vector<std::string> vParts = MTS::Text::split(MTS::Text::trim(CGREGstring.substr(start)), ",");
if(vParts.size() < 3) {
result = ICellularRadio::VALUE_UNAVAILABLE;
@@ -723,7 +667,7 @@ void CellularRadio::setCGREG(std::string value) {
std::string sCmd("AT+CGREG=" + value);
std::string cmdResult(sendCommand(sCmd));
if (cmdResult.find("OK") == std::string::npos) {
- printDebug("%s| AT#CGREG=%s returned unexpected response: [%s][%s]", m_sName.c_str(), value.c_str(), sCmd.c_str(), cmdResult.c_str());
+ printDebug("%s| AT+CGREG=%s returned unexpected response: [%s][%s]", m_sName.c_str(), value.c_str(), sCmd.c_str(), cmdResult.c_str());
}
}
@@ -731,7 +675,7 @@ std::string CellularRadio::queryCGREGstring() {
std::string sCmd("AT+CGREG?");
std::string cmdResult(sendCommand(sCmd));
if (cmdResult.find("+CGREG:") == std::string::npos) {
- printDebug("%s| AT#CGREG? returned unexpected response: [%s][%s]", m_sName.c_str(), sCmd.c_str(), cmdResult.c_str());
+ printDebug("%s| AT+CGREG? returned unexpected response: [%s][%s]", m_sName.c_str(), sCmd.c_str(), cmdResult.c_str());
return ICellularRadio::RSP_ERROR;
}
return cmdResult;
@@ -1006,87 +950,6 @@ bool CellularRadio::splitAndAssign(const std::string& sLine, const std::string&
return true;
}
-bool CellularRadio::getCarrierFromFirmware(const std::string& sFirmware, std::string& sCarrier) {
- // Telit Radios
- // H.ab.zyx => 3 Main Components
- // "H" = Hardware -> 15 = DE910 family, 18 = CE910 family, 12 = HE910 family
- // "a" = Hardware version
- // "b" = Software Major Version
- // "z" = is the product type, i.e. DUAL or SC
- // "y" = is the carrier variant
- // "x" = is the firmware version
- // Telit will do their best to keep the carrier variant as "0" for Sprint, "1" for Aeris, "2" for Verizon, and "3" for U.S. Cellular.
-
- const uint32_t CARRIER_INDEX = 1; //y in [zyx]
-
- bool bResult = false;
- std::vector<std::string> vParts = MTS::Text::split(sFirmware, '.');
-
- if(vParts.size() == 3) {
- //CDMA firmware version notation
- if(vParts[0] == "15" || vParts[0] == "18") {
- //DE910 or CE910 -> Good good
- std::string sID = vParts[2];
- if(sID.size() == 3) {
- char cId = sID[CARRIER_INDEX];
-
- //Good good
- if(cId == '0') {
- sCarrier = ICellularRadio::VALUE_CARRIER_SPRINT;
- bResult = true;
- } else
- if(cId == '1') {
- sCarrier = ICellularRadio::VALUE_CARRIER_AERIS;
- bResult = true;
- } else
- if(cId == '2') {
- sCarrier = ICellularRadio::VALUE_CARRIER_VERIZON;
- bResult = true;
- } else
- if(cId == '3') {
- sCarrier = ICellularRadio::VALUE_CARRIER_USCELLULAR;
- bResult = true;
- }
- }
- }
- }
-
- return bResult;
-}
-
-bool CellularRadio::getHardwareVersionFromFirmware(const std::string& sFirmware, std::string& sHardware) {
- // Telit Radios
- // H.ab.zyx => 3 Main Components
- // "H" = Hardware -> 15 = DE910 family, 18 = CE910 family, 12 = HE910 family
- // "a" = Hardware version
- // "b" = Software Major Version
- // "z" = is the product type, i.e. DUAL or SC
- // "y" = is the carrier variant
- // "x" = is the firmware version
- // Telit will do their best to keep the carrier variant as "0" for Sprint, "1" for Aeris, and "2" for Verizon.
-
- const uint32_t HARDWARE_INDEX = 0; //a in [ab]
-
- bool bResult = false;
- std::vector<std::string> vParts = MTS::Text::split(sFirmware, '.');
-
- if(vParts.size() == 3) {
- //GSM Hardware Version
- if(!(vParts[0] == "15" || vParts[0] == "18")) {
- //Not DE910 or CE910 -> Good good
- std::string sVersion = vParts[1];
- if(sVersion.size() == 2) {
- sHardware = "1.";
- sHardware += sVersion[HARDWARE_INDEX];
- bResult = true;
- }
- }
- }
-
- return bResult;
-
-}
-
const char *CellularRadio::RadioBandMap::getLTEBand(const int32_t channel)
{
for (unsigned int ii = 0; ii < NUM_LTE_BANDS; ii++)