AWS IoT Over-the-air Update  v3.1.0
Client library for AWS IoT OTA
ota_interface_private.h
Go to the documentation of this file.
1 /*
2  * AWS IoT Over-the-air Update v3.1.0
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
28 #ifndef OTA_INTERFACE_PRIVATE_H
29 #define OTA_INTERFACE_PRIVATE_H
30 
31 /* *INDENT-OFF* */
32 #ifdef __cplusplus
33  extern "C" {
34 #endif
35 /* *INDENT-ON* */
36 
37 /* OTA includes. */
38 #include "ota.h"
39 #include "ota_private.h"
40 
41 /* General Constants. */
42 
43 /* OTA control protocol constants. */
44 #define OTA_CONTROL_OVER_MQTT 0x00000001
46 /* OTA data protocol constants. */
47 #define OTA_DATA_OVER_MQTT 0x00000001
48 #define OTA_DATA_OVER_HTTP 0x00000002
49 #define OTA_DATA_NUM_PROTOCOLS ( 2U )
58 typedef struct
59 {
60  OtaErr_t ( * requestJob )( OtaAgentContext_t * pAgentCtx );
61  OtaErr_t ( * updateJobStatus )( OtaAgentContext_t * pAgentCtx,
62  OtaJobStatus_t status,
63  int32_t reason,
64  int32_t subReason );
65  OtaErr_t ( * cleanup )( const OtaAgentContext_t * pAgentCtx );
67 
74 typedef struct
75 {
76  OtaErr_t ( * initFileTransfer )( OtaAgentContext_t * pAgentCtx );
77  OtaErr_t ( * requestFileBlock )( OtaAgentContext_t * pAgentCtx );
78  OtaErr_t ( * decodeFileBlock )( const uint8_t * pMessageBuffer,
79  size_t messageSize,
80  int32_t * pFileId,
81  int32_t * pBlockId,
82  int32_t * pBlockSize,
83  uint8_t ** pPayload,
84  size_t * pPayloadSize );
85  OtaErr_t ( * cleanup )( const OtaAgentContext_t * pAgentCtx );
87 
97 void setControlInterface( OtaControlInterface_t * pControlInterface );
98 
115  const uint8_t * pProtocol );
116 
117 /* *INDENT-OFF* */
118 #ifdef __cplusplus
119  }
120 #endif
121 /* *INDENT-ON* */
122 
123 #endif /* ifndef OTA_INTERFACE_PRIVATE_H */
OtaDataInterface_t
Represents the OTA data interface functions.
Definition: ota_interface_private.h:75
ota.h
OTA Agent Interface.
setDataInterface
OtaErr_t setDataInterface(OtaDataInterface_t *pDataInterface, const uint8_t *pProtocol)
Set the data interface used for OTA operations.
Definition: ota_interface.c:76
OtaErr_t
OtaErr_t
The OTA API return status. OTA agent error codes are in the upper 8 bits of the 32 bit OTA error word...
Definition: ota.h:79
OtaControlInterface_t
Represents the OTA control interface functions.
Definition: ota_interface_private.h:59
OtaAgentContext_t
The OTA agent is a singleton today. The structure keeps it nice and organized.
Definition: ota.h:294
ota_private.h
Macros, enums, variables, and definitions internal to the OTA Agent module and shared by other OTA mo...
setControlInterface
void setControlInterface(OtaControlInterface_t *pControlInterface)
Set control interface for OTA operations.
Definition: ota_interface.c:63
OtaJobStatus_t
OtaJobStatus_t
Gives the status of the job operation.
Definition: ota.h:183