Multiple connections for CS

deleted

  • Hello,

    When you're done with a connection, you should:
    Call bt_conn_disconnect() with an appropriate reason code (like BT_HCI_ERR_REMOTE_USER_TERM_CONN)
    Call bt_conn_unref() to release your reference to the connection object

    It's important to understand that connection objects are reference counted. As explained in this DevZone thread:
    "Connection objects are reference counted, and the application is expected to use the bt_conn_ref() API whenever storing a connection pointer for a longer period of time, since this ensures that the object remains valid (even if the connection would get disconnected). Similarly the bt_conn_unref() API is to be used when releasing a reference to a connection."

    I expect in this case that you are not using bt_conn_ref() and bt_conn_unref() for each connections.

    Kenneth

  • NickDeLeenheer said:
    is it possible for me to just use bt_conn_ref() to reconnect again with the device then?

    No, you cannot use bt_conn_ref() to reconnect to a previously connected device. You can store the device address after the first discovery and reuse it, but you must recreate the connection — bt_conn_ref() is only for managing references to an active connection.

    Kenneth

  • Hi Kenneth,

    Thank you very much! I now have working Semaphores and working chronology:

    With a for loop of MAX_RANGING_ROUNDS for the ranging process:



    And this is the outputs that works Succesfully until the security step for the next device:


    I don't know why this is. I use a conn* pointer for every connection = NULL. Why should this work for the first device but not for the second?

    I have also tried to use bt_conn_disconnect after the end of the ranging process, but this gives me this weird ASSERTION ERROR and REBUILD sequence constantly:



    Can you help me with this?

    Kind regards,

    Nick De Leenheer




Related