Files
softbus_OPC/docs/edge_device_setup.md
flower_linux 628ccf1409 phase 2 serial
2026-06-12 18:34:49 +08:00

61 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
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.
# Edge 设备配置指南
## 配置目录
| 目录 | 用途 |
|------|------|
| `config/edge/` | 边缘设备本地配置(物理层 + 可选本地绑定子集) |
| `config/daemon/` | 核心守护进程配置逻辑点、全局绑定、OPC 主题规则) |
## 双域配置
| 文件 | 目录 | 职责 |
|------|------|------|
| `edge.json` | `config/edge/` | edge 入口uplink 地址、子配置文件路径 |
| `physical_channels.json` | `config/edge/` | 串口/网络接口 |
| `physical_devices.json` | `config/edge/` | 从站、寄存器、物理点 ID |
| `bindings_local.json` | `config/edge/` | 可选,本 edge 绑定子集(校验/本地调试) |
| `logical_points.json` | `config/daemon/` | OPC/业务语义 |
| `bindings_global.json` | `config/daemon/` | 物理点 ↔ 逻辑点 + edgeId 路由 |
| `topic_rule.json` | `config/daemon/` | 总线主题模板 |
| `point_table.json` | `config/daemon/` | **遗留**全量点表,仅 daemon 兼容加载 |
edge **不加载** `logical_points.json``point_table.json` 或全量 `bindings_global`;下行命令由 daemon 解析后携带 `physicalPointId``edgeId`
## 已知设备流程
1. edge编辑 `config/edge/physical_channels.json``config/edge/physical_devices.json`
2. daemon编辑 `config/daemon/logical_points.json`
3. daemon编辑 `config/daemon/bindings_global.json`(含 `edgeId``scale`
4. 启动:`softbus_daemon --logical-points config/daemon/logical_points.json --bindings-global config/daemon/bindings_global.json`
5. 启动:`softbus_edge --config config/edge/edge.json`
6. 热加载:`kill -HUP <daemon-pid>``kill -HUP <edge-pid>`
## 未知设备(物理先行)
1. 仅配置 `physical_devices.json`,物理点 ID 如 `phy_modbus_s1_r40001`
2. edge 启动后 daemon 收到 `edge/raw/unbound/*` 主题数据
3. 后补 `logical_points.json``bindings_global.json`HUP daemon 即可打通 OPC
## libmodbus
构建时自动选择:
1. **系统包**(优先):`sudo apt install libmodbus-dev`
2. **vendor**(默认回退):`third_party/libmodbus` v3.1.10 静态编译进 `softbus_edge`
强制使用 vendor
```bash
cmake -B build -DSOFTBUS_FORCE_VENDOR_LIBMODBUS=ON
cmake --build build
```
串口权限:`sudo usermod -aG dialout $USER` 后重新登录。
## Mock 模式
```bash
./build/bin/softbus_edge --config config/edge/edge.json --mock
```