diff options
author | Jeff Hatch <Jeff.Hatch@multitech.com> | 2018-04-13 11:16:57 -0500 |
---|---|---|
committer | Jeff Hatch <Jeff.Hatch@multitech.com> | 2018-04-13 11:16:57 -0500 |
commit | 9fc7c4094a2d1cfa9f23ed8e3ac80d111fd4e87f (patch) | |
tree | 064762842652bd565ed2f7fc9bf8dafb0639fa4b /src | |
parent | e3c38ce54b17ef0fa3e251abadb2887c889257ad (diff) | |
download | libmts-io-9fc7c4094a2d1cfa9f23ed8e3ac80d111fd4e87f.tar.gz libmts-io-9fc7c4094a2d1cfa9f23ed8e3ac80d111fd4e87f.tar.bz2 libmts-io-9fc7c4094a2d1cfa9f23ed8e3ac80d111fd4e87f.zip |
Add getModemLocation for CellularRadio and LE910 radio1.0.5
Diffstat (limited to 'src')
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 5 | ||||
-rw-r--r-- | src/MTS_IO_LE910Radio.cpp | 26 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 9b4502d..2b15194 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -800,6 +800,11 @@ CellularRadio::CODE CellularRadio::getSignalStrength(int32_t& rssi) { return SUCCESS; } +CellularRadio::CODE CellularRadio::getModemLocation(std::string& sLocation) { + printTrace("%s|CellularRadio getModemLocation - not supported", m_sName.c_str()); + return FAILURE; +} + CellularRadio::CODE CellularRadio::convertSignalStrengthTodBm(const int32_t& iRssi, int32_t& iDbm) { //Telit Conversion diff --git a/src/MTS_IO_LE910Radio.cpp b/src/MTS_IO_LE910Radio.cpp index 33719f2..76ccae2 100644 --- a/src/MTS_IO_LE910Radio.cpp +++ b/src/MTS_IO_LE910Radio.cpp @@ -28,6 +28,7 @@ */ #include <mts/MTS_IO_LE910Radio.h> +#include <mts/MTS_Logger.h> using namespace MTS::IO; @@ -50,3 +51,28 @@ CellularRadio::CODE LE910Radio::setRxDiversity(const Json::Value& jArgs) { return CellularRadio::sendBasicCommand(sCmd); } + +CellularRadio::CODE LE910Radio::getModemLocation(std::string& sLocation) { + const std::string& whitespace = " \t"; + printTrace("LE910Radio getModemLocation"); + std::string sCmd("AT$GPSACP"); + std::string sResult = sendCommand(sCmd); + if (sResult.find("$GPSACP: ") == std::string::npos) { + printDebug("AT$GPSACP command returned unexpected response: [%s]", sResult.c_str()); + return FAILURE; + } + printDebug("modem reply: [%s]", sResult.c_str()); + size_t start = sResult.find(':'); + if (start==std::string::npos){ + start = 0; + } else { + start++; + } + start = sResult.find_first_not_of(whitespace, start); + size_t stop = sResult.find('\n', start); + sLocation = sResult.substr(start, stop - start - 1); + + printDebug("function reply: [%s]", sLocation.c_str()); + + return SUCCESS; +} |