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