Update Device Topology

2022-07-19
No Rating

DJI Pilot 2 Publishes Topology Update for Online Devices

After loading the cloud module, DJI Pilot 2 immediately initiates an MQTT connection request to the server. After the connection request is successful, a status topic is sent to the server immediately afterwards.

Communication method: MQTT

API interface:

ScenesPublished topicSubscribed topicremark
Device onlinesys/product/#{pid}/statussys/product/#{pid}/status_reply

Parameter Description:

  • #{pid}: Refers to the product ID of the gateway device. It is generally represented by the SN number of the device. Each device is different, so it is necessary to use wildcards when the server subscribes to Topic.
ParameterRequiredTypeIllustration
tidYesstring
bidYesstring
methodYesstringOnly supports update_topo
timestampYesint13-bit time stamp
dataYesobjectOnline data
data > typeYesintProduct type of gateway equipment
data > sub_typeYesintProduct sub-type of gateway sub-device
data > device_secretYesstringThe device secret of the gateway device
data > nonceYesstringThe device secret of the gateway device
data > versionYesintThe thing model version of the gateway device
data > sub_devicesYesarrayList of sub-devices, an empty array means there are no sub-devices
data > sub_devices > snYesstringThe serial number of the child device
data > sub_devices > typeYesintProduct type of sub-device
data > sub_devices > sub_typeYesintProduct sub-type of sub-device
data > sub_devices > indexYesintThe channel index of the connected gateway device. For example: A, B
data > sub_devices > device_secretYesstringThe device secret of the child device
data > sub_devices > nonceYesstringThe device secret of the child device
data > sub_devices > versionnointSub-device's thing model version

Example:

// Topic: sys/product/#{pid}/status
// Gateway devices and sub devices are online.
{
    "tid": "tid001",
    "bid": "bid001",
    "method": "update_topo",
    "timestamp": 1234567890123,
    "data": {
        "type": 98,
        "sub_type": 0,
        "device_secret":"secret",
        "nonce":"nonce",
        "version": 1,
        "sub_devices":[{
            "sn": "drone001",
            "type": 116,
            "sub_type": 0,
            "index": "A",
            "device_secret":"secret",
            "nonce":"nonce", 
            "version": 1
        }]
    }
}

// Topic: sys/product/#{pid}/status
// Sub devices are offline.
{
    "tid": "tid001",
    "bid": "bid001",
    "method": "update_topo",
    "timestamp": 1234567890123,
    "data": {
        "type": 98,
        "sub_type": 0,
        "device_secret":"secret",
        "nonce":"nonce",
        "version": 1,
        "sub_devices":[]
    }
}

// Topic: sys/product/#{pid}/status_reply 
{
    "tid": "xxx",
    "bid": "xxx",
    "method": "update_topo",
    "timestamp": 1234567890123,
    "data": {
        "result": 0
    }
}

Notice:

1. As long as there is a device topology change, the DJI Pilot 2 side will send a topic to the server side to update the topology.

2. When the server side receives the status topic, it needs to send the status_reply topic to reply, otherwise the DJI Pilot 2 side will keep on pushing until it stops after receiving the reply.