feat(events): 添加传输策略事件支持

添加了新的 transport_policy_event 事件类型,用于管理 HID
传输策略和蓝牙配置文件策略。该事件包含源模式、HID 传输策
略和蓝牙配置文件策略三个枚举值,并提供了相应的提交函数
和日志记录功能。

BREAKING CHANGE: 将原有的 mode_switch_event 替换为更具体的
transport_policy_event,相关模块需要更新以使用新的事件类
型。
This commit is contained in:
2026-04-23 09:48:06 +08:00
parent a11f4c0110
commit 6a03df1b39
6 changed files with 289 additions and 54 deletions

View File

@@ -0,0 +1,42 @@
#ifndef BLINKY_TRANSPORT_POLICY_EVENT_H_
#define BLINKY_TRANSPORT_POLICY_EVENT_H_
#include <app_event_manager.h>
#include "mode_switch_event.h"
enum hid_transport_policy {
HID_TRANSPORT_POLICY_NONE = 0,
HID_TRANSPORT_POLICY_USB,
HID_TRANSPORT_POLICY_BLE,
};
enum ble_profile_policy {
BLE_PROFILE_POLICY_NONE = 0,
BLE_PROFILE_POLICY_GENERAL,
BLE_PROFILE_POLICY_DONGLE,
};
struct transport_policy_event {
struct app_event_header header;
enum mode_switch_mode source_mode;
enum hid_transport_policy hid_transport;
enum ble_profile_policy ble_profile;
};
APP_EVENT_TYPE_DECLARE(transport_policy_event);
static inline void submit_transport_policy_event(
enum mode_switch_mode source_mode,
enum hid_transport_policy hid_transport,
enum ble_profile_policy ble_profile)
{
struct transport_policy_event *event = new_transport_policy_event();
event->source_mode = source_mode;
event->hid_transport = hid_transport;
event->ble_profile = ble_profile;
APP_EVENT_SUBMIT(event);
}
#endif /* BLINKY_TRANSPORT_POLICY_EVENT_H_ */