diff --git a/doc/releases/release-notes-4.3.rst b/doc/releases/release-notes-4.3.rst index 90bae2a48646b..3d0bff87a8c98 100644 --- a/doc/releases/release-notes-4.3.rst +++ b/doc/releases/release-notes-4.3.rst @@ -57,6 +57,7 @@ Removed APIs and options * The TinyCrypt library was removed as the upstream version is no longer maintained. PSA Crypto API is now the recommended cryptographic library for Zephyr. * The legacy pipe object API was removed. Use the new pipe API instead. +* ``bt_le_set_auto_conn`` Deprecated APIs and options =========================== diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 2f9b796e1ec14..67c3db64e92a1 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -1639,23 +1639,6 @@ int bt_conn_le_create_auto(const struct bt_conn_le_create_param *create_param, */ int bt_conn_create_auto_stop(void); -/** @brief Automatically connect to remote device if it's in range. - * - * This function enables/disables automatic connection initiation. - * Every time the device loses the connection with peer, this connection - * will be re-established if connectable advertisement from peer is received. - * - * @note Auto connect is disabled during explicit scanning. - * - * @param addr Remote Bluetooth address. - * @param param If non-NULL, auto connect is enabled with the given - * parameters. If NULL, auto connect is disabled. - * - * @return Zero on success or error code otherwise. - */ -__deprecated int bt_le_set_auto_conn(const bt_addr_le_t *addr, - const struct bt_le_conn_param *param); - /** @brief Set security level for a connection. * * This function enable security (encryption) for a connection. If the device diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index fb31f879191e0..ad627bcdf175f 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -3994,65 +3994,6 @@ int bt_conn_le_create_synced(const struct bt_le_ext_adv *adv, *ret_conn = conn; return 0; } - -#if !defined(CONFIG_BT_FILTER_ACCEPT_LIST) -int bt_le_set_auto_conn(const bt_addr_le_t *addr, - const struct bt_le_conn_param *param) -{ - struct bt_conn *conn; - - if (!atomic_test_bit(bt_dev.flags, BT_DEV_READY)) { - return -EAGAIN; - } - - if (param && !bt_le_conn_params_valid(param)) { - return -EINVAL; - } - - if (!bt_id_scan_random_addr_check()) { - return -EINVAL; - } - - /* Only default identity is supported */ - conn = bt_conn_lookup_addr_le(BT_ID_DEFAULT, addr); - if (!conn) { - conn = bt_conn_add_le(BT_ID_DEFAULT, addr); - if (!conn) { - return -ENOMEM; - } - } - - if (param) { - bt_conn_set_param_le(conn, param); - - if (!atomic_test_and_set_bit(conn->flags, - BT_CONN_AUTO_CONNECT)) { - bt_conn_ref(conn); - } - } else { - if (atomic_test_and_clear_bit(conn->flags, - BT_CONN_AUTO_CONNECT)) { - bt_conn_unref(conn); - if (conn->state == BT_CONN_SCAN_BEFORE_INITIATING) { - bt_conn_set_state(conn, BT_CONN_DISCONNECTED); - } - } - } - - int err = 0; - if (conn->state == BT_CONN_DISCONNECTED && - atomic_test_bit(bt_dev.flags, BT_DEV_READY)) { - if (param) { - bt_conn_set_state(conn, BT_CONN_SCAN_BEFORE_INITIATING); - err = bt_le_scan_user_add(BT_LE_SCAN_USER_CONN); - } - } - - bt_conn_unref(conn); - - return err; -} -#endif /* !defined(CONFIG_BT_FILTER_ACCEPT_LIST) */ #endif /* CONFIG_BT_CENTRAL */ int bt_conn_le_conn_update(struct bt_conn *conn,