feat(ble): 添加快速广告配置并优化连接状态检查

添加了BLE快速广告相关的配置选项到prj.conf中,包括快速广告间隔、超时等参数。
同时修复了ble_bond_module中的连接状态检查逻辑,避免在挂起后保留LE连接时进行不必要的
断开操作。

在ble_hid_module和usb_hid_module中改进了HID传输事件处理逻辑,确保在相应模式未激活
或连接未建立时正确提交传输完成事件,提高了设备响应的准确性。

BREAKING CHANGE: 广告行为在连接保持情况下有所改变,可能影响配对流程。
This commit is contained in:
2026-03-28 13:59:59 +08:00
parent 64fec3a19e
commit 277462a8fe
4 changed files with 48 additions and 8 deletions

View File

@@ -711,11 +711,17 @@ static bool handle_wake_up_event(void)
static bool handle_hid_tx_event(const struct hid_tx_event *event)
{
if (!g_usb_hid.policy.usb_mode_selected || !usb_hid_stack_is_active())
if (!g_usb_hid.policy.usb_mode_selected)
{
return false;
}
if (!usb_hid_stack_is_active())
{
submit_usb_tx_done(event->kind, false);
return false;
}
if (event->kind == HID_TX_KIND_BOOT)
{
const uint8_t *payload = hid_tx_event_get_data(event);
@@ -724,6 +730,7 @@ static bool handle_hid_tx_event(const struct hid_tx_event *event)
if (g_usb_hid.current_protocol != HID_PROTO_BOOT)
{
submit_usb_tx_done(HID_TX_KIND_BOOT, false);
return false;
}
@@ -762,6 +769,7 @@ static bool handle_hid_tx_event(const struct hid_tx_event *event)
*/
if (g_usb_hid.current_protocol != HID_PROTO_REPORT)
{
submit_usb_tx_done(HID_TX_KIND_REPORT, false);
return false;
}