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 &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 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...
 

Typedef Documentation

◆ image_available_func_t

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.

Parameters
metameta information of the newly available image.

◆ image_ready_funct_t

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.

Enumeration Type Documentation

◆ image_ready_result_t

enum class uic_ota::image_ready_result_t
strong

Result enum that describes if an image is ready for the caller to be used to donwload its clients.

Enumerator
OK 

success

TIMED_OUT 
ERROR 

mqtt client error. the mqtt transport could not get images

◆ last_error_t

enum class uic_ota::last_error_t
strong

Structure used to indicate the last error status. Used by protocol controllers to report firmware download status.

Enumerator
SUCCESS 
ABORT 
NOT_AUTHORIZED 

no permission to download image

INVALID_IMAGE 
REQUIRE_MORE_IMAGE 
NOT_SUPPORTED 

◆ status_t

enum class uic_ota::status_t
strong

Structure used to indicate the firmware upload status. used in function ota::status_update.

Enumerator
IDLE 
DOWNLOAD_IN_PROGRESS 
WAITING_TO_UPGRADE 
WAITING_TO_UPGRADE_VIA_EXTERNAL_EVENT 
WAIT_FOR_MORE 

Function Documentation

◆ clear_cache()

void uic_ota::clear_cache ( )

Utility function to clear the internal cache.

◆ get_by_unid()

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.

Parameters
unidend-note id of image.
uiidunique image id.
get_ready_cbcallback providing a file to the image on disk.

◆ init()

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

Parameters
image_available_cbwill be called if there is new image information available for the subscribed nodes.
image_base_paththis path is used to download the images from the imageprovider to.
cache_sizespecify 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_sspecify the timeout before a get function returns with a result TIMEOUT,
cluster_revisionThe ClusterRevision value to advertise on MQTT publications. It will default to DEFAULT_CLUSTER_REVISION

◆ subscribe_unid()

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.

Parameters
unidend-note id.
uiidunique image id.

◆ unretain_ota_status()

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.

◆ unretain_ota_status_by_unid()

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.

◆ unsubscribe_all_unids_uiid()

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.

Parameters
unidend-note id.

◆ unsubscribe_unid()

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.

Parameters
unidend-note id.
uiidunique image id.

◆ update_apply_after()

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.

Parameters
unidend point.
uiidunique image id.
endpointendpoint of device.
apply_afterTime to apply after, MUST be in UTC time!

◆ update_current_version()

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.

Parameters
unidend point.
uiidunique image id.
endpointendpoint of device.
current_versionstring representing the current version of device.

◆ update_last_error()

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.

Parameters
unidend point.
uiidunique image id.
endpointendpoint of device.
last_errorerror information.

◆ update_offset()

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.

Parameters
unidend point.
uiidunique image id.
endpointendpoint of device.
offsetoffset from being done with the upgrade.

◆ update_size()

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.

Parameters
unidend point.
uiidunique image id.
endpointendpoint of device.
size_fileSize of file.

◆ update_status()

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.

Parameters
unidend point.
uiidunique image id.
endpointendpoint of device.
statusstatus of OTA.

◆ update_target_version()

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.

Parameters
unidend point.
uiidunique image id.
endpointendpoint of device.
target_versiondesired version of target.