Function anjay_advanced_fw_update_set_state_and_result
Defined in File advanced_fw_update.h
Function Documentation
-
int anjay_advanced_fw_update_set_state_and_result(anjay_t *anjay, anjay_iid_t iid, anjay_advanced_fw_update_state_t state, anjay_advanced_fw_update_result_t result)
Sets the Advanced Firmware Update object instance State to
stateand Result toresult, interrupting the update process.If the function fails, neither Update State nor Update Result are changed.
Some state transitions are disallowed and cause this function to fail:
ANJAY_ADVANCED_FW_UPDATE_RESULT_INITIAL and ANJAY_ADVANCED_FW_UPDATE_RESULT_UPDATE_CANCELLED are never allowed and cause this function to fail.
ANJAY_ADVANCED_FW_UPDATE_RESULT_SUCCESS is only allowed if the firmware application process was started by the server (an Execute operation was already performed on the Update resource of the Firmware Update object or ANJAY_ADVANCED_FW_UPDATE_STATE_UPDATING was used in a call to anjay_advanced_fw_update_instance_add). Otherwise, the function fails.
Other values of
result(various error codes) are only allowed if Advanced Firmware Update State is not Idle (0), i.e. firmware is being downloaded, was already downloaded or is being applied.
WARNING: calling this in anjay_advanced_fw_update_perform_upgrade_t handler is supported, but the result of using it from within any other of anjay_advanced_fw_update_handlers_t handlers is undefined.
- Parameters:
anjay – Anjay object to operate on.
iid – Instance ID of an Advanced Firmware Object.
state – Value of the State resource to set.
result – Value of the Update Result resource to set.
- Returns:
0 on success, or a negative value in case of error.