ThingsBoard Client SDK 0.16.0
Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDCard_Updater< Logger > Class Template Reference

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>

Inheritance diagram for SDCard_Updater< Logger >:
[legend]
Collaboration diagram for SDCard_Updater< Logger >:
[legend]

Public Member Functions

 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...
 
- Public Member Functions inherited from IUpdater
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...
 

Detailed Description

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
LoggerImplementation that should be used to print error messages generated by internal processes and additional debugging messages if THINGSBOARD_ENABLE_DEBUG is set, default = DefaultLogger

Constructor & Destructor Documentation

◆ SDCard_Updater() [1/2]

template<typename Logger = DefaultLogger>
SDCard_Updater< Logger >::SDCard_Updater ( char const *  file_path)
inline

Constructor.

Parameters
file_pathNon 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>
SDCard_Updater< Logger >::SDCard_Updater ( SDCard_Updater< Logger > const &  other)
delete

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
otherOther instance we disallow copying from

◆ ~SDCard_Updater()

template<typename Logger = DefaultLogger>
SDCard_Updater< Logger >::~SDCard_Updater ( )
inlineoverride

Member Function Documentation

◆ begin()

template<typename Logger = DefaultLogger>
bool SDCard_Updater< Logger >::begin ( size_t const &  firmware_size)
inlineoverridevirtual

Initalizes the writing of the given data.

Parameters
firmware_sizeTotal 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>
bool SDCard_Updater< Logger >::end ( )
inlineoverridevirtual

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>
void SDCard_Updater< Logger >::operator= ( SDCard_Updater< Logger > const &  other)
delete

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
otherOther instance we disallow copying from

◆ reset()

template<typename Logger = DefaultLogger>
void SDCard_Updater< Logger >::reset ( )
inlineoverridevirtual

Resets the writing of the given data so it can be restarted with begin.

Implements IUpdater.

◆ write()

template<typename Logger = DefaultLogger>
size_t SDCard_Updater< Logger >::write ( uint8_t payload,
size_t const &  total_bytes 
)
inlineoverridevirtual

Writes the given amount of bytes of the packet data.

Parameters
payloadFirmware packet data that should be written
total_bytesAmount 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: