Updated on 2023-02-16 GMT+08:00

Gateway Synchronizing Child Device Information

Function

This API is used by a gateway to synchronize child device information from the platform. The platform can notify an online gateway of child device addition or deletion by respectively using the topics described in Platform Notifying a Gateway of New Child Device Connection and Platform Notifying a Gateway of Child Device Deletion. However, the platform cannot send notifications to a gateway that is offline. When the gateway goes online, it can use the topic described here to synchronize information about child device addition or deletion from the platform.

Topic

Upstream: $oc/devices/{device_id}/sys/events/up

Parameters

Parameter

Mandatory or Optional

Type

Description

object_device_id

Optional

String

Indicates the device that the event is about. If this parameter is not carried, the device specified in the topic is considered to be the device involved.

services

Optional

List<EventService>

Indicates a list of services that the event is about.

EventService structure

Parameter

Mandatory or Optional

Type

Description

service_id

Mandatory

String

System field. The value is fixed to $sub_device_manager.

event_type

Mandatory

String

System field. The value is fixed to sub_device_sync_request.

event_time

Optional

String

Indicates the time when the event occurs.

paras

Mandatory

Object

Indicates the event parameters in JSON format.

paras structure

Parameter

Mandatory or Optional

Type

Description

version

Optional

Long

Indicates the last version of child device addition or deletion information received by the gateway. The platform will send the information of later versions to the gateway during the synchronization.

Example

Topic: $oc/devices/{device_id}/sys/events/up
Data format:
{
	"object_device_id": "{object_device_id}",
	"services": [{
		"service_id": "$sub_device_manager",
		"event_type": "sub_device_sync_request",
		"event_time": "20151212T121212Z",
		"paras": {"version": 1}
	}]
}