A device that does not have an IP address can be attached to a gateway as a sub-device. You can connect the sub-device to IoT Platform by using the gateway. Then, the sub-device can communicate with IoT Platform. This article describes how to configure Link SDK for C to connect a sub-device with IoT Platform.
Prerequisites
- A gateway and a sub-device are created.
- Create a product and a device for the gateway. When you create the product, set the node type to Gateway device.
- Create a product and device for the sub-device. When you create the product, set the node type to Gateway sub-device.
For more information, see Create a product and Create a device.
- Link SDK for C is obtained.
When you customize an SDK on the SDK customization page, set Advanced Capabilities to Sub-device management.
- A development environment is prepared.
Background information
- For more information about sub-device management, see Gateways and sub-devices.
- For more information about the communication protocols between sub-devices and IoT Platform, see Manage topological relationships and Connect or disconnect sub-devices.
Process
The application program calls the API operations of Link SDK for C to attach the sub-device to the gateway and connect with IoT Platform by using the unique-certificate-per-device authentication method.
The following figure shows the process. In this example, the ./demos/subdev_basic_demo.c application program is used.
For more information about API operations that are related to sub-device management, see aiot_subdev_api.h.
Examples
- For more information about examples, see Example.
- For more information about error codes, see aiot_subdev_api.h.