summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksym Telychko <maksym.telychko@globallogic.com>2019-07-30 18:39:03 +0300
committerMaksym Telychko <maksym.telychko@globallogic.com>2019-07-30 18:39:03 +0300
commitdf51426afd369bec64597eb922b6f6cc87d1f5ac (patch)
tree828150e35835a86a61d955774839d887e445869b
parentd8b526a82a9b4575adf7dd0d8451d95b6984b02f (diff)
downloadlibmts-io-df51426afd369bec64597eb922b6f6cc87d1f5ac.tar.gz
libmts-io-df51426afd369bec64597eb922b6f6cc87d1f5ac.tar.bz2
libmts-io-df51426afd369bec64597eb922b6f6cc87d1f5ac.zip
MTX-2891 mpower 2-3-4g switch: quectel methods
-rw-r--r--src/MTS_IO_EG95Radio.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp
index 88f5724..501a164 100644
--- a/src/MTS_IO_EG95Radio.cpp
+++ b/src/MTS_IO_EG95Radio.cpp
@@ -21,6 +21,10 @@
#include <mts/MTS_IO_EG95Radio.h>
+#include <climits>
+
+#include <mts/MTS_Logger.h>
+
using namespace MTS::IO;
const std::string EG95Radio::MODEL_NAME("EG95");
@@ -51,10 +55,27 @@ ICellularRadio::CODE EG95Radio::getSupportedCellularModes(CELLULAR_MODES &networ
return SUCCESS;
}
-ICellularRadio::CODE EG95Radio::getCellularMode(CELLULAR_MODES &networks) {
+ICellularRadio::CODE EG95Radio::getCellularMode(CELLULAR_MODES&) {
return FAILURE;
}
ICellularRadio::CODE EG95Radio::setCellularMode(CELLULAR_MODES networks) {
+ std::string prefNet;
+ for (int i = sizeof(networks)*CHAR_BIT-1; i>=0; --i){
+ switch (1<<i & networks) {
+ case ICellularRadio::CELLULAR_MODE_2G: prefNet += "01"; break;
+ case ICellularRadio::CELLULAR_MODE_3G: prefNet += "0302"; break;
+ case ICellularRadio::CELLULAR_MODE_4G: prefNet += "04"; break;
+ default: printError("Unhandled preferred network flag.");
+ }
+ }
+ std::string sCmd("AT+QCFG=\"nwscanseq\",");
+ sCmd += prefNet;
+ std::string cmdResult = sendCommand(sCmd);
+ if (cmdResult.find(ICellularRadio::RSP_OK) == std::string::npos) {
+ printDebug("%s| AT+QCFG returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str());
+ return FAILURE;
+ }
+
return SUCCESS;
}