summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-05-29 21:02:15 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-05-30 11:58:27 +0300
commit6e9ce61addd97809d5ea7b912332dd11a4bf7cee (patch)
treedc45ee1c7ce5cbdef3e2f0d9770c9562309072da /include
parent9f5a4f138b56a0a1b4e5764a69261aa4a4edaa71 (diff)
downloadlibmts-io-6e9ce61addd97809d5ea7b912332dd11a4bf7cee.tar.gz
libmts-io-6e9ce61addd97809d5ea7b912332dd11a4bf7cee.tar.bz2
libmts-io-6e9ce61addd97809d5ea7b912332dd11a4bf7cee.zip
Quectel Delta Radio Firmware Upgrade support - libmts-io implementation
Initial implementation of the delta firmware image upload for Quectel radios.
Diffstat (limited to 'include')
-rw-r--r--include/mts/MTS_IO_CellularRadio.h2
-rw-r--r--include/mts/MTS_IO_ICellularRadio.h1
-rw-r--r--include/mts/MTS_IO_QuectelRadio.h20
3 files changed, 23 insertions, 0 deletions
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h
index 9fdb076..92df561 100644
--- a/include/mts/MTS_IO_CellularRadio.h
+++ b/include/mts/MTS_IO_CellularRadio.h
@@ -177,6 +177,8 @@ namespace MTS {
REGISTRATION parseRegResponse(std::string sResult);
CODE getRegistration(REGISTRATION& eRegistration, const std::string& sType);
+ virtual CODE sendData(const char* pData, size_t nBytes);
+
class RadioBandMap : public MTS::NonCopyable {
public:
RadioBandMap()
diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h
index 5123ba1..7ad69c7 100644
--- a/include/mts/MTS_IO_ICellularRadio.h
+++ b/include/mts/MTS_IO_ICellularRadio.h
@@ -103,6 +103,7 @@ namespace MTS {
static const char *RSP_OK;
static const char *RSP_ERROR;
+ static const char *RSP_CONNECT;
static const char *VALUE_NOT_REGISTERED;
static const char *VALUE_REGISTERED;
diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h
index 8aba437..9ccf50a 100644
--- a/include/mts/MTS_IO_QuectelRadio.h
+++ b/include/mts/MTS_IO_QuectelRadio.h
@@ -60,11 +60,31 @@ namespace MTS {
virtual CODE checkFile(bool& bFilePresent, const std::string& sTargetFilename);
private:
+ 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 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);
};
}
}
+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_ */