Golioth Firmware SDK
golioth_ota.h File Reference
#include <stdint.h>
#include "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_t
 A component/artifact within an OTA manifest. More...
 
struct  golioth_ota_manifest_t
 An OTA manifest, composed of multiple components/artifacts. More...
 

Macros

#define GOLIOTH_OTA_BLOCKSIZE   1024
 Maximum size of an OTA block, in bytes. More...
 

Enumerations

enum  golioth_ota_state_t { 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_t {
  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

golioth_status_t golioth_ota_payload_as_manifest (const uint8_t *payload, size_t payload_size, golioth_ota_manifest_t *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) More...
 
const golioth_ota_component_tgolioth_ota_find_component (const golioth_ota_manifest_t *manifest, const char *package)
 
golioth_status_t golioth_ota_observe_manifest_async (golioth_client_t client, golioth_get_cb_fn callback, void *arg)
 
golioth_status_t golioth_ota_get_block_sync (golioth_client_t 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_status_t golioth_ota_report_state_sync (golioth_client_t client, golioth_ota_state_t state, golioth_ota_reason_t reason, const char *package, const char *current_version, const char *target_version, int32_t timeout_s)
 
golioth_ota_state_t golioth_ota_get_state (void)