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/MTS_IO_LE910Radio.cpp | |
parent | e3c38ce54b17ef0fa3e251abadb2887c889257ad (diff) | |
download | libmts-io-aa86253bd64f7f1c1946fdd7386b2d3402561aa8.tar.gz libmts-io-aa86253bd64f7f1c1946fdd7386b2d3402561aa8.tar.bz2 libmts-io-aa86253bd64f7f1c1946fdd7386b2d3402561aa8.zip |
Add getModemLocation for CellularRadio and LE910 radio1.0.5
Diffstat (limited to 'src/MTS_IO_LE910Radio.cpp')
-rw-r--r-- | src/MTS_IO_LE910Radio.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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; +} |