forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhawkbit.h
68 lines (60 loc) · 1.62 KB
/
hawkbit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright (c) 2020 Linumiz
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @brief Hawkbit Firmware Over-the-Air for Zephyr Project.
* @defgroup hawkbit Hawkbit Firmware Over-the-Air
* @ingroup lib
* @{
*/
#ifndef ZEPHYR_INCLUDE_MGMT_HAWKBIT_H_
#define ZEPHYR_INCLUDE_MGMT_HAWKBIT_H_
#define HAWKBIT_JSON_URL "/default/controller/v1"
/**
* @brief Response message from Hawkbit.
*
* @details These messages are used to inform the server and the
* user about the process status of the Hawkbit and also
* used to standardize the errors that may occur.
*
*/
enum hawkbit_response {
HAWKBIT_NETWORKING_ERROR,
HAWKBIT_UNCONFIRMED_IMAGE,
HAWKBIT_METADATA_ERROR,
HAWKBIT_DOWNLOAD_ERROR,
HAWKBIT_OK,
HAWKBIT_UPDATE_INSTALLED,
HAWKBIT_NO_UPDATE,
HAWKBIT_CANCEL_UPDATE,
};
/**
* @brief Init the flash partition
*
* @return 0 on success, negative on error.
*/
int hawkbit_init(void);
/**
* @brief Runs Hawkbit probe and Hawkbit update automatically
*
* @details The hawkbit_autohandler handles the whole process
* in pre-determined time intervals.
*/
void hawkbit_autohandler(void);
/**
* @brief The Hawkbit probe verify if there is some update to be performed.
*
* @return HAWKBIT_UPDATE_INSTALLED has an update available.
* @return HAWKBIT_NO_UPDATE no update available.
* @return HAWKBIT_NETWORKING_ERROR fail to connect to the Hawkbit server.
* @return HAWKBIT_METADATA_ERROR fail to parse or to encode the metadata.
* @return HAWKBIT_OK if success.
* @return HAWKBIT_DOWNLOAD_ERROR faile while downloading the update package.
*/
enum hawkbit_response hawkbit_probe(void);
/**
* @}
*/
#endif /* _HAWKBIT_H_ */