Zigbee Protocol Controller 1.6.0
|
Classes | |
struct | meta_t |
Struct that describes meta for a new available image. More... | |
Typedefs | |
using | 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 | 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 | status_t { IDLE , DOWNLOAD_IN_PROGRESS , WAITING_TO_UPGRADE , WAITING_TO_UPGRADE_VIA_EXTERNAL_EVENT , WAIT_FOR_MORE } |
Structure used to indicate the firmware upload status. used in function ota::status_update . More... | |
enum class | last_error_t { SUCCESS = 0 , ABORT = 1 , NOT_AUTHORIZED = 2 , INVALID_IMAGE = 3 , REQUIRE_MORE_IMAGE = 4 , NOT_SUPPORTED = 5 } |
Structure used to indicate the last error status. Used by protocol controllers to report firmware download status. More... | |
enum class | image_ready_result_t { OK , TIMED_OUT , 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 | 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 | 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 | unsubscribe_unid (const std::string &unid, const std::string &uiid) |
Stop watching specific images. More... | |
void | unsubscribe_all_unids_uiid (const std::string &unid) |
Stop watching all images for unid and unretain MQTT messages. More... | |
void | 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 | 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 | 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 | 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 | 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 | 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 | update_current_version (const dotdot_unid_t &unid, const dotdot_endpoint_id_t &endpoint, const ota_uiid_t &uiid, const std::string ¤t_version) |
Current version update of firmware upgrade OTA MQTT for the image_listener component specific for a UIID, UNID, and endpoint device. More... | |
void | 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 | clear_cache () |
Utility function to clear the internal cache. More... | |
void | unretain_ota_status () |
Clean up MQTT status for UNIDs and endpoints. More... | |
void | unretain_ota_status_by_unid (const dotdot_unid_t &unid) |
Clean up MQTT status for a UNID and related endpoints. More... | |
using uic_ota::image_available_func_t = typedef std::function<void(const meta_t &)> |
Callback function that is triggered when an new firmware image is detected on the image provider.
meta | meta information of the newly available image. |
using uic_ota::image_ready_funct_t = typedef 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.
|
strong |
|
strong |
|
strong |
void uic_ota::clear_cache | ( | ) |
Utility function to clear the internal cache.
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.
The get function can be used to get the path to the actual fw image.
In this call the actual fw image will be retrieved from the imageprovider component.
unid | end-note id of image. |
uiid | unique image id. |
get_ready_cb | callback providing a file to the image on disk. |
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
image_available_cb | will be called if there is new image information available for the subscribed nodes. |
image_base_path | this path is used to download the images from the imageprovider to. |
cache_size | specify a limit of the internal cache size in bytes. note that the maximal image size is not allowed to be bigger as 256 MB. |
timeout_s | specify the timeout before a get function returns with a result TIMEOUT , |
cluster_revision | The ClusterRevision value to advertise on MQTT publications. It will default to DEFAULT_CLUSTER_REVISION |
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.
unid | end-note id. |
uiid | unique image id. |
void uic_ota::unretain_ota_status | ( | ) |
Clean up MQTT status for UNIDs and endpoints.
When importing this shared component this function should be used on shutdown of the protocol controller. This will clean up MQTT topics.
void uic_ota::unretain_ota_status_by_unid | ( | const dotdot_unid_t & | unid | ) |
Clean up MQTT status for a UNID and related endpoints.
This function should be used when a device or endpoint disconnects for cleaning up OTA statuses.
void uic_ota::unsubscribe_all_unids_uiid | ( | const std::string & | unid | ) |
Stop watching all images for unid and unretain MQTT messages.
Will unsubscribe on all image UIIDs and unretain all MQTT topics for the unid.
unid | end-note id. |
void uic_ota::unsubscribe_unid | ( | const std::string & | unid, |
const std::string & | uiid | ||
) |
Stop watching specific images.
Will stop watching specific UIID image and will NOT unretain MQTT topics.
unid | end-note id. |
uiid | unique image id. |
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.
Upgrading images is the responsibility of the protocol controller. Thus, this function are for the protocol controller to update it's state of the firmware upgrade.
unid | end point. |
uiid | unique image id. |
endpoint | endpoint of device. |
apply_after | Time to apply after, MUST be in UTC time! |
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.
Upgrading images is the responsibility of the protocol controller. Thus, this function are for the protocol controller to update it's state of the firmware upgrade.
unid | end point. |
uiid | unique image id. |
endpoint | endpoint of device. |
current_version | string representing the current version of device. |
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.
Upgrading images is the responsibility of the protocol controller. Thus, this function are for the protocol controller to update it's state of the firmware upgrade.
unid | end point. |
uiid | unique image id. |
endpoint | endpoint of device. |
last_error | error information. |
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.
Upgrading images is the responsibility of the protocol controller. Thus, this function are for the protocol controller to update it's state of the firmware upgrade.
unid | end point. |
uiid | unique image id. |
endpoint | endpoint of device. |
offset | offset from being done with the upgrade. |
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.
Upgrading images is the responsibility of the protocol controller. Thus, this function are for the protocol controller to update its state of the firmware upgrade.
unid | end point. |
uiid | unique image id. |
endpoint | endpoint of device. |
size_file | Size of file. |
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.
Upgrading images is the responsibility of the protocol controller. Thus, this function are for the protocol controller to update its state of the firmware upgrade.
unid | end point. |
uiid | unique image id. |
endpoint | endpoint of device. |
status | status of OTA. |
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.
Upgrading images is the responsibility of the protocol controller. Thus, this function are for the protocol controller to update it's state of the firmware upgrade.
unid | end point. |
uiid | unique image id. |
endpoint | endpoint of device. |
target_version | desired version of target. |