AWS IoT Over-the-air Update v3.4.0
Client library for AWS IoT OTA
 
Loading...
Searching...
No Matches
ota_os_interface.h
Go to the documentation of this file.
1/*
2 * AWS IoT Over-the-air Update v3.4.0
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * SPDX-License-Identifier: MIT
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
31#ifndef OTA_OS_INTERFACE_H
32#define OTA_OS_INTERFACE_H
33
34/* *INDENT-OFF* */
35#ifdef __cplusplus
36 extern "C" {
37#endif
38/* *INDENT-ON* */
39
40
79struct OtaEventContext;
80
84typedef struct OtaEventContext OtaEventContext_t;
85
89typedef enum
90{
91 OtaRequestTimer = 0,
92 OtaSelfTestTimer,
93 OtaNumOfTimers
95
100typedef enum OtaOsStatus
101{
113
124typedef OtaOsStatus_t ( * OtaInitEvent_t ) ( OtaEventContext_t * pEventCtx );
125
141 const void * pEventMsg,
142 unsigned int timeout );
143
159 void * pEventMsg,
160 uint32_t timeout );
161
174
185typedef void ( * OtaTimerCallback_t )( OtaTimerId_t otaTimerId );
186
203typedef OtaOsStatus_t ( * OtaStartTimer_t ) ( OtaTimerId_t otaTimerId,
204 const char * const pTimerName,
205 const uint32_t timeout,
206 OtaTimerCallback_t callback );
207
218typedef OtaOsStatus_t ( * OtaStopTimer_t ) ( OtaTimerId_t otaTimerId );
219
230typedef OtaOsStatus_t ( * OtaDeleteTimer_t ) ( OtaTimerId_t otaTimerId );
231
243typedef void * ( * OtaMalloc_t ) ( size_t size );
244
257typedef void ( * OtaFree_t ) ( void * ptr );
258
263typedef struct OtaEventInterface
264{
271
276typedef struct OtaTimerInterface
277{
280 #ifndef __cplusplus
282 #else
283 OtaDeleteTimer_t deleteTimer;
284 #endif
286
291typedef struct OtaMallocInterface
292{
293 /* MISRA Ref 21.3.2 [Use of free or malloc] */
294 /* More details at: https://github.com/aws/ota-for-aws-iot-embedded-sdk/blob/main/MISRA.md#rule-213 */
295 /* coverity[misra_c_2012_rule_21_3_violation] */
297 /* MISRA Ref 21.3.2 [Use of free or malloc] */
298 /* More details at: https://github.com/aws/ota-for-aws-iot-embedded-sdk/blob/main/MISRA.md#rule-213 */
299 /* coverity[misra_c_2012_rule_21_3_violation] */
302
307typedef struct OtaOSInterface
308{
313
314/* *INDENT-OFF* */
315#ifdef __cplusplus
316 }
317#endif
318/* *INDENT-ON* */
319
320#endif /* ifndef OTA_OS_INTERFACE_H */
OtaOsStatus_t
The OTA OS interface return status.
Definition: ota_os_interface.h:101
@ OtaOsEventQueueSendFailed
Posting event message to the event queue failed.
Definition: ota_os_interface.h:104
@ OtaOsTimerDeleteFailed
Failed to delete the timer.
Definition: ota_os_interface.h:111
@ OtaOsTimerCreateFailed
Failed to create the timer.
Definition: ota_os_interface.h:107
@ OtaOsEventQueueReceiveFailed
Failed to receive from the event queue.
Definition: ota_os_interface.h:105
@ OtaOsTimerStopFailed
Failed to stop the timer.
Definition: ota_os_interface.h:110
@ OtaOsEventQueueCreateFailed
Failed to create the event queue.
Definition: ota_os_interface.h:103
@ OtaOsTimerRestartFailed
Failed to restart the timer.
Definition: ota_os_interface.h:109
@ OtaOsSuccess
OTA OS interface success.
Definition: ota_os_interface.h:102
@ OtaOsTimerStartFailed
Failed to create the timer.
Definition: ota_os_interface.h:108
@ OtaOsEventQueueDeleteFailed
Failed to delete the event queue.
Definition: ota_os_interface.h:106
void(* OtaFree_t)(void *ptr)
Free memory.
Definition: ota_os_interface.h:257
OtaOsStatus_t(* OtaDeleteTimer_t)(OtaTimerId_t otaTimerId)
Delete a timer.
Definition: ota_os_interface.h:230
OtaOsStatus_t(* OtaStartTimer_t)(OtaTimerId_t otaTimerId, const char *const pTimerName, const uint32_t timeout, OtaTimerCallback_t callback)
Start timer.
Definition: ota_os_interface.h:203
struct OtaEventContext OtaEventContext_t
Type definition for Event Context.
Definition: ota_os_interface.h:84
void(* OtaTimerCallback_t)(OtaTimerId_t otaTimerId)
Timer callback.
Definition: ota_os_interface.h:185
void *(* OtaMalloc_t)(size_t size)
Allocate memory.
Definition: ota_os_interface.h:243
OtaOsStatus_t(* OtaDeinitEvent_t)(OtaEventContext_t *pEventCtx)
Deinitialize the OTA Events mechanism.
Definition: ota_os_interface.h:173
OtaOsStatus_t(* OtaSendEvent_t)(OtaEventContext_t *pEventCtx, const void *pEventMsg, unsigned int timeout)
Sends an OTA event.
Definition: ota_os_interface.h:140
OtaOsStatus_t(* OtaInitEvent_t)(OtaEventContext_t *pEventCtx)
Initialize the OTA events.
Definition: ota_os_interface.h:124
OtaOsStatus_t(* OtaReceiveEvent_t)(OtaEventContext_t *pEventCtx, void *pEventMsg, uint32_t timeout)
Receive an OTA event.
Definition: ota_os_interface.h:158
OtaOsStatus_t(* OtaStopTimer_t)(OtaTimerId_t otaTimerId)
Stop timer.
Definition: ota_os_interface.h:218
OtaTimerId_t
Enumeration for tracking multiple timers.
Definition: ota_os_interface.h:90
Definition: ota_os_interface.h:264
OtaSendEvent_t send
Send data.
Definition: ota_os_interface.h:266
OtaDeinitEvent_t deinit
Deinitialize event.
Definition: ota_os_interface.h:268
OtaEventContext_t * pEventContext
Event context to store event information.
Definition: ota_os_interface.h:269
OtaInitEvent_t init
Initialization event.
Definition: ota_os_interface.h:265
OtaReceiveEvent_t recv
Receive data.
Definition: ota_os_interface.h:267
OTA memory allocation interface.
Definition: ota_os_interface.h:292
OtaFree_t free
OTA memory deallocate interface.
Definition: ota_os_interface.h:300
OtaMalloc_t malloc
OTA memory allocate interface.
Definition: ota_os_interface.h:296
OTA OS Interface.
Definition: ota_os_interface.h:308
OtaMallocInterface_t mem
OTA memory interface.
Definition: ota_os_interface.h:311
OtaEventInterface_t event
OTA Event interface.
Definition: ota_os_interface.h:309
OtaTimerInterface_t timer
OTA Timer interface.
Definition: ota_os_interface.h:310
OTA Retry Timer Interface.
Definition: ota_os_interface.h:277
OtaStartTimer_t start
Timer start state.
Definition: ota_os_interface.h:278
OtaStopTimer_t stop
Timer stop state.
Definition: ota_os_interface.h:279