summaryrefslogtreecommitdiff
path: root/include/mts/MTS_IO_QuectelRadio.h
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2020-07-22 08:25:08 -0500
committerJeff Hatch <jhatch@multitech.com>2020-07-22 08:25:08 -0500
commitd340135922da6eb881418824e470cbdba835b498 (patch)
tree90e162e6cf2c6a1d3b890a5483c9f77a000ced09 /include/mts/MTS_IO_QuectelRadio.h
parent343e662b6224cf03fea5ebfd419c7cf990528b53 (diff)
parentbeb3f36c5dcc70beed900859d6426dc74e4bccc8 (diff)
downloadlibmts-io-d340135922da6eb881418824e470cbdba835b498.tar.gz
libmts-io-d340135922da6eb881418824e470cbdba835b498.tar.bz2
libmts-io-d340135922da6eb881418824e470cbdba835b498.zip
Merge branch 'delta-radio-fwu' into 'master'
Delta Radio Firmware Upgrade support: LEU7 and L4E1 See merge request !30
Diffstat (limited to 'include/mts/MTS_IO_QuectelRadio.h')
-rw-r--r--include/mts/MTS_IO_QuectelRadio.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h
index fcee069..41c89dc 100644
--- a/include/mts/MTS_IO_QuectelRadio.h
+++ b/include/mts/MTS_IO_QuectelRadio.h
@@ -31,6 +31,7 @@ namespace MTS {
public:
bool resetRadio(uint32_t iTimeoutMillis = 5000) override;
+ CODE getVendorFirmware(std::string& sVendorFirmware) override;
CODE getModel(std::string& sModel) override;
CODE getIccid(std::string& sIccid) override;
CODE getService(std::string& sService) override;
@@ -45,6 +46,11 @@ namespace MTS {
CODE setCellularMode(CELLULAR_MODES networks) override;
+ CODE updateFumoLocal(int fd, UpdateCb& stepCb) override;
+ CODE fumoLocalInject(int fd, UpdateCb& stepCb) override;
+ CODE fumoLocalCleanup() override;
+ CODE fumoLocalApply(UpdateCb& stepCb) override;
+
protected:
QuectelRadio(const std::string& sName, const std::string& sRadioPort);
@@ -54,10 +60,54 @@ namespace MTS {
virtual CODE getServiceDomain(SERVICEDOMAIN& sd);
virtual CODE convertToActiveBand(const std::string& sQuectelBand, ACTIVEBAND& band);
+ virtual CODE uploadFile(int fd, const std::string& sTargetFilename, UpdateCb& stepCb);
+ virtual CODE removeFile(const std::string& sTargetFilename);
+ virtual CODE checkFile(bool& bFilePresent, const std::string& sTargetFilename);
+
private:
+ // 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;
+
+ CODE startFileUpload(const std::string& sTargetFilename, size_t nBytes);
+ CODE abortFileUpload();
+ static inline void callNextStep(UpdateCb& stepCb, const char* csMessage);
+ static inline void callNextStep(UpdateCb& stepCb, const std::string& sMessage);
+
+ 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);
+ CODE fumoWaitUpgradeFinished(UpdateCb& stepCb);
+ CODE fumoWaitNewFirmware(UpdateCb& stepCb);
};
}
}
+void MTS::IO::QuectelRadio::callNextStep(ICellularRadio::UpdateCb& stepCb, const char* csMessage) {
+ if (stepCb) {
+ stepCb(Json::Value(csMessage));
+ }
+}
+
+void MTS::IO::QuectelRadio::callNextStep(ICellularRadio::UpdateCb& stepCb, const std::string& sMessage) {
+ if (stepCb) {
+ stepCb(Json::Value(sMessage));
+ }
+}
+
+void MTS::IO::QuectelRadio::updateQuectelChecksum(uint16_t& iChecksum, uint16_t iNewFragment) {
+ iChecksum = iChecksum ^ iNewFragment;
+}
+
+uint16_t MTS::IO::QuectelRadio::bytesToUint16(uint8_t high, uint8_t low) {
+ uint16_t comboHigh = static_cast<uint16_t>(high << 8); // explicit cast to prevent warnings
+ uint16_t comboLow = low;
+ return (comboHigh | comboLow);
+}
+
#endif /* MTS_IO_QUECTELRADIO_H_ */