A2DP_Source Example Pairing Bug

jeeper1974
Posts: 11
Joined: Thu Aug 13, 2020 5:47 am

A2DP_Source Example Pairing Bug

Postby jeeper1974 » Wed Aug 19, 2020 5:41 am

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.

jeeper1974
Posts: 11
Joined: Thu Aug 13, 2020 5:47 am

Re: A2DP_Source Example Pairing Bug

Postby jeeper1974 » Sun Aug 23, 2020 7:10 pm

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.

Fireman
Posts: 2
Joined: Sat Jan 23, 2021 6:52 am

Re: A2DP_Source Example Pairing Bug

Postby Fireman » Sat Jan 23, 2021 7:05 am

hi,

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

thanks

Who is online

Users browsing this forum: No registered users and 172 guests