summaryrefslogtreecommitdiff
path: root/src/MTS_IO_LE910Radio.cpp
diff options
context:
space:
mode:
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;
+}