diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2019-06-11 16:11:14 +0300 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2019-06-11 16:26:17 +0300 |
commit | ea4e0213f94a1014a0b4f0e0e43c3222eddc177a (patch) | |
tree | 7fc5f305e38f23d69649e67001c01fb63cd4e0aa | |
parent | 16c34c61203dee01c8091b92df1bdf0a399af32f (diff) | |
download | libmts-io-ea4e0213f94a1014a0b4f0e0e43c3222eddc177a.tar.gz libmts-io-ea4e0213f94a1014a0b4f0e0e43c3222eddc177a.tar.bz2 libmts-io-ea4e0213f94a1014a0b4f0e0e43c3222eddc177a.zip |
[MTS-MTQ] QuectelRadio implementation
Converted the following functions to protected virtual functions:
- CellularRadio::queryLteLac
- CellularRadio::setCGREG
- CellularRadio::queryCGREGstring
Those functions are handy to fetch LAC in LTE mode for both Quectel and Telit radios.
Also fixed comments and debug messages for the mentioned functions.
-rw-r--r-- | include/mts/MTS_IO_CellularRadio.h | 8 | ||||
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index c4e5b86..1572ac8 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -127,6 +127,10 @@ namespace MTS { void initMipProfile(Json::Value& jData); bool splitAndAssign(const std::string& sLine, const std::string& sKey, Json::Value& jParent, const std::string& sJsonKey, Json::ValueType eType = Json::ValueType::stringValue); + virtual std::string queryLteLac(); + virtual std::string queryCGREGstring(); + virtual void setCGREG(std::string value); + class RadioBandMap : public MTS::NonCopyable { public: RadioBandMap() @@ -168,10 +172,6 @@ namespace MTS { bool m_bEchoEnabled; bool m_bEnableEchoOnClose; - - std::string queryLteLac(); - std::string queryCGREGstring(); - void setCGREG(std::string value); }; } } diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 092da35..ee4e9ec 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -670,7 +670,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; @@ -690,7 +690,7 @@ std::string CellularRadio::queryLteLac() { if (CGREGstring == RSP_ERROR) { result = 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 = VALUE_UNAVAILABLE; @@ -708,7 +708,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()); } } @@ -716,7 +716,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 RSP_ERROR; } return cmdResult; |