1#ifndef OTA_Update_Callback_h
2#define OTA_Update_Callback_h
48 OTA_Update_Callback(
char const * current_fw_title,
char const * current_fw_version,
IUpdater * updater,
function finished_callback,
Callback<void, size_t const &, size_t const &>::function progress_callback =
nullptr,
Callback<void>::function update_starting_callback =
nullptr,
uint8_t chunk_retries =
CHUNK_RETRIES, uint16_t chunk_size =
CHUNK_SIZE, uint64_t
const & timeout_microseconds =
REQUEST_TIMEOUT_MS);
159 char const *m_current_fw_title = {};
160 char const *m_current_fw_version = {};
162 size_t m_request_id = {};
166 uint16_t m_chunk_size = {};
uint8_t constexpr CHUNK_RETRIES
Definition: OTA_Update_Callback.h:11
uint16_t constexpr CHUNK_SIZE
Definition: OTA_Update_Callback.h:12
uint64_t constexpr REQUEST_TIMEOUT_MS
Definition: OTA_Update_Callback.h:13
General purpose safe callback wrapper. Expects either c-style or c++ style function pointer,...
Definition: Callback.h:30
std::function< void(argument_types... arguments)> function
Callback signature.
Definition: Callback.h:34
Updater interface that contains the method that a class that can be used to flash given binary data o...
Definition: IUpdater.h:14
Over the air firmware update callback wrapper.
Definition: OTA_Update_Callback.h:19
Timeoutable_Request & Get_Request_Timeout()
Gets the request timeout callback.
Definition: OTA_Update_Callback.cpp:83
void Set_Firmware_Version(const char *current_fw_version)
Sets the current firmware version.
Definition: OTA_Update_Callback.cpp:31
void Call_Progress_Callback(size_t const ¤t, size_t const &total) const
Calls the progress callback that was subscribed, when this class instance was initally created.
Definition: OTA_Update_Callback.cpp:51
uint8_t Get_Chunk_Retries() const
Gets the amount of times we attempt to download each chunk of the OTA firmware binary file.
Definition: OTA_Update_Callback.cpp:67
void Set_Request_ID(size_t const &request_id)
Sets the unique request identifier that is connected to the original request.
Definition: OTA_Update_Callback.cpp:47
void Set_Firmware_Title(const char *current_fw_title)
Sets the current firmware title.
Definition: OTA_Update_Callback.cpp:23
uint16_t Get_Chunk_Size() const
Gets the size of the chunks that the firmware binary data will be split into.
Definition: OTA_Update_Callback.cpp:75
OTA_Update_Callback()=default
Constructs empty callbacks, will result in never being called. Internals are simply default construct...
void Set_Chunk_Size(uint16_t chunk_size)
Sets the size of the chunks that the firmware binary data will be split into.
Definition: OTA_Update_Callback.cpp:79
IUpdater * Get_Updater() const
Gets the updater implementation, used to write the actual firmware data into the needed memory locati...
Definition: OTA_Update_Callback.cpp:35
void Set_Updater(IUpdater *updater)
Sets the updater implementation, used to write the actual firmware data into the needed memory locati...
Definition: OTA_Update_Callback.cpp:39
void Set_Update_Starting_Callback(Callback< void >::function update_starting_callback)
Sets the update starting callback method.
Definition: OTA_Update_Callback.cpp:63
size_t const & Get_Request_ID() const
Gets the unique request identifier that is connected to the original request.
Definition: OTA_Update_Callback.cpp:43
~OTA_Update_Callback() override=default
char const * Get_Firmware_Version() const
Gets the current firmware version.
Definition: OTA_Update_Callback.cpp:27
void Call_Update_Starting_Callback() const
Calls the update starting callback that was subscribed, when this class instance was initally created...
Definition: OTA_Update_Callback.cpp:59
void Set_Progress_Callback(Callback< void, size_t const &, size_t const & >::function progress_callback)
Sets the progress callback method.
Definition: OTA_Update_Callback.cpp:55
void Set_Chunk_Retries(uint8_t chunk_retries)
Sets the amount of times we attempt to download each chunk of the OTA firmware binary file.
Definition: OTA_Update_Callback.cpp:71
char const * Get_Firmware_Title() const
Gets the current firmware title.
Definition: OTA_Update_Callback.cpp:19
General purpose request callback that can timeout if the response to the request is not received in t...
Definition: Timeoutable_Request.h:10