Zigbee Protocol Controller 1.6.0
ota.hpp File Reference
#include "uic_typedefs.h"
#include "sl_status.h"
#include <functional>
#include <string>
#include <ctime>

Go to the source code of this file.

Classes

struct  uic_ota::meta_t
 Struct that describes meta for a new available image. More...
 

Namespaces

namespace  uic_ota
 

Typedefs

using uic_ota::image_available_func_t = std::function< void(const meta_t &)>
 Callback function that is triggered when an new firmware image is detected on the image provider. More...
 
using uic_ota::image_ready_funct_t = std::function< void(const image_ready_result_t, const std::string &)>
 this callback is returned when the actually firmware image is downloaded and stored to disk, ready to be used for protocol controllers. More...
 

Enumerations

enum class  uic_ota::status_t {
  uic_ota::IDLE , uic_ota::DOWNLOAD_IN_PROGRESS , uic_ota::WAITING_TO_UPGRADE , uic_ota::WAITING_TO_UPGRADE_VIA_EXTERNAL_EVENT ,
  uic_ota::WAIT_FOR_MORE
}
 Structure used to indicate the firmware upload status. used in function ota::status_update. More...
 
enum class  uic_ota::last_error_t {
  uic_ota::SUCCESS = 0 , uic_ota::ABORT = 1 , uic_ota::NOT_AUTHORIZED = 2 , uic_ota::INVALID_IMAGE = 3 ,
  uic_ota::REQUIRE_MORE_IMAGE = 4 , uic_ota::NOT_SUPPORTED = 5
}
 Structure used to indicate the last error status. Used by protocol controllers to report firmware download status. More...
 
enum class  uic_ota::image_ready_result_t { uic_ota::OK , uic_ota::TIMED_OUT , uic_ota::ERROR }
 Result enum that describes if an image is ready for the caller to be used to donwload its clients. More...
 

Functions

sl_status_t uic_ota::init (const image_available_func_t &image_available_cb, const std::string &image_base_path, unsigned long int cache_size, uint32_t timeout_s, uint16_t cluster_revision=DEFAULT_CLUSTER_REVISION)
 initialize ota_listener More...
 
void uic_ota::subscribe_unid (const std::string &unid, const std::string &uiid)
 Listen for images that match the UNID + UIID pair/ when changes to this key is detected, image_ready will be called. More...
 
void uic_ota::unsubscribe_unid (const std::string &unid, const std::string &uiid)
 Stop watching specific images. More...
 
void uic_ota::unsubscribe_all_unids_uiid (const std::string &unid)
 Stop watching all images for unid and unretain MQTT messages. More...
 
void uic_ota::get_by_unid (const std::string &unid, const std::string &uiid, const image_ready_funct_t &get_ready_cb)
 After an image_available call is triggered. More...
 
void uic_ota::update_status (const dotdot_unid_t &unid, const dotdot_endpoint_id_t &endpoint, const ota_uiid_t &uiid, const status_t status)
 Status update of firmware upgrade OTA MQTT for the image_listener component specific for a UIID, UNID, and endpoint device. More...
 
void uic_ota::update_size (const dotdot_unid_t &unid, const dotdot_endpoint_id_t &endpoint, const ota_uiid_t &uiid, const size_t size_file)
 Size file of firmware upgrade OTA MQTT for the image_listener component specific for a UIID, UNID, and endpoint device. More...
 
void uic_ota::update_offset (const dotdot_unid_t &unid, const dotdot_endpoint_id_t &endpoint, const ota_uiid_t &uiid, const size_t offset)
 Offset update of firmware upgrade OTA MQTT for the image_listener component specific for a UIID, UNID and endpoint device. More...
 
void uic_ota::update_last_error (const dotdot_unid_t &unid, const dotdot_endpoint_id_t &endpoint, const ota_uiid_t &uiid, const last_error_t last_error)
 Last error update of firmware upgrade OTA MQTT for the image_listener component specific for a UIID, UNID, and endpoint device. More...
 
void uic_ota::update_apply_after (const dotdot_unid_t &unid, const dotdot_endpoint_id_t &endpoint, const ota_uiid_t &uiid, const time_t apply_after)
 Apply after update of firmware upgrade OTA MQTT for the image_listener component specific for a UIID, UNID, and endpoint device. More...
 
void uic_ota::update_current_version (const dotdot_unid_t &unid, const dotdot_endpoint_id_t &endpoint, const ota_uiid_t &uiid, const std::string &current_version)
 Current version update of firmware upgrade OTA MQTT for the image_listener component specific for a UIID, UNID, and endpoint device. More...
 
void uic_ota::update_target_version (const dotdot_unid_t &unid, const dotdot_endpoint_id_t &endpoint, const ota_uiid_t &uiid, const std::string &target_version)
 Target version update of firmware upgrade OTA MQTT for the image_listener component specific for a UIID, UNID, and endpoint device. More...
 
void uic_ota::clear_cache ()
 Utility function to clear the internal cache. More...
 
void uic_ota::unretain_ota_status ()
 Clean up MQTT status for UNIDs and endpoints. More...
 
void uic_ota::unretain_ota_status_by_unid (const dotdot_unid_t &unid)
 Clean up MQTT status for a UNID and related endpoints. More...
 

Variables

constexpr uint16_t DEFAULT_CLUSTER_REVISION = 1
 

Variable Documentation

◆ DEFAULT_CLUSTER_REVISION

constexpr uint16_t DEFAULT_CLUSTER_REVISION = 1
constexpr