A sub-device can be connected to IoT Platform only by using a gateway. This article describes how to connect a sub-device to IoT Platform by using a gateway.
First, create a gateway and a sub-device in the IoT Platform console. Then, develop a device SDK for the gateway to connect the gateway to IoT Platform. Next, the gateway creates a topological relationship between the gateway and sub-devices and reports the relationship to IoT Platform. If a sub-device has a topological relationship with the gateway, the gateway reports the certificate of the sub-device to IoT Platform or dynamically registers the sub-device. IoT Platform validates the identity of the sub-device and the topological relationship between the sub-device and the gateway. If the validation is successful, IoT Platform establishes a logical channel between the sub-device and IoT Platform and associates the logical channel with the physical channel of the gateway. This way, the sub-device can connect to and communicate with IoT Platform by using the gateway.

This example describes only how to connect a sub-device to IoT Platform by using a gateway, and does not involve configurations for data communication such as Thing Specification Language (TSL) data communication. If you want to transmit TSL data between your sub-device and IoT Platform, configure your gateway to transmit the data for the sub-device. For more information, see TSL model communication.
Reference
You can download the sample code for connecting a sub-device to IoT Platform by using a gateway: iotx-api-demo.
To connect the sub-device to IoT Platform by using the gateway, perform the following steps: