diff options
Diffstat (limited to 'src/MTS_IO_TelitRadio.cpp')
-rw-r--r-- | src/MTS_IO_TelitRadio.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index 86c3565..52b5664 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -28,6 +28,7 @@ using namespace MTS::IO; +const size_t TelitRadio::FILE_CHUNK_SIZE = 1024; const std::string TelitRadio::CMD_ABORT_UPLOAD = "+++"; @@ -855,10 +856,16 @@ ICellularRadio::CODE TelitRadio::fumoWriteGroupsABD(int fd, ICellularRadio::Upda size_t nChunks; CODE rc; - rc = getFileSize(fd, dPayloadLength, nChunks); + rc = getFileSize(fd, dPayloadLength); if (rc != SUCCESS) { return rc; } + + rc = sizeToChunks(dPayloadLength, FILE_CHUNK_SIZE, nChunks); + if (rc != SUCCESS) { + return rc; + } + printTrace("File size: %d bytes and %d chunks", dPayloadLength, nChunks); printTrace("Starting file upload..."); @@ -927,25 +934,25 @@ ICellularRadio::CODE TelitRadio::abortWrite() { * 2) Input “+++” within 1s, and no other characters can be inputted during the time. * 3) Do not input any character within 1s after “+++” has been inputted. */ - sleep(1); - return sendBasicCommand(CMD_ABORT_UPLOAD, 2000, 0x00); + sleep(1); + return sendBasicCommand(CMD_ABORT_UPLOAD, 2000, 0x00); } ICellularRadio::CODE TelitRadio::getTelitFirmware(std::string& sFirmware) { /* - * Currently, AT+CGMR command is used to determine the radio firmware version. - * - * AT+CGMR + * Currently, AT+CGMR command is used to determine the radio firmware version. + * + * AT+CGMR + * M0F.670006 + * + * Perhaps in the future we will use AT#SWPKGV command. + * + * AT#SWPKGV + * 25.20.676-P0F.670690 * M0F.670006 - * - * Perhaps in the future we will use AT#SWPKGV command. - * - * AT#SWPKGV - * 25.20.676-P0F.670690 - * M0F.670006 - * P0F.670690 - * A0F.670006 - */ + * P0F.670690 + * A0F.670006 + */ printTrace("%s| Get Telit-specific firmware version", getName().c_str()); sFirmware = ICellularRadio::VALUE_NOT_SUPPORTED; @@ -968,7 +975,7 @@ ICellularRadio::CODE TelitRadio::getTelitFirmware(std::string& sFirmware) { ICellularRadio::CODE TelitRadio::fumoWaitUpgradeFinished(ICellularRadio::UpdateCb& stepCb) { const uint32_t duAttachTimeout = 300000; // wait for 300 seconds for the radio to attach - const uint32_t duUrcTimeout = 60 * 1000; // wait for 1 minutes for the next URC message + const uint32_t duUrcTimeout = 60 * 1000; // wait for 1 minutes for the next URC message const std::string sFotaUrcPrefix = "#OTAEV:"; // prefix for the URC notification messages const std::string sFotaUrcEndSuccess = "Module Upgraded To New Fw"; const std::string sFotaUrcEndFailed = "OTA Fw Upgrade Failed"; |