summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-08-06 14:06:19 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-08-06 14:06:19 +0300
commite1855057708468bc5383d948be70da7179730231 (patch)
tree87d441aa1ae2b7e138129c340463d4e64ffd04fe /src
parent96445eaa166dd8f4ba99014f5eea2c1146b9db80 (diff)
downloadlibmts-io-e1855057708468bc5383d948be70da7179730231.tar.gz
libmts-io-e1855057708468bc5383d948be70da7179730231.tar.bz2
libmts-io-e1855057708468bc5383d948be70da7179730231.zip
Quectel EG25-G Delta Radio Firmware Upgrade support - libmts-io implementation
Added waitResponse overloads to the public interface of ICellularRadio.
Diffstat (limited to 'src')
-rw-r--r--src/MTS_IO_CellularRadio.cpp8
-rw-r--r--src/MTS_IO_ICellularRadio.cpp18
2 files changed, 26 insertions, 0 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp
index 49a2b32..ce95929 100644
--- a/src/MTS_IO_CellularRadio.cpp
+++ b/src/MTS_IO_CellularRadio.cpp
@@ -1133,6 +1133,14 @@ std::string CellularRadio::sendCommand(const std::string& sCmd, MTS::IO::Cellula
return ICellularRadio::sendCommand(m_apIo, sCmd, isNeedMoreData, timeoutMillis, ESC);
}
+std::string CellularRadio::waitResponse(const std::vector<std::string>& vBail, int32_t timeoutMillis) {
+ return ICellularRadio::waitResponse(m_apIo, vBail, timeoutMillis);
+}
+
+std::string CellularRadio::waitResponse(ICellularRadio::IsNeedMoreData& isNeedMoreData, int32_t timeoutMillis) {
+ return ICellularRadio::waitResponse(m_apIo, isNeedMoreData, timeoutMillis);
+}
+
ICellularRadio::CODE CellularRadio::sendData(const char* pData, size_t nBytes) {
if(m_apIo.isNull()) {
printError("RADIO| IO is not set in sendData");
diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp
index 69f731a..73737c7 100644
--- a/src/MTS_IO_ICellularRadio.cpp
+++ b/src/MTS_IO_ICellularRadio.cpp
@@ -379,6 +379,24 @@ std::string MTS::IO::ICellularRadio::sendCommand(MTS::AutoPtr<MTS::IO::Connectio
return waitResponse(apIo, isNeedMoreData, timeoutMillis);
}
+std::string MTS::IO::ICellularRadio::waitResponse(MTS::AutoPtr<MTS::IO::Connection>& apIo, const std::vector<std::string>& vBail, int32_t timeoutMillis) {
+ IsNeedMoreData isNeedMoreData = [&vBail](const std::string&, const std::string& allData)->bool {
+ for(size_t i = 0; i < vBail.size(); i++) {
+ const std::string& sBail = vBail[i];
+ if(sBail.size() > 0) {
+ if(allData.find(sBail) != std::string::npos) {
+ //Return when bail string is found
+ printTrace("RADIO| Found bail string [%s]", sBail.c_str());
+ return false;
+ }
+ }
+ }
+ return true;
+ };
+
+ return waitResponse(apIo, isNeedMoreData, timeoutMillis);
+}
+
std::string MTS::IO::ICellularRadio::waitResponse(MTS::AutoPtr<MTS::IO::Connection>& apIo, MTS::IO::ICellularRadio::IsNeedMoreData& isNeedMoreData, int32_t timeoutMillis) {
bool done = false;
const uint32_t capacity = 1024;