diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-08-06 14:06:19 +0300 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-08-06 14:06:19 +0300 |
commit | e1855057708468bc5383d948be70da7179730231 (patch) | |
tree | 87d441aa1ae2b7e138129c340463d4e64ffd04fe /src/MTS_IO_ICellularRadio.cpp | |
parent | 96445eaa166dd8f4ba99014f5eea2c1146b9db80 (diff) | |
download | libmts-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/MTS_IO_ICellularRadio.cpp')
-rw-r--r-- | src/MTS_IO_ICellularRadio.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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; |