feat: 添加蓝牙多槽位绑定支持模块
- 新增 ble_bond_multi_module.c 实现多槽位蓝牙绑定管理功能 - 添加 ble_bond_multi_event 事件系统支持槽位状态广播 - 在 CMakeLists.txt 中注册新模块和事件源文件 - 更新 Kconfig 配置添加 BLINKY_BLE_BOND_MULTI 选项 - 修改 prj.conf 配置支持 4 个配对设备和 5 个身份标识 - 关闭默认 CAF ble_bond 模块使用自定义实现 - 更新 ui_settings_controller.h 接口支持槽位元数据设置 - 在 display_module.c 中添加事件订阅刷新UI显示 - 编写详细的设计文档 ble_multi_slot_design.md
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
#include <caf/events/power_event.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/sys/util.h>
|
||||
|
||||
#include "ble_bond_multi_event.h"
|
||||
#include "encoder_event.h"
|
||||
#include "module_lifecycle.h"
|
||||
#include "settings_mode_event.h"
|
||||
@@ -157,6 +159,22 @@ static bool handle_theme_rgb_update_event(
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool handle_ble_bond_multi_event(
|
||||
const struct ble_bond_multi_event *event)
|
||||
{
|
||||
ui_settings_ble_set_current_slot(event->current_slot);
|
||||
|
||||
for (uint8_t i = 0U; i < ARRAY_SIZE(event->slots); i++) {
|
||||
ui_settings_ble_set_slot_meta(i + 1U, &event->slots[i]);
|
||||
}
|
||||
|
||||
if (ctx.active) {
|
||||
ui_settings_controller_refresh(false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool app_event_handler(const struct app_event_header *aeh)
|
||||
{
|
||||
if (is_click_event(aeh)) {
|
||||
@@ -172,6 +190,11 @@ static bool app_event_handler(const struct app_event_header *aeh)
|
||||
cast_theme_rgb_update_event(aeh));
|
||||
}
|
||||
|
||||
if (is_ble_bond_multi_event(aeh)) {
|
||||
return handle_ble_bond_multi_event(
|
||||
cast_ble_bond_multi_event(aeh));
|
||||
}
|
||||
|
||||
if (is_module_state_event(aeh)) {
|
||||
const struct module_state_event *event = cast_module_state_event(aeh);
|
||||
|
||||
@@ -206,5 +229,6 @@ APP_EVENT_SUBSCRIBE(MODULE, click_event);
|
||||
APP_EVENT_SUBSCRIBE(MODULE, encoder_event);
|
||||
APP_EVENT_SUBSCRIBE(MODULE, module_state_event);
|
||||
APP_EVENT_SUBSCRIBE(MODULE, theme_rgb_update_event);
|
||||
APP_EVENT_SUBSCRIBE(MODULE, ble_bond_multi_event);
|
||||
APP_EVENT_SUBSCRIBE_EARLY(MODULE, power_down_event);
|
||||
APP_EVENT_SUBSCRIBE(MODULE, wake_up_event);
|
||||
|
||||
Reference in New Issue
Block a user