Golioth Zephyr SDK
SDK for development of Zephyr OS powered devices with Golioth
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 <net/golioth.h>
11 
20 };
21 
36 };
37 
43  char uri[64];
44  size_t uri_len;
45 };
46 
63 int golioth_fw_desired_parse(const uint8_t *payload, uint16_t payload_len,
64  uint8_t *version, size_t *version_len,
65  uint8_t *uri, size_t *uri_len);
66 
80  struct coap_reply *reply,
81  coap_reply_t desired_cb);
82 
99  struct golioth_fw_download_ctx *ctx,
100  const char *uri, size_t uri_len,
101  struct coap_reply *reply,
103 
118  const char *package_name,
119  const char *current_version,
120  const char *target_version,
121  enum golioth_fw_state state,
122  enum golioth_dfu_result result);
123 
124 #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_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.
int golioth_fw_download(struct golioth_client *client, struct golioth_fw_download_ctx *ctx, const char *uri, size_t uri_len, struct coap_reply *reply, golioth_blockwise_download_received_t received_cb)
Request firmware download from Golioth.
int golioth_fw_observe_desired(struct golioth_client *client, struct coap_reply *reply, coap_reply_t desired_cb)
Observe desired firmware.
golioth_fw_state
State of downloading or updating the firmware.
Definition: fw.h:15
@ GOLIOTH_FW_STATE_DOWNLOADED
Definition: fw.h:18
@ GOLIOTH_FW_STATE_IDLE
Definition: fw.h:16
@ GOLIOTH_FW_STATE_UPDATING
Definition: fw.h:19
@ GOLIOTH_FW_STATE_DOWNLOADING
Definition: fw.h:17
golioth_dfu_result
Result of downloading or updating the firmware.
Definition: fw.h:25
@ GOLIOTH_DFU_RESULT_INITIAL
Definition: fw.h:26
@ GOLIOTH_DFU_RESULT_CONNECTION_LOST
Definition: fw.h:30
@ GOLIOTH_DFU_RESULT_FIRMWARE_UPDATE_FAILED
Definition: fw.h:34
@ GOLIOTH_DFU_RESULT_NOT_ENOUGH_FLASH_MEMORY
Definition: fw.h:28
@ GOLIOTH_DFU_RESULT_UNSUPPORTED_PROTOCOL
Definition: fw.h:35
@ GOLIOTH_DFU_RESULT_UNSUPPORTED_PACKAGE_TYPE
Definition: fw.h:32
@ GOLIOTH_DFU_RESULT_FIRMWARE_UPDATED_SUCCESSFULLY
Definition: fw.h:27
@ GOLIOTH_DFU_RESULT_INTEGRITY_CHECK_FAILURE
Definition: fw.h:31
@ GOLIOTH_DFU_RESULT_OUT_OF_RAM
Definition: fw.h:29
@ GOLIOTH_DFU_RESULT_INVALID_URI
Definition: fw.h:33
int(* golioth_blockwise_download_received_t)(struct golioth_blockwise_download_ctx *ctx, const uint8_t *data, size_t offset, size_t len, bool last)
Type of the callback being called when a single block of data is received as part of CoAP response.
Definition: golioth.h:100
Represents blockwise download transfer from Golioth.
Definition: golioth.h:108
golioth_blockwise_download_received_t received_cb
Definition: golioth.h:113
struct coap_reply * reply
Definition: golioth.h:111
struct golioth_client * client
Definition: golioth.h:110
Represents a Golioth client instance.
Definition: golioth.h:48
Represents incoming firmware from Golioth.
Definition: fw.h:41
char uri[64]
Definition: fw.h:43
size_t uri_len
Definition: fw.h:44
struct golioth_blockwise_download_ctx blockwise_ctx
Definition: fw.h:42