From eeb8dc9c35302e969424097464532d40d9b87ed5 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 20 Jul 2017 15:28:29 +1000 Subject: [PATCH] aws_iot: Expose common SDK compile-time configuration in menuconfig Closes https://github.com/espressif/esp-idf/issues/637 --- components/aws_iot/Kconfig | 53 +++++++++++++++++++++ components/aws_iot/include/aws_iot_config.h | 10 ++-- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/components/aws_iot/Kconfig b/components/aws_iot/Kconfig index 031def977..76b587e9c 100644 --- a/components/aws_iot/Kconfig +++ b/components/aws_iot/Kconfig @@ -30,3 +30,56 @@ config AWS_IOT_MQTT_PORT If you need per-device port numbers for different regions, you can override the default port number in your app. + +config AWS_IOT_MQTT_TX_BUF_LEN + int "MQTT TX Buffer Length" + depends on AWS_IOT_SDK + default 512 + range 32 65536 + help + Maximum MQTT transmit buffer size. This is the maximum MQTT + message length (including protocol overhead) which can be sent. + + Sending longer messages will fail. + +config AWS_IOT_MQTT_RX_BUF_LEN + int "MQTT RX Buffer Length" + depends on AWS_IOT_SDK + default 512 + range 32 65536 + help + Maximum MQTT receive buffer size. This is the maximum MQTT + message length (including protocol overhead) which can be + received. + + Longer messages are dropped. + + + +config AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS + int "Maximum MQTT Topic Filters" + depends on AWS_IOT_SDK + default 5 + range 1 100 + help + Maximum number of concurrent MQTT topic filters. + + +config AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL + int "Auto reconnect initial interval (ms)" + depends on AWS_IOT_SDK + default 1000 + range 10 3600000 + help + Initial delay before making first reconnect attempt, if the AWS IoT connection fails. + Client will perform exponential backoff, starting from this value. + +config AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL + int "Auto reconnect maximum interval (ms)" + depends on AWS_IOT_SDK + default 128000 + range 10 3600000 + help + Maximum delay between reconnection attempts. If the exponentially increased delay + interval reaches this value, the client will stop automatically attempting to reconnect. + diff --git a/components/aws_iot/include/aws_iot_config.h b/components/aws_iot/include/aws_iot_config.h index a19de46e0..2d10702af 100644 --- a/components/aws_iot/include/aws_iot_config.h +++ b/components/aws_iot/include/aws_iot_config.h @@ -37,9 +37,9 @@ #define AWS_IOT_MY_THING_NAME "ESP32" ///< Thing Name of the Shadow this device is associated with // MQTT PubSub -#define AWS_IOT_MQTT_TX_BUF_LEN 512 ///< Any time a message is sent out through the MQTT layer. The message is copied into this buffer anytime a publish is done. This will also be used in the case of Thing Shadow -#define AWS_IOT_MQTT_RX_BUF_LEN 512 ///< Any message that comes into the device should be less than this buffer size. If a received message is bigger than this buffer size the message will be dropped. -#define AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS 5 ///< Maximum number of topic filters the MQTT client can handle at any given time. This should be increased appropriately when using Thing Shadow +#define AWS_IOT_MQTT_TX_BUF_LEN CONFIG_AWS_IOT_MQTT_TX_BUF_LEN ///< Any time a message is sent out through the MQTT layer. The message is copied into this buffer anytime a publish is done. This will also be used in the case of Thing Shadow +#define AWS_IOT_MQTT_RX_BUF_LEN CONFIG_AWS_IOT_MQTT_RX_BUF_LEN ///< Any message that comes into the device should be less than this buffer size. If a received message is bigger than this buffer size the message will be dropped. +#define AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS CONFIG_AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS ///< Maximum number of topic filters the MQTT client can handle at any given time. This should be increased appropriately when using Thing Shadow // Thing Shadow specific configs #define SHADOW_MAX_SIZE_OF_RX_BUFFER (AWS_IOT_MQTT_RX_BUF_LEN + 1) ///< Maximum size of the SHADOW buffer to store the received Shadow message @@ -54,7 +54,7 @@ #define MAX_SHADOW_TOPIC_LENGTH_BYTES (MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME + MAX_SIZE_OF_THING_NAME) ///< This size includes the length of topic with Thing Name // Auto Reconnect specific config -#define AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL 1000 ///< Minimum time before the First reconnect attempt is made as part of the exponential back-off algorithm -#define AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL 128000 ///< Maximum time interval after which exponential back-off will stop attempting to reconnect. +#define AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL CONFIG_AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL ///< Minimum time before the First reconnect attempt is made as part of the exponential back-off algorithm +#define AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL CONFIG_AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL ///< Maximum time interval after which exponential back-off will stop attempting to reconnect. #endif /* _AWS_IOT_CONFIG_H_ */