summaryrefslogtreecommitdiff
path: root/src/MTS_IO_LE910Radio.cpp
diff options
context:
space:
mode:
authorJeff Hatch <Jeff.Hatch@multitech.com>2018-04-13 11:16:57 -0500
committerJeff Hatch <Jeff.Hatch@multitech.com>2018-04-13 11:16:57 -0500
commit9fc7c4094a2d1cfa9f23ed8e3ac80d111fd4e87f (patch)
tree064762842652bd565ed2f7fc9bf8dafb0639fa4b /src/MTS_IO_LE910Radio.cpp
parente3c38ce54b17ef0fa3e251abadb2887c889257ad (diff)
downloadlibmts-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/MTS_IO_LE910Radio.cpp')
-rw-r--r--src/MTS_IO_LE910Radio.cpp26
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;
+}