Mistake on this page? Email us
fota_platform.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_PLATFORM_H_
20 #define __FOTA_PLATFORM_H_
21 
22 #include "fota/fota_base.h"
23 
24 #if MBED_CLOUD_CLIENT_FOTA_ENABLE
25 
26 #include "fota/fota_status.h"
27 #include "fota/fota_block_device.h"
28 #include "fota/fota_candidate.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 
35 #if defined(FOTA_CUSTOM_PLATFORM) && (FOTA_CUSTOM_PLATFORM)
36 
37 // Hooks that need to be supplied by platform specific code
38 
45 int fota_platform_init_hook(bool after_upgrade);
46 
53 int fota_platform_start_update_hook(const char *comp_name);
54 
61 int fota_platform_finish_update_hook(const char *comp_name);
62 
70 int fota_platform_abort_update_hook(const char *comp_name);
71 
72 #else
73 
74 // Default platform hooks
75 static inline int fota_platform_init_hook(bool after_upgrade)
76 {
77  return FOTA_STATUS_SUCCESS;
78 }
79 
80 static inline int fota_platform_start_update_hook(const char *comp_name)
81 {
82  return FOTA_STATUS_SUCCESS;
83 }
84 
85 static inline int fota_platform_finish_update_hook(const char *comp_name)
86 {
87  return FOTA_STATUS_SUCCESS;
88 }
89 
90 static inline int fota_platform_abort_update_hook(const char *comp_name)
91 {
92  return FOTA_STATUS_SUCCESS;
93 }
94 
95 #endif // !defined(FOTA_CUSTOM_PLATFORM) || (!FOTA_CUSTOM_PLATFORM)
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif // MBED_CLOUD_CLIENT_FOTA_ENABLE
102 #endif // __FOTA_PLATFORM_H_