Skip to content

Commit dca154d

Browse files
dottspinacfriedt
authored andcommitted
Bluetooth: Host: Amend disconnected() callback documentation
The API documentation for the disconnected() callback warns that the listener can't assume that the corresponding connection object has been freed and may me available to the application. The recommendations given to still start a new connection or connectable advertiser are outdated or misleading: - "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 6079781 commit dca154d

File tree

1 file changed

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

1 file changed

+2
-3
lines changed

include/zephyr/bluetooth/conn.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,9 +1877,8 @@ struct bt_conn_cb {
18771877
* start either a connectable advertiser or create a new connection
18781878
* this might fail because there are no free connection objects
18791879
* available.
1880-
* To avoid this issue it is recommended to either start connectable
1881-
* advertise or create a new connection using @ref k_work_submit or
1882-
* increase @kconfig{CONFIG_BT_MAX_CONN}.
1880+
* To avoid this issue, it's recommended to rely instead on @ref bt_conn_cb.recycled
1881+
* which notifies the application when a connection object has actually been freed.
18831882
*
18841883
* @param conn Connection object.
18851884
* @param reason BT_HCI_ERR_* reason for the disconnection.

0 commit comments

Comments
 (0)