kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/btdm_change_scan_mode_after_conn_or_disconn' into 'master'
component/bt: Change scan mode after connected or disconnected See merge request idf/esp-idf!2402pull/1880/merge
commit
c584f624b5
|
@ -97,6 +97,11 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
|
||||||
uint8_t *bda = a2d->conn_stat.remote_bda;
|
uint8_t *bda = a2d->conn_stat.remote_bda;
|
||||||
ESP_LOGI(BT_AV_TAG, "A2DP connection state: %s, [%02x:%02x:%02x:%02x:%02x:%02x]",
|
ESP_LOGI(BT_AV_TAG, "A2DP connection state: %s, [%02x:%02x:%02x:%02x:%02x:%02x]",
|
||||||
m_a2d_conn_state_str[a2d->conn_stat.state], bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);
|
m_a2d_conn_state_str[a2d->conn_stat.state], bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);
|
||||||
|
if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
||||||
|
esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
|
||||||
|
} else if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_CONNECTED){
|
||||||
|
esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_NONE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESP_A2D_AUDIO_STATE_EVT: {
|
case ESP_A2D_AUDIO_STATE_EVT: {
|
||||||
|
|
|
@ -386,7 +386,7 @@ static void bt_app_av_state_connecting(uint16_t event, void *param)
|
||||||
ESP_LOGI(BT_AV_TAG, "a2dp connected");
|
ESP_LOGI(BT_AV_TAG, "a2dp connected");
|
||||||
m_a2d_state = APP_AV_STATE_CONNECTED;
|
m_a2d_state = APP_AV_STATE_CONNECTED;
|
||||||
m_media_state = APP_AV_MEDIA_STATE_IDLE;
|
m_media_state = APP_AV_MEDIA_STATE_IDLE;
|
||||||
|
esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_NONE);
|
||||||
} else if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
} else if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
||||||
m_a2d_state = APP_AV_STATE_UNCONNECTED;
|
m_a2d_state = APP_AV_STATE_UNCONNECTED;
|
||||||
}
|
}
|
||||||
|
@ -482,6 +482,7 @@ static void bt_app_av_state_connected(uint16_t event, void *param)
|
||||||
if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
||||||
ESP_LOGI(BT_AV_TAG, "a2dp disconnected");
|
ESP_LOGI(BT_AV_TAG, "a2dp disconnected");
|
||||||
m_a2d_state = APP_AV_STATE_UNCONNECTED;
|
m_a2d_state = APP_AV_STATE_UNCONNECTED;
|
||||||
|
esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -515,6 +516,7 @@ static void bt_app_av_state_disconnecting(uint16_t event, void *param)
|
||||||
if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
||||||
ESP_LOGI(BT_AV_TAG, "a2dp disconnected");
|
ESP_LOGI(BT_AV_TAG, "a2dp disconnected");
|
||||||
m_a2d_state = APP_AV_STATE_UNCONNECTED;
|
m_a2d_state = APP_AV_STATE_UNCONNECTED;
|
||||||
|
esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue