anjay
|
#include <fw_update.h>
Handler callbacks that shall implement the platform-specific part of firmware update process.
The Firmware Update object logic may be in one of the following states:
ANJAY_FW_UPDATE_INITIAL_DOWNLOADED
or ANJAY_FW_UPDATE_INITIAL_DOWNLOADING
). The following handlers may be called in this state:stream_open
- shall open the download stream; moves the object into the Downloading stateget_security_config
- shall fill in security info that shall be used for a given URLreset
- shall free data allocated by get_security_config
, if it was called and there is anyANJAY_FW_UPDATE_INITIAL_DOWNLOADING
. In this state, the download stream is open and data may be transferred. The following handlers may be called in this state:stream_write
- shall write a chunk of data into the download stream; it normally does not change state - however, if it fails, it will be immediately followed by a call to reset
stream_finish
- shall close the download stream and perform integrity check on the downloaded image; if successful, this moves the object into the Downloaded state. If failed - into the Idle state; note that reset
will NOT be called in that casereset
- shall remove all downloaded data; moves the object into the Idle stateANJAY_FW_UPDATE_INITIAL_DOWNLOADED
. In this state, the firmware package has been downloaded and checked and is ready to be flashed. The following handlers may be called in this state:reset
- shall reset all downloaded data; moves the object into the Idle stateget_name
- shall return the package name, if availableget_version
- shall return the package version, if availableperform_upgrade
- shall perform the actual upgrade; if it fails, it does not cause a state change and may be called again; upon success, it may be treated as a transition to a "terminal" state, after which the device is expected to reboot anjay_fw_update_get_coap_tx_params_t* get_coap_tx_params |
Queries CoAP transmission parameters to be used during firmware update; anjay_fw_update_get_coap_tx_params_t
anjay_fw_update_get_name_t* get_name |
Returns the name of downloaded firmware package; anjay_fw_update_get_name_t
anjay_fw_update_get_security_config_t* get_security_config |
Queries security configuration that shall be used for an encrypted connection; anjay_fw_update_get_security_config_t
anjay_fw_update_get_tcp_request_timeout_t* get_tcp_request_timeout |
Queries request timeout to be used during firmware update over CoAP+TCP or HTTP; anjay_fw_update_get_tcp_request_timeout_t
anjay_fw_update_get_version_t* get_version |
Return the version of downloaded firmware package; anjay_fw_update_get_version_t
anjay_fw_update_perform_upgrade_t* perform_upgrade |
Performs the actual upgrade with previously downloaded package; anjay_fw_update_perform_upgrade_t
anjay_fw_update_reset_t* reset |
Resets the firmware update state and performs any applicable cleanup of temporary storage if necessary; anjay_fw_update_reset_t
anjay_fw_update_stream_finish_t* stream_finish |
Closes the download stream and prepares the firmware package to be flashed; anjay_fw_update_stream_finish_t
anjay_fw_update_stream_open_t* stream_open |
Opens the stream that will be used to write the firmware package to; anjay_fw_update_stream_open_t
anjay_fw_update_stream_write_t* stream_write |
Writes data to the download stream; anjay_fw_update_stream_write_t