添加了新的 transport_policy_event 事件类型,用于管理 HID 传输策略和蓝牙配置文件策略。该事件包含源模式、HID 传输策 略和蓝牙配置文件策略三个枚举值,并提供了相应的提交函数 和日志记录功能。 BREAKING CHANGE: 将原有的 mode_switch_event 替换为更具体的 transport_policy_event,相关模块需要更新以使用新的事件类 型。
43 lines
1.0 KiB
C
43 lines
1.0 KiB
C
#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_ */
|