feat(nimble): support vendor event mask set and vendor HCI event on nimble host

This commit is contained in:
Shreeyash
2025-03-07 12:19:24 +05:30
committed by Rahul Tank
parent 149eec704a
commit 0a221c0693
3 changed files with 41 additions and 0 deletions
+21
View File
@@ -30,6 +30,13 @@ typedef enum gap_status gap_status_t;
#define BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV 3
#define BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV 4
#define ESP_BLE_VENDOR_LEGACY_SCAN_REQ_EVT_MASK BIT(0)
#define ESP_BLE_VENDOR_CHAN_MAP_UPDATE_CMPL_EVT_MASK BIT(1)
#define ESP_BLE_VENDOR_TL_RUNNING_STATUS_EVT_MASK BIT(2)
#define ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT_MASK BIT(3)
#define ESP_BLE_VENDOR_CONNECT_IND_REQ_EVT_MASK BIT(4)
#define ESP_BLE_VENDOR_AUX_CONNECT_RSP_EVT_MASK BIT(5)
#if MYNEWT_VAL(BLE_ENABLE_CONN_REATTEMPT)
#ifdef CONFIG_BT_NIMBLE_MAX_CONN_REATTEMPT
#define MAX_REATTEMPT_ALLOWED CONFIG_BT_NIMBLE_MAX_CONN_REATTEMPT
@@ -274,6 +281,20 @@ int ble_gap_set_chan_select(uint8_t select);
int
ble_gap_dev_authorization(uint16_t conn_handle, bool authorized);
/**
* Sets the vendor-specific event mask for BLE host.
*
* This function configures the vendor-specific event mask, enabling or disabling
* specific vendor-defined events from being reported by the controller.
*
* @param event_mask Bitmask representing the events to enable.
*
* @return 0 on success;
* A nonzero value indicating an error if the command fails.
*/
int
ble_hs_send_vs_event_mask(uint32_t event_mask);
void ble_gap_rx_test_evt(const void *buf, uint8_t len);
void ble_gap_tx_test_evt(const void *buf, uint8_t len);
void ble_gap_end_test_evt(const void *buf, uint8_t len);
+13
View File
@@ -8663,6 +8663,19 @@ ble_gap_vs_hci_event(const void *buf, uint8_t len)
ble_gap_event_listener_call(&event);
}
int
ble_hs_send_vs_event_mask(uint32_t event_mask)
{
struct ble_hci_vs_set_event_mask_cp cmd;
/* Populate command */
cmd.event_mask = htole32(event_mask);
/* Send command via HCI */
return ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_SET_EVT_MASK,
&cmd, sizeof(cmd), NULL, 0);
}
#endif
int
+7
View File
@@ -1383,6 +1383,11 @@ struct ble_hci_vs_duplicate_exception_list_cp {
#define BLE_HCI_OCF_VS_SET_CHAN_SELECT (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0112))
#define BLE_HCI_OCF_VS_SET_EVT_MASK (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0116))
struct ble_hci_vs_set_event_mask_cp {
uint32_t event_mask;
} __attribute__((packed));
/* Command Specific Definitions */
/* --- Set controller to host flow control (OGF 0x03, OCF 0x0031) --- */
#define BLE_HCI_CTLR_TO_HOST_FC_OFF (0)
@@ -1807,6 +1812,8 @@ struct ble_hci_ev_vs_css_slot_changed {
#define BLE_HCI_VS_SUBEV_ID_LLCP_TRACE (0x17)
#define BLE_HCI_VS_SUBEV_LE_SLEEP_WAKE_UP (0xC3)
/* LE sub-event codes */
#define BLE_HCI_LE_SUBEV_CONN_COMPLETE (0x01)
struct ble_hci_ev_le_subev_conn_complete {