A sub-device can be connected to IoT Platform only by using a gateway. This topic describes how to connect a sub-device to IoT Platform by using a gateway.

Working mechanism

To connect a sub-device to IoT Platform, you must authenticate the sub-device by using unique-certificate-per-device authentication or dynamic registration. To authenticate the sub-device, you must develop the Link SDK for the gateway. This way, the gateway can report the topological relationship between the gateway and sub-device, and the certificate information about the sub-device for authentication. IoT Platform verifies the topological relationship and certificate information about the sub-device. If the information passes the verification, IoT Platform establishes a logical channel for the sub-device, and binds the logical channel with a physical channel of the gateway. Then, the sub-device can connect to and communicate with IoT Platform by using the gateway.

Sub-device communication

This topic describes only how to connect a sub-device to IoT Platform by using a gateway. This topic 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 Establish TSL-based communication.

Note Data transmission between a gateway and a sub-device must be implemented by the provider of the gateway. Alibaba Cloud does not provide code for this feature.

Procedure

In this example, the iotx-api-demo package of SDKs is used.

Steps:

  1. Create a gateway and a sub-device: Create a gateway and a sub-device in IoT Platform and obtain the certificate information about the sub-device.
  2. Initialize the SDKs: Import the SDK package that contains the sample code.
  3. Connect a gateway to IoT Platform: Develop the gateway and connect the gateway directly to IoT Platform.
  4. Connect the sub-device to IoT Platform: Configure the gateway to connect the sub-device to IoT Platform.