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

This commit is contained in:
Shreeyash
2025-03-15 16:55:57 +05:30
committed by Rahul Tank
parent c67396bad6
commit d6fbbc7d55
3 changed files with 41 additions and 0 deletions
+21
View File
@@ -24,6 +24,13 @@ enum gap_status {
typedef enum gap_status gap_status_t;
#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
@@ -110,6 +117,20 @@ int ble_gap_duplicate_exception_list(uint8_t subcode, uint8_t type, uint8_t *val
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
@@ -7987,6 +7987,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
@@ -1199,6 +1199,11 @@ struct ble_hci_vs_duplicate_exception_list_cp {
#define BLE_HCI_OCF_VS_LEGACY_ADV_CLEAR (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x010C))
#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)
@@ -1604,6 +1609,8 @@ struct ble_hci_ev_vendor_debug {
uint8_t data[0];
} __attribute__((packed));
#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 {