IoT Platform provides the device shadow feature to cache the statuses that are submitted by devices and the commands that are sent by IoT Platform. Online devices can receive commands from IoT Platform. If devices are offline, you can request commands from IoT Platform after the devices go online. This article describes how to configure Link SDK for C to achieve the device shadow feature.

Prerequisites

Background information

  • A device shadow is a JSON file stored in IoT Platform. The shadow is used to cache submitted device properties (reported) and desired properties of cloud applications (desired).

    For more information, see Overview.

  • For more information about the JSON format of device shadows, see JSON format of device shadows.
  • For more information about the data forwarding process of device shadows, see Forwarding of device shadow data.

Process

A device calls the API operations of Link SDK for C to send the status information to IoT Platform over MQTT. IoT Platform caches the information as a device shadow. The device can call the API operations to query and delete properties in the shadow.

The following figure the process. In this example, the ./demos/shadow_basic_demo.c sample code file is used.

Process

For more information about device shadow-specific API operations, see aiot_shadow_api.h.

Examples