#include <stddef.h>
#include <stdint.h>
#include <net/golioth/req.h>
Go to the source code of this file.
|
enum | golioth_fw_state { GOLIOTH_FW_STATE_IDLE = 0
, GOLIOTH_FW_STATE_DOWNLOADING = 1
, GOLIOTH_FW_STATE_DOWNLOADED = 2
, GOLIOTH_FW_STATE_UPDATING = 3
} |
| State of downloading or updating the firmware. More...
|
|
enum | golioth_dfu_result {
GOLIOTH_DFU_RESULT_INITIAL = 0
, GOLIOTH_DFU_RESULT_FIRMWARE_UPDATED_SUCCESSFULLY
, GOLIOTH_DFU_RESULT_NOT_ENOUGH_FLASH_MEMORY
, GOLIOTH_DFU_RESULT_OUT_OF_RAM
,
GOLIOTH_DFU_RESULT_CONNECTION_LOST
, GOLIOTH_DFU_RESULT_INTEGRITY_CHECK_FAILURE
, GOLIOTH_DFU_RESULT_UNSUPPORTED_PACKAGE_TYPE
, GOLIOTH_DFU_RESULT_INVALID_URI
,
GOLIOTH_DFU_RESULT_FIRMWARE_UPDATE_FAILED
, GOLIOTH_DFU_RESULT_UNSUPPORTED_PROTOCOL
} |
| Result of downloading or updating the firmware. More...
|
|
|
int | golioth_fw_desired_parse (const uint8_t *payload, uint16_t payload_len, uint8_t *version, size_t *version_len, uint8_t *uri, size_t *uri_len) |
| Parse desired firmware description. More...
|
|
int | golioth_fw_observe_desired (struct golioth_client *client, golioth_req_cb_t cb, void *user_data) |
| Observe desired firmware. More...
|
|
int | golioth_fw_download (struct golioth_client *client, const uint8_t *uri, size_t uri_len, golioth_req_cb_t cb, void *user_data) |
| Request firmware download from Golioth. More...
|
|
int | golioth_fw_report_state_cb (struct golioth_client *client, const char *package_name, const char *current_version, const char *target_version, enum golioth_fw_state state, enum golioth_dfu_result result, golioth_req_cb_t cb, void *user_data) |
| Report state of firmware (callback based) More...
|
|
int | golioth_fw_report_state (struct golioth_client *client, const char *package_name, const char *current_version, const char *target_version, enum golioth_fw_state state, enum golioth_dfu_result result) |
| Report state of firmware. More...
|
|
◆ golioth_dfu_result
Result of downloading or updating the firmware.
Enumerator |
---|
GOLIOTH_DFU_RESULT_INITIAL | |
GOLIOTH_DFU_RESULT_FIRMWARE_UPDATED_SUCCESSFULLY | |
GOLIOTH_DFU_RESULT_NOT_ENOUGH_FLASH_MEMORY | |
GOLIOTH_DFU_RESULT_OUT_OF_RAM | |
GOLIOTH_DFU_RESULT_CONNECTION_LOST | |
GOLIOTH_DFU_RESULT_INTEGRITY_CHECK_FAILURE | |
GOLIOTH_DFU_RESULT_UNSUPPORTED_PACKAGE_TYPE | |
GOLIOTH_DFU_RESULT_INVALID_URI | |
GOLIOTH_DFU_RESULT_FIRMWARE_UPDATE_FAILED | |
GOLIOTH_DFU_RESULT_UNSUPPORTED_PROTOCOL | |
Definition at line 29 of file fw.h.
◆ golioth_fw_state
State of downloading or updating the firmware.
Enumerator |
---|
GOLIOTH_FW_STATE_IDLE | |
GOLIOTH_FW_STATE_DOWNLOADING | |
GOLIOTH_FW_STATE_DOWNLOADED | |
GOLIOTH_FW_STATE_UPDATING | |
Definition at line 19 of file fw.h.
◆ golioth_fw_desired_parse()
int golioth_fw_desired_parse |
( |
const uint8_t * |
payload, |
|
|
uint16_t |
payload_len, |
|
|
uint8_t * |
version, |
|
|
size_t * |
version_len, |
|
|
uint8_t * |
uri, |
|
|
size_t * |
uri_len |
|
) |
| |
Parse desired firmware description.
- Parameters
-
payload | Pointer to CBOR encoded 'desired' description |
payload_len | Length of CBOR encoded 'desired' description |
version | Pointer to version string, which will be updated by this function |
version_len | On input pointer to available space in version string, on output actual length of version string |
uri | URI of the image, which will be updated by this function |
uri_len | On input pointer to available space in URI string, on output actual length of URI string |
- Return values
-
◆ golioth_fw_download()
Request firmware download from Golioth.
- Parameters
-
client | Client instance |
uri | Pointer to URI string |
uri_len | Length of URI string |
cb | Callback executed on response received, timeout or error |
user_data | User data passed to cb with each invocation |
- Return values
-
◆ golioth_fw_observe_desired()
Observe desired firmware.
- Parameters
-
client | Client instance |
cb | Callback executed on response received, timeout or error |
user_data | User data passed to cb |
- Return values
-
◆ golioth_fw_report_state()
Report state of firmware.
- Parameters
-
client | Client instance |
package_name | Package name of firmware |
current_version | Current firmware version |
target_version | Target firmware version |
state | State of firmware |
result | Result of downloading or updating firmware |
- Return values
-
◆ golioth_fw_report_state_cb()
Report state of firmware (callback based)
Asynchronously push firmware state information to Golioth
- Warning
- Experimental API
- Parameters
-
client | Client instance |
package_name | Package name of firmware |
current_version | Current firmware version |
target_version | Target firmware version |
state | State of firmware |
result | Result of downloading or updating firmware |
cb | Callback executed on response received, timeout or error |
user_data | User data passed to cb |
- Return values
-