Function anjay_fw_update_set_result
Defined in File fw_update.h
Function Documentation
-
int anjay_fw_update_set_result(anjay_t *anjay, anjay_fw_update_result_t result)
Sets the Firmware Update Result to
result, interrupting the update process.A successful call to this function always sets Update State to Idle (0). If the function fails, neither Update State nor Update Result are changed.
Some state transitions are disallowed and cause this function to fail:
ANJAY_FW_UPDATE_RESULT_INITIAL and ANJAY_FW_UPDATE_RESULT_UPDATE_CANCELLED are never allowed and cause this function to fail.
ANJAY_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_FW_UPDATE_INITIAL_UPDATING was used in a call to anjay_fw_update_install). Otherwise, the function fails.
Other values of
result(various error codes) are only allowed if 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_fw_update_perform_upgrade_t handler is supported, but the result of using it from within any other of anjay_fw_update_handlers_t handlers is undefined.
- Parameters:
anjay – Anjay object to operate on.
result – Value of the Update Result resource to set.
- Returns:
0 on success, or a negative value in case of error.