kopia lustrzana https://github.com/espressif/esp-idf
component/bt: Change scan mode after connected or disconnected
rodzic
c54a679a41
commit
50f82a1aa5
|
@ -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: {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue