docs(network): add BLUFI provisioning reference guide
This commit is contained in:
1 parent
d3f8f9d13c
commit
cd73a8a6f1
6 files changed
+115
No files matched your search
@@ -0,0 +1,59 @@
|
||||
<p align="right">
|
||||
<a href="wifi-provisioning.zh_CN.md">简体中文</a> · <strong>English</strong>
|
||||
</p>
|
||||
|
||||
# Wi-Fi Connection via Bluetooth Provisioning
|
||||
|
||||
When a user needs the device to connect to a Wi-Fi network, the
|
||||
[`demo/blufi-provisioning` branch](https://github.com/FoloToy/ai-passport/tree/demo/blufi-provisioning)
|
||||
provides a reference for Bluetooth-based Wi-Fi setup. The phone supplies the
|
||||
SSID and password over BLE using BLUFI; the device connects as a Wi-Fi station
|
||||
and reports connection status. Bluetooth carries the provisioning exchange,
|
||||
not the application's Internet traffic.
|
||||
|
||||
This is an optional application reference. The current `main` Wi-Fi demo only
|
||||
scans networks; it does not implement connection or provisioning. Do not enable
|
||||
networking for applications that do not need it.
|
||||
|
||||
## Mini program name
|
||||
|
||||
Use the companion mini program identified by the
|
||||
[exact Chinese search name](wifi-provisioning.zh_CN.md#mini-program-name).
|
||||
Keep that name unchanged in setup instructions rather than inventing a
|
||||
translated search name. It is the mini program's name, not the device's BLE
|
||||
advertising name. The reference firmware advertises as `BLUFI_FoloPassport`.
|
||||
|
||||
The intended flow is to open provisioning on the device, enable Bluetooth and
|
||||
the required permissions on the phone, open the mini program, select the target
|
||||
device, and provide a 2.4 GHz Wi-Fi network's credentials. Confirm that the
|
||||
device obtains an IP address, then test the application's actual network
|
||||
request; a successful BLE connection alone does not prove Internet access.
|
||||
|
||||
## Code to inspect
|
||||
|
||||
- [`main/demo_blufi.c`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/main/demo_blufi.c): BLUFI callbacks, Wi-Fi scanning/connection, credential handling, status reporting, and lifecycle.
|
||||
- [`main/demo_blufi_security.c`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/main/demo_blufi_security.c) and its header: BLUFI security negotiation callbacks; do not discard them when extracting the example.
|
||||
- [`main/demo_radio.c`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/main/demo_radio.c): shared initialization of NVS, `esp_netif`, and the default event loop.
|
||||
- [`main/CMakeLists.txt`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/main/CMakeLists.txt) and [`sdkconfig.defaults`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/sdkconfig.defaults): source registration, dependencies, NimBLE/BLUFI, and cryptographic configuration. Copying a single C file is not sufficient.
|
||||
|
||||
## Integration and acceptance
|
||||
|
||||
Start from the application's current baseline, record the reference commit,
|
||||
and adapt only the relevant networking logic. Do not merge the entire demo or
|
||||
overwrite current BSP, partitions, or configuration with the branch's older
|
||||
versions. Implement the application's own UI and keep provisioning state,
|
||||
tasks, and Wi-Fi/BLE services in the application layer.
|
||||
|
||||
Define provisioning entry/exit, timeouts, retry limits, credential persistence,
|
||||
and an explicit way to clear saved credentials. Never log or commit Wi-Fi
|
||||
passwords. Preserve LVGL locking, non-blocking callbacks, and cleanup of tasks
|
||||
and event handlers; budget internal RAM for concurrent Wi-Fi, BLE, and UI use.
|
||||
The example is not a complete production authorization or security design.
|
||||
|
||||
Run the [validation gate](build-and-test.md), then follow the
|
||||
[on-device testing handoff](../ai-guide.md#offer-on-device-testing). Test with
|
||||
the named mini program: discovery, successful provisioning, wrong-password and
|
||||
unavailable-network failures, reconnect/restart behavior, credential clearing,
|
||||
repeated entry/exit, and an actual application network request. Build success
|
||||
does not prove mini program compatibility or on-device networking; keep
|
||||
unperformed checks under `Unverified`.
|
||||
@@ -0,0 +1,52 @@
|
||||
<p align="right">
|
||||
<strong>简体中文</strong> · <a href="wifi-provisioning.md">English</a>
|
||||
</p>
|
||||
|
||||
# 通过蓝牙配网连接 Wi-Fi
|
||||
|
||||
当用户需要设备通过 Wi-Fi 连接网络时,可以参考
|
||||
[`demo/blufi-provisioning` 分支](https://github.com/FoloToy/ai-passport/tree/demo/blufi-provisioning)
|
||||
的代码实现蓝牙配网。手机通过 BLE 上的 BLUFI 协议发送 Wi-Fi 名称(SSID)和
|
||||
密码,设备以 Wi-Fi STA 模式连接网络并回报连接状态。蓝牙用于传递配网信息,
|
||||
不是承载应用的互联网流量。
|
||||
|
||||
这是可选的应用参考。当前 `main` 的 Wi-Fi demo 仅扫描网络,并未实现联网或
|
||||
蓝牙配网;没有联网需求的应用不必启用网络功能。
|
||||
|
||||
<a id="mini-program-name"></a>
|
||||
|
||||
## 小程序名称
|
||||
|
||||
配套小程序的准确名称为:**蓝牙配网-FoloToy AI PASSPORT**。
|
||||
|
||||
向用户说明或搜索小程序时,请使用上述完整名称,不要自行翻译或改写。
|
||||
这是小程序名称,不是设备的蓝牙广播名;参考固件的广播名为
|
||||
`BLUFI_FoloPassport`。
|
||||
|
||||
预期流程:设备进入配网状态,手机打开蓝牙并授予所需权限,打开该小程序,
|
||||
选择目标设备,提供 2.4 GHz Wi-Fi 的名称和密码。确认设备取得 IP 地址后,
|
||||
再验证应用实际需要的网络请求;仅蓝牙连接成功不能证明能够访问互联网。
|
||||
|
||||
## 代码参考入口
|
||||
|
||||
- [`main/demo_blufi.c`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/main/demo_blufi.c):BLUFI 回调、Wi-Fi 扫描与连接、凭据处理、状态回报和生命周期。
|
||||
- [`main/demo_blufi_security.c`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/main/demo_blufi_security.c) 及其头文件:BLUFI 安全协商回调,提取示例时不要丢弃这些逻辑。
|
||||
- [`main/demo_radio.c`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/main/demo_radio.c):NVS、`esp_netif` 和默认事件循环的共享初始化。
|
||||
- [`main/CMakeLists.txt`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/main/CMakeLists.txt) 和 [`sdkconfig.defaults`](https://github.com/FoloToy/ai-passport/blob/demo/blufi-provisioning/sdkconfig.defaults):源文件注册、依赖、NimBLE/BLUFI 和加密配置。不能只复制单个 C 文件就认为完成接入。
|
||||
|
||||
## 接入与验收
|
||||
|
||||
从应用当前基线出发,记录参考提交,仅移植适用的联网逻辑。不要直接合并整个
|
||||
demo,也不要用该分支的旧版 BSP、分区表或配置覆盖当前版本。重新实现应用
|
||||
自己的界面,将配网状态、任务及 Wi-Fi/BLE 服务放在应用层。
|
||||
|
||||
明确配网入口与退出、超时、重试上限、凭据持久化及主动清除凭据的方式。
|
||||
禁止记录或提交 Wi-Fi 密码。保留 LVGL 锁、非阻塞回调、任务与事件处理器清理
|
||||
机制,并评估 Wi-Fi、BLE 和 UI 同时运行的内部 RAM 占用。示例不等于完整的
|
||||
生产环境授权或安全设计。
|
||||
|
||||
运行[验证门禁](build-and-test.zh_CN.md),再遵循
|
||||
[真机测试交接流程](../ai-guide.zh_CN.md#主动询问真机测试)。使用上述小程序
|
||||
验证:发现设备、成功配网、密码错误与网络不可用、重连与重启、清除凭据、
|
||||
反复进入退出配网,以及应用实际需要的网络请求。编译成功不能证明小程序
|
||||
兼容性或实机联网正常;未执行的检查列入 `Unverified`。
|
||||
Reference in new issue
Block a user