The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.
Help & Documentation>Internet of Things Hub>Developer Manual>Gateway Subdevice>Proxied Subdevice Connection and Disconnection

Proxied Subdevice Connection and Disconnection

Last updated: 2025-03-19 14:56:32

Feature Overview

A gateway device can proxy the online and decommission operations of its sub-devices through data communication with the cloud. The topics used for this feature are the same as those for gateway subdevice topology management:
Upstream data Topic (for publishing): $gateway/operation/${productid}/${devicename}
Downstream data Topic (for subscribing): $gateway/operation/result/${productid}/${devicename}

Proxies subdevice connection

The gateway device can proxy subdevice connection through the data upstream topic. After the request succeeds, the platform will return the connection information of the subdevice through the data downstream topic.
Data format of the proxy subdevice connection request:
{
"type": "online",
"payload": {
"devices": [
{
"product_id": "CFCSQ5EAG7",
"device_name": "onlinedev00"
}
}
}
Data format of the proxy subdevice connection response:
{
"type": "online",
"payload": {
"devices": [
{
"product_id": "CFCSQ5EAG7",
"device_name": "onlinedev00",
"result":0
}
}
}
Request parameter description:
Field
Type
Description
type
String
Gateway message type. For agent sub-device online, the value is online.
payload.devices
Array
List of sub-devices to be online.
product_id
String
Subdevice product ID.
device_name
String
Subdevice name.
Response parameter description:
Field
Type
Description
type
String
Gateway message type. For agent sub-device online, the value is online.
payload.devices
Array
List of sub-devices to be online.
product_id
String
Subdevice product ID.
device_name
String
Subdevice name.
result
Int
Subdevice connection results. For specific error codes, see the table below.

Proxies subdevice disconnection.

The gateway device can proxy subdevice disconnection through the data upstream topic. After the request succeeds, the platform will return the successful disconnection information of the subdevice through the data downstream topic.
Data format of the subdevice disconnection request:
{
"type": "offline",
"payload": {
"devices": [
{
"product_id": "CFCSQ5EAG7",
"device_name": "offlinedev00"
}
}
}
Data format of the subdevice disconnection response:
{
"type": "offline",
"payload": {
"devices": [
{
"product_id": "CFCSQ5EAG7",
"device_name": "offlinedev00",
"result":-1
}
}
}
Request parameter description:
Field
Type
Description
type
String
Gateway message type. The value for agent sub-device offline is: offline.
payload.devices
Array
List of sub-devices to be proxied offline.
product_id
String
Subdevice product ID.
device_name
String
Subdevice name.
Response parameter description:
Field
Type
Description
type
String
Gateway message type. The value for agent sub-device offline is: offline.
payload.devices
Array
List of sub-devices to be proxied offline.
product_id
String
Subdevice product ID.
device_name
String
Subdevice name.
result
Int
Subdevice offline result. For specific error codes, see the table below.

Error Codes

Error Codes
Description
0
Execution succeeded.
-1
The gateway device is not bound to the subdevice.
-2
System error. Subdevice connection or disconnection failed.
801
Request parameter error.
802
The device name is invalid, or the device does not exist.
810
Unsupported subdevice.