Golioth Firmware SDK
Loading...
Searching...
No Matches
ota.h File Reference
#include <stdint.h>
#include <golioth/golioth_status.h>
#include <golioth/client.h>
#include <golioth/config.h>

Go to the source code of this file.

Data Structures

struct  golioth_ota_component
 A component/artifact within an OTA manifest. More...
 
struct  golioth_ota_manifest
 An OTA manifest, composed of multiple components/artifacts. More...
 

Macros

#define GOLIOTH_OTA_BLOCKSIZE   1024
 Maximum size of an OTA block, in bytes.
 
#define GOLIOTH_OTA_COMPONENT_HASH_LEN   64
 Size of a SHA256 of Artifact Binary in bytes.
 
#define GOLIOTH_OTA_MAX_COMPONENT_BOOTLOADER_NAME_LEN   7
 Maximum size of Binary Detected Type in bytes.
 
#define GOLIOTH_OTA_MAX_COMPONENT_URI_LEN    (CONFIG_GOLIOTH_OTA_MAX_PACKAGE_NAME_LEN + CONFIG_GOLIOTH_OTA_MAX_VERSION_LEN + 7)
 Maximum size of Relative URI to download binary (+ 7 bytes for Path)
 

Enumerations

enum  golioth_ota_state { GOLIOTH_OTA_STATE_IDLE , GOLIOTH_OTA_STATE_DOWNLOADING , GOLIOTH_OTA_STATE_DOWNLOADED , GOLIOTH_OTA_STATE_UPDATING }
 State of OTA update, reported to Golioth server. More...
 
enum  golioth_ota_reason {
  GOLIOTH_OTA_REASON_READY , GOLIOTH_OTA_REASON_FIRMWARE_UPDATED_SUCCESSFULLY , GOLIOTH_OTA_REASON_NOT_ENOUGH_FLASH_MEMORY , GOLIOTH_OTA_REASON_OUT_OF_RAM ,
  GOLIOTH_OTA_REASON_CONNECTION_LOST , GOLIOTH_OTA_REASON_INTEGRITY_CHECK_FAILURE , GOLIOTH_OTA_REASON_UNSUPPORTED_PACKAGE_TYPE , GOLIOTH_OTA_REASON_INVALID_URI ,
  GOLIOTH_OTA_REASON_FIRMWARE_UPDATE_FAILED , GOLIOTH_OTA_REASON_UNSUPPORTED_PROTOCOL
}
 A reason associated with state changes. More...
 

Functions

enum golioth_status golioth_ota_payload_as_manifest (const uint8_t *payload, size_t payload_size, struct golioth_ota_manifest *manifest)
 
size_t golioth_ota_size_to_nblocks (size_t component_size)
 Convert a size in bytes to the number of blocks required (of size up to GOLIOTH_OTA_BLOCKSIZE)
 
const struct golioth_ota_componentgolioth_ota_find_component (const struct golioth_ota_manifest *manifest, const char *package)
 
enum golioth_status golioth_ota_observe_manifest_async (struct golioth_client *client, golioth_get_cb_fn callback, void *arg)
 
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)
 
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_ota_state golioth_ota_get_state (void)