2 * Amazon FreeRTOS MQTT V2.0.0
\r
3 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://aws.amazon.com/freertos
\r
23 * http://www.FreeRTOS.org
\r
27 * @file iot_mqtt_agent_config_defaults.h
\r
28 * @brief MQTT agent default config options.
\r
30 * Ensures that the config options for MQTT agent are set to sensible
\r
31 * default values if the user does not provide one.
\r
34 #ifndef _AWS_MQTT_AGENT_CONFIG_DEFAULTS_H_
\r
35 #define _AWS_MQTT_AGENT_CONFIG_DEFAULTS_H_
\r
37 /* FreeRTOS includes. */
\r
38 #include "FreeRTOS.h"
\r
42 * @brief Controls whether or not to report usage metrics to the
\r
45 * If mqttconfigENABLE_METRICS is set to 1, a string containing
\r
46 * metric information will be included in the "username" field of
\r
47 * the MQTT connect messages.
\r
49 #ifndef mqttconfigENABLE_METRICS
\r
50 #define mqttconfigENABLE_METRICS ( 1 )
\r
54 * @brief The maximum time interval in seconds allowed to elapse between 2 consecutive
\r
57 #ifndef mqttconfigKEEP_ALIVE_INTERVAL_SECONDS
\r
58 #define mqttconfigKEEP_ALIVE_INTERVAL_SECONDS ( 1200 )
\r
62 * @brief Defines the frequency at which the client should send Keep Alive messages.
\r
64 * Even though the maximum time allowed between 2 consecutive control packets
\r
65 * is defined by the mqttconfigKEEP_ALIVE_INTERVAL_SECONDS macro, the user
\r
66 * can and should send Keep Alive messages at a slightly faster rate to ensure
\r
67 * that the connection is not closed by the server because of network delays.
\r
68 * This macro defines the interval of inactivity after which a keep alive messages
\r
71 #ifndef mqttconfigKEEP_ALIVE_ACTUAL_INTERVAL_TICKS
\r
72 #define mqttconfigKEEP_ALIVE_ACTUAL_INTERVAL_TICKS ( 5000 )
\r
76 * @brief The maximum interval in ticks to wait for PINGRESP.
\r
78 * If PINGRESP is not received within this much time after sending PINGREQ,
\r
79 * the client assumes that the PINGREQ timed out.
\r
81 #ifndef mqttconfigKEEP_ALIVE_TIMEOUT_TICKS
\r
82 #define mqttconfigKEEP_ALIVE_TIMEOUT_TICKS ( 1000 )
\r
86 * @brief The maximum time in ticks for which the MQTT task is permitted to block.
\r
88 * The MQTT task blocks until the user initiates any action or until it receives
\r
89 * any data from the broker. This macro controls the maximum time the MQTT task can
\r
90 * block. It should be set to a small number for the platforms which do not have any
\r
91 * mechanism to wake up the MQTT task whenever data is received on a connected socket.
\r
92 * This ensures that the MQTT task keeps waking up frequently and processes the publish
\r
93 * messages received from the broker, if any.
\r
95 * If the platform's secure_sockets layer supports SOCKETS_SO_WAKEUP_CALLBACK i.e.
\r
96 * the MQTT task can wake up whenever data is received on a connected socket, this
\r
97 * value should be set to maximum value:
\r
98 * #define #define mqttconfigMQTT_TASK_MAX_BLOCK_TICKS ( ~( ( uint32_t ) 0 ) )
\r
100 * If the platform's secure_sockets layer does not support SOCKETS_SO_WAKEUP_CALLBACK
\r
101 * i.e. the MQTT task cannot wake up whenever data is received on a connected socket,
\r
102 * this value should be set to a small number:
\r
103 * #define mqttconfigMQTT_TASK_MAX_BLOCK_TICKS ( 100 )
\r
105 #ifndef mqttconfigMQTT_TASK_MAX_BLOCK_TICKS
\r
106 #error "mqttconfigMQTT_TASK_MAX_BLOCK_TICKS must be defined in iot_mqtt_agent_config.h."
\r
110 * @defgroup MQTTTask MQTT task configuration parameters.
\r
113 #ifndef mqttconfigMQTT_TASK_STACK_DEPTH
\r
114 #define mqttconfigMQTT_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 4 )
\r
117 #ifndef mqttconfigMQTT_TASK_PRIORITY
\r
118 #define mqttconfigMQTT_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
123 * @brief Maximum number of MQTT clients that can exist simultaneously.
\r
125 #ifndef mqttconfigMAX_BROKERS
\r
126 #define mqttconfigMAX_BROKERS ( 1 )
\r
130 * @brief Maximum number of parallel operations per client.
\r
132 #ifndef mqttconfigMAX_PARALLEL_OPS
\r
133 #define mqttconfigMAX_PARALLEL_OPS ( 5 )
\r
137 * @brief Time in milliseconds after which the TCP send operation should timeout.
\r
139 #ifndef mqttconfigTCP_SEND_TIMEOUT_MS
\r
140 #define mqttconfigTCP_SEND_TIMEOUT_MS ( 2000 )
\r
144 * @brief Length of the buffer used to receive data.
\r
146 #ifndef mqttconfigRX_BUFFER_SIZE
\r
147 #define mqttconfigRX_BUFFER_SIZE ( 1024 )
\r
151 * @defgroup BufferPoolInterface The functions used by the MQTT client to get and return buffers.
\r
153 * The MQTT client needs buffers for both transmitting and receiving messages.
\r
154 * Whenever it needs a buffer, it invokes mqttconfigGET_FREE_BUFFER_FXN function to get
\r
155 * a buffer and after it is done it invokes mqttconfigRETURN_BUFFER_FXN to return the
\r
156 * buffer. By default, BUFFERPOOL_GetFreeBuffer and BUFFERPOOL_ReturnBuffer functions are
\r
157 * used to get and return buffers from the central buffer pool. The user can change the
\r
158 * buffer management functions for MQTT client by defining mqttconfigGET_FREE_BUFFER_FXN
\r
159 * and mqttconfigRETURN_BUFFER_FXN macros. The user should implement the two functions
\r
160 * having signatures same as BUFFERPOOL_GetFreeBuffer and BUFFERPOOL_ReturnBuffer and then
\r
161 * define the macros in BufferPoolConfig.h:
\r
163 * uint8_t* UserDefined_GetFreeBuffer( uint32_t *pulBufferLength );
\r
164 * void UserDefined_ReturnBuffer( uint8_t * const pucBuffer );
\r
166 * #define mqttconfigGET_FREE_BUFFER_FXN UserDefined_GetFreeBuffer
\r
167 * #define mqttconfigRETURN_BUFFER_FXN UserDefined_ReturnBuffer
\r
171 #ifndef mqttconfigGET_FREE_BUFFER_FXN
\r
172 #define mqttconfigGET_FREE_BUFFER_FXN BUFFERPOOL_GetFreeBuffer
\r
175 #ifndef mqttconfigRETURN_BUFFER_FXN
\r
176 #define mqttconfigRETURN_BUFFER_FXN BUFFERPOOL_ReturnBuffer
\r
180 #endif /* _AWS_MQTT_AGENT_CONFIG_DEFAULTS_H_ */
\r