This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

A3DP Automatic reconnection

I am working on a system based on the A3DP Demo SNK board, and I'm trying to find all features I'll need in this project.


What I want to achieve is that a previously paired device automatically reconnects to this audio sink whenever it comes back in range or turns bluetooth back on.

I already have stored the LinkKeyInfo of each device, but how can I achieve that these devices will automatically reconnect? Is this a feature of the Bluetopia stack or should I regularly scan for devices, and when a match is found initiate the connection?

  • Hi,

    In general this is done by the source, If you want to do it from the sink, You need to tweak it a little.

    like for example : you can keep initiating the connection (in a loop until it is successful) for that specific device or continuously scan and compare the found device DB address with the ones you have saved and If it matches, stop inquiry and initiate connection
  • I am looking around on how to do this in A3DP. Inquiring is not the problem, and also knowing which host to connect to is no problem. My problem is in finding how to initiate a connection as a client.

    I have found the HIDDemo, this demo is able to connect to a host while being a slave itself.
    processors.wiki.ti.com/index.php;keyMatch=HIDDemo&tisearch=Search-EN-Everything

    It uses a function "HID_Connect_Remote_Host()" to do this. However this is a HID function, and I cannot find anything comparable for the A3DP.

    How to do this? Is there any documentation I might be missing?
  • Hi,

    You can try: AUD_Open_Remote_Stream() - This API is available in the A3DPDemo_SRC. I don't see any reason why it wouldn't work with the A3DPDemo_SNK case as well - Just use the StreamType as "astSNK".

    Regards,
    Gigi Joseph.
  • That helped a bit.

    Now the bluetooth device is able to connect, this is a big step already :)

    Now AUD_Event_Callback() gets called with event "etAUD_Stream_Open_Confirmation".

    I put in the following code there:


    case etAUD_Stream_Open_Confirmation:
    BD_ADDRToStr(AUD_Event_Data->Event_Data.AUD_Stream_Open_Confirmation_Data->BD_ADDR, Callback_BoardStr);
    Display(("etAUD_Stream_Open_Confirmation\r\n"));
    Display(("Status: %u\r\n", AUD_Event_Data->Event_Data.AUD_Stream_Open_Confirmation_Data->OpenStatus));
    Display(("BD_ADDR: %s\r\n", Callback_BoardStr));

    if(AUD_Event_Data->Event_Data.AUD_Stream_Open_Confirmation_Data->OpenStatus == AUD_STREAM_OPEN_CONFIRMATION_STATUS_SUCCESS)
    {
    Display(("MediaMTU: %d\r\n", AUD_Event_Data->Event_Data.AUD_Stream_Open_Confirmation_Data->MediaMTU));
    Display(("StreamType: %s\r\n", (AUD_Event_Data->Event_Data.AUD_Stream_Open_Confirmation_Data->StreamType == astSRC) ? "SRC" : "SNK"));

    OpenA3DPStream(AUD_Event_Data->Event_Data.AUD_Stream_Open_Confirmation_Data);
    //OpenA3DPStream(AUD_Event_Data->Event_Data.AUD_Stream_Open_Indication_Data);
    }
    else
    {
    Display(("Connection to %s failed.\r\n", Callback_BoardStr));

    This is also copied from the SRC code. It was a lucky guess to put this in there, but it is not working completely. The bluetooth connection is made with the phone, but when I play sounds that should go to the SINK application, it is not being played. The phone does send it I think, because it has muted its speaker. Should I configure the codec there, or am I doing something wrong?

    I would like to have some documentation on this, it is quite difficult to figure out how it _should_ work.
  • Hi,

    Have you also modified the A3DPSNK::OpenA3DPStream() method? It takes: "AUD_Stream_Open_Indication_Data_t" structure. From your call, it looks like you are passing the "AUD_Stream_Open_Confirmation_Data_t" structure.

    Can you show me some logs from the SNK - OpenA3DPStream() implementation?

    Regards,
    Gigi Joseph.