1 /*
2  * Percepio DFM v2.1.0
3  * Copyright 2023 Percepio AB
4  * www.percepio.com
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 /**
10  * @file
11  *
12  * @brief DFM serial port Cloud port API
13  */
14 
15 #ifndef DFM_CLOUD_PORT_H
16 #define DFM_CLOUD_PORT_H
17 
18 #include <stdint.h>
19 #include <dfmTypes.h>
20 #include <dfmCloudPortConfig.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /**
27  * @defgroup dfm_cloud_port_aws_apis DFM serial port Cloud port API
28  * @ingroup dfm_apis
29  * @{
30  */
31 
32 /* This will allow DFM to attempt transfers in all situations, hardfaults included */
33 #define DFM_CLOUD_PORT_ALWAYS_ATTEMPT_TRANSFER
34 
35 
36 typedef struct{
37 	uint32_t startmarker;
38 	uint16_t keylen;
39 	uint16_t datalen;
40 } DfmSerialHeader_t;
41 
42 /**
43  * @brief Cloud port system data
44  */
45 typedef struct DfmCloudPortData
46 {
47 	char buf[80];
48 	char cKeyBuffer[DFM_CFG_CLOUD_PORT_MAX_TOPIC_SIZE];
49 	DfmSerialHeader_t xDfmSerialHeader;
50 } DfmCloudPortData_t;
51 
52 /**
53  * @brief Initialize Cloud port system
54  *
55  * @param[in] pxBuffer Cloud port system buffer.
56  *
57  * @retval DFM_FAIL Failure
58  * @retval DFM_SUCCESS Success
59  */
60 DfmResult_t xDfmCloudPortInitialize(DfmCloudPortData_t* pxBuffer);
61 
62 /**
63  * @brief Send Alert Entry
64  *
65  * @param[in] xEntryHandle Entry handle.
66  *
67  * @retval DFM_FAIL Failure
68  * @retval DFM_SUCCESS Success
69  */
70 DfmResult_t xDfmCloudPortSendAlert(DfmEntryHandle_t xEntryHandle);
71 
72 /**
73  * @brief Send Payload chunk Entry
74  *
75  * @param[in] xEntryHandle Entry handle.
76  *
77  * @retval DFM_FAIL Failure
78  * @retval DFM_SUCCESS Success
79  */
80 DfmResult_t xDfmCloudPortSendPayloadChunk(DfmEntryHandle_t xEntryHandle);
81 
82 /** @} */
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif
89