Function anjay_advanced_fw_update_instance_add

Function Documentation

int anjay_advanced_fw_update_instance_add(anjay_t *anjay, anjay_iid_t iid, const char *component_name, const anjay_advanced_fw_update_handlers_t *handlers, void *user_arg, const anjay_advanced_fw_update_initial_state_t *initial_state)

Adds the Advanced Firmware Update object instance in an Advanced Firmware Update object.

The Advanced Firmware Update module does not require explicit cleanup; all resources will be automatically freed up during the call to anjay_delete.

Parameters:
  • anjay – Anjay object for which the Advanced Firmware Update Object is installed.

  • iid – Instance ID of an Advanced Firmware Object.

  • component_name – Pointer to null-terminated component name string. Note: String is NOT copied, so it needs to remain valid for the lifetime of the object instance.

  • handlers – Pointer to a set of handler functions that handle the platform-specific part of firmware update process. Note: Contents of the structure are NOT copied, so it needs to remain valid for the lifetime of the object instance.

  • user_arg – Opaque user pointer that will be passed as the first argument to handler functions.

  • initial_state – Information about the state to initialize the Advanced Firmware Update object instance in. It is intended to be used after either an orderly reboot caused by a firmware update attempt to report the update result, or by an unexpected reboot in the middle of the download process. If the object shall be initialized in a neutral initial state, NULL might be passed.

Returns:

0 on success, or a negative value in case of error.