Overview

更新时间:
复制 MD 格式

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 Device shadow overview.

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

How it works

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

  • For a code sample of the MQTT connection feature, see Usage examples.
  • For error codes related to the MQTT connection feature, see aiot_shadow_api.hStatus code descriptions.