From eaff702df1f68853967e07f142331c2329ecf241 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 9 Jan 2018 11:18:41 +1100 Subject: [PATCH] aws iot: Expose Thing Shadow settings in menuconfig Closes https://github.com/espressif/esp-idf/issues/1340 Ref TW#16817 --- components/aws_iot/Kconfig | 74 +++++++++++++++++++ .../aws_iot/aws-iot-device-sdk-embedded-C | 2 +- components/aws_iot/include/aws_iot_config.h | 17 +++-- 3 files changed, 86 insertions(+), 7 deletions(-) diff --git a/components/aws_iot/Kconfig b/components/aws_iot/Kconfig index 76b587e9c0..9144f16608 100644 --- a/components/aws_iot/Kconfig +++ b/components/aws_iot/Kconfig @@ -83,3 +83,77 @@ config AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL Maximum delay between reconnection attempts. If the exponentially increased delay interval reaches this value, the client will stop automatically attempting to reconnect. +menu "Thing Shadow" + depends on AWS_IOT_SDK + +config AWS_IOT_OVERRIDE_THING_SHADOW_RX_BUFFER + bool "Override Shadow RX buffer size" + depends on AWS_IOT_SDK + default n + help + Allows setting a different Thing Shadow RX buffer + size. This is the maximum size of a Thing Shadow + message in bytes, plus one. + + If not overridden, the default value is the MQTT RX Buffer length plus one. If overriden, do not set higher than the default value. + +config AWS_IOT_SHADOW_MAX_SIZE_OF_RX_BUFFER + int "Maximum RX Buffer (bytes)" + depends on AWS_IOT_OVERRIDE_THING_SHADOW_RX_BUFFER + default 513 + range 32 65536 + help + Allows setting a different Thing Shadow RX buffer size. + This is the maximum size of a Thing Shadow message in bytes, + plus one. + + +config AWS_IOT_SHADOW_MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES + int "Maximum unique client ID size (bytes)" + depends on AWS_IOT_SDK + default 80 + range 4 1000 + help + Maximum size of the Unique Client Id. + +config AWS_IOT_SHADOW_MAX_SIMULTANEOUS_ACKS + int "Maximum simultaneous responses" + depends on AWS_IOT_SDK + default 10 + range 1 100 + help + At any given time we will wait for this many responses. This will correlate to the rate at which the shadow actions are requested + +config AWS_IOT_SHADOW_MAX_SIMULTANEOUS_THINGNAMES + int "Maximum simultaneous Thing Name operations" + depends on AWS_IOT_SDK + default 10 + range 1 100 + help + We could perform shadow action on any thing Name and this is maximum Thing Names we can act on at any given time + +config AWS_IOT_SHADOW_MAX_JSON_TOKEN_EXPECTED + int "Maximum expected JSON tokens" + depends on AWS_IOT_SDK + default 120 + help + These are the max tokens that is expected to be in the Shadow JSON document. Includes the metadata which is published + +config AWS_IOT_SHADOW_MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME + int "Maximum topic length (not including Thing Name)" + depends on AWS_IOT_SDK + default 60 + range 10 1000 + help + All shadow actions have to be published or subscribed to a topic which is of the format $aws/things/{thingName}/shadow/update/accepted. This refers to the size of the topic without the Thing Name + +config AWS_IOT_SHADOW_MAX_SIZE_OF_THING_NAME + int "Maximum Thing Name length" + depends on AWS_IOT_SDK + default 20 + range 4 1000 + help + Maximum length of a Thing Name. + +endmenu # Thing Shadow + diff --git a/components/aws_iot/aws-iot-device-sdk-embedded-C b/components/aws_iot/aws-iot-device-sdk-embedded-C index b9f19d57a0..8bf852db77 160000 --- a/components/aws_iot/aws-iot-device-sdk-embedded-C +++ b/components/aws_iot/aws-iot-device-sdk-embedded-C @@ -1 +1 @@ -Subproject commit b9f19d57a0d94e98469cde470003ec45d5819ba4 +Subproject commit 8bf852db77c360eebfa4b800754fdb90e29ea43e diff --git a/components/aws_iot/include/aws_iot_config.h b/components/aws_iot/include/aws_iot_config.h index 2d10702af8..14a1ced27e 100644 --- a/components/aws_iot/include/aws_iot_config.h +++ b/components/aws_iot/include/aws_iot_config.h @@ -42,15 +42,20 @@ #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 +#ifdef CONFIG_AWS_IOT_OVERRIDE_THING_SHADOW_RX_BUFFER +#define SHADOW_MAX_SIZE_OF_RX_BUFFER CONFIG AWS_IOT_SHADOW_MAX_SIZE_OF_RX_BUFFER ///< Maximum size of the SHADOW buffer to store the received Shadow message, including NULL termianting byte +#else +#define SHADOW_MAX_SIZE_OF_RX_BUFFER (AWS_IOT_MQTT_RX_BUF_LEN + 1) +#endif + #define MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES 80 ///< Maximum size of the Unique Client Id. For More info on the Client Id refer \ref response "Acknowledgments" #define MAX_SIZE_CLIENT_ID_WITH_SEQUENCE (MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES + 10) ///< This is size of the extra sequence number that will be appended to the Unique client Id #define MAX_SIZE_CLIENT_TOKEN_CLIENT_SEQUENCE (MAX_SIZE_CLIENT_ID_WITH_SEQUENCE + 20) ///< This is size of the the total clientToken key and value pair in the JSON -#define MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME 10 ///< At Any given time we will wait for this many responses. This will correlate to the rate at which the shadow actions are requested -#define MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME 10 ///< We could perform shadow action on any thing Name and this is maximum Thing Names we can act on at any given time -#define MAX_JSON_TOKEN_EXPECTED 120 ///< These are the max tokens that is expected to be in the Shadow JSON document. Include the metadata that gets published -#define MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME 60 ///< All shadow actions have to be published or subscribed to a topic which is of the formablogt $aws/things/{thingName}/shadow/update/accepted. This refers to the size of the topic without the Thing Name -#define MAX_SIZE_OF_THING_NAME 20 ///< The Thing Name should not be bigger than this value. Modify this if the Thing Name needs to be bigger +#define MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME CONFIG_AWS_IOT_SHADOW_MAX_SIMULTANEOUS_ACKS ///< At Any given time we will wait for this many responses. This will correlate to the rate at which the shadow actions are requested +#define MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME CONFIG_AWS_IOT_SHADOW_MAX_SIMULTANEOUS_THINGNAMES ///< We could perform shadow action on any thing Name and this is maximum Thing Names we can act on at any given time +#define MAX_JSON_TOKEN_EXPECTED CONFIG_AWS_IOT_SHADOW_MAX_JSON_TOKEN_EXPECTED ///< These are the max tokens that is expected to be in the Shadow JSON document. Include the metadata that gets published +#define MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME CONFIG_AWS_IOT_SHADOW_MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME ///< All shadow actions have to be published or subscribed to a topic which is of the formablogt $aws/things/{thingName}/shadow/update/accepted. This refers to the size of the topic without the Thing Name +#define MAX_SIZE_OF_THING_NAME CONFIG_AWS_IOT_SHADOW_MAX_SIZE_OF_THING_NAME ///< The Thing Name should not be bigger than this value. Modify this if the Thing Name needs to be bigger #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 -- 2.40.0