Skip to content

Commit bdd0062

Browse files
committed
Bluetooth: Host: Amend disconnected() callback documentation
The API documentation for the disconnected() callback warns that the corresponding connection object is not actually available to the application at this point. Recommendations for avoiding this issue are out of date: - "start connectable advertising": the options that "will attempt to resume the advertiser under some conditions" are deprecated since Zephyr 4.0 (BT_LE_ADV_OPT_CONNECTABLE and related) - "using k_work_submit()": assuming everything will be fine when the work is actually processed is not reliable - "increase CONFIG_BT_MAX_CONN": setting BT_MAX_CONN to N+1 when planning N simultaneous connections is a work-around that users may have gotten used to (despite its footprint), but there is no longer any reason to advise it Stop documenting creating new connections or restarting advertising from the disconnected() callback and instead recommend relying on recycled() for these use cases. Signed-off-by: Christophe Dufaza <[email protected]>
1 parent 4f2154c commit bdd0062

File tree

1 file changed

+6
-3
lines changed
  • include/zephyr/bluetooth

1 file changed

+6
-3
lines changed

include/zephyr/bluetooth/conn.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,9 +1835,12 @@ struct bt_conn_cb {
18351835
* start either a connectable advertiser or create a new connection
18361836
* this might fail because there are no free connection objects
18371837
* available.
1838-
* To avoid this issue it is recommended to either start connectable
1839-
* advertise or create a new connection using @ref k_work_submit or
1840-
* increase @kconfig{CONFIG_BT_MAX_CONN}.
1838+
* To avoid this issue, it's strongly recommended to rely instead
1839+
* on @ref bt_conn_cb.recycled which notifies the application when
1840+
* a connection object has actually been freed.
1841+
*
1842+
* This callback runs on the system workqueue thread,
1843+
* the usual precautions apply.
18411844
*
18421845
* @param conn Connection object.
18431846
* @param reason BT_HCI_ERR_* reason for the disconnection.

0 commit comments

Comments
 (0)