knowledge_map/工作/艾航/无人机喊话器mqtt对接.md
2024-11-16 14:33:59 +08:00

117 lines
3.8 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### mqtt 基础配置
| 配置项 | 内容 | 备注 |
| ---------- | ------------------------------------ | ---------------- |
| mqtt 服务器地址 | mqtt.aihang.cn:1883 | |
| username | ahmqtt | |
| 指令发送topic | /ah/uav/${deviceId}/command/ | deviceId 为无人机序列号 |
| 指令响应topic | /ah/uav/${deviceId}/commandResponse/ | deviceId 为无人机序列号 |
## 指令发送内容
| 字段名 | 字段值介绍 | 字段类型 | 是否必填 |
| ---------- | -------------------- | ------- | ------ |
| deviceId | 无人机序列号 | String | 是 |
| code | 指令code(参考指令集) | String | 是 |
| data | 数据体(参考指令集) | JSONObj | 否 |
| deviceType | 设备类型(无人机:uav) | String | 是 |
| sdkType | sdk类型 msdk | osdk) | String |
| time | 请求时间(ISO dateformat) | String | 否 |
### 请求示例:
```json
{
    "code": "actionMount",
    "data": {
        "type": "MP",
        "code": "shout",
        "param": {
            "conten": "无人机汉化内容",
            "repeat": false,
            "volume": 80,
            "speed": 50,
            "sex": 1
        }
    },
    "sdkType": "msdk",
    "deviceId": "1ZNDH8500B72MM",
    "requestId": "04c1fbde-2123-48b5-a159-d469b978147d",
    "time": 1667467817551
}
```
### 响应体:
| 字段名 | 字段值介绍 | 字段类型 | 是否都有值 |
| --------- | ------------------------------------ | ------- | ----------------------- |
| requestId | 请求ID(由服务端生成) | String | 否(是->code==0) |
| code | 请求结果(0成功,非0失败) | int | 是 |
| data | 响应数据 | JSONObj | 否(是->code==0&&是获取数据的请求) |
| msg | 备注信息(code==0,msg无用;code==1,msg为错误原因) | String | 是 |
| | | | |
### 响应示例:
```json
1(请求成功无数据)
{
"requestId": "04c1fbde-2123-48b5-a159-d469b978147d",
"code": 0,
"msg": "",
"data": ""
}
2(请求失败)
{
"requestId": "04c1fbde-2123-48b5-a159-d469b978147d",
"code": -1,
"msg": "",
"data": ""
}
```
# 指令集
\###操作挂载设备
code: actionMount
data: ↓
| 字段名 | 字段值介绍 | 字段类型 | 是否必填 |
| ------ | -------- | -------------- | ---- |
| type | 挂载设备类型 | String喊话器:MP | 是 |
| code | 挂载设备操作指令 | String | 是 |
| params | 挂载设备操作参数 | Obejct | 否 |
挂载设备类型:
```json
typeStringMP 喊话器
```
挂载设备类型对应操作指令:
```
type = MP
code1:shout 喊话
code2:stop 停止
```
```
code = shout
param: ↓
```
| 字段名 | 字段值介绍 | 字段类型 | 是否必填 |
| ------ | ----------------- | ------- | ---- |
| conten | 文字内容 | String | 是 |
| repeat | 是否重复喊话 | Boolean | 是 |
| volume | 声音大小0-100(默认为50) | Integer | 是 |
| speed | 喊话语速0-100(默认为50) | Integer | 是 |
| sex | 声音男女0女1男(默认男) | Integer | 是 |
```
code = stop
param:null
```