mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(bt/bluedroid): Report sniff interval to application layer
This commit is contained in:
parent
0a935f1c1b
commit
e5984120ac
@ -413,8 +413,9 @@ typedef union {
|
||||
* @brief ESP_BT_GAP_MODE_CHG_EVT
|
||||
*/
|
||||
struct mode_chg_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
esp_bt_pm_mode_t mode; /*!< PM mode*/
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address */
|
||||
esp_bt_pm_mode_t mode; /*!< PM mode */
|
||||
uint16_t interval; /*!< Number of baseband slots. unit is 0.625ms */
|
||||
} mode_chg; /*!< mode change event parameter struct */
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,7 @@ void bta_dm_init_pm(void)
|
||||
{
|
||||
memset(&bta_dm_conn_srvcs, 0x00, sizeof(bta_dm_conn_srvcs));
|
||||
|
||||
/* if there are no power manger entries, so not register */
|
||||
/* if there are no power manager entries, so not register */
|
||||
if (p_bta_dm_pm_cfg[0].app_id != 0) {
|
||||
bta_sys_pm_register((tBTA_SYS_CONN_CBACK *)bta_dm_pm_cback);
|
||||
|
||||
@ -694,9 +694,9 @@ static BOOLEAN bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE *p_peer_dev, UINT8 index)
|
||||
#endif
|
||||
{
|
||||
#if (BTM_SSR_INCLUDED == TRUE)
|
||||
/* Dont initiate Sniff if controller has alreay accepted
|
||||
/* Dont initiate Sniff if controller has already accepted
|
||||
* remote sniff params. This avoid sniff loop issue with
|
||||
* some agrresive headsets who use sniff latencies more than
|
||||
* some aggressive headsets who use sniff latencies more than
|
||||
* DUT supported range of Sniff intervals.*/
|
||||
if ((mode == BTM_PM_MD_SNIFF) && (p_peer_dev->info & BTA_DM_DI_ACP_SNIFF)) {
|
||||
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)
|
||||
} else {
|
||||
#if (BTM_SSR_INCLUDED == TRUE)
|
||||
if (p_dev->prev_low) {
|
||||
/* need to send the SSR paramaters to controller again */
|
||||
/* need to send the SSR parameters to controller again */
|
||||
bta_dm_pm_ssr(p_dev->peer_bdaddr);
|
||||
}
|
||||
p_dev->prev_low = BTM_PM_STS_ACTIVE;
|
||||
@ -980,6 +980,7 @@ void bta_dm_pm_btm_status(tBTA_DM_MSG *p_data)
|
||||
) {
|
||||
tBTA_DM_SEC conn;
|
||||
conn.mode_chg.mode = p_data->pm_status.status;
|
||||
conn.mode_chg.interval = p_data->pm_status.value;
|
||||
bdcpy(conn.mode_chg.bd_addr, p_data->pm_status.bd_addr);
|
||||
bta_dm_cb.p_sec_cback(BTA_DM_PM_MODE_CHG_EVT, (tBTA_DM_SEC *)&conn);
|
||||
}
|
||||
|
@ -997,6 +997,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
tBTA_PM_MODE mode; /* the new connection role */
|
||||
UINT16 interval; /* Number of baseband slots */
|
||||
} tBTA_DM_MODE_CHG;
|
||||
|
||||
typedef struct {
|
||||
|
@ -625,6 +625,7 @@ static void btc_dm_pm_mode_chg_evt(tBTA_DM_MODE_CHG *p_mode_chg)
|
||||
msg->act = BTC_GAP_BT_MODE_CHG_EVT;
|
||||
memcpy(param.mode_chg.bda, p_mode_chg->bd_addr, ESP_BD_ADDR_LEN);
|
||||
param.mode_chg.mode = p_mode_chg->mode;
|
||||
param.mode_chg.interval= p_mode_chg->interval;
|
||||
memcpy(msg->arg, ¶m, sizeof(esp_bt_gap_cb_param_t));
|
||||
|
||||
ret = btc_inter_profile_call(msg);
|
||||
|
@ -99,7 +99,8 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
|
||||
/* when GAP mode changed, this event comes */
|
||||
case ESP_BT_GAP_MODE_CHG_EVT:
|
||||
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_MODE_CHG_EVT mode: %d", param->mode_chg.mode);
|
||||
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_MODE_CHG_EVT mode: %d, interval: %.2f ms",
|
||||
param->mode_chg.mode, param->mode_chg.interval * 0.625);
|
||||
break;
|
||||
/* when ACL connection completed, this event comes */
|
||||
case ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT:
|
||||
|
Loading…
Reference in New Issue
Block a user