Skip to content

Commit 7894d07

Browse files
committed
Bluetooth: Host: Amend recycled() callback documentation
The API documentation for the recycled() callback predates [1], and still warns users to "treat this callback as an ISR", although it now runs on the system work-queue thread, as does disconnected(). "Making Bluetooth API calls" to "re-start connectable advertising or scanning" should no longer be "strongly discouraged". On the contrary, we can emphasize that this is the right event to listen for to initiate operations that will try to re-allocate a freed connection object. Mention that BT_MAX_CONN configures the size of the connection pool. Refs: - [1] efb5d83: Bluetooth: Host: Defer `conn.recycled()` to the syswq Signed-off-by: Christophe Dufaza <[email protected]>
1 parent dfb3d7a commit 7894d07

File tree

1 file changed

+9
-5
lines changed
  • include/zephyr/bluetooth

1 file changed

+9
-5
lines changed

include/zephyr/bluetooth/conn.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,12 +1752,16 @@ struct bt_conn_cb {
17521752
* This callback notifies the application that it might be able to
17531753
* allocate a connection object. No guarantee, first come, first serve.
17541754
*
1755-
* Use this to e.g. re-start connectable advertising or scanning.
1755+
* The maximum number of simultaneous connections is configured
1756+
* by @kconfig{CONFIG_BT_MAX_CONN}, which usually defaults to a single connection.
17561757
*
1757-
* Treat this callback as an ISR, as it originates from
1758-
* @ref bt_conn_unref which is used by the BT stack. Making
1759-
* Bluetooth API calls in this context is error-prone and strongly
1760-
* discouraged.
1758+
* This is the event to listen for to start a new connection, connectable advertiser
1759+
* or scanner, both when the intention is to start it after the system is completely
1760+
* finished with an earlier connection, and when the application wants to start
1761+
* a connection for any reason but failed and is waiting for the right time to retry.
1762+
*
1763+
* This callback runs on the system workqueue thread,
1764+
* the usual precautions apply.
17611765
*/
17621766
void (*recycled)(void);
17631767

0 commit comments

Comments
 (0)