Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hawkbit.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Linumiz
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
13#ifndef ZEPHYR_INCLUDE_MGMT_HAWKBIT_H_
14#define ZEPHYR_INCLUDE_MGMT_HAWKBIT_H_
15
17
18#define HAWKBIT_JSON_URL "/default/controller/v1"
19
41
54
66typedef int (*hawkbit_config_device_data_cb_handler_t)(const char *device_id, uint8_t *buffer,
67 const size_t buffer_size);
68
81
88int hawkbit_init(void);
89
97
114
118void hawkbit_reboot(void);
119
126typedef bool (*hawkbit_get_device_identity_cb_handler_t)(char *id, int id_max_len);
127
139
148
155
163static inline int hawkbit_set_server_addr(char *addr_str)
164{
165 struct hawkbit_runtime_config set_config = {
166 .server_addr = addr_str, .server_port = 0, .auth_token = NULL, .tls_tag = 0};
167
168 return hawkbit_set_config(&set_config);
169}
170
178static inline int hawkbit_set_server_port(uint16_t port)
179{
180 struct hawkbit_runtime_config set_config = {
181 .server_addr = NULL, .server_port = port, .auth_token = NULL, .tls_tag = 0};
182
183 return hawkbit_set_config(&set_config);
184}
185
193static inline int hawkbit_set_ddi_security_token(char *token)
194{
195 struct hawkbit_runtime_config set_config = {
196 .server_addr = NULL, .server_port = 0, .auth_token = token, .tls_tag = 0};
197
198 return hawkbit_set_config(&set_config);
199}
200
209{
210 struct hawkbit_runtime_config set_config = {
211 .server_addr = NULL, .server_port = 0, .auth_token = NULL, .tls_tag = tag};
212
213 return hawkbit_set_config(&set_config);
214}
215
221static inline char *hawkbit_get_server_addr(void)
222{
224}
225
232{
234}
235
241static inline char *hawkbit_get_ddi_security_token(void)
242{
244}
245
252{
254}
255
263
275
280#endif /* _HAWKBIT_H_ */
void hawkbit_reboot(void)
Request system to reboot.
int32_t hawkbit_get_action_id(void)
Get the hawkBit action id.
int hawkbit_init(void)
Init the flash partition.
bool(* hawkbit_get_device_identity_cb_handler_t)(char *id, int id_max_len)
Callback to get the device identity.
Definition hawkbit.h:126
int hawkbit_reset_action_id(void)
Resets the hawkBit action id, that is saved in settings.
int(* hawkbit_config_device_data_cb_handler_t)(const char *device_id, uint8_t *buffer, const size_t buffer_size)
Callback to provide the custom data to the hawkBit server.
Definition hawkbit.h:66
static uint16_t hawkbit_get_server_port(void)
Get the hawkBit server port.
Definition hawkbit.h:231
int hawkbit_set_device_identity_cb(hawkbit_get_device_identity_cb_handler_t cb)
Set the device identity callback.
enum hawkbit_response hawkbit_probe(void)
The hawkBit probe verify if there is some update to be performed.
static int hawkbit_set_tls_tag(sec_tag_t tag)
Set the hawkBit TLS tag.
Definition hawkbit.h:208
int hawkbit_set_config(struct hawkbit_runtime_config *config)
Set the hawkBit server configuration settings.
static sec_tag_t hawkbit_get_tls_tag(void)
Get the hawkBit TLS tag.
Definition hawkbit.h:251
static int hawkbit_set_server_port(uint16_t port)
Set the hawkBit server port.
Definition hawkbit.h:178
hawkbit_response
Response message from hawkBit.
Definition hawkbit.h:28
static int hawkbit_set_ddi_security_token(char *token)
Set the hawkBit security token.
Definition hawkbit.h:193
static int hawkbit_set_server_addr(char *addr_str)
Set the hawkBit server address.
Definition hawkbit.h:163
struct hawkbit_runtime_config hawkbit_get_config(void)
Get the hawkBit server configuration settings.
void hawkbit_autohandler(void)
Runs hawkBit probe and hawkBit update automatically.
static char * hawkbit_get_server_addr(void)
Get the hawkBit server address.
Definition hawkbit.h:221
int hawkbit_set_custom_data_cb(hawkbit_config_device_data_cb_handler_t cb)
Set the custom data callback.
static char * hawkbit_get_ddi_security_token(void)
Get the hawkBit security token.
Definition hawkbit.h:241
@ HAWKBIT_PERMISSION_ERROR
Definition hawkbit.h:31
@ HAWKBIT_PROBE_IN_PROGRESS
Definition hawkbit.h:39
@ HAWKBIT_METADATA_ERROR
Definition hawkbit.h:32
@ HAWKBIT_NETWORKING_ERROR
Definition hawkbit.h:29
@ HAWKBIT_OK
Definition hawkbit.h:34
@ HAWKBIT_CANCEL_UPDATE
Definition hawkbit.h:37
@ HAWKBIT_UPDATE_INSTALLED
Definition hawkbit.h:35
@ HAWKBIT_NOT_INITIALIZED
Definition hawkbit.h:38
@ HAWKBIT_NO_UPDATE
Definition hawkbit.h:36
@ HAWKBIT_UNCONFIRMED_IMAGE
Definition hawkbit.h:30
@ HAWKBIT_DOWNLOAD_ERROR
Definition hawkbit.h:33
int sec_tag_t
Secure tag, a reference to TLS credential.
Definition tls_credentials.h:72
#define bool
Definition stdbool.h:13
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
hawkBit configuration structure.
Definition hawkbit.h:48
sec_tag_t tls_tag
Definition hawkbit.h:52
uint16_t server_port
Definition hawkbit.h:50
char * auth_token
Definition hawkbit.h:51
char * server_addr
Definition hawkbit.h:49
static ZTEST_BMEM char buffer[8]
Definition test_mbox_api.c:433
static const char * tag(void)
Definition main.c:27
TLS credentials management.