AWS IoT Device SDK C: Shadow
AWS IoT Device Shadow library
Return to main page ↑
Configuration

Configuration settings of the Shadow library.

Configuration settings are C pre-processor constants. They can be set with a #define in the config file (iot_config.h) or by using a compiler option such as -D in gcc. If a configuration setting is not defined, the library will use a "sensible" default value (unless otherwise noted). Because they are compile-time constants, a library must be rebuilt if a configuration setting is changed.

configpagemarker

AWS_IOT_SHADOW_ENABLE_ASSERTS

Set this to 1 to perform sanity checks when using the Shadow library.

Asserts are useful for debugging, but should be disabled in production code. If this is set to 1, AwsIotShadow_Assert can be defined to set the assertion function; otherwise, the Iot_DefaultAssert will be used.

Possible values: 0 (asserts disabled) or 1 (asserts enabled)
Recommended values: 1 when debugging; 0 in production code.
Default value (if undefined): 0

AWS_IOT_SHADOW_DEFAULT_MQTT_TIMEOUT_MS

Set the default timeout (in milliseconds) for MQTT library called by the Shadow library.

If the mqttTimeout argument of AwsIotShadow_Init is 0, the Shadow library uses this setting for MQTT timeouts. This timeout is passed to functions such as IotMqtt_SubscribeSync, IotMqtt_UnsubscribeSync, and IotMqtt_PublishSync to limit amount of time an MQTT function may block.

Possible values: Any positive integer.
Recommended values: This setting must be at least the network round-trip time, as an MQTT packet must be sent to the AWS IoT server and a response must be received. The recommended minimum value is 500.
Default value (if undefined): 5000

AWS_IOT_LOG_LEVEL_SHADOW

Set the log level of the Shadow library.

Log messages from the Shadow library at or below this setting will be printed.

Possible values: One of the Log levels.
Default value (if undefined): IOT_LOG_LEVEL_GLOBAL; if that is undefined, then IOT_LOG_NONE.

AwsIotShadow_Assert

Assertion function used when AWS_IOT_SHADOW_ENABLE_ASSERTS is 1.

Possible values: Any function with the same signature as the standard library's assert function.
Default value (if undefined): Iot_DefaultAssert if AWS_IOT_SHADOW_ENABLE_ASSERTS is 1; otherwise, nothing. If Iot_DefaultAssert is not defined when asserts are enabled, the Shadow library will fail to build.

Memory allocation

The following functions may be re-implemented for the Shadow library.

If a custom implementation is not set for a Shadow memory allocation function, IotDefault_Malloc and Iot_DefaultFree will be used. If IotDefault_Malloc and Iot_DefaultFree are not set, the Shadow library will fail to build.

When IOT_STATIC_MEMORY_ONLY is 1, the following settings configure the number of statically-allocated buffers for Shadow.

  • AWS_IOT_SHADOW_MAX_IN_PROGRESS_OPERATIONS
    Maximum number of Shadow operations that may be in-progress at any time. Defaults to 10 if undefined.
  • AWS_IOT_SHADOW_SUBSCRIPTIONS
    Maximum number of Shadow subscriptions at any time. Defaults to 2 if undefined.