docs(network): add BLUFI provisioning reference guide

This commit is contained in:
cjiio committed 2026-09-15 19:44:54 +08:00
1 parent d3f8f9d13c
commit cd73a8a6f1
6 files changed
+115

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ This directory contains AI Passport engineering rules and reusable workflows, gr
- [firmware-layout.md](engineering/firmware-layout.md): default and user-defined partition layouts and merged-artifact validation.
- [coding-conventions.md](engineering/coding-conventions.md): source-code and resource conventions, including Chinese font integration, blank/boxed text troubleshooting, and display acceptance.
- [lvgl-chinese-fonts.md](engineering/lvgl-chinese-fonts.md): step-by-step CJK configuration, font generation/linking, fallback examples, glyph checks, and troubleshooting.
- [wifi-provisioning.md](engineering/wifi-provisioning.md): Bluetooth-based Wi-Fi setup using the BLUFI reference branch, the companion mini program, and integration checks.
## CI
+1
View File
@@ -26,6 +26,7 @@
- [firmware-layout.zh_CN.md](engineering/firmware-layout.zh_CN.md):默认/用户自定义分区布局与合并产物验证。
- [coding-conventions.zh_CN.md](engineering/coding-conventions.zh_CN.md):代码约定(语言风格、复用、注释、测试同步、资源约束等),包含中文字体接入、空白/方框排查与显示验收。
- [lvgl-chinese-fonts.zh_CN.md](engineering/lvgl-chinese-fonts.zh_CN.md):CJK 配置、字体生成/链接、fallback 示例、缺字检查和故障排查的分步指南。
- [wifi-provisioning.zh_CN.md](engineering/wifi-provisioning.zh_CN.md):参考 BLUFI 分支实现蓝牙 Wi-Fi 配网,包含配套小程序名称及接入检查。
## CI(ci)
@@ -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`.
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff. Show more