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

How to migrate a Shadow application from v3 to v4.

The Shadow library has been redesigned in v4 as a thread-aware library supporting asynchronous operations.

The features of the Shadow libraries in v3 and v4 are defined by the common AWS service; therefore, the two versions are similar.

Removed features

The following features which were present in v3 were removed in v4.

  • Shadow JSON functions
    Version 3 has functions for generating and parsing JSON Shadow documents. These functions have been removed in v4 due to their high memory usage.
    Workaround: snprintf can be used to generate Shadow documents. JSON parsing can be done through third-party libraries.

Functions

The following table lists equivalent API functions in v3 and v4. These functions are the API functions declared in:

Version 3 Version 4 Notes
aws_iot_shadow_init AwsIotShadow_Init In v3, this function initializes a single client.
In v4, this function initializes the entire library.
aws_iot_shadow_free AwsIotShadow_Cleanup In v3, this function frees a single client.
In v4, this function cleans up the entire library.
aws_iot_mqtt_connect
aws_iot_shadow_disconnect
None These functions were thin wrappers for the MQTT connect and disconnect functions.
Applications using these v3 functions should replace them with calls to:
IotMqtt_Connect
IotMqtt_Disconnect
aws_iot_shadow_yield None Removed in favor of background tasks.
Nothing needs to be changed in an application.
aws_iot_shadow_update AwsIotShadow_UpdateSync AwsIotShadow_UpdateAsync is the equivalent asynchronous function.
aws_iot_shadow_get AwsIotShadow_GetSync AwsIotShadow_GetAsync is the equivalent asynchronous function.
aws_iot_shadow_delete AwsIotShadow_DeleteSync AwsIotShadow_DeleteAsync is the equivalent asynchronous function.
aws_iot_shadow_register_delta AwsIotShadow_SetDeltaCallback
aws_iot_shadow_reset_last_received_version
aws_iot_shadow_get_last_received_version
aws_iot_shadow_enable_discard_old_delta_msgs
aws_iot_shadow_disable_discard_old_delta_msgs
None Removed due to removal of JSON parsing.
The application should parse received Shadow documents and decide whether to discard them based on the version key.
aws_iot_shadow_set_autoreconnect_status None Removed due to removal of auto-reconnect in the MQTT library.