summaryrefslogtreecommitdiff
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
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
-rw-r--r--include/mts/MTS_IO_CellularRadio.h1
-rw-r--r--include/mts/MTS_IO_LE910Radio.h1
-rw-r--r--src/MTS_IO_CellularRadio.cpp5
-rw-r--r--src/MTS_IO_LE910Radio.cpp26
4 files changed, 33 insertions, 0 deletions
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h
index 0ec4ac8..bc7c437 100644
--- a/include/mts/MTS_IO_CellularRadio.h
+++ b/include/mts/MTS_IO_CellularRadio.h
@@ -283,6 +283,7 @@ namespace MTS {
virtual CODE getRoaming(bool& bRoaming);
virtual CODE getSignalStrength(int32_t& iRssi);
+ virtual CODE getModemLocation(std::string& sLocation);
virtual CODE convertSignalStrengthTodBm(const int32_t& iRssi, int32_t& dBm);
virtual CODE convertdBmToSignalStrength(const int32_t& dBm, int32_t& iRssi);
diff --git a/include/mts/MTS_IO_LE910Radio.h b/include/mts/MTS_IO_LE910Radio.h
index 6b77607..e8ac21f 100644
--- a/include/mts/MTS_IO_LE910Radio.h
+++ b/include/mts/MTS_IO_LE910Radio.h
@@ -43,6 +43,7 @@ namespace MTS {
virtual ~LE910Radio(){};
CODE setRxDiversity(const Json::Value& jArgs);
+ CODE getModemLocation(std::string& sLocation);
protected:
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;
+}