IUpdater implementation that uses the c fopen function (https://cplusplus.com/reference/cstdio/fopen/), under the hood to write the given binary firmware data into a file. Can be used to write the binary into an intermediate SD card instead of directly updating to flash memory.
More...
#include <SDCard_Updater.h>
|
| | SDCard_Updater (char const *file_path) |
| | Constructor. More...
|
| |
| | SDCard_Updater (SDCard_Updater const &other)=delete |
| | Deleted copy constructor. More...
|
| |
| void | operator= (SDCard_Updater const &other)=delete |
| | Deleted copy assignment operator. More...
|
| |
| | ~SDCard_Updater () override |
| |
| bool | begin (size_t const &firmware_size) override |
| | Initalizes the writing of the given data. More...
|
| |
| size_t | write (uint8_t *payload, size_t const &total_bytes) override |
| | Writes the given amount of bytes of the packet data. More...
|
| |
| void | reset () override |
| | Resets the writing of the given data so it can be restarted with begin. More...
|
| |
| bool | end () override |
| | Ends the update and returns wheter it was successfully completed. More...
|
| |
| virtual | ~IUpdater () |
| | Virtual default destructor, created to ensure that if a pointer to this class is used and deleted, we will also call the derived base class destructor. More...
|
| |
| virtual bool | begin (size_t const &firmware_size)=0 |
| | Initalizes the writing of the given data. More...
|
| |
| virtual size_t | write (uint8_t *payload, size_t const &total_bytes)=0 |
| | Writes the given amount of bytes of the packet data. More...
|
| |
| virtual void | reset ()=0 |
| | Resets the writing of the given data so it can be restarted with begin. More...
|
| |
| virtual bool | end ()=0 |
| | Ends the update and returns wheter it was successfully completed. More...
|
| |
template<typename Logger = DefaultLogger>
class SDCard_Updater< Logger >
IUpdater implementation that uses the c fopen function (https://cplusplus.com/reference/cstdio/fopen/), under the hood to write the given binary firmware data into a file. Can be used to write the binary into an intermediate SD card instead of directly updating to flash memory.
- Template Parameters
-
| Logger | Implementation that should be used to print error messages generated by internal processes and additional debugging messages if THINGSBOARD_ENABLE_DEBUG is set, default = DefaultLogger |
◆ SDCard_Updater() [1/2]
template<typename Logger = DefaultLogger>
Constructor.
- Parameters
-
| file_path | Non owning pointer to the file path the binary firmware data should be written into. Additionally it has to be kept alive by the user for the runtime of the OTA Update process |
◆ SDCard_Updater() [2/2]
template<typename Logger = DefaultLogger>
Deleted copy constructor.
- Note
- Copying an active Updater writing to the same path, makes no sense as it would overwrite file contents. Therefore copying is disabled alltogether
- Parameters
-
| other | Other instance we disallow copying from |
◆ ~SDCard_Updater()
template<typename Logger = DefaultLogger>
◆ begin()
template<typename Logger = DefaultLogger>
Initalizes the writing of the given data.
- Parameters
-
| firmware_size | Total size of the data that should be written, is done in multiple packets |
- Returns
- Whether initalizing the update was successful or not
Implements IUpdater.
◆ end()
template<typename Logger = DefaultLogger>
Ends the update and returns wheter it was successfully completed.
- Returns
- Whether the complete amount of bytes initally given was successfully written or not
Implements IUpdater.
◆ operator=()
template<typename Logger = DefaultLogger>
Deleted copy assignment operator.
- Note
- Copying an active Updater writing to the same path, makes no sense as it would overwrite file contents. Therefore copying is disabled alltogether
- Parameters
-
| other | Other instance we disallow copying from |
◆ reset()
template<typename Logger = DefaultLogger>
Resets the writing of the given data so it can be restarted with begin.
Implements IUpdater.
◆ write()
template<typename Logger = DefaultLogger>
Writes the given amount of bytes of the packet data.
- Parameters
-
| payload | Firmware packet data that should be written |
| total_bytes | Amount of bytes in the current firmware packet data |
- Returns
- Total amount of bytes that were successfully written
Implements IUpdater.
The documentation for this class was generated from the following file: