大疆无人机 MQTT消息定义

公共字段解释

Column Name Type Description
tid 事务uuid text 事务(Transaction)的 UUID:表征一次简单的消息通信,如:增/删/改/查,云台控制等,可以是: 1. 数据上报请求+数据上报响应 2. 握手认证请求+响应+ack 3.报警事件单向通知等,解决事务多并发和消息匹配的问题
bid 业务uuid text 业务(Business)的 UUID:有些功能不是一次通信就能完成的,包含持续一段时间内的所有交互。 业务通常由多个原子事务组成,且持续时间较长; 例如点播/下载/回放;解决业务多并发和重复请求的问题,便于所有模块的状态机管理。
timestamp 毫秒时间戳 int 消息的发送时间
gateway 网关设备的序列号 text 发送该消息的网关设备的序列号
data 消息内容 object 消息内容

osd 结构示例

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 结构示例

topic : thing/product/{device_sn}/state

复制代码
{
    "tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
    "bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
    "timestamp": 1598411295123,
    "gateway":"sn",
    "data":{}
}

#services 结构示例

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 结构示例

#data中必填字段解释

Column Name Type constraint Description
result 设备响应的结果码 int 非 0 代表错误
output 设备消息内容 struct 设备响应服务端命令的消息内容
复制代码
{
    "tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
    "bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
    "timestamp": 1598411295123,
    "gateway":"sn",
    "method": "some_method",
    "data": {
        "result": 0, 
    	"output": {}
    }  
}

#events 结构示例

topic : thing/product/{gateway_sn}/events

Column Name Type constraint Description
need_reply 服务端是否需要答复 int 服务端收到设备的events事件上报消息后,跟进need_reply来判断是否给予收到答复;0代表不需要,1代表需要
复制代码
{
    "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 结构示例

topic : thing/product/{gateway_sn}/events_reply

#data中必填字段解释

Column Name Type constraint Description
result 服务端响应的结果码 int 非 0 代表错误
复制代码
{
    "tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
    "bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
    "timestamp": 1598411295123,
    "gateway":"sn",
    "method": "some_method",
    "data": {
        "result": 0
    }
}

#requests 结构示例

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 结构示例

topic : thing/product/{gateway_sn}/requests_reply

#data中必填字段解释

Column Name Type constraint Description
result 服务端响应的结果码 int 非 0 代表错误
output 服务消息内容 struct 服务端响应设备的消息内容
复制代码
{
    "tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
    "bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
    "timestamp": 1598411295123,
    "gateway":"sn",
    "method": "some_method",
    "data": {
        "result": 0,
        "output":{}
    }
}

#status 结构示例

topic : sys/product/{gateway_sn}/status

复制代码
## 网关设备+子设备上线
{
	"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
	"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
	"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
			}
		]
	}
}

## 子设备下线
{
    "tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
    "bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
    "method": "update_topo",
    "timestamp": 1234567890123,
    "data": {
        "type": 98,
        "sub_type": 0,
        "device_secret":"secret",
        "nonce":"nonce",
        "version": 1,
        "sub_devices":[]
    }
}

#status_reply 结构示例

topic : sys/product/{gateway_sn}/status_reply

#data中必填字段解释

Column Name Type constraint Description
result 结果码 int 非0代表错误
复制代码
{
    "tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
    "bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
    "timestamp": 1598411295123,
    "method": "update_topo",
    "data": {
        "result": 0 
    }
}

#property set 结构示例

topic : thing/product/{gateway_sn}/property/set

Column Name Type constraint Description
some_property 需要修改的属性key string 参考设备管理-设备属性设置 设备属性是否可以被修改,在设备属性章节通过"accessMode"标识符号判断,accessMode = rw 表示可被读写。
some_value 需要修改的属性value string/int/float 参考对应的设备属性
复制代码
{
    "tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
    "bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
    "timestamp": 1598411295123,
    "data": {
      "some_property": some_value
    }
}

#property set_reply 结构示例

topic : thing/product/{gateway_sn}/property/set_reply

#data中必填字段解释

Column Name Type constraint Description
some_property 需要修改的属性key string 参考设备管理-设备属性设置 设备属性是否可以被修改,在设备属性章节通过"accessMode"标识符号判断,accessMode = rw 表示可被读写。
result 对应属性的设置结果 int 0: 成功,1:失败,2:超时,其他参考错误码解释
复制代码
{
    "tid":"6a7bfe89-c386-4043-b600-b518e10096cc",
    "bid":"42a19f36-5117-4520-bd13-fd61d818d52e",
    "timestamp": 1598411295123,
    "data": {
        "some_property": {
           "result": 0  // 0: 成功,1:失败,2:超时,其他参考错误码解释
        }
    }
}

#drc up 结构示例

topic : thing/product/{gateway_sn}/drc/up

#data中必填字段解释

Column Name Type constraint Description
result 服务端响应的结果码 int 非 0 代表错误
output 服务消息内容 struct 服务端响应设备的消息内容
复制代码
{
	"method": "drone_control",
	"data": {
		"result": 0,
		"output": {
			"seq": 1
		}
	}
}

#drc down 结构示例

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
	}
}
相关推荐
The_Uniform_C@t27 小时前
IOT | 无人机(第一期)
物联网·无人机
蓝天居士10 小时前
无人机知识科普之无人机发展简史(5)
无人机
蓝天居士1 天前
无人机知识科普之无人机发展简史(4)
无人机
土拨鼠不是老鼠1 天前
状态栏&飞行控制&地图控制
无人机·地面站
小O的算法实验室1 天前
2026年IEEE IOTJ SCI2区TOP,面向关键节点感知的灾害区域无人机集群路径规划,深度解析+性能实测
算法·无人机·论文复现·智能算法·智能算法改进
AI浩1 天前
EFSI-DETR:用于无人机图像实时小目标检测的高效频域 - 语义集成方法
人工智能·目标检测·无人机
J2虾虾1 天前
使用Springboot Integration做无人机飞控系统
spring boot·后端·无人机
蓝天居士2 天前
无人机知识科普之无人机发展简史(3)
无人机
蓝天居士2 天前
无人机知识科普之无人机发展简史(2)
无人机