From e09f54c6b6fe35dc022fcea66935f5269866bff1 Mon Sep 17 00:00:00 2001 From: Andrii Pientsov Date: Fri, 10 Jul 2020 15:40:48 +0300 Subject: MTX-3404 mPower Oct20: Delta Radio Firmware Upgrade - L4E1 - libmts-io support --- include/mts/MTS_IO_TelitRadio.h | 50 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'include/mts/MTS_IO_TelitRadio.h') diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index bd542f1..07a95de 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -44,6 +44,10 @@ namespace MTS { CODE getSupportedCellularModes(CELLULAR_MODES &networks) override; CODE setCellularMode(CELLULAR_MODES networks) override; + CODE updateFumoLocal(int fd, UpdateCb& stepCb) override; + CODE fumoLocalInject(int fd, UpdateCb& stepCb) override; + CODE fumoLocalApply(UpdateCb& stepCb) override; + protected: TelitRadio(const std::string& sName, const std::string& sRadioPort); @@ -53,10 +57,54 @@ namespace MTS { CODE getIsSimInserted(bool& bData) override; CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; + enum FOTA_GROUP : uint8_t { + VALUE_GROUP_A = 0, + VALUE_GROUP_B, + VALUE_GROUP_C, + VALUE_GROUP_D, + VALUE_UNKNOWN + }; + + virtual FOTA_GROUP getFotaGroup(); + virtual CODE uploadFile(int fd, UpdateCb& stepCb); + private: virtual CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk, const std::string& sLockStatus); ICellularRadio::CODE wdsList(std::set &wds); + + // 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(); + + 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 fumoCheckNewFirmware(UpdateCb& stepCb); + }; } } -#endif + +void MTS::IO::TelitRadio::callNextStep(ICellularRadio::UpdateCb& stepCb, const char* csMessage) { + if (stepCb) { + stepCb(Json::Value(csMessage)); + } +} + +void MTS::IO::TelitRadio::callNextStep(ICellularRadio::UpdateCb& stepCb, const std::string& sMessage) { + if (stepCb) { + stepCb(Json::Value(sMessage)); + } +} + +#endif /* MTS_IO_TELITRADIO_H_ */ -- cgit v1.2.3 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_TelitRadio.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'include/mts/MTS_IO_TelitRadio.h') 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 From 8186f98913c55191b5a3610d19c8580c6a86c2f4 Mon Sep 17 00:00:00 2001 From: Andrii Pientsov Date: Wed, 15 Jul 2020 13:49:59 +0300 Subject: MTX-3404 Code Review --- include/mts/MTS_IO_TelitRadio.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/mts/MTS_IO_TelitRadio.h') diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index fdf8a20..a3425f9 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -76,6 +76,7 @@ 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); -- cgit v1.2.3