From dc66d9e9dccad505ef5697f782a7562e0a5d016f Mon Sep 17 00:00:00 2001 From: wizmo2 Date: Fri, 25 Nov 2022 13:55:01 -0500 Subject: [PATCH] Bluetooth Source mods (#204) * support legacy bt pairing * extend bt source support --- components/driver_bt/bt_app_core.c | 8 ++++++++ components/driver_bt/bt_app_source.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/driver_bt/bt_app_core.c b/components/driver_bt/bt_app_core.c index f8a392c6..3b3f15b9 100644 --- a/components/driver_bt/bt_app_core.c +++ b/components/driver_bt/bt_app_core.c @@ -117,6 +117,14 @@ static void bt_app_task_handler(void *arg) esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t)); #endif + /* + * Set default parameters for Legacy Pairing + * Use variable pin, input pin code when pairing + */ + esp_bt_pin_type_t pin_type = ESP_BT_PIN_TYPE_VARIABLE; + esp_bt_pin_code_t pin_code; + esp_bt_gap_set_pin(pin_type, 0, pin_code); + running = true; while (running) { diff --git a/components/driver_bt/bt_app_source.c b/components/driver_bt/bt_app_source.c index 29c54663..9c5aad6f 100644 --- a/components/driver_bt/bt_app_source.c +++ b/components/driver_bt/bt_app_source.c @@ -672,9 +672,9 @@ static void filter_inquiry_scan_result(esp_bt_gap_cb_param_t *param) ESP_LOGV(TAG,"--Invalid class of device. Skipping.\n"); return; } - else if (!(esp_bt_gap_get_cod_srvc(cod) & ESP_BT_COD_SRVC_RENDERING)) + else if (!(esp_bt_gap_get_cod_srvc(cod) & (ESP_BT_COD_SRVC_RENDERING | ESP_BT_COD_SRVC_AUDIO))) { - ESP_LOGV(TAG,"--Not a rendering device. Skipping.\n"); + ESP_LOGV(TAG,"--Not a rendering or audio device. Skipping.\n"); return; }