From 099349258be29f4a9bbffddcddabb5f040dceeb9 Mon Sep 17 00:00:00 2001 From: ozh Date: Wed, 22 Apr 2026 17:50:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(ble):=20=E6=94=AF=E6=8C=81=E5=A4=9A?= =?UTF-8?q?=E7=A7=8D=E8=93=9D=E7=89=99=E6=9C=8D=E5=8A=A1UUID=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 FFF4 服务UUID兼容性支持,适配不同固件版本 - 重构服务发现逻辑,支持多候选UUID匹配 - 添加详细的蓝牙协议状态调试日志 - 优化WiFi配置模块的日志输出和预延时机制 - 更新设备发现过滤器以支持新UUID格式 - 添加AGENTS.md和CLAUDE.md项目指导文件 - 重构认证模块增加调试日志功能 --- .claude/rules/frontend.md | 67 ++++++++++++++++++++++++++++++++++ .claude/rules/git-workflow.md | 5 +++ .claude/rules/test.md | 2 + AGENTS.md | 7 ++++ CLAUDE.md | 7 ++++ constants/bluetooth.js | 12 +++++- hooks/useBluetoothDiscovery.js | 26 ++++++++----- utils/ble/core/bleCore.js | 20 ++++++++-- utils/ble/core/controller.js | 4 +- utils/ble/modules/auth.js | 26 +++++-------- utils/ble/modules/wifi.js | 52 ++++++++------------------ 11 files changed, 160 insertions(+), 68 deletions(-) create mode 100644 .claude/rules/frontend.md create mode 100644 .claude/rules/git-workflow.md create mode 100644 .claude/rules/test.md create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/.claude/rules/frontend.md b/.claude/rules/frontend.md new file mode 100644 index 0000000..5117624 --- /dev/null +++ b/.claude/rules/frontend.md @@ -0,0 +1,67 @@ +# Project Overview + +This is a uni-app Vue3 smart home (智慧养老) application using uview-plus component library. + +- Use the new features of es6 +- Use the uniapp framework for small program development +- Added uview-plus component as UI component + +# Build & Run Commands + +Install dependencies with `npm install`. + +This repository does not define npm scripts; builds and previews are normally run through HBuilderX. Use HBuilderX for the active target platform: + +```bash +npm install +``` + +Typical local workflow: +- Open the project in HBuilderX and run to WeChat Mini Program or Android emulator/device. +- Use the built-in packaging flow for release builds. + +# Architecture + +## Module Organization +App entry files live at the repository root: `main.js`, `App.vue`, `pages.json`, and `manifest.json`. Feature pages are under `pages/` (`login`, `index`, `event`, `mine`, `device`). Shared business code is split across `api/`, `constants/`, `hooks/`, and `utils/`. Bluetooth logic is centralized in `utils/ble/`, with subfolders for `core/`, `modules/`, `parsers/`, `protocols/`, and `utils/`. Static assets go in `static/`; design and protocol notes live in `docs/`. + +## BLE Module (`utils/ble/`) +If you are unclear about the functions of the BLE Module, please refer to the `docs/unified-ble-flow.md` file. + +Unified Bluetooth Low Energy module for ED713/ED719 devices. Key files: + +- `core/bleCore.js` - Bluetooth core capabilities (connect/discover/read/write/notify/reconnect) +- `core/controller.js` - Standard flow orchestration (scan→connect→discover→auth) +- `core/packet.js` - A7 packet fragmentation +- `modules/auth.js` - Authentication flow (read MSG + write KEY) +- `modules/wifi.js` - WiFi configuration +- `modules/radar.js` - Radar control (start/stop/params) +- `protocols/profiles.js` - ED713/ED719 device profile differences + +The unified flow: `standardConnectFlow({ deviceId, key })` → `wifi.configureWifi(ssid, password)` → `radar.startRadarStream()` + +Profile differences: +- ED713: radar signature `0x7C`, supports narrow mode +- ED719: radar signature `0x67`, supports fall param 67 + +If modifications are made to the BLE Module, they shall be added to the `docs/unified-ble-flow.md` file!! + +## Authentication (`utils/auth.js`) + +Route guard system with `setupAuthInterceptors()`. Currently `AUTH_ENABLED = false` for development. Routes are defined in `constants/routes.js`. + +## Pages + +- `pages/login/index.vue` - Login page +- `pages/index/index.vue` - Home (tab) +- `pages/event/index.vue` - Events (tab) +- `pages/mine/index.vue` - Profile (tab) +- `pages/device/add.vue` - Add device +- `pages/device/config.vue` - Device config with BLE search + WiFi panel + +## Component Auto-import + +uview-plus components auto-imported via `pages.json` easycom config: `^u-(.*)` → `uview-plus/components/u-$1/u-$1.vue` + +## Coding Style & Naming Conventions +Follow the existing Vue SFC structure: `