fix: MQTT协议 V1.02 同步 — 字段名缩短 + 时间单位修正

- docs/DLD960_IoT_MQTT协议.md: 字段缩写 + 时间单位 5ms→50ms
- vd960DBN/iot_mqtt_srv.c: 6字段缩短对齐协议 (level/iscar/freq/diff/sens/cndtn)
- vd960DBN/tcp_json_srv.c: gap_ms5/passtime_ms → gap/passtime
- vd960DBN/loop_uart_proto.h: 注释 5ms→50ms
- DBNMQTTool/main.py: 模拟样本数据字段同步
This commit is contained in:
wangfq
2026-07-09 10:18:03 +08:00
parent 466ce00680
commit c515638032
7 changed files with 275 additions and 150 deletions
+89 -87
View File
@@ -462,47 +462,47 @@ dld960/{dev_serial}/{direction}
"channels": [
{
"ch": 1,
"sensitivity": 7,
"freq_level": "high",
"loop_delay": 0,
"output_mode": "exist",
"exist_mode": 0,
"direction_mode": 0,
"safe_mode": 0,
"function_mode": 0
"sens": 7,
"level": "high",
"delay": 0,
"output": "exist",
"exist": 0,
"dir": 0,
"safe": 0,
"fun_mode": 0
},
{
"ch": 2,
"sensitivity": 7,
"freq_level": "mid_high",
"loop_delay": 5,
"output_mode": "enter_pulse",
"exist_mode": 10,
"direction_mode": 0,
"safe_mode": 0,
"function_mode": 0
"sens": 7,
"level": "mid_high",
"delay": 5,
"output": "enter_pulse",
"exist": 10,
"dir": 0,
"safe": 0,
"fun_mode": 0
},
{
"ch": 3,
"sensitivity": 5,
"freq_level": "mid_low",
"loop_delay": 0,
"output_mode": "exist",
"exist_mode": 0,
"direction_mode": 1,
"safe_mode": 5,
"function_mode": 0
"sens": 5,
"level": "mid_low",
"delay": 0,
"output": "exist",
"exist": 0,
"dir": 1,
"safe": 5,
"fun_mode": 0
},
{
"ch": 4,
"sensitivity": 8,
"freq_level": "low",
"loop_delay": 10,
"output_mode": "leave_pulse",
"exist_mode": 15,
"direction_mode": 0,
"safe_mode": 0,
"function_mode": 0
"sens": 8,
"level": "low",
"delay": 10,
"output": "leave_pulse",
"exist": 15,
"dir": 0,
"safe": 0,
"fun_mode": 0
}
]
}
@@ -514,14 +514,14 @@ dld960/{dev_serial}/{direction}
| `auto_mode` | bool | 自动调频模式,默认 false |
| `channels` | array | 各路通道参数,1~4 路 |
| `channels[].ch` | uint8 | 通道号 1~4 |
| `channels[].sensitivity` | uint8 | 灵敏度 0~9,默认 7 |
| `channels[].freq_level` | string | `"high"`(33nF) / `"mid_high"`(43nF) / `"mid_low"`(66nF) / `"low"`(76nF) |
| `channels[].loop_delay` | uint8 | 延时时间,0~200(×0.1s),最大 20s |
| `channels[].output_mode` | string | `"exist"` / `"enter_pulse"` / `"leave_pulse"` / `"direction"` |
| `channels[].exist_mode` | uint8 | 存在方式,0=永久,非0=分钟数 |
| `channels[].direction_mode` | uint8 | 方向判别模式,0=触发,1~6=方向输出 |
| `channels[].safe_mode` | uint8 | 安全模式,0=关闭,非0=分钟数 |
| `channels[].function_mode` | uint8 | 功能模式 |
| `channels[].sens` | uint8 | sensitivity, 灵敏度 0~9,默认 7 |
| `channels[].level` | string | freq_level, `"high"`(33nF) / `"mid_high"`(43nF) / `"mid_low"`(66nF) / `"low"`(76nF) |
| `channels[].delay` | uint8 | loop_delay, 延时时间,0~200(×0.1s),最大 20s |
| `channels[].output` | string | exist_mode, `"exist"` / `"enter_pulse"` / `"leave_pulse"` / `"direction"` |
| `channels[].exist` | uint8 | output_mode, 存在方式,0=永久,非0=分钟数 |
| `channels[].dir` | uint8 | direction_mode, 方向判别模式,0=触发,1~6=方向输出 |
| `channels[].safe` | uint8 | safe_mode, 安全模式,0=关闭,非0=分钟数 |
| `channels[].fun_mode` | uint8 | function_mode, 功能模式 |
**响应:**
@@ -563,17 +563,17 @@ dld960/{dev_serial}/{direction}
"channels": [
{
"ch": 1,
"sensitivity": 7,
"freq_level": "high",
"loop_delay": 0,
"output_mode": "exist",
"exist_mode": 0,
"direction_mode": 0,
"safe_mode": 0,
"function_mode": 0,
"freq_initial": 105300,
"freq_current": 105280,
"freq_diff": 20
"sens": 7,
"level": "high",
"delay": 0,
"output": "exist",
"exist": 0,
"dir": 0,
"safe": 0,
"fun_mode": 0,
"f_initial": 105300,
"f_current": 105280,
"diff": 20
}
]
}
@@ -582,9 +582,9 @@ dld960/{dev_serial}/{direction}
| 额外字段 | 类型 | 单位 | 说明 |
|----------|------|------|------|
| `freq_initial` | uint32 | Hz | 初始频率 |
| `freq_current` | uint32 | Hz | 当前实时频率 |
| `freq_diff` | uint32 | Hz | 频率变化量(绝对值) |
| `f_initial` | uint32 | Hz | freq_initial, 初始频率 |
| `f_current` | uint32 | Hz | freq_current, 当前实时频率 |
| `diff` | uint32 | Hz | 变化量(绝对值) |
## 4.15 设置主动上报 `report_config`
@@ -639,13 +639,13 @@ dld960/{dev_serial}/{direction}
"channels": [
{
"ch": 1,
"freq_level": "high",
"has_car": false,
"level": "high",
"iscar": false,
"loop_ok": true,
"freq_current": 105280,
"freq_diff": 20,
"sensitivity": 7,
"condition": 0,
"freq": 105280,
"diff": 20,
"sens": 7,
"cndtn": 0,
"misc": {
"type": "time",
"value": 0
@@ -653,13 +653,13 @@ dld960/{dev_serial}/{direction}
},
{
"ch": 2,
"freq_level": "mid_high",
"has_car": true,
"level": "mid_high",
"iscar": true,
"loop_ok": true,
"freq_current": 98700,
"freq_diff": 1500,
"sensitivity": 7,
"condition": 2,
"freq": 98700,
"diff": 1500,
"sens": 7,
"cndtn": 2,
"misc": {
"type": "time",
"value": 350
@@ -667,13 +667,13 @@ dld960/{dev_serial}/{direction}
},
{
"ch": 3,
"freq_level": "mid_low",
"has_car": false,
"level": "mid_low",
"iscar": false,
"loop_ok": false,
"freq_current": 0,
"freq_diff": 0,
"sensitivity": 5,
"condition": 0,
"freq": 0,
"diff": 0,
"sens": 5,
"cndtn": 0,
"misc": {
"type": "cut_count",
"value": 3
@@ -681,13 +681,13 @@ dld960/{dev_serial}/{direction}
},
{
"ch": 4,
"freq_level": "low",
"has_car": false,
"level": "low",
"iscar": false,
"loop_ok": true,
"freq_current": 62100,
"freq_diff": 5,
"sensitivity": 8,
"condition": 0,
"freq": 62100,
"diff": 5,
"sens": 8,
"cndtn": 0,
"misc": {
"type": "flow_count",
"value": 128
@@ -701,15 +701,15 @@ dld960/{dev_serial}/{direction}
| 通道字段 | 类型 | 说明 |
|----------|------|------|
| `ch` | uint8 | 通道号 1~4 |
| `freq_level` | string | 线圈高低频档位 |
| `has_car` | bool | 是否有车 |
| `level` | string | freq_level 线圈高低频档位 |
| `iscar` | bool | 是否有车 |
| `loop_ok` | bool | 线圈是否正常(false=断开) |
| `freq_current` | uint32 | 当前频率 (Hz) |
| `freq_diff` | uint32 | 频率变化量 (Hz) |
| `sensitivity` | uint8 | 当前灵敏度等级 |
| `condition` | uint8 | 环境状态评估值(越大干扰越大) |
| `freq` | uint32 | 当前频率 (Hz) |
| `diff` | uint32 | 变化量 |
| `sens` | uint8 | sensitivity, 当前灵敏度等级 |
| `cndtn` | uint8 | condition, 环境状态评估值(越大干扰越大) |
| `misc.type` | string | `"time"`(时间量) / `"cut_count"`(断开次数) / `"flow_count"`(车流量) |
| `misc.value` | uint32 | 杂项数值(时间量单位 5ms) |
| `misc.value` | uint32 | 杂项数值(时间量单位 50ms |
## 5.2 事件上报 `event_report`
@@ -747,9 +747,9 @@ dld960/{dev_serial}/{direction}
| 事件类型 `type` | 说明 | `value` 含义 |
|----------------|------|-------------|
| `car_enter` | 车辆进入 | 0 |
| `car_leave` | 车辆离开 | 通过时间 (×5ms) |
| `car_leave` | 车辆离开 | 通过时间 (×50ms) |
| `loop_cut` | 线圈断开 | 0 |
| `loop_restore` | 线圈恢复 | 断开持续时长 (×5ms) |
| `loop_restore` | 线圈恢复 | 断开持续时长 (×50ms) |
## 5.3 设备心跳 `heartbeat`
@@ -785,3 +785,5 @@ dld960/{dev_serial}/{direction}
|------|----------|----------|--------|
| V1.00 | 2026-06-22 | 初始版本,基于串口协议 V1.01 | wangfq |
| V1.01 | 2026-07-07 | Topic 压缩为双主题(`{sn}/srv` + `{sn}/dev`),消息类型由 `cmd` 字段区分 | wangfq |
| V1.02 | 2026-07-09 | 缩写相关字段 | wangfq |