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!2402
pull/1880/merge
Jiang Jiang Jian 2018-05-17 11:13:13 +08:00
commit c584f624b5
2 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -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;
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]);
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;
}
case ESP_A2D_AUDIO_STATE_EVT: {

Wyświetl plik

@ -386,7 +386,7 @@ static void bt_app_av_state_connecting(uint16_t event, void *param)
ESP_LOGI(BT_AV_TAG, "a2dp connected");
m_a2d_state = APP_AV_STATE_CONNECTED;
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) {
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) {
ESP_LOGI(BT_AV_TAG, "a2dp disconnected");
m_a2d_state = APP_AV_STATE_UNCONNECTED;
esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
}
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) {
ESP_LOGI(BT_AV_TAG, "a2dp disconnected");
m_a2d_state = APP_AV_STATE_UNCONNECTED;
esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
}
break;
}