From 39ecabe5d948575f6924fedd3946968c8783dda1 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Fri, 10 Jul 2020 12:22:19 +0300 Subject: Quectel Delta Radio Firmware Upgrade support - libmts-io implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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" --- src/MTS_IO_QuectelRadio.cpp | 22 +++++++++++----------- 1 file 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 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); } -- cgit v1.2.3