Page 1 of 1

A2DP_Source Example Pairing Bug

Posted: Wed Aug 19, 2020 5:41 am
by jeeper1974
The esp-idf a2dp_source example will only connect correctly to an a2dp sink device(head phones) when the sink device is put into pairing mode first. After pairing to the ESP32, I should not need to be pair them again unless I erase the bonded device list. But there is a bug in the BT stack or in the example. The headphones work great if in pairing mode first. If not in pairing mode the ESP32 will connect to the headphones but it will not run the callback (bt_app_s2d_data_cb()) funciton, or the call back function to disable discovery mode.

I've tried various examples from esp-adf, multiple speakers, and headphones and all with the same results.

I can see the bonded device list also and the device is there.

Is there something in these examples/menuconfig that needs to be enabled to allow a previously bonded device to connect correctly without putting the device in pairing mode first?

Is there a list of callback functions that need to be set for different BT connection types? There are these three callback functions which are called when pairing mode is run first, but not called if the bluetooth connects without pairing mode. These need to be run for the example to work correctly.

Code: Select all

/* register GAP callback function */
        esp_bt_gap_register_callback(bt_app_gap_cb);
        
         /* initialize AVRCP controller */
        esp_avrc_ct_init();
        esp_avrc_ct_register_callback(bt_app_rc_ct_cb);
        
        /* initialize A2DP source */
        esp_a2d_register_callback(&bt_app_a2d_cb);
        esp_a2d_source_register_data_callback(bt_app_a2d_data_cb);
       
Any help or pointers would be appreciated.

Re: A2DP_Source Example Pairing Bug

Posted: Sun Aug 23, 2020 7:10 pm
by jeeper1974
Found the issue. I had turned the main function into part of a C++ Class with the other functions remaining in their native C code. Although this did not throw any compile errors, it clearly broke something in how the C++ setup the bluetooth. I switched it back to native C and it works great.

Re: A2DP_Source Example Pairing Bug

Posted: Sat Jan 23, 2021 7:05 am
by Fireman
hi,

can you show the code how to do this convertion to "C".

thanks