diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-07-10 12:22:19 +0300 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-07-10 12:45:41 +0300 |
commit | 39ecabe5d948575f6924fedd3946968c8783dda1 (patch) | |
tree | 882c64dc15c0e6a59531903bc6b592f3b6b5061b /src/MTS_IO_QuectelRadio.cpp | |
parent | 9e007df4a7e3fafff27a0c3fa11d4ba53e785985 (diff) | |
download | libmts-io-39ecabe5d948575f6924fedd3946968c8783dda1.tar.gz libmts-io-39ecabe5d948575f6924fedd3946968c8783dda1.tar.bz2 libmts-io-39ecabe5d948575f6924fedd3946968c8783dda1.zip |
Quectel Delta Radio Firmware Upgrade support - libmts-io implementation
Small fixes and improvements.
1. Fixed casing for the "FUMO Error: timeout, radio is not responding" message.
All error messages passed to the status callback shall start with "FUMO Error:"
2. Removed extra carriage return for the "abortFileUpload" command.
Passing "+++\r" instead of the "+++" to the radio works for Quectel but cause
issues for Telit.
At the same time Quectel specificly requires to
"Do not input any character within 1s after “+++” has been inputted."
in their FILE manual. Possibly, "any character" includes carriage return.
3. Fixed a typo: "lenght" -> "length"
Diffstat (limited to 'src/MTS_IO_QuectelRadio.cpp')
-rw-r--r-- | src/MTS_IO_QuectelRadio.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index 7aeed96..22374ee 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -833,18 +833,18 @@ ICellularRadio::CODE QuectelRadio::setCellularMode(CELLULAR_MODES networks) { } ICellularRadio::CODE QuectelRadio::uploadFile(int fd, const std::string& sTargetFilename, ICellularRadio::UpdateCb& stepCb) { - size_t dPayloadLenght; + size_t dPayloadLength; size_t nChunks; CODE rc; - rc = getFileSize(fd, dPayloadLenght, nChunks); + rc = getFileSize(fd, dPayloadLength, nChunks); if (rc != SUCCESS) { return rc; } - printTrace("File size: %d bytes and %d chunks", dPayloadLenght, nChunks); + printTrace("File size: %d bytes and %d chunks", dPayloadLength, nChunks); printTrace("Starting file upload..."); - rc = startFileUpload(sTargetFilename, dPayloadLenght); + rc = startFileUpload(sTargetFilename, dPayloadLength); if (rc != SUCCESS) { return rc; } @@ -854,21 +854,21 @@ ICellularRadio::CODE QuectelRadio::uploadFile(int fd, const std::string& sTarget uint16_t dChecksum = 0; size_t nChunksPerCent = (nChunks / 100) + 1; - size_t nFragmentLenght = 0; + size_t nFragmentLength = 0; std::array<char, FILE_CHUNK_SIZE> vBuffer; for (size_t iChunk = 1; iChunk < (nChunks + 1); iChunk++) { - rc = readChunk(fd, vBuffer.data(), vBuffer.size(), nFragmentLenght); + rc = readChunk(fd, vBuffer.data(), vBuffer.size(), nFragmentLength); if (rc != SUCCESS) { break; } // we got our fragment, calculate checksum and flush the data - uint16_t dFragmentChecksum = getQuectelChecksum(vBuffer.data(), nFragmentLenght); + uint16_t dFragmentChecksum = getQuectelChecksum(vBuffer.data(), nFragmentLength); updateQuectelChecksum(dChecksum, dFragmentChecksum); - rc = sendData(vBuffer.data(), nFragmentLenght); + rc = sendData(vBuffer.data(), nFragmentLength); if (rc != SUCCESS) { break; } @@ -889,7 +889,7 @@ ICellularRadio::CODE QuectelRadio::uploadFile(int fd, const std::string& sTarget printTrace("Waiting for acknoledge from the radio"); std::string sExpectedResult = "+QFUPL: "; - sExpectedResult += MTS::Text::format(dPayloadLenght); + sExpectedResult += MTS::Text::format(dPayloadLength); sExpectedResult += ","; sExpectedResult += MTS::Text::toLowerCase(MTS::Text::formatHex(dChecksum)); @@ -1074,7 +1074,7 @@ ICellularRadio::CODE QuectelRadio::fumoWaitUpgradeFinished(ICellularRadio::Updat if (sResponse.find(sFotaUrcPrefix) == std::string::npos) { printError("No URC messages from the radio in %d ms", duUrcTimeout); - callNextStep(stepCb, "FUMO error: timeout, radio is not responding"); + callNextStep(stepCb, "FUMO Error: timeout, radio is not responding"); rc = ERROR; break; } @@ -1176,5 +1176,5 @@ ICellularRadio::CODE QuectelRadio::abortFileUpload() { * 3) Do not input any character within 1s after “+++” has been inputted. */ sleep(1); - return sendBasicCommand(CMD_ABORT_UPLOAD, 2000); + return sendBasicCommand(CMD_ABORT_UPLOAD, 2000, 0x00); } |