summaryrefslogtreecommitdiff
path: root/include/mts
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-07-03 18:53:57 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-07-03 18:56:00 +0300
commitd19829b7e9cdd3c7e3d209628044ab62cd46b907 (patch)
tree37ed66ed5179853b6fb3d7581d583b9dc2b74adf /include/mts
parent2c3296b5239b5d27f5df4d61a9609ace6d70904f (diff)
downloadlibmts-io-d19829b7e9cdd3c7e3d209628044ab62cd46b907.tar.gz
libmts-io-d19829b7e9cdd3c7e3d209628044ab62cd46b907.tar.bz2
libmts-io-d19829b7e9cdd3c7e3d209628044ab62cd46b907.zip
Quectel Delta Radio Firmware Upgrade support - libmts-io implementation
Simplified usage of step callbacks in the QuectelRadio class. Refactored existing function to use a wrapper and preven repetitive checks.
Diffstat (limited to 'include/mts')
-rw-r--r--include/mts/MTS_IO_QuectelRadio.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h
index b805ed8..3751b5a 100644
--- a/include/mts/MTS_IO_QuectelRadio.h
+++ b/include/mts/MTS_IO_QuectelRadio.h
@@ -72,6 +72,9 @@ namespace MTS {
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);
@@ -83,6 +86,18 @@ namespace MTS {
}
}
+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;
}