AWS IoT Over-the-air Update  v3.0.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.0.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 /* OTA includes. */
32 #include "ota.h"
33 #include "ota_private.h"
34 
35 /* General Constants. */
36 
37 /* OTA control protocol constants. */
38 #define OTA_CONTROL_OVER_MQTT 0x00000001
40 /* OTA data protocol constants. */
41 #define OTA_DATA_OVER_MQTT 0x00000001
42 #define OTA_DATA_OVER_HTTP 0x00000002
43 #define OTA_DATA_NUM_PROTOCOLS ( 2U )
52 typedef struct
53 {
54  OtaErr_t ( * requestJob )( OtaAgentContext_t * pAgentCtx );
55  OtaErr_t ( * updateJobStatus )( OtaAgentContext_t * pAgentCtx,
56  OtaJobStatus_t status,
57  int32_t reason,
58  int32_t subReason );
59  OtaErr_t ( * cleanup )( const OtaAgentContext_t * pAgentCtx );
61 
68 typedef struct
69 {
70  OtaErr_t ( * initFileTransfer )( OtaAgentContext_t * pAgentCtx );
71  OtaErr_t ( * requestFileBlock )( OtaAgentContext_t * pAgentCtx );
72  OtaErr_t ( * decodeFileBlock )( const uint8_t * pMessageBuffer,
73  size_t messageSize,
74  int32_t * pFileId,
75  int32_t * pBlockId,
76  int32_t * pBlockSize,
77  uint8_t ** pPayload,
78  size_t * pPayloadSize );
79  OtaErr_t ( * cleanup )( const OtaAgentContext_t * pAgentCtx );
81 
91 void setControlInterface( OtaControlInterface_t * pControlInterface );
92 
109  const uint8_t * pProtocol );
110 
111 #endif /* ifndef OTA_INTERFACE_PRIVATE_H */
OtaDataInterface_t
Represents the OTA data interface functions.
Definition: ota_interface_private.h:69
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:73
OtaControlInterface_t
Represents the OTA control interface functions.
Definition: ota_interface_private.h:53
OtaAgentContext_t
The OTA agent is a singleton today. The structure keeps it nice and organized.
Definition: ota.h:290
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:177