Golioth Firmware SDK
Loading...
Searching...
No Matches
fw_update.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Golioth, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifdef __cplusplus
8extern "C"
9{
10#endif
11
12#pragma once
13
14#include <golioth/client.h>
15#include <golioth/ota.h>
16#include <stdbool.h>
17
18#define GOLIOTH_FW_UPDATE_DEFAULT_PACKAGE_NAME "main"
19
21{
23 const char *current_version;
26 const char *fw_package_name;
27};
28
34
51void golioth_fw_update_init(struct golioth_client *client, const char *current_version);
52
57void golioth_fw_update_init_with_config(struct golioth_client *client,
58 const struct golioth_fw_update_config *config);
59
66 enum golioth_ota_reason reason,
67 void *user_arg);
68
78 void *user_arg);
79
80//---------------------------------------------------------------------------
81// Backend API for firmware updates. Required to be implemented by port.
82// Not intended to be called by user code.
83//---------------------------------------------------------------------------
84
88
91
97
102
113enum golioth_status fw_update_handle_block(const uint8_t *block,
114 size_t block_size,
115 size_t offset,
116 size_t total_size);
117
131 size_t bufsize,
132 size_t offset);
133
139
149
156
161void fw_update_end(void);
162//---------------------------------------------------------------------------
163
165
166#ifdef __cplusplus
167}
168#endif
golioth_status
enum golioth_status fw_update_validate(void)
void fw_update_rollback(void)
Initiate a firmware rollback.
void fw_update_post_download(void)
void golioth_fw_update_init_with_config(struct golioth_client *client, const struct golioth_fw_update_config *config)
void(* golioth_fw_update_state_change_callback)(enum golioth_ota_state state, enum golioth_ota_reason reason, void *user_arg)
Definition fw_update.h:65
void golioth_fw_update_register_state_change_callback(golioth_fw_update_state_change_callback callback, void *user_arg)
enum golioth_status fw_update_handle_block(const uint8_t *block, size_t block_size, size_t offset, size_t total_size)
enum golioth_status fw_update_read_current_image_at_offset(uint8_t *buf, size_t bufsize, size_t offset)
void fw_update_end(void)
void fw_update_cancel_rollback(void)
bool fw_update_is_pending_verify(void)
void fw_update_reboot(void)
void golioth_fw_update_init(struct golioth_client *client, const char *current_version)
enum golioth_status fw_update_change_boot_image(void)
golioth_ota_state
State of OTA update, reported to Golioth server.
Definition ota.h:37
golioth_ota_reason
A reason associated with state changes.
Definition ota.h:50
const char * fw_package_name
Definition fw_update.h:26
const char * current_version
The current firmware version, NULL-terminated, shallow-copied from user. (e.g. "1....
Definition fw_update.h:23