Mistake on this page? Email us
fota_component.h
1 // ----------------------------------------------------------------------------
2 // Copyright 2018-2020 ARM Ltd.
3 //
4 // SPDX-License-Identifier: Apache-2.0
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // ----------------------------------------------------------------------------
18 
19 #ifndef __FOTA_COMPONENT_H_
20 #define __FOTA_COMPONENT_H_
21 
22 #include "fota/fota_base.h"
23 
24 #if MBED_CLOUD_CLIENT_FOTA_ENABLE
25 
26 #include "fota/fota_component_defs.h"
27 #include "fota/fota_crypto_defs.h"
28 #include "fota/fota_candidate.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
43 typedef int (*fota_component_curr_fw_read)(uint8_t *buf, size_t offset, size_t size, size_t *num_read);
44 
51 typedef int (*fota_component_curr_fw_get_digest)(uint8_t *buf);
52 
58 typedef int (*fota_component_post_install_handler_t)(const char *new_sem_ver);
59 
71 typedef struct {
72  uint32_t install_alignment;
73  bool support_delta;
74  bool need_reboot;
75 #if !defined(TARGET_LIKE_LINUX)
76  fota_candidate_iterate_handler_t candidate_iterate_cb;
77 #endif
78  fota_component_post_install_handler_t component_post_install_cb;
79  fota_component_curr_fw_read curr_fw_read;
80  fota_component_curr_fw_get_digest curr_fw_get_digest;
82 
92 int fota_component_add(const fota_component_desc_info_t *comp_desc, const char *comp_name, const char *comp_semver);
93 
100 int fota_component_version_int_to_semver(fota_component_version_t version, char *sem_ver);
101 
102 
103 #if defined(TARGET_LIKE_LINUX)
104 
115 int fota_component_install_main(const char *candidate_file_name);
116 
117 #endif // defined(TARGET_LIKE_LINUX)
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif // MBED_CLOUD_CLIENT_FOTA_ENABLE
124 #endif // __FOTA_COMPONENT_H_
Definition: fota_component.h:71