From 5ee7664dde53f71fd245db530f985f10f111b28b Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Mon, 29 Jul 2019 13:27:29 +0300 Subject: MTX-2891 mpower 2-3-4g switch refactoring: method names --- src/MTS_IO_EG95Radio.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/MTS_IO_EG95Radio.cpp') diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp index 5c9ed69..f85b2c3 100644 --- a/src/MTS_IO_EG95Radio.cpp +++ b/src/MTS_IO_EG95Radio.cpp @@ -45,3 +45,16 @@ ICellularRadio::CODE EG95Radio::setRxDiversity(const Json::Value& jArgs) { return sendBasicCommand(sCmd); } + +ICellularRadio::CODE EG95Radio::getSupportedCellularModes(PREFERRED_NETWORKS &networks) { + networks = static_cast(PREFERRED_NETWORK_2G | PREFERRED_NETWORK_3G | PREFERRED_NETWORK_4G); + return SUCCESS; +} + +ICellularRadio::CODE EG95Radio::getCellularMode(PREFERRED_NETWORKS &networks) { + return FAILURE; +} + +ICellularRadio::CODE EG95Radio::setCellularMode(PREFERRED_NETWORKS networks) { + return SUCCESS; +} -- cgit v1.2.3 From d8b526a82a9b4575adf7dd0d8451d95b6984b02f Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 30 Jul 2019 10:47:36 +0300 Subject: MTX-2891 mpower 2-3-4g switch refactoring: enums --- src/MTS_IO_EG95Radio.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/MTS_IO_EG95Radio.cpp') diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp index f85b2c3..88f5724 100644 --- a/src/MTS_IO_EG95Radio.cpp +++ b/src/MTS_IO_EG95Radio.cpp @@ -46,15 +46,15 @@ ICellularRadio::CODE EG95Radio::setRxDiversity(const Json::Value& jArgs) { return sendBasicCommand(sCmd); } -ICellularRadio::CODE EG95Radio::getSupportedCellularModes(PREFERRED_NETWORKS &networks) { - networks = static_cast(PREFERRED_NETWORK_2G | PREFERRED_NETWORK_3G | PREFERRED_NETWORK_4G); +ICellularRadio::CODE EG95Radio::getSupportedCellularModes(CELLULAR_MODES &networks) { + networks = static_cast(CELLULAR_MODE_2G | CELLULAR_MODE_3G | CELLULAR_MODE_4G); return SUCCESS; } -ICellularRadio::CODE EG95Radio::getCellularMode(PREFERRED_NETWORKS &networks) { +ICellularRadio::CODE EG95Radio::getCellularMode(CELLULAR_MODES &networks) { return FAILURE; } -ICellularRadio::CODE EG95Radio::setCellularMode(PREFERRED_NETWORKS networks) { +ICellularRadio::CODE EG95Radio::setCellularMode(CELLULAR_MODES networks) { return SUCCESS; } -- cgit v1.2.3 From df51426afd369bec64597eb922b6f6cc87d1f5ac Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 30 Jul 2019 18:39:03 +0300 Subject: MTX-2891 mpower 2-3-4g switch: quectel methods --- src/MTS_IO_EG95Radio.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/MTS_IO_EG95Radio.cpp') 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 +#include + +#include + 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< Date: Mon, 5 Aug 2019 19:05:47 +0300 Subject: MTX-2898 mpower 2-3-4g: quectel methods for set-cellular-mode and common methods for get-cellular-mode --- src/MTS_IO_EG95Radio.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/MTS_IO_EG95Radio.cpp') diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp index 501a164..f934e50 100644 --- a/src/MTS_IO_EG95Radio.cpp +++ b/src/MTS_IO_EG95Radio.cpp @@ -24,6 +24,7 @@ #include #include +#include using namespace MTS::IO; @@ -55,27 +56,27 @@ ICellularRadio::CODE EG95Radio::getSupportedCellularModes(CELLULAR_MODES &networ return SUCCESS; } -ICellularRadio::CODE EG95Radio::getCellularMode(CELLULAR_MODES&) { - return FAILURE; -} - ICellularRadio::CODE EG95Radio::setCellularMode(CELLULAR_MODES networks) { std::string prefNet; + unsigned int prefOnly = 0; for (int i = sizeof(networks)*CHAR_BIT-1; i>=0; --i){ switch (1< Date: Thu, 8 Aug 2019 13:41:08 +0300 Subject: MTX-2898 mpower 2-3-4g: quectel set cellular mode fix --- src/MTS_IO_EG95Radio.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/MTS_IO_EG95Radio.cpp') diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp index f934e50..7705e64 100644 --- a/src/MTS_IO_EG95Radio.cpp +++ b/src/MTS_IO_EG95Radio.cpp @@ -67,15 +67,23 @@ ICellularRadio::CODE EG95Radio::setCellularMode(CELLULAR_MODES networks) { default: printError("Unhandled preferred network flag."); } } + std::string sCmd; if (prefNet.size() == 2) { // *g-only sCmd = "AT+QCFG=\"nwscanmode\"," + std::to_string(prefOnly); } else { // preferred - sCmd = "AT+QCFG=\"nwscanseq\"," + prefNet; + sCmd = "AT+QCFG=\"nwscanmode\",0"; } 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()); + printDebug("%s| AT+QCFG=\"nwscanmode\" returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str()); + return FAILURE; + } + + sCmd = "AT+QCFG=\"nwscanseq\"," + prefNet; + cmdResult = sendCommand(sCmd); + if (cmdResult.find(ICellularRadio::RSP_OK) == std::string::npos) { + printDebug("%s| AT+QCFG=\"nwscanseq\" returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str()); return FAILURE; } return SUCCESS; -- cgit v1.2.3 From 4e5c4eb9d3b9a8974429810ebe5afc3387753643 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Thu, 8 Aug 2019 13:45:31 +0300 Subject: MTX-2891 mpower 2-3-4g: error messages printed with printError --- src/MTS_IO_EG95Radio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/MTS_IO_EG95Radio.cpp') diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp index 7705e64..aff53d2 100644 --- a/src/MTS_IO_EG95Radio.cpp +++ b/src/MTS_IO_EG95Radio.cpp @@ -76,14 +76,14 @@ ICellularRadio::CODE EG95Radio::setCellularMode(CELLULAR_MODES networks) { } std::string cmdResult = sendCommand(sCmd); if (cmdResult.find(ICellularRadio::RSP_OK) == std::string::npos) { - printDebug("%s| AT+QCFG=\"nwscanmode\" returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str()); + printError("%s| AT+QCFG=\"nwscanmode\" returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str()); return FAILURE; } sCmd = "AT+QCFG=\"nwscanseq\"," + prefNet; cmdResult = sendCommand(sCmd); if (cmdResult.find(ICellularRadio::RSP_OK) == std::string::npos) { - printDebug("%s| AT+QCFG=\"nwscanseq\" returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str()); + printError("%s| AT+QCFG=\"nwscanseq\" returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str()); return FAILURE; } return SUCCESS; -- cgit v1.2.3