26#define GOLIOTH_OTA_COMPONENT_HEX_HASH_LEN 64
28#define GOLIOTH_OTA_COMPONENT_BIN_HASH_LEN 32
30#define GOLIOTH_OTA_MAX_COMPONENT_BOOTLOADER_NAME_LEN 7
32#define GOLIOTH_OTA_MAX_COMPONENT_URI_LEN \
33 (CONFIG_GOLIOTH_OTA_MAX_PACKAGE_NAME_LEN + CONFIG_GOLIOTH_OTA_MAX_VERSION_LEN + 7)
159 uint8_t *block_buffer,
160 size_t block_buffer_len,
162 size_t negotiated_block_size,
230 size_t *block_nbytes,
253 const char *current_version,
254 const char *target_version,
#define CONFIG_GOLIOTH_OTA_MAX_VERSION_LEN
#define CONFIG_GOLIOTH_OTA_MAX_NUM_COMPONENTS
#define CONFIG_GOLIOTH_OTA_MAX_PACKAGE_NAME_LEN
void(* golioth_get_cb_fn)(struct golioth_client *client, enum golioth_status status, const struct golioth_coap_rsp_code *coap_rsp_code, const char *path, const uint8_t *payload, size_t payload_size, void *arg)
#define GOLIOTH_OTA_MAX_COMPONENT_BOOTLOADER_NAME_LEN
Maximum size of Binary Detected Type in bytes.
enum golioth_status golioth_ota_report_state_sync(struct golioth_client *client, enum golioth_ota_state state, enum golioth_ota_reason reason, const char *package, const char *current_version, const char *target_version, int32_t timeout_s)
enum golioth_status golioth_ota_download_component(struct golioth_client *client, const struct golioth_ota_component *component, uint32_t *block_idx, ota_component_block_write_cb cb, void *arg)
enum golioth_ota_state golioth_ota_get_state(void)
enum golioth_status golioth_ota_observe_manifest_async(struct golioth_client *client, golioth_get_cb_fn callback, void *arg)
size_t golioth_ota_size_to_nblocks(size_t component_size)
enum golioth_status(* ota_component_block_write_cb)(const struct golioth_ota_component *component, uint32_t block_idx, uint8_t *block_buffer, size_t block_buffer_len, bool is_last, size_t negotiated_block_size, void *arg)
#define GOLIOTH_OTA_MAX_COMPONENT_URI_LEN
Maximum size of Relative URI to download binary (+ 7 bytes for Path)
const struct golioth_ota_component * golioth_ota_find_component(const struct golioth_ota_manifest *manifest, const char *package)
golioth_ota_state
State of OTA update, reported to Golioth server.
#define GOLIOTH_OTA_COMPONENT_BIN_HASH_LEN
Size of a SHA256 of Artifact bin array in bytes.
enum golioth_status golioth_ota_payload_as_manifest(const uint8_t *payload, size_t payload_size, struct golioth_ota_manifest *manifest)
enum golioth_status golioth_ota_get_block_sync(struct golioth_client *client, const char *package, const char *version, size_t block_index, uint8_t *buf, size_t *block_nbytes, bool *is_last, int32_t timeout_s)
golioth_ota_reason
A reason associated with state changes.
@ GOLIOTH_OTA_STATE_DOWNLOADED
OTA has been downloaded and written to flash.
@ GOLIOTH_OTA_STATE_IDLE
No OTA update in progress.
@ GOLIOTH_OTA_STATE_UPDATING
OTA is being applied to the system, but is not yet complete.
@ GOLIOTH_OTA_STATE_DOWNLOADING
OTA is being downloaded and written to flash.
@ GOLIOTH_OTA_REASON_IO
IO error while trying to store component.
@ GOLIOTH_OTA_REASON_FIRMWARE_UPDATE_FAILED
Firmware update was not successful.
@ GOLIOTH_OTA_REASON_OUT_OF_RAM
Insufficient RAM on device.
@ GOLIOTH_OTA_REASON_INVALID_URI
URI not valid.
@ GOLIOTH_OTA_REASON_CONNECTION_LOST
Lost connection to server during OTA update.
@ GOLIOTH_OTA_REASON_UNSUPPORTED_PROTOCOL
Protocol not supported.
@ GOLIOTH_OTA_REASON_NOT_ENOUGH_FLASH_MEMORY
Insufficient flash memory on device.
@ GOLIOTH_OTA_REASON_READY
OTA update is ready to go. Also used for "no reason".
@ GOLIOTH_OTA_REASON_FIRMWARE_UPDATED_SUCCESSFULLY
Firmware update was successful.
@ GOLIOTH_OTA_REASON_INTEGRITY_CHECK_FAILURE
Data integrity check of downloaded artifact failed.
@ GOLIOTH_OTA_REASON_UNSUPPORTED_PACKAGE_TYPE
Package type not supported.
@ GOLIOTH_OTA_REASON_AWAIT_RETRY
Awaiting retry.
A component/artifact within an OTA manifest.
char bootloader[GOLIOTH_OTA_MAX_COMPONENT_BOOTLOADER_NAME_LEN+1]
Artifact bootloader ("mcuboot" or "default"")
uint8_t hash[GOLIOTH_OTA_COMPONENT_BIN_HASH_LEN]
Artifact Hash.
char uri[GOLIOTH_OTA_MAX_COMPONENT_URI_LEN+1]
char version[CONFIG_GOLIOTH_OTA_MAX_VERSION_LEN+1]
Artifact version (e.g. "1.0.0")
int32_t size
Size of the artifact, in bytes.
char package[CONFIG_GOLIOTH_OTA_MAX_PACKAGE_NAME_LEN+1]
Artifact package name (e.g. "main")
An OTA manifest, composed of multiple components/artifacts.
struct golioth_ota_component components[CONFIG_GOLIOTH_OTA_MAX_NUM_COMPONENTS]
An array of artifacts.
int32_t seqnum
OTA release sequence number.
size_t num_components
Number of artifacts.