si-m1-face-package/Documentation~/SDK_Mock_And_Testing.zh-CN.md

37 lines
927 B
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.

# Mock 与测试
English documentation: [SDK_Mock_And_Testing.md](SDK_Mock_And_Testing.md).
## Editor Mock
无真实硬件进行 Editor 联调时,在 `FaceSdkSettings` 中启用:
```text
Use Mock In Editor = true
```
启用后,SDK 在 Unity Editor 中使用 `MockFaceModuleTransport`,不会打开真实串口。
Mock 模式适用于:
- UI 流程测试
- 命令回调测试
- 用户列表显示测试
- 基础录入和验证流程测试
## 真实硬件验证
验证真实 SI-M1 硬件时:
1. 设置 `Use Mock In Editor = false`。
2. 配置 `Editor Port Name`、`Editor Baud Rate` 和 `Editor Read Buffer Size`。
3. 打开包含一个 `FaceModuleManager` 的场景。
4. 调用 `Open()`。
5. 等待 `WaitReadyAsync()` 或处理 `OnReady`。
## 日志
启用 `RawLogEnabled` 后,可以通过 `OnRawLog` 接收原始 TX/RX 日志。
启用 `DebugLogEnabled` 后,可以输出 SDK 层 Debug 日志。