mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/a2dp_source_app_state_error_v5.1' into 'release/v5.1'
bt: Fixed the issue that the a2dp source would not send the media start command due to the connection initiated by the peer device(v5.1) See merge request espressif/esp-idf!23557
This commit is contained in:
commit
2010d70892
@ -319,7 +319,8 @@ static void bt_av_hdl_stack_evt(uint16_t event, void *p_param)
|
||||
esp_a2d_register_callback(&bt_app_a2d_cb);
|
||||
esp_a2d_source_register_data_callback(bt_app_a2d_data_cb);
|
||||
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
|
||||
/* Avoid the state error of s_a2d_state caused by the connection initiated by the peer device. */
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_NON_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
|
||||
|
||||
ESP_LOGI(BT_AV_TAG, "Starting device discovery...");
|
||||
s_a2d_state = APP_AV_STATE_DISCOVERING;
|
||||
@ -437,7 +438,6 @@ static void bt_app_av_state_connecting_hdlr(uint16_t event, void *param)
|
||||
ESP_LOGI(BT_AV_TAG, "a2dp connected");
|
||||
s_a2d_state = APP_AV_STATE_CONNECTED;
|
||||
s_media_state = APP_AV_MEDIA_STATE_IDLE;
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_NON_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
|
||||
} else if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
||||
s_a2d_state = APP_AV_STATE_UNCONNECTED;
|
||||
}
|
||||
@ -549,7 +549,6 @@ static void bt_app_av_state_connected_hdlr(uint16_t event, void *param)
|
||||
if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
||||
ESP_LOGI(BT_AV_TAG, "a2dp disconnected");
|
||||
s_a2d_state = APP_AV_STATE_UNCONNECTED;
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -591,7 +590,6 @@ static void bt_app_av_state_disconnecting_hdlr(uint16_t event, void *param)
|
||||
if (a2d->conn_stat.state == ESP_A2D_CONNECTION_STATE_DISCONNECTED) {
|
||||
ESP_LOGI(BT_AV_TAG, "a2dp disconnected");
|
||||
s_a2d_state = APP_AV_STATE_UNCONNECTED;
|
||||
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user