Sub-devices do not connect directly to IoT Platform. Instead, they connect to IoT Platform through a gateway, which reuses the communication channel between the gateway and IoT Platform.
Background information
When you develop a gateway, you must implement several features. These features include managing the topology with sub-devices, acting as an agent to manage the online and offline status of sub-devices, and proxying communication for the Thing Specification Language (TSL) model between sub-devices and IoT Platform.
You can use the device-side SDK provided by Alibaba Cloud to develop the gateway. For more information, see the Link SDK documentation.
If you develop the gateway yourself, you must encapsulate the sub-device Alink protocol data on the gateway. For information about the Alink protocol data for each feature, see the Alink protocol documentation.
Sub-device publishing procedure
The gateway brings a sub-device online by performing the following steps.
- The gateway connects to IoT Platform.
- The sub-device connects to the gateway.
Sub-devices do not connect directly to IoT Platform. Therefore, the IoT Platform device-side SDK should not be installed on sub-devices. The manufacturer is responsible for developing the device-side of the sub-device.
The gateway manufacturer must implement features such as sub-device discovery, obtaining device certificates from IoT Platform for sub-devices, detecting the online and offline status of sub-devices, and sending messages from IoT Platform to sub-devices. Alternatively, the gateway manufacturer and the sub-device manufacturer can define a protocol to implement these features.
- The gateway queries for an existing topology relationship with the sub-device.
If a topology relationship already exists between the gateway and the sub-device, skip Step 5.
- (Optional) The gateway reports the ProductKey and DeviceName of the sub-device to IoT Platform to dynamically register the sub-device.
This step applies only if the gateway has not obtained the DeviceSecret of the sub-device and dynamic registration for sub-devices is enabled in the console.
- (Optional) The gateway adds a topology relationship with the sub-device.
This step is required if a topology relationship does not exist between the gateway and the sub-device.
- The gateway sends a connection request to IoT Platform on behalf of the sub-device.
For detailed development guidance, see the sub-device management documentation in Link SDK.
Example
For an example, see Connect a sub-device to IoT Platform.