LED-Germany/03_Flash_and_Tools/QR_Guide_CN.md
2026-02-26 09:59:27 +08:00

86 lines
2.0 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.

# QR 码/配网码生成说明Matter Onboarding Codes
本目录已包含一个可直接使用的脚本,用于生成/解析 Matter 的:
- **QR Code 字符串**(以 `MT:` 开头)
- **Manual Pairing Code**11位或21位数字
对应文件:
- `SetupPayload.py`
- `Base38.py`
- 依赖列表:`requirements.setuppayload.txt`
---
## 1. 安装 Python 依赖
在 PowerShell 中进入本目录:
```powershell
cd D:\ESP-LED\Deliverable\03_Flash_and_Tools
python -m pip install -r .\requirements.setuppayload.txt
```
---
## 2. 生成配网码(推荐用法)
### 2.1 生成(仅标准 flow
```powershell
python .\SetupPayload.py generate -d 3840 -p 20202021
```
输出示例:
- `Manualcode : 34970112332`
- `QRCode : MT:...`
### 2.2 生成(带 VID/PID
当 commissioning flow 非 0 时,会把 VID/PID 编进 manual code
```powershell
python .\SetupPayload.py generate -d 3840 -p 20202021 -cf 2 -vid 65521 -pid 32768 -dm 2
```
参数说明:
- `-d` / `--discriminator`0..4095
- `-p` / `--passcode`1..0x5F5E0FE
- `-vid` / `--vendor-id`0..65535
- `-pid` / `--product-id`0..65535
- `-dm` / `--discovery-cap-bitmask`
- 0: SoftAP
- 1: BLE
- 2: OnNetwork
- 默认 4脚本里描述为 OnNetwork不同实现可能有组合值
- `-cf` / `--commissioning-flow`
- 0: Standard
- 1: User-Intent
- 2: Custom
---
## 3. 解析配网码
解析 QR 字符串:
```powershell
python .\SetupPayload.py parse "MT:00000CQM00KA0648G00"
```
解析 Manual pairing code
```powershell
python .\SetupPayload.py parse 34970112332
```
---
## 4. 交付说明(测试数据 vs 量产数据)
当前工程处于开发/演示阶段,通常使用测试用的 VID/PID/证书/配网参数:
- 可以用于演示配网与控制。
- 若后续甲方申请 CSA 认证并进入量产:
- 需要使用正式 VID/PID
- 每台设备需要唯一的出厂数据(如 DAC/证书链、唯一 passcode/discriminator 或出厂注入策略)
- 通常需要重新生成 QR 并恢复出厂重新配网(属正常流程)