00.topic-definition
Topic Overview
In order to distinguish the processing strategy of different properties, we divide the device properties into osd and state, and upload them through different topic.
osd: The properties that are uploaded in frequency by device, which is corresponding to the properties of
pushmode = 0.state: The properties that are uploaded by device when there are changes, which is corresponding to the properties of
pushmode = 1.
Note: The {gateway_sn} represents the serial number of gateway device. The {device_sn} represents the serial number of thing model belonged device.
thing/product/{device_sn}/osd
Device > Cloud Server
The properties that are uploaded in frequency by device(properties) , For the specific content range, please refer to the content of the thing model.
thing/product/{device_sn}/state
Device > Cloud Server
The properties that are uploaded in need by device (properties) , For the specific content range, please refer to the content of the thing model.
thing/product/{gateway_sn}/services
Cloud Server > Device
The services sent by device to cloud server. (For specific service identifier, please refer to the content of the thing model. )
thing/product/{gateway_sn}/services_reply
Device > Cloud Server
The reply and processing result of service by device.
thing/product/{gateway_sn}/events
Device > Cloud Server
The events that need to be followed and processed, which is sent by device to cloud server. For example, the SD is full, the information of fly zone is unrestricted, and so on. (For the events range,please refer to the content of the thing model.)
thing/product/{gateway_sn}/events_reply
Cloud Server > Device
The reply and processing result of device event by cloud server.
thing/product/{gateway_sn}/requests
Device > Cloud Server
Device send requests to cloud server for obtaining some information. For example, the temporary credentials.
thing/product/{gateway_sn}/requests_reply
Cloud Server > Device
The reply to device requests by cloud server.
sys/product/{gateway_sn}/status
Device > Cloud Server
Device online, device offline, topology update.
sys/product/{gateway_sn}/status_reply
Cloud Server > Device
Reply by platform.
thing/product/{gateway_sn}/property/set
Cloud Server > Device
Device property setting.
thing/product/{gateway_sn}/property/set_reply
Device > Cloud Server
Response to the device property setting.
Common Fields Explanation
tid
Transaction uuid
text
Transaction UUID: Characterize a simple message communication. For example, add, delete, modify, check, and gimbal control. It can be: 1. Data report request + data report response 2. Handshake authentication request + Response+ack 3.One-way notification of alarm events, etc., to solve the problem of multi-concurrency transactions and message matching.
bid
Business uuid
text
Business UUID: Some functions are not completed in one communication and include all interactions over a period of time. The business is usually composed of multiple atomic transactions and has a long duration; For example, on-demand/download/playback; solves the problem of multiple concurrent and repeated requests for business, and facilitates the state machine management of all modules
timestamp
millisecond timestamp
int
the time the message was sent
gateway
Serial number of the gateway device
text
The serial number of the gateway device that sent the message
data
Message content
object
Message content
osd Struct Example
topic: thing/product/{device_sn}/osd
{
"tid": "65717bf1-aee7-4abb-8ea3-9b1908548d74",
"bid": "cf5ad2e6-2f32-4b59-980e-d5c9ee412805",
"timestamp": 1667220873846,
"data": {
"job_number": 492,
"acc_time": 1859010,
"activation_time": 0,
"maintain_status": {
"maintain_status_array": [
{
"state": 0,
"last_maintain_type": 17,
"last_maintain_time": 0,
"last_maintain_work_sorties": 0
}
]
},
"electric_supply_voltage": 231,
"working_voltage": 25440,
"working_current": 1120,
"backup_battery": {
"voltage": 26631,
"temperature": 27.9,
"switch": 1
},
"drone_battery_maintenance_info": {
"maintenance_state": 0,
"maintenance_time_left": 0
}
},
"gateway": "dock_sn"
} {
"bid": "d6cfcea4-c6ca-439b-948f-b17d88fc308f",
"data": {
"flighttask_step_code": 255,
"media_file_detail": {
"remain_upload": 0
},
"wireless_link": {
"4g_freq_band": 2.4,
"4g_gnd_quality": 0,
"4g_link_state": 0,
"4g_quality": 0,
"4g_uav_quality": 0,
"dongle_number": 0,
"link_workmode": 0,
"sdr_freq_band": 2.4,
"sdr_link_state": 0,
"sdr_quality": 0
}
},
"tid": "e4c15182-776b-4c13-9973-3fc76848ca15",
"timestamp": 1667220881576,
"gateway": "dock_sn"
}{
"tid": "43d2e632-1558-4c4e-83d2-eeb51b7a377a",
"bid": "7578f2ac-1f12-4d47-9ab6-5de146ed7b8a",
"timestamp": 1667220916697,
"data": {
"network_state": {
"type": 2,
"quality": 0,
"rate": 5.0970001220703125
},
"drone_charge_state": {
"state": 0,
"capacity_percent": 100
},
"drone_in_dock": 1,
"rainfall": 0,
"wind_speed": 0,
"environment_temperature": 24,
"temperature": 24.9,
"humidity": 62,
"latitude": 22.907809968,
"longitude": 113.703482143,
"height": 34.174125671386719,
"alternate_land_point": {
"latitude": 22.907898319908661,
"longitude": 113.70347329676635,
"safe_land_height": 0,
"is_configured": 1
},
"first_power_on": 1631945855969,
"position_state": {
"is_calibration": 1,
"is_fixed": 2,
"quality": 5,
"gps_number": 6,
"rtk_number": 25
},
"storage": {
"total": 82045336,
"used": 51772
},
"mode_code": 1,
"cover_state": 0,
"supplement_light_state": 0,
"emergency_stop_state": 0,
"air_conditioner_mode": 0,
"battery_store_mode": 1,
"alarm_state": 0,
"putter_state": 0,
"sub_device": {
"device_sn": "1581F5BKD225D00BP891",
"device_model_key": "0-67-0",
"device_online_status": 0,
"device_paired": 1
}
},
"gateway": "dock_sn"
}state Struct Example
topic: thing/product/{device_sn}/state
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"gateway":"sn",
"data":{}
}services Struct Example
topic: thing/product/{gateway_sn}/services
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"gateway":"sn",
"method": "some_method",
"data": {}
}services_reply Struct Example
Explanation of required fields in data
result
The result code of the device's response
int
-
Non-0 means error
output
Device message content
struct
-
The content of the message that the device responds to the server command
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"gateway":"sn",
"method": "some_method",
"data": {
"result": 0,
"output": {}
}
}events Struct Example
topic: thing/product/{gateway_sn}/events
need_reply
Does the server need a reply
int
-
After the server receives the device's events event report message, it follows need_reply to determine whether it has received a reply; 0 means no need, 1 means need.
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"need_reply": 0,
"gateway":"sn",
"method": "some_method",
"data": {}
}events_reply Struct Example
topic: thing/product/{gateway_sn}/events_reply
Explanation of required fields in data
result
Result code of server response
int
-
Non-0 means error
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"gateway":"sn",
"method": "some_method",
"data": {
"result": 0
}
}requests Struct Example
topic: thing/product/{gateway_sn}/requests
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"gateway":"sn",
"method": "some_method",
"data": {}
}requests_reply Struct Example
topic: thing/product/{gateway_sn}/requests_reply
Explanation of required fields in data
result
Result code of server response
int
-
Non-0 means error
output
Service message content
struct
-
The server responds to the message content of the device
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"gateway":"sn",
"method": "some_method",
"data": {
"result": 0,
"output":{}
}
}status Struct Example
topic: sys/product/{gateway_sn}/status
## Gateway device and sub-device 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
}
]
}
}
## Sub-device 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":[]
}
}status_reply Struct Example
topic: sys/product/{gateway_sn}/status_reply
Explanation of required fields in data
result
Result code
int
-
Non-0 means error
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"method": "update_topo",
"data": {
"result": 0
}
}property set Struct Example
topic: thing/product/{gateway_sn}/property/set
some_property
Property key that needs to be set
string
Refer to Device Management-Device Property Set Whether a property can be set or not can be judged according to the "accessMode" identifier on the "Properties chapter". If accessMode = 2, this property can be set.
some_value
Property value that needs to be set
string/int/float
refer to the property that is set
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"data": {
"some_property": some_value
}
}property set_reply Struct Example
topic: thing/product/{gateway_sn}/property/set_reply
Explanation of required fields in data
some_property
Property key that needs to be set
string
Refer to Device Management-Device Property Set Whether a property can be set or not can be judged according to the "accessMode" identifier on the "Properties chapter". If accessMode = 2, this property can be set.
result
Setting result
int
0: success, 1: fail, 2: time exceed, other value: refer to the error code.
{
"tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
"bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
"timestamp": 1598411295123,
"data": {
"some_property": {
"result": 0 // 0: success, 1: fail, 2: time exceed, other value: refer to the error code.
}
}
}drc up Struct Example
topic: thing/product/{gateway_sn}/drc/up
Explanation of required fields in data
result
Result code of server response
int
-
Non-0 means error
output
Service message content
struct
-
The server responds to the message content of the device
{
"method": "drone_control",
"data": {
"result": 0,
"output": {
"seq": 1
}
}
}drc down Struct Example
topic: thing/product/{gateway_sn}/drc/down
{
"method": "drone_control",
"data": {
"seq": 1,
"x": 2.34,
"y": -2.45,
"h": 2.76,
"w": 2.86
}
}Last updated