Golioth Zephyr SDK
fw.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Golioth, Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef GOLIOTH_INCLUDE_NET_GOLIOTH_FW_H_
8 #define GOLIOTH_INCLUDE_NET_GOLIOTH_FW_H_
9 
10 #include <stddef.h>
11 #include <stdint.h>
12 #include <net/golioth/req.h>
13 
14 struct golioth_client;
15 
24 };
25 
40 };
41 
58 int golioth_fw_desired_parse(const uint8_t *payload, uint16_t payload_len,
59  uint8_t *version, size_t *version_len,
60  uint8_t *uri, size_t *uri_len);
61 
73  golioth_req_cb_t cb, void *user_data);
74 
88  const uint8_t *uri, size_t uri_len,
89  golioth_req_cb_t cb, void *user_data);
90 
111  const char *package_name,
112  const char *current_version,
113  const char *target_version,
114  enum golioth_fw_state state,
115  enum golioth_dfu_result result,
116  golioth_req_cb_t cb,
117  void *user_data);
118 
133  const char *package_name,
134  const char *current_version,
135  const char *target_version,
136  enum golioth_fw_state state,
137  enum golioth_dfu_result result);
138 
139 #endif /* GOLIOTH_INCLUDE_NET_GOLIOTH_FW_H_ */
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.
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)
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.
golioth_fw_state
State of downloading or updating the firmware.
Definition: fw.h:19
@ GOLIOTH_FW_STATE_DOWNLOADED
Definition: fw.h:22
@ GOLIOTH_FW_STATE_IDLE
Definition: fw.h:20
@ GOLIOTH_FW_STATE_UPDATING
Definition: fw.h:23
@ GOLIOTH_FW_STATE_DOWNLOADING
Definition: fw.h:21
golioth_dfu_result
Result of downloading or updating the firmware.
Definition: fw.h:29
@ GOLIOTH_DFU_RESULT_INITIAL
Definition: fw.h:30
@ GOLIOTH_DFU_RESULT_CONNECTION_LOST
Definition: fw.h:34
@ GOLIOTH_DFU_RESULT_FIRMWARE_UPDATE_FAILED
Definition: fw.h:38
@ GOLIOTH_DFU_RESULT_NOT_ENOUGH_FLASH_MEMORY
Definition: fw.h:32
@ GOLIOTH_DFU_RESULT_UNSUPPORTED_PROTOCOL
Definition: fw.h:39
@ GOLIOTH_DFU_RESULT_UNSUPPORTED_PACKAGE_TYPE
Definition: fw.h:36
@ GOLIOTH_DFU_RESULT_FIRMWARE_UPDATED_SUCCESSFULLY
Definition: fw.h:31
@ GOLIOTH_DFU_RESULT_INTEGRITY_CHECK_FAILURE
Definition: fw.h:35
@ GOLIOTH_DFU_RESULT_OUT_OF_RAM
Definition: fw.h:33
@ GOLIOTH_DFU_RESULT_INVALID_URI
Definition: fw.h:37
int golioth_fw_observe_desired(struct golioth_client *client, golioth_req_cb_t cb, void *user_data)
Observe desired firmware.
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.
int(* golioth_req_cb_t)(struct golioth_req_rsp *rsp)
User callback for handling valid response from server or error condition.
Definition: req.h:51
Represents a Golioth client instance.
Definition: net/golioth.h:50