From ccd41677d998134ff501a8d6ac3a154dcaca9321 Mon Sep 17 00:00:00 2001 From: Andrii Pientsov Date: Mon, 13 Jul 2020 15:29:38 +0300 Subject: MTX-3404 Code Review --- include/mts/MTS_IO_CellularRadio.h | 4 ++++ include/mts/MTS_IO_QuectelRadio.h | 3 --- include/mts/MTS_IO_TelitRadio.h | 12 +++++------- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index e3941c3..6b23986 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -217,6 +217,10 @@ namespace MTS { std::string m_sRadioType; }; + static const size_t FILE_CHUNK_SIZE = 1024; + static CODE getFileSize(int fd, size_t& nBytes, size_t& nFileChunks); + static CODE readChunk(int fd, char* pChunk, size_t dChunkSize, size_t& nReadBytes); + private: std::string m_sName; std::string m_sRadioPort; diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index d8228cb..2121f7c 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -67,7 +67,6 @@ namespace MTS { // private variable to save old firmware versions during FOTA std::string m_sQuectelFirmware; - static const size_t FILE_CHUNK_SIZE; static const std::string CMD_ABORT_UPLOAD; static const std::string VALUE_MTS_DELTA_NAME; static const std::string VALUE_MTS_DELTA_PATH; @@ -85,8 +84,6 @@ namespace MTS { static uint16_t getQuectelChecksum(const void* data, size_t nBytes); static inline void updateQuectelChecksum(uint16_t& iChecksum, uint16_t iNewFragment); static inline uint16_t bytesToUint16(uint8_t high, uint8_t low); - static CODE getFileSize(int fd, size_t& nBytes, size_t& nFileChunks); - static CODE readChunk(int fd, char* pChunk, size_t dChunkSize, size_t& nReadBytes); CODE fumoWaitUpgradeFinished(UpdateCb& stepCb); CODE fumoWaitNewFirmware(UpdateCb& stepCb); }; diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index 07a95de..fdf8a20 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -66,7 +66,8 @@ namespace MTS { }; virtual FOTA_GROUP getFotaGroup(); - virtual CODE uploadFile(int fd, UpdateCb& stepCb); + virtual CODE fumoWriteGroupsABD(int fd, UpdateCb& stepCb); + //virtual CODE fumoWriteGroupC(int fd, UpdateCb& stepCb); private: virtual CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk, const std::string& sLockStatus); @@ -75,20 +76,17 @@ namespace MTS { // private variable to save old firmware versions during FOTA std::string m_sTelitFirmware; - static const size_t FILE_CHUNK_SIZE; static const std::string CMD_ABORT_UPLOAD; CODE getTelitFirmware(std::string& sFirmware); - CODE startFileUpload(); - CODE abortFileUpload(); + CODE startWrite(); + CODE abortWrite(); static inline void callNextStep(UpdateCb& stepCb, const char* csMessage); static inline void callNextStep(UpdateCb& stepCb, const std::string& sMessage); - static CODE getFileSize(int fd, size_t& nBytes, size_t& nFileChunks); - static CODE readChunk(int fd, char* pChunk, size_t dChunkSize, size_t& nReadBytes); - CODE fumoWaitRadioBooted(UpdateCb& stepCb); + CODE fumoWaitUpgradeFinished(UpdateCb& stepCb); CODE fumoCheckNewFirmware(UpdateCb& stepCb); }; -- cgit v1.2.3