RTU_ALL_AI/docs/README.md

100 lines
5.9 KiB
Markdown
Raw 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.

# RTU_ALL_AI API 参考文档
> 生成日期: 2026-07-07
> 项目: RTU_ALL_AI — C/C++ 嵌入式通讯装置示例工程
---
## 文档索引
### 基础公共库 (public/)
| 模块 | 文档 | 语言 | 说明 |
|------|------|------|------|
| myBase.h | [API-myBase.md](public/API-myBase.md) | C 头文件 | 公共宏、类型常量、字节序转换 |
| liblist | [API-liblist.md](public/liblist/API-liblist.md) | 纯 C 头文件 | 侵入式双向循环链表 |
| liblog | [API-liblog.md](public/liblog/API-liblog.md) | 纯 C | 异步日志系统 |
| libfunc | [API-libfunc.md](public/libfunc/API-libfunc.md) | 纯 C | 65 个基础工具函数 |
| libmd5 | [API-libmd5.md](public/libmd5/API-libmd5.md) | 纯 C | MD5 消息摘要 (RFC 1321) |
| libtask | [API-libtask.md](public/libtask/API-libtask.md) | 纯 C | 定时器 + 事件 + 消息队列 |
| libdatacenter | [API-libdatacenter.md](public/libdatacenter/API-libdatacenter.md) | C 接口+C++ 内部 | 信号数据中心5种信号+事件队列) |
| libcJSON | [API-libcJSON.md](public/libcJSON/API-libcJSON.md) | 纯 C (开源库) | JSON 解析/生成 |
| libmy_xxhash | [API-libmy_xxhash.md](public/libmy_xxhash/API-libmy_xxhash.md) | 纯 C (开源库) | xxHash 快速哈希 |
| libxml | [API-libxml.md](public/libxml/API-libxml.md) | C 接口+C++ 内部 | XML 解析C接口包裹 tinyxml2 |
| libcmd | [API-libcmd.md](public/libcmd/API-libcmd.md) | C 接口+C++ 内部 | 命令注册/补全 + 内置 linenoise |
| libcomm | [API-libcomm.md](public/libcomm/API-libcomm.md) | C 接口+C++ 内部 | TCP/UDP/UART 通讯抽象层 |
### 通讯与协议库 (protocol/ — 阶段 2 计划)
```
┌──────────┐
│ myBase.h │ (颜色/大小端/类型常量)
└────┬─────┘
┌──────────────┼──────────────┐
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌──────────┐
│ liblist │ │ libfunc │ │ libmd5 │
│ (链表) │ │ (65函数)│ │ (MD5) │
└────┬────┘ └────┬────┘ └──────────┘
│ │
▼ ▼
┌─────────────────────────┐
│ liblog │ (异步日志)
│ (消息池+批量+文件轮转) │
└─────────────────────────┘
┌──────────┐ ┌──────────────┐
│ libcJSON │ │ libmy_xxhash │ (开源库)
└──────────┘ └──────┬───────┘
┌─────────────────────┼─────────────────────┐
│ ▼ │
│ ┌──────────┐ ┌──────────┐ ┌─────────┐ │
│ │ libtask │ │ libxml │ │ libcmd │ │ (P2库提前实现
│ │ (事件/ │ │ (C接口+ │ │ (命令 │ │ 供datacenter
│ │ 定时器) │ │ tinyxml2)│ │ 框架) │ │ 依赖)
│ └──────────┘ └────┬─────┘ └────┬────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────────────────────┐ │
│ │ libdatacenter │ │
│ │ (信号数据中心 5种信号类型) │ │
│ │ 依赖: libxml + libcmd │ │
│ │ + libmy_xxhash │ │
└──────────┴─────────────────────────────┘
┌──────────┐
│ myBase.h │
└────┬─────┘
┌──────────────────┐
│ libcomm │ (通讯抽象层)
│ TCP/UDP/UART │ 阶段 2 首个模块
│ epoll 异步事件 │
└────┬───┬────┬────┘
│ │ │
┌──────────┼───┘ └──────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌────────────┐
│libmodbus │ │lib60870 │ ... │libweb_server│ (协议栈)
│ (Modbus) │ │(IEC104) │ │ (Web 管理) │
└──────────┘ └──────────┘ └────────────┘
```
### 构建与编译
```bash
cd release
./build.sh # x86 本地编译
./build.sh arm # ARM 交叉编译
```
### 编码规范
详见项目内存 `/memories/code-style.md`
- 一行一语句,`{}` 独占行,`}` 后空行,`return` 前空行
- 运算符前后空格(`a + b`, `x << 8`),逗号分号后空格
- 结构体 `stru_` 前缀,枚举 `enum_` 前缀
- 注释使用 UTF-8 中文