From 66e52c60f59187766ce70563279dff7c2e871b35 Mon Sep 17 00:00:00 2001 From: jincheng Date: Thu, 16 Jun 2022 14:56:29 +0800 Subject: [PATCH] avoid wrongly restart discovery --- .../bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c b/examples/bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c index 0469285616..6cf00bc010 100644 --- a/examples/bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c +++ b/examples/bluetooth/bluedroid/classic_bt/a2dp_source/main/main.c @@ -215,7 +215,9 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa switch (event) { /* when device discovered a result, this event comes */ case ESP_BT_GAP_DISC_RES_EVT: { - filter_inquiry_scan_result(param); + if (s_a2d_state == APP_AV_STATE_DISCOVERING) { + filter_inquiry_scan_result(param); + } break; } /* when discovery state changed, this event comes */