Skip to content

Commit b715974

Browse files
committed
feat(bt/bluedroid): Report sniff interval to application layer
1 parent efc143b commit b715974

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,9 @@ typedef union {
440440
* @brief ESP_BT_GAP_MODE_CHG_EVT
441441
*/
442442
struct mode_chg_param {
443-
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
444-
esp_bt_pm_mode_t mode; /*!< PM mode*/
443+
esp_bd_addr_t bda; /*!< remote bluetooth device address */
444+
esp_bt_pm_mode_t mode; /*!< PM mode */
445+
uint16_t interval; /*!< Number of baseband slots. unit is 0.625ms */
445446
} mode_chg; /*!< mode change event parameter struct */
446447

447448
/**

components/bt/host/bluedroid/bta/dm/bta_dm_pm.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void bta_dm_init_pm(void)
7575
{
7676
memset(&bta_dm_conn_srvcs, 0x00, sizeof(bta_dm_conn_srvcs));
7777

78-
/* if there are no power manger entries, so not register */
78+
/* if there are no power manager entries, so not register */
7979
if (p_bta_dm_pm_cfg[0].app_id != 0) {
8080
bta_sys_pm_register((tBTA_SYS_CONN_CBACK *)bta_dm_pm_cback);
8181

@@ -694,9 +694,9 @@ static BOOLEAN bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE *p_peer_dev, UINT8 index)
694694
#endif
695695
{
696696
#if (BTM_SSR_INCLUDED == TRUE)
697-
/* Dont initiate Sniff if controller has alreay accepted
697+
/* Dont initiate Sniff if controller has already accepted
698698
* remote sniff params. This avoid sniff loop issue with
699-
* some agrresive headsets who use sniff latencies more than
699+
* some aggressive headsets who use sniff latencies more than
700700
* DUT supported range of Sniff intervals.*/
701701
if ((mode == BTM_PM_MD_SNIFF) && (p_peer_dev->info & BTA_DM_DI_ACP_SNIFF)) {
702702
APPL_TRACE_DEBUG("%s: already in remote initiate sniff", __func__);
@@ -917,7 +917,7 @@ void bta_dm_pm_btm_status(tBTA_DM_MSG *p_data)
917917
} else {
918918
#if (BTM_SSR_INCLUDED == TRUE)
919919
if (p_dev->prev_low) {
920-
/* need to send the SSR paramaters to controller again */
920+
/* need to send the SSR parameters to controller again */
921921
bta_dm_pm_ssr(p_dev->peer_bdaddr);
922922
}
923923
p_dev->prev_low = BTM_PM_STS_ACTIVE;
@@ -980,6 +980,7 @@ void bta_dm_pm_btm_status(tBTA_DM_MSG *p_data)
980980
) {
981981
tBTA_DM_SEC conn;
982982
conn.mode_chg.mode = p_data->pm_status.status;
983+
conn.mode_chg.interval = p_data->pm_status.value;
983984
bdcpy(conn.mode_chg.bd_addr, p_data->pm_status.bd_addr);
984985
bta_dm_cb.p_sec_cback(BTA_DM_PM_MODE_CHG_EVT, (tBTA_DM_SEC *)&conn);
985986
}

components/bt/host/bluedroid/bta/include/bta/bta_api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,7 @@ typedef struct {
10011001
typedef struct {
10021002
BD_ADDR bd_addr; /* BD address peer device. */
10031003
tBTA_PM_MODE mode; /* the new connection role */
1004+
UINT16 interval; /* Number of baseband slots */
10041005
} tBTA_DM_MODE_CHG;
10051006

10061007
typedef struct {

components/bt/host/bluedroid/btc/core/btc_dm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ static void btc_dm_pm_mode_chg_evt(tBTA_DM_MODE_CHG *p_mode_chg)
625625
msg->act = BTC_GAP_BT_MODE_CHG_EVT;
626626
memcpy(param.mode_chg.bda, p_mode_chg->bd_addr, ESP_BD_ADDR_LEN);
627627
param.mode_chg.mode = p_mode_chg->mode;
628+
param.mode_chg.interval= p_mode_chg->interval;
628629
memcpy(msg->arg, &param, sizeof(esp_bt_gap_cb_param_t));
629630

630631
ret = btc_inter_profile_call(msg);

examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
119119

120120
/* when GAP mode changed, this event comes */
121121
case ESP_BT_GAP_MODE_CHG_EVT:
122-
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_MODE_CHG_EVT mode: %d", param->mode_chg.mode);
122+
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_MODE_CHG_EVT mode: %d, interval: %.2f ms",
123+
param->mode_chg.mode, param->mode_chg.interval * 0.625);
123124
break;
124125
/* when ACL connection completed, this event comes */
125126
case ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT:

0 commit comments

Comments
 (0)