From 8c319900654bc8292ec53e6a0f971f7d61e700bd Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Tue, 14 May 2024 10:02:15 +0200 Subject: [PATCH] Bluetooth: Deprecate adv auto-resume The host-based adv auto-resume function has both a problematic implementation and disagreement in the community around how it should behave. See the issue linked resolved below for details. This patch makes the deprecation visible to the user. The user will be better served by a auto-resume tailored their applications use case, based on more primitive host API like `conn_cb.recycled`, which has obvious behavior that is unlikely to change. Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/72567 Signed-off-by: Aleksander Wasaznik --- doc/releases/migration-guide-4.0.rst | 72 +++++++++ include/zephyr/bluetooth/bluetooth.h | 138 +++++++++++++++--- samples/bluetooth/direct_adv/src/main.c | 2 +- .../direction_finding_peripheral/src/main.c | 2 +- samples/bluetooth/eddystone/src/main.c | 4 +- .../peripheral/src/peripheral_ead.c | 13 +- samples/bluetooth/hci_pwr_ctrl/src/main.c | 2 +- .../iso_connected_benchmark/src/main.c | 5 +- samples/bluetooth/iso_peripheral/src/main.c | 2 +- .../peripheral/src/peripheral_mtu_update.c | 2 +- .../bluetooth/periodic_sync_rsp/src/main.c | 5 +- samples/bluetooth/peripheral/src/main.c | 2 +- .../peripheral_accept_list/src/main.c | 2 +- samples/bluetooth/peripheral_csc/src/main.c | 2 +- samples/bluetooth/peripheral_dis/src/main.c | 2 +- samples/bluetooth/peripheral_esp/src/main.c | 2 +- .../src/peripheral_gatt_write.c | 2 +- samples/bluetooth/peripheral_hids/src/main.c | 2 +- samples/bluetooth/peripheral_hr/src/main.c | 8 +- samples/bluetooth/peripheral_ht/src/main.c | 2 +- .../src/peripheral_identity.c | 3 +- samples/bluetooth/peripheral_nus/src/main.c | 2 +- samples/bluetooth/peripheral_ots/src/main.c | 2 +- samples/bluetooth/peripheral_past/src/main.c | 2 +- .../bluetooth/peripheral_sc_only/src/main.c | 2 +- samples/bluetooth/st_ble_sensor/src/main.c | 2 +- samples/boards/bbc/microbit/pong/src/ble.c | 2 +- .../phytec/reel_board/mesh_badge/src/main.c | 2 +- samples/subsys/logging/ble_backend/src/main.c | 2 +- .../mgmt/mcumgr/smp_svr/src/bluetooth.c | 2 +- subsys/bluetooth/host/adv.c | 32 ++-- subsys/bluetooth/host/id.c | 4 +- subsys/bluetooth/host/shell/bt.c | 14 +- subsys/bluetooth/mesh/pb_gatt_srv.c | 3 +- subsys/bluetooth/mesh/proxy_srv.c | 3 +- .../services/nus/bt_nus_auto_start_bt.c | 2 +- tests/bluetooth/common/testlib/src/adv.c | 2 +- .../id/bt_id_adv_random_addr_check/src/main.c | 2 +- .../host/id/bt_id_set_adv_own_addr/src/main.c | 22 +-- .../src/test_suite_invalid_inputs.c | 22 +-- tests/bluetooth/shell/src/main.c | 2 +- tests/bluetooth/tester/src/btp_gap.c | 14 +- .../audio/src/bap_scan_delegator_test.c | 2 +- .../audio/src/bap_unicast_server_test.c | 4 +- .../bluetooth/audio/src/cap_acceptor_test.c | 4 +- .../audio/src/csip_notify_server_test.c | 4 +- .../audio/src/csip_set_member_test.c | 2 +- .../bsim/bluetooth/audio/src/gmap_ugt_test.c | 4 +- tests/bsim/bluetooth/audio/src/has_test.c | 2 +- tests/bsim/bluetooth/audio/src/ias_test.c | 2 +- tests/bsim/bluetooth/audio/src/mcs_test.c | 2 +- .../audio/src/media_controller_test.c | 2 +- .../bluetooth/audio/src/micp_mic_dev_test.c | 2 +- .../audio/src/pacs_notify_server_test.c | 8 +- .../bluetooth/audio/src/tbs_client_test.c | 2 +- .../bluetooth/audio/src/vcp_vol_rend_test.c | 2 +- .../css_sample_data/src/peripheral.c | 2 +- .../bsim/bluetooth/host/att/eatt/src/common.c | 2 +- .../host/att/eatt_notif/src/server_test.c | 2 +- .../host/att/pipeline/dut/src/main.c | 7 +- .../host/central/src/dummy_peripheral.c | 2 +- .../gatt/authorization/src/gatt_server_test.c | 2 +- .../host/gatt/caching/src/gatt_server_test.c | 2 +- .../host/gatt/ccc_store/src/peripheral.c | 12 +- .../host/gatt/general/src/gatt_server_test.c | 2 +- .../host/gatt/notify/src/gatt_server_test.c | 2 +- .../notify_multiple/src/gatt_server_test.c | 2 +- .../host/gatt/sc_indicate/src/bs_bt_utils.c | 2 +- .../bluetooth/host/gatt/settings/src/utils.c | 3 +- .../host/iso/cis/src/cis_peripheral.c | 2 +- .../bluetooth/host/l2cap/credits/src/main.c | 7 +- .../host/l2cap/credits_seg_recv/src/main.c | 6 +- .../host/l2cap/general/src/main_l2cap_ecred.c | 2 +- .../host/l2cap/many_conns/src/main.c | 7 +- .../host/l2cap/multilink_peripheral/src/dut.c | 2 +- .../src/main_l2cap_send_on_connect.c | 2 +- .../bluetooth/host/l2cap/stress/src/main.c | 7 +- .../l2cap/userdata/src/main_l2cap_userdata.c | 2 +- .../misc/conn_stress/peripheral/src/main.c | 2 +- .../host/misc/disable/src/gatt_server_test.c | 2 +- tests/bsim/bluetooth/host/misc/hfc/src/main.c | 6 +- .../host/misc/unregister_conn_cb/src/main.c | 2 +- .../host/privacy/central/src/tester.c | 5 +- .../device/src/test_undirected_peripheral.c | 6 +- .../bluetooth/host/privacy/legacy/src/dut.c | 10 +- .../bond_overwrite_allowed/src/bs_bt_utils.c | 3 +- .../bond_overwrite_denied/src/bs_bt_utils.c | 3 +- .../bond_per_connection/src/bs_bt_utils.c | 3 +- .../host/security/ccc_update/src/peripheral.c | 2 +- .../id_addr_update/peripheral/src/utils.c | 3 +- .../src/bs_bt_utils.c | 3 +- tests/bsim/bluetooth/ll/advx/src/main.c | 6 +- tests/bsim/bluetooth/ll/cis/src/main.c | 16 +- .../bluetooth/ll/conn/src/test_connect2.c | 26 +++- .../ll/edtt/gatt_test_app/src/main.c | 32 +++- .../battery_service/src/peripheral_test.c | 2 +- 96 files changed, 394 insertions(+), 273 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index e8c09adbb3bb77..b5c32a0e7d4cef 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -311,6 +311,78 @@ Bluetooth Classic Bluetooth Host ============== +Automatic advertiser resumption is deprecated +--------------------------------------------- + +.. note:: + + This deprecation is compiler-checked. If you get no warnings, + you should not be affected. + +Deprecated symbols: + * :c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` + * :c:enumerator:`BT_LE_ADV_OPT_ONE_TIME` + * :c:macro:`BT_LE_ADV_CONN` + +New symbols: + * :c:enumerator:`BT_LE_ADV_OPT_CONN` + * :c:macro:`BT_LE_ADV_CONN_FAST_1` + * :c:macro:`BT_LE_ADV_CONN_FAST_2` + +:c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` is a combined +instruction to make the advertiser connectable and to enable +automatic resumption. To disable the automatic resumption, use +:c:enumerator:`BT_LE_ADV_OPT_CONN`. + +Extended Advertising API with shorthands +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Extended Advertising API ``bt_le_ext_adv_*`` implicitly assumes +:c:enumerator:`BT_LE_ADV_OPT_ONE_TIME` and never automatically +resume advertising. Therefore, the following search/replace can +be applied without thinking: + +Replace all + +.. code-block:: diff + + -bt_le_ext_adv_create(BT_LE_ADV_CONN, ...) + +bt_le_ext_adv_create(BT_LE_ADV_FAST_2, ...) + +.. code-block:: diff + + -bt_le_ext_adv_update_param(..., BT_LE_ADV_CONN) + +bt_le_ext_adv_update_param(..., BT_LE_ADV_FAST_2) + +Extended Advertising API with custom parameters +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You may have uses of :c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` +in assignments to a :c:struct:`bt_le_adv_param`. If your struct +is never passed to :c:func:`bt_le_adv_start`, you should: + +* replace :c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` with + :c:enumerator:`BT_LE_ADV_OPT_CONN`. +* remove :c:enumerator:`BT_LE_ADV_OPT_ONE_TIME`. + +Legacy Advertising API not using automatic resumption +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Any calls to :c:func:`bt_le_adv_start` that use the combination +:c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` and +:c:enumerator:`BT_LE_ADV_OPT_ONE_TIME` should have that +combination replaced with :c:enumerator:`BT_LE_ADV_OPT_CONN`. + +Legacy Advertising API using automatic resumption +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For this case, the application has to take over the +responsibility of restarting the advertiser. + +Refer to the extended advertising sample for an example +implementation of advertiser restarting. The same technique can +be used for legacy advertising. + Bluetooth Crypto ================ diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 4b388bfd146926..8d2ceebf6cb6d3 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -525,16 +525,42 @@ enum { /** * @brief Advertise as connectable. * + * @deprecated Use @ref BT_LE_ADV_OPT_CONN instead. + * * Advertise as connectable. If not connectable then the type of * advertising is determined by providing scan response data. * The advertiser address is determined by the type of advertising * and/or enabling privacy @kconfig{CONFIG_BT_PRIVACY}. + * + * Starting connectable advertising preallocates a connection + * object. If this fails, the API returns @c -ENOMEM. + * + * When an advertiser set results in a connection creation, the + * controller automatically disables that advertising set. + * + * If the advertising set was started with @ref bt_le_adv_start + * without @ref BT_LE_ADV_OPT_ONE_TIME, the host will attempt to + * resume the advertiser under some conditions. + */ + BT_LE_ADV_OPT_CONNECTABLE __deprecated = BIT(0), + + /** + * @internal + * + * Internal access to the deprecated value to maintain the + * implementation of the deprecated feature. + * + * At the end of the deprecation period, ABI will change so + * `BT_LE_ADV_OPT_CONN` is just `BIT(0)`, removing the need for this + * symbol. */ - BT_LE_ADV_OPT_CONNECTABLE = BIT(0), + _BT_LE_ADV_OPT_CONNECTABLE = BIT(0), /** * @brief Advertise one time. * + * @deprecated Use @ref BT_LE_ADV_OPT_CONN instead. + * * Don't try to resume connectable advertising after a connection. * This option is only meaningful when used together with * BT_LE_ADV_OPT_CONNECTABLE. If set the advertising will be stopped @@ -546,7 +572,35 @@ enum { * @ref bt_le_ext_adv_start then this behavior is the default behavior * and this flag has no effect. */ - BT_LE_ADV_OPT_ONE_TIME = BIT(1), + BT_LE_ADV_OPT_ONE_TIME __deprecated = BIT(1), + + /** + * @internal + * + * Internal access to the deprecated value to maintain + * the implementation of the deprecated feature. + */ + _BT_LE_ADV_OPT_ONE_TIME = BIT(1), + + /** + * @brief Connectable advertising + * + * Starting connectable advertising preallocates a connection + * object. If this fails, the API returns @c -ENOMEM. + * + * The advertising set stops immediately after it creates a + * connection. This happens automatically in the controller. + * + * @note To continue advertising after a connection is created, + * the application should listen for the @ref bt_conn_cb.connected + * event and start the advertising set again. Note that the + * advertiser cannot be started when all connection objects are + * in use. In that case, defer starting the advertiser until + * @ref bt_conn_cb.recycled. To continue after a disconnection, + * listen for @ref bt_conn_cb.recycled. + + */ + BT_LE_ADV_OPT_CONN = BIT(0) | BIT(1), /** * @brief Advertise using identity address. @@ -625,8 +679,7 @@ enum { * @brief Support scan response data. * * When used together with @ref BT_LE_ADV_OPT_EXT_ADV then this option - * cannot be used together with the @ref BT_LE_ADV_OPT_CONNECTABLE - * option. + * cannot be used together with the @ref BT_LE_ADV_OPT_CONN option. * When used together with @ref BT_LE_ADV_OPT_EXT_ADV then scan * response data must be set. */ @@ -914,20 +967,61 @@ struct bt_le_per_adv_param { BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) \ }) -#define BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, 0, 0,\ - _peer) +#define BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, 0, 0, _peer) +/** + * @deprecated This is a convenience macro for @ref + * BT_LE_ADV_OPT_CONNECTABLE, which is deprecated. Please use + * @ref BT_LE_ADV_CONN_FAST_1 or @ref BT_LE_ADV_CONN_FAST_2 + * instead. + */ +#define BT_LE_ADV_CONN \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, BT_GAP_ADV_FAST_INT_MIN_2, \ + BT_GAP_ADV_FAST_INT_MAX_2, NULL) \ + __DEPRECATED_MACRO -#define BT_LE_ADV_CONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) +/** @brief GAP recommended connectable advertising + * + * This is the recommended default for when a person is likely + * to be waiting the device to connect or be discovered. + * + * Use a longer interval to conserve battery at the cost of + * responsiveness. Consider entering a lower power state with + * longer intervals after a timeout. + * + * GAP recommends advertisers use this "when user-initiated". + * The application developer decides what this means. It can by + * any time the user interacts with the device, a press on a + * dedicated Bluetooth wakeup button, or anything in-between. + * + * This is the recommended setting for limited discoverable + * mode. + * + * See Bluetooth Core Specification: + * - 3.C.A "Timers and Constants", T_GAP(adv_fast_interval1) + * - 3.C.9.3.11 "Connection Establishment Timing parameters" + */ +#define BT_LE_ADV_CONN_FAST_1 \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_1, BT_GAP_ADV_FAST_INT_MAX_1, \ + NULL) -/** This is the recommended default for connectable advertisers. +/** @brief Connectable advertising with + * T_GAP(adv_fast_interval2) + * + * The advertising interval corresponds to what was offered as + * `BT_LE_ADV_CONN` in Zephyr 3.6 and earlier, but unlike + * `BT_LE_ADV_CONN`, the host does not automatically resume the + * advertiser after it results in a connection. + * + * See Bluetooth Core Specification: + * - 3.C.A "Timers and Constants", T_GAP(adv_fast_interval1) + * - 3.C.9.3.11 "Connection Establishment Timing parameters" */ -#define BT_LE_ADV_CONN_ONE_TIME \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL) +#define BT_LE_ADV_CONN_FAST_2 \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, \ + NULL) + +#define BT_LE_ADV_CONN_ONE_TIME BT_LE_ADV_CONN_FAST_2 __DEPRECATED_MACRO /** * @deprecated This macro will be removed in the near future, see @@ -950,11 +1044,9 @@ struct bt_le_per_adv_param { BT_GAP_ADV_FAST_INT_MAX_2, NULL) \ __DEPRECATED_MACRO -#define BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | \ - BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY, \ - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, \ - _peer) +#define BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY, \ + BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, _peer) /** Non-connectable advertising with private address */ #define BT_LE_ADV_NCONN BT_LE_ADV_PARAM(0, BT_GAP_ADV_FAST_INT_MIN_2, \ @@ -978,11 +1070,9 @@ struct bt_le_per_adv_param { NULL) /** Connectable extended advertising */ -#define BT_LE_EXT_ADV_CONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \ - BT_LE_ADV_OPT_CONNECTABLE, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, \ - NULL) +#define BT_LE_EXT_ADV_CONN \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, \ + BT_GAP_ADV_FAST_INT_MAX_2, NULL) /** * @deprecated This macro will be removed in the near future, see diff --git a/samples/bluetooth/direct_adv/src/main.c b/samples/bluetooth/direct_adv/src/main.c index a381cf0c1e29c5..992c6e46059c74 100644 --- a/samples/bluetooth/direct_adv/src/main.c +++ b/samples/bluetooth/direct_adv/src/main.c @@ -128,7 +128,7 @@ static void bt_ready(void) adv_param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; err = bt_le_adv_start(&adv_param, NULL, 0, NULL, 0); } else { - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); } if (err) { diff --git a/samples/bluetooth/direction_finding_peripheral/src/main.c b/samples/bluetooth/direction_finding_peripheral/src/main.c index da4cd72888a69c..c016145ce4c0f1 100644 --- a/samples/bluetooth/direction_finding_peripheral/src/main.c +++ b/samples/bluetooth/direction_finding_peripheral/src/main.c @@ -100,7 +100,7 @@ static void bt_ready(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/eddystone/src/main.c b/samples/bluetooth/eddystone/src/main.c index 8bc3213f880296..c574c57cae13f1 100644 --- a/samples/bluetooth/eddystone/src/main.c +++ b/samples/bluetooth/eddystone/src/main.c @@ -431,7 +431,7 @@ static int eds_slot_restart(struct eds_slot *slot, uint8_t type) addr = oob.addr; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); } else { size_t count = 1; @@ -634,7 +634,7 @@ static void bt_ready(int err) printk("Bluetooth initialized\n"); /* Start advertising */ - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/encrypted_advertising/peripheral/src/peripheral_ead.c b/samples/bluetooth/encrypted_advertising/peripheral/src/peripheral_ead.c index d2476d2ce822d5..7bafd8a5b7b183 100644 --- a/samples/bluetooth/encrypted_advertising/peripheral/src/peripheral_ead.c +++ b/samples/bluetooth/encrypted_advertising/peripheral/src/peripheral_ead.c @@ -128,21 +128,10 @@ static bool rpa_expired_cb(struct bt_le_ext_adv *adv) static int create_adv(struct bt_le_ext_adv **adv) { int err; - struct bt_le_adv_param params; - - memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - - params.options |= BT_LE_ADV_OPT_CONNECTABLE; - params.options |= BT_LE_ADV_OPT_EXT_ADV; - - params.id = BT_ID_DEFAULT; - params.sid = 0; - params.interval_min = BT_GAP_ADV_FAST_INT_MIN_2; - params.interval_max = BT_GAP_ADV_FAST_INT_MAX_2; adv_cb.rpa_expired = rpa_expired_cb; - err = bt_le_ext_adv_create(¶ms, &adv_cb, adv); + err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN, &adv_cb, adv); if (err) { LOG_ERR("Failed to create advertiser (%d)", err); return -1; diff --git a/samples/bluetooth/hci_pwr_ctrl/src/main.c b/samples/bluetooth/hci_pwr_ctrl/src/main.c index 42ef4d214ca635..3b08d45b8a0091 100644 --- a/samples/bluetooth/hci_pwr_ctrl/src/main.c +++ b/samples/bluetooth/hci_pwr_ctrl/src/main.c @@ -43,7 +43,7 @@ static K_THREAD_STACK_DEFINE(pwr_thread_stack, 512); static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8, -15, -18, -23, -30}; static const struct bt_le_adv_param *param = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, 0x0020, 0x0020, NULL); + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, 0x0020, 0x0020, NULL); static void read_conn_rssi(uint16_t handle, int8_t *rssi) { diff --git a/samples/bluetooth/iso_connected_benchmark/src/main.c b/samples/bluetooth/iso_connected_benchmark/src/main.c index ff694b4a1cfc92..8b63d4eec7c054 100644 --- a/samples/bluetooth/iso_connected_benchmark/src/main.c +++ b/samples/bluetooth/iso_connected_benchmark/src/main.c @@ -1279,10 +1279,7 @@ static int run_peripheral(void) } LOG_INF("Starting advertising"); - err = bt_le_adv_start( - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_CONNECTABLE, - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL), - NULL, 0, sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, sd, ARRAY_SIZE(sd)); if (err != 0) { LOG_ERR("Advertising failed to start: %d", err); return err; diff --git a/samples/bluetooth/iso_peripheral/src/main.c b/samples/bluetooth/iso_peripheral/src/main.c index 3ce6f688e849c8..d11baa9633fa20 100644 --- a/samples/bluetooth/iso_peripheral/src/main.c +++ b/samples/bluetooth/iso_peripheral/src/main.c @@ -177,7 +177,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/mtu_update/peripheral/src/peripheral_mtu_update.c b/samples/bluetooth/mtu_update/peripheral/src/peripheral_mtu_update.c index 1cb99801c94347..a5bbef6f5eee6f 100644 --- a/samples/bluetooth/mtu_update/peripheral/src/peripheral_mtu_update.c +++ b/samples/bluetooth/mtu_update/peripheral/src/peripheral_mtu_update.c @@ -91,7 +91,7 @@ void run_peripheral_sample(uint8_t *notify_data, size_t notify_data_size, uint16 struct bt_gatt_attr *notify_crch = bt_gatt_find_by_uuid(mtu_test.attrs, 0xffff, ¬ify_characteristic_uuid.uuid); - bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, adv_ad_data, ARRAY_SIZE(adv_ad_data), NULL, 0); + bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, adv_ad_data, ARRAY_SIZE(adv_ad_data), NULL, 0); bool infinite = seconds == 0; diff --git a/samples/bluetooth/periodic_sync_rsp/src/main.c b/samples/bluetooth/periodic_sync_rsp/src/main.c index 013e7a28e50865..60fe5661390b6a 100644 --- a/samples/bluetooth/periodic_sync_rsp/src/main.c +++ b/samples/bluetooth/periodic_sync_rsp/src/main.c @@ -231,10 +231,7 @@ int main(void) } do { - err = bt_le_adv_start( - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_CONNECTABLE, - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL), - ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, sd, ARRAY_SIZE(sd), NULL, 0); if (err && err != -EALREADY) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index 9c9001213e6fa8..db77691db613a8 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -290,7 +290,7 @@ static void bt_ready(void) settings_load(); } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_accept_list/src/main.c b/samples/bluetooth/peripheral_accept_list/src/main.c index ee32add74cfdc6..e14ea8dd997752 100644 --- a/samples/bluetooth/peripheral_accept_list/src/main.c +++ b/samples/bluetooth/peripheral_accept_list/src/main.c @@ -121,7 +121,7 @@ static void bt_ready(void) bond_count = 0; bt_foreach_bond(BT_ID_DEFAULT, add_bonded_addr_to_filter_list, NULL); - adv_param = *BT_LE_ADV_CONN_ONE_TIME; + adv_param = *BT_LE_ADV_CONN_FAST_1; /* If we have got at least one bond, activate the filter */ if (bond_count) { diff --git a/samples/bluetooth/peripheral_csc/src/main.c b/samples/bluetooth/peripheral_csc/src/main.c index aeb7a71ecddb32..5090641433da92 100644 --- a/samples/bluetooth/peripheral_csc/src/main.c +++ b/samples/bluetooth/peripheral_csc/src/main.c @@ -379,7 +379,7 @@ static void bt_ready(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_dis/src/main.c b/samples/bluetooth/peripheral_dis/src/main.c index 324602de30d23e..b611ef6e170963 100644 --- a/samples/bluetooth/peripheral_dis/src/main.c +++ b/samples/bluetooth/peripheral_dis/src/main.c @@ -100,7 +100,7 @@ int main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_esp/src/main.c b/samples/bluetooth/peripheral_esp/src/main.c index b71ff7ed15405a..0ac62a42627eff 100644 --- a/samples/bluetooth/peripheral_esp/src/main.c +++ b/samples/bluetooth/peripheral_esp/src/main.c @@ -421,7 +421,7 @@ static void bt_ready(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_gatt_write/src/peripheral_gatt_write.c b/samples/bluetooth/peripheral_gatt_write/src/peripheral_gatt_write.c index 0e0d082004b47e..94b25e0d519adc 100644 --- a/samples/bluetooth/peripheral_gatt_write/src/peripheral_gatt_write.c +++ b/samples/bluetooth/peripheral_gatt_write/src/peripheral_gatt_write.c @@ -67,7 +67,7 @@ uint32_t peripheral_gatt_write(uint32_t count) (void)bt_conn_auth_cb_register(&auth_callbacks); #endif /* CONFIG_BT_SMP */ - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0U; diff --git a/samples/bluetooth/peripheral_hids/src/main.c b/samples/bluetooth/peripheral_hids/src/main.c index 25e82c346e825c..9feb3607802607 100644 --- a/samples/bluetooth/peripheral_hids/src/main.c +++ b/samples/bluetooth/peripheral_hids/src/main.c @@ -100,7 +100,7 @@ static void bt_ready(int err) settings_load(); } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index 8d7f73e544067f..ea86dc9f7f0223 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -204,7 +204,7 @@ int main(void) #if !defined(CONFIG_BT_EXT_ADV) printk("Starting Legacy Advertising (connectable and scannable)\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; @@ -215,9 +215,7 @@ int main(void) .id = BT_ID_DEFAULT, .sid = 0U, .secondary_max_skip = 0U, - .options = (BT_LE_ADV_OPT_EXT_ADV | - BT_LE_ADV_OPT_CONNECTABLE | - BT_LE_ADV_OPT_CODED), + .options = (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_CODED), .interval_min = BT_GAP_ADV_FAST_INT_MIN_2, .interval_max = BT_GAP_ADV_FAST_INT_MAX_2, .peer = NULL, @@ -283,7 +281,7 @@ int main(void) } else if (atomic_test_and_clear_bit(state, STATE_DISCONNECTED)) { #if !defined(CONFIG_BT_EXT_ADV) printk("Starting Legacy Advertising (connectable and scannable)\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_ht/src/main.c b/samples/bluetooth/peripheral_ht/src/main.c index b3bffc30e4fb9f..c6b0540632a7f8 100644 --- a/samples/bluetooth/peripheral_ht/src/main.c +++ b/samples/bluetooth/peripheral_ht/src/main.c @@ -62,7 +62,7 @@ static void bt_ready(void) hts_init(); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_identity/src/peripheral_identity.c b/samples/bluetooth/peripheral_identity/src/peripheral_identity.c index 52d71e642a38a4..a4722907d501e8 100644 --- a/samples/bluetooth/peripheral_identity/src/peripheral_identity.c +++ b/samples/bluetooth/peripheral_identity/src/peripheral_identity.c @@ -33,8 +33,7 @@ static void adv_start(struct k_work *work) .id = BT_ID_DEFAULT, .sid = 0, .secondary_max_skip = 0, - .options = (BT_LE_ADV_OPT_CONNECTABLE | - BT_LE_ADV_OPT_ONE_TIME), + .options = BT_LE_ADV_OPT_CONN, .interval_min = 0x0020, /* 20 ms */ .interval_max = 0x0020, /* 20 ms */ .peer = NULL, diff --git a/samples/bluetooth/peripheral_nus/src/main.c b/samples/bluetooth/peripheral_nus/src/main.c index 767b2286fb237c..dd4d57cf31db2f 100644 --- a/samples/bluetooth/peripheral_nus/src/main.c +++ b/samples/bluetooth/peripheral_nus/src/main.c @@ -61,7 +61,7 @@ int main(void) return err; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Failed to start advertising: %d\n", err); return err; diff --git a/samples/bluetooth/peripheral_ots/src/main.c b/samples/bluetooth/peripheral_ots/src/main.c index f3e70c2e8ce6b3..79c8a11b7096f4 100644 --- a/samples/bluetooth/peripheral_ots/src/main.c +++ b/samples/bluetooth/peripheral_ots/src/main.c @@ -335,7 +335,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_past/src/main.c b/samples/bluetooth/peripheral_past/src/main.c index 9461b28b2f9846..1bd6aa35cf7f6a 100644 --- a/samples/bluetooth/peripheral_past/src/main.c +++ b/samples/bluetooth/peripheral_past/src/main.c @@ -147,7 +147,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, NULL, 0, sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_sc_only/src/main.c b/samples/bluetooth/peripheral_sc_only/src/main.c index 91cc46a385a501..f4ae4252cdcd01 100644 --- a/samples/bluetooth/peripheral_sc_only/src/main.c +++ b/samples/bluetooth/peripheral_sc_only/src/main.c @@ -145,7 +145,7 @@ int main(void) bt_conn_auth_cb_register(&auth_cb_display); bt_conn_auth_info_cb_register(&auth_cb_info); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/st_ble_sensor/src/main.c b/samples/bluetooth/st_ble_sensor/src/main.c index de287b61167438..b7c1547b04c707 100644 --- a/samples/bluetooth/st_ble_sensor/src/main.c +++ b/samples/bluetooth/st_ble_sensor/src/main.c @@ -142,7 +142,7 @@ static void bt_ready(int err) } LOG_INF("Bluetooth initialized"); /* Start advertising */ - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); return; diff --git a/samples/boards/bbc/microbit/pong/src/ble.c b/samples/boards/bbc/microbit/pong/src/ble.c index 3601c35612675f..bdbad05639af33 100644 --- a/samples/boards/bbc/microbit/pong/src/ble.c +++ b/samples/boards/bbc/microbit/pong/src/ble.c @@ -471,7 +471,7 @@ static void ble_timeout(struct k_work *work) k_work_reschedule(&ble_work, K_NO_WAIT); break; case BLE_ADV_START: - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/boards/phytec/reel_board/mesh_badge/src/main.c b/samples/boards/phytec/reel_board/mesh_badge/src/main.c index 33189b8bb626d9..c025c15b9a4bd9 100644 --- a/samples/boards/phytec/reel_board/mesh_badge/src/main.c +++ b/samples/boards/phytec/reel_board/mesh_badge/src/main.c @@ -181,7 +181,7 @@ static void bt_ready(int err) if (!mesh_is_initialized()) { /* Start advertising */ - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/subsys/logging/ble_backend/src/main.c b/samples/subsys/logging/ble_backend/src/main.c index c8edb8d8838db6..249e582a0e8338 100644 --- a/samples/subsys/logging/ble_backend/src/main.c +++ b/samples/subsys/logging/ble_backend/src/main.c @@ -26,7 +26,7 @@ static void start_adv(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); return; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c b/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c index 04cff562eef8f9..7c5723bf999f29 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c +++ b/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c @@ -30,7 +30,7 @@ static void advertise(struct k_work *work) { int rc; - rc = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + rc = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (rc) { LOG_ERR("Advertising failed to start (rc %d)", rc); return; diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 2191effefbae1b..39b0a6beedb0f2 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -392,7 +392,7 @@ static bool valid_adv_ext_param(const struct bt_le_adv_param *param) BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) { if (param->peer && !(param->options & BT_LE_ADV_OPT_EXT_ADV) && - !(param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + !(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { /* Cannot do directed non-connectable advertising * without extended advertising. */ @@ -441,7 +441,7 @@ static bool valid_adv_ext_param(const struct bt_le_adv_param *param) return false; } - if (!(param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + if (!(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { /* * BT Core 4.2 [Vol 2, Part E, 7.8.5] * The Advertising_Interval_Min and Advertising_Interval_Max @@ -484,7 +484,7 @@ static bool valid_adv_param(const struct bt_le_adv_param *param) return false; } - if (param->peer && !(param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + if (param->peer && !(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { return false; } @@ -1020,7 +1020,7 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, name_type = get_adv_name_type_param(param); - if (param->options & BT_LE_ADV_OPT_CONNECTABLE) { + if (param->options & _BT_LE_ADV_OPT_CONNECTABLE) { if (dir_adv) { if (param->options & BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY) { set_param.type = BT_HCI_ADV_DIRECT_IND_LOW_DUTY; @@ -1062,11 +1062,11 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, } if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && - (param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + (param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { err = le_adv_start_add_conn(adv, &conn); if (err) { if (err == -ENOMEM && !dir_adv && - !(param->options & BT_LE_ADV_OPT_ONE_TIME)) { + !(param->options & _BT_LE_ADV_OPT_ONE_TIME)) { goto set_adv_state; } @@ -1096,7 +1096,7 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, set_adv_state: atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && - !(param->options & BT_LE_ADV_OPT_ONE_TIME)); + !(param->options & _BT_LE_ADV_OPT_ONE_TIME)); atomic_set_bit_to(adv->flags, BT_ADV_INCLUDE_NAME_AD, name_type == ADV_NAME_TYPE_AD); @@ -1105,7 +1105,7 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, name_type == ADV_NAME_TYPE_SD); atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, - param->options & BT_LE_ADV_OPT_CONNECTABLE); + param->options & _BT_LE_ADV_OPT_CONNECTABLE); atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); @@ -1187,7 +1187,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, cp->scan_req_notify_enable = BT_HCI_LE_ADV_SCAN_REQ_ENABLE; } - if (param->options & BT_LE_ADV_OPT_CONNECTABLE) { + if (param->options & _BT_LE_ADV_OPT_CONNECTABLE) { props |= BT_HCI_LE_ADV_PROP_CONN; if (!dir_adv && !(param->options & BT_LE_ADV_OPT_EXT_ADV)) { /* When using non-extended adv packets then undirected @@ -1252,7 +1252,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, name_type == ADV_NAME_TYPE_SD); atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, - param->options & BT_LE_ADV_OPT_CONNECTABLE); + param->options & _BT_LE_ADV_OPT_CONNECTABLE); atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); @@ -1312,11 +1312,11 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, } if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && - (param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + (param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { err = le_adv_start_add_conn(adv, &conn); if (err) { if (err == -ENOMEM && !dir_adv && - !(param->options & BT_LE_ADV_OPT_ONE_TIME)) { + !(param->options & _BT_LE_ADV_OPT_ONE_TIME)) { goto set_adv_state; } @@ -1347,7 +1347,7 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, set_adv_state: /* Flag always set to false by le_ext_adv_param_set */ atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && - !(param->options & BT_LE_ADV_OPT_ONE_TIME)); + !(param->options & _BT_LE_ADV_OPT_ONE_TIME)); return 0; } @@ -1459,11 +1459,11 @@ static uint32_t adv_get_options(const struct bt_le_ext_adv *adv) uint32_t options = 0; if (!atomic_test_bit(adv->flags, BT_ADV_PERSIST)) { - options |= BT_LE_ADV_OPT_ONE_TIME; + options |= _BT_LE_ADV_OPT_ONE_TIME; } if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= _BT_LE_ADV_OPT_CONNECTABLE; } if (atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { @@ -1596,7 +1596,7 @@ int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv, /* If params for per adv has been set, do not allow setting * connectable, scanable or use legacy adv */ - if (param->options & BT_LE_ADV_OPT_CONNECTABLE || + if (param->options & _BT_LE_ADV_OPT_CONNECTABLE || param->options & BT_LE_ADV_OPT_SCANNABLE || !(param->options & BT_LE_ADV_OPT_EXT_ADV) || param->options & BT_LE_ADV_OPT_ANONYMOUS) { diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 6261e1fabb7ad6..f98636096bc209 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -792,7 +792,7 @@ bool bt_id_adv_random_addr_check(const struct bt_le_adv_param *param) * Explicitly stop it here. */ - if (!(param->options & BT_LE_ADV_OPT_CONNECTABLE) && + if (!(param->options & _BT_LE_ADV_OPT_CONNECTABLE) && (param->options & BT_LE_ADV_OPT_USE_IDENTITY)) { /* Attempt to set non-connectable NRPA */ return false; @@ -1870,7 +1870,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, return 0; } - if (options & BT_LE_ADV_OPT_CONNECTABLE) { + if (options & _BT_LE_ADV_OPT_CONNECTABLE) { if (dir_adv && (options & BT_LE_ADV_OPT_DIR_ADDR_RPA) && !BT_FEAT_LE_PRIVACY(bt_dev.le.features)) { return -ENOTSUP; diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 54ab12cec8f3ac..85efc36d4247bc 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -2003,7 +2003,7 @@ static int cmd_advertise(const struct shell *sh, size_t argc, char *argv[]) param.interval_max = BT_GAP_ADV_FAST_INT_MAX_2; if (!strcmp(argv[1], "on")) { - param.options = BT_LE_ADV_OPT_CONNECTABLE; + param.options = BT_LE_ADV_OPT_CONN; } else if (!strcmp(argv[1], "nconn")) { param.options = 0U; } else { @@ -2033,8 +2033,6 @@ static int cmd_advertise(const struct shell *sh, size_t argc, char *argv[]) } else if (!strcmp(arg, "name-ad")) { name_ad = true; name_sd = false; - } else if (!strcmp(arg, "one-time")) { - param.options |= BT_LE_ADV_OPT_ONE_TIME; } else if (!strcmp(arg, "disable-37")) { param.options |= BT_LE_ADV_OPT_DISABLE_CHAN_37; } else if (!strcmp(arg, "disable-38")) { @@ -2058,7 +2056,7 @@ static int cmd_advertise(const struct shell *sh, size_t argc, char *argv[]) atomic_clear(adv_opt); atomic_set_bit_to(adv_opt, SHELL_ADV_OPT_CONNECTABLE, - (param.options & BT_LE_ADV_OPT_CONNECTABLE) > 0); + (param.options & BT_LE_ADV_OPT_CONN) > 0); atomic_set_bit_to(adv_opt, SHELL_ADV_OPT_DISCOVERABLE, discoverable); atomic_set_bit_to(adv_opt, SHELL_ADV_OPT_APPEARANCE, appearance); @@ -2143,10 +2141,10 @@ static bool adv_param_parse(size_t argc, char *argv[], memset(param, 0, sizeof(struct bt_le_adv_param)); if (!strcmp(argv[1], "conn-scan")) { - param->options |= BT_LE_ADV_OPT_CONNECTABLE; + param->options |= BT_LE_ADV_OPT_CONN; param->options |= BT_LE_ADV_OPT_SCANNABLE; } else if (!strcmp(argv[1], "conn-nscan")) { - param->options |= BT_LE_ADV_OPT_CONNECTABLE; + param->options |= BT_LE_ADV_OPT_CONN; } else if (!strcmp(argv[1], "nconn-scan")) { param->options |= BT_LE_ADV_OPT_SCANNABLE; } else if (!strcmp(argv[1], "nconn-nscan")) { @@ -2245,7 +2243,7 @@ static int cmd_adv_create(const struct shell *sh, size_t argc, char *argv[]) atomic_clear(adv_set_opt[adv_index]); atomic_set_bit_to(adv_set_opt[adv_index], SHELL_ADV_OPT_CONNECTABLE, - (param.options & BT_LE_ADV_OPT_CONNECTABLE) > 0); + (param.options & BT_LE_ADV_OPT_CONN) > 0); atomic_set_bit_to(adv_set_opt[adv_index], SHELL_ADV_OPT_EXT_ADV, (param.options & BT_LE_ADV_OPT_EXT_ADV) > 0); @@ -4977,7 +4975,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, SHELL_CMD_ARG(advertise, NULL, " [mode: discov, non_discov] " "[filter-accept-list: fal, fal-scan, fal-conn] [identity] [no-name] " - "[one-time] [name-ad] [appearance] " + "[name-ad] [appearance] " "[disable-37] [disable-38] [disable-39]", cmd_advertise, 2, 8), #if defined(CONFIG_BT_PERIPHERAL) diff --git a/subsys/bluetooth/mesh/pb_gatt_srv.c b/subsys/bluetooth/mesh/pb_gatt_srv.c index 85b60cbe0fd99b..f59797ecff13a8 100644 --- a/subsys/bluetooth/mesh/pb_gatt_srv.c +++ b/subsys/bluetooth/mesh/pb_gatt_srv.c @@ -34,8 +34,7 @@ LOG_MODULE_REGISTER(bt_mesh_pb_gatt_srv); #define ADV_OPT_PROV \ - (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_SCANNABLE | \ - BT_LE_ADV_OPT_ONE_TIME | ADV_OPT_USE_IDENTITY) + (BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_SCANNABLE | ADV_OPT_USE_IDENTITY) #define FAST_ADV_TIME (60LL * MSEC_PER_SEC) diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index c3b33035a3f507..8855f021734e3a 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -48,8 +48,7 @@ LOG_MODULE_REGISTER(bt_mesh_gatt); BT_LE_ADV_OPT_USE_IDENTITY : (private) ? BT_LE_ADV_OPT_USE_NRPA : 0) #define ADV_OPT_PROXY(private) \ - (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_SCANNABLE | ADV_OPT_ADDR(private) | \ - BT_LE_ADV_OPT_ONE_TIME) + (BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_SCANNABLE | ADV_OPT_ADDR(private)) static void proxy_send_beacons(struct k_work *work); static int proxy_send(struct bt_conn *conn, diff --git a/subsys/bluetooth/services/nus/bt_nus_auto_start_bt.c b/subsys/bluetooth/services/nus/bt_nus_auto_start_bt.c index be7b16998a03a6..164a17156e91f2 100644 --- a/subsys/bluetooth/services/nus/bt_nus_auto_start_bt.c +++ b/subsys/bluetooth/services/nus/bt_nus_auto_start_bt.c @@ -27,7 +27,7 @@ static int bt_nus_auto_start(void) err = bt_enable(NULL); __ASSERT_NO_MSG(!err); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); __ASSERT_NO_MSG(!err); return 0; diff --git a/tests/bluetooth/common/testlib/src/adv.c b/tests/bluetooth/common/testlib/src/adv.c index ba2a201199d368..d02d5990846400 100644 --- a/tests/bluetooth/common/testlib/src/adv.c +++ b/tests/bluetooth/common/testlib/src/adv.c @@ -50,7 +50,7 @@ int bt_testlib_adv_conn(struct bt_conn **conn, int id, const char *name) param.id = id; param.interval_min = BT_GAP_ADV_FAST_INT_MIN_1; param.interval_max = BT_GAP_ADV_FAST_INT_MAX_1; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; k_condvar_init(&ctx.done); diff --git a/tests/bluetooth/host/id/bt_id_adv_random_addr_check/src/main.c b/tests/bluetooth/host/id/bt_id_adv_random_addr_check/src/main.c index 5f97f24cb3a17a..a8a1e6e8c3e253 100644 --- a/tests/bluetooth/host/id/bt_id_adv_random_addr_check/src/main.c +++ b/tests/bluetooth/host/id/bt_id_adv_random_addr_check/src/main.c @@ -154,7 +154,7 @@ ZTEST(bt_id_adv_random_addr_check, test_check_returns_false_advertise_with_local atomic_set_bit(bt_dev.flags, BT_DEV_SCANNING); - adv_param.options &= ~BT_LE_ADV_OPT_CONNECTABLE; + adv_param.options &= ~BT_LE_ADV_OPT_CONN; adv_param.options |= BT_LE_ADV_OPT_USE_IDENTITY; bt_dev.id_addr[BT_ID_DEFAULT].type = BT_ADDR_LE_RANDOM; diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c index 6540f6d4b2b14e..c6da5720ca4a4d 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c @@ -34,7 +34,7 @@ ZTEST_SUITE(bt_id_set_adv_own_addr, NULL, NULL, NULL, NULL, NULL); * privacy is enabled and 'BT_LE_ADV_OPT_USE_IDENTITY' options bit isn't set. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * - 'CONFIG_BT_PRIVACY' is enabled * - bt_id_set_adv_private_addr() succeeds and returns 0 @@ -53,7 +53,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_adv_conne Z_TEST_SKIP_IFNDEF(CONFIG_BT_PRIVACY); - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; /* This will cause bt_id_set_adv_private_addr() to return 0 */ atomic_set_bit(bt_dev.flags, BT_DEV_RPA_VALID); @@ -82,7 +82,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_adv_conne * bt_id_set_adv_random_addr() if privacy isn't enabled. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - 'CONFIG_BT_PRIVACY' isn't enabled * - bt_id_set_adv_random_addr() succeeds and returns 0 * @@ -102,7 +102,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_adv_connec /* If 'CONFIG_BT_EXT_ADV' is defined, it changes bt_id_set_adv_random_addr() behaviour */ Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; adv.id = 0; bt_addr_le_copy(&bt_dev.id_addr[adv.id], BT_RPA_LE_ADDR); @@ -132,12 +132,12 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_adv_connec /* * Test setting the advertising private address with a static random address through * bt_id_set_adv_random_addr() when device isn't advertising as a connectable device (i.e. - * BT_LE_ADV_OPT_CONNECTABLE bit in options isn't set) and the advertisement is using the device + * BT_LE_ADV_OPT_CONN bit in options isn't set) and the advertisement is using the device * identity (i.e. BT_LE_ADV_OPT_USE_IDENTITY bit is set in options). * * Constraints: * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit is set - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - bt_id_set_adv_random_addr() succeeds and returns 0 * * Expected behaviour: @@ -156,7 +156,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_not_connec Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); options |= BT_LE_ADV_OPT_USE_IDENTITY; - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; adv.id = 0; bt_addr_le_copy(&bt_dev.id_addr[adv.id], BT_RPA_LE_ADDR); @@ -178,7 +178,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_not_connec * 'BT_LE_ADV_OPT_USE_IDENTITY' and 'BT_LE_ADV_OPT_USE_IDENTITY' options bits aren't set. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * - bt_id_set_adv_random_addr() succeeds and returns 0 * @@ -196,7 +196,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_not_conne Z_TEST_SKIP_IFNDEF(CONFIG_BT_EXT_ADV); - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; options &= ~BT_LE_ADV_OPT_USE_IDENTITY; /* This will cause bt_id_set_adv_private_addr() to return 0 */ @@ -216,7 +216,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_not_conne * before updating the device advertising address and then re-enable it after the update is done. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * * Expected behaviour: @@ -233,7 +233,7 @@ ZTEST(bt_id_set_adv_own_addr, test_observer_scanning_re_enabled_after_updating_a Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); Z_TEST_SKIP_IFNDEF(CONFIG_BT_OBSERVER); - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; options &= ~BT_LE_ADV_OPT_USE_IDENTITY; /* Set device scanning active flag */ diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/test_suite_invalid_inputs.c b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/test_suite_invalid_inputs.c index c987f8e327609e..a5c7feaf5c1d08 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/test_suite_invalid_inputs.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/test_suite_invalid_inputs.c @@ -58,7 +58,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_null_address_type_reference) * Constraints: * - Directed advertising flag is set * - 'BT_LE_FEAT_BIT_PRIVACY' bit isn't set - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - Options 'BT_LE_ADV_OPT_DIR_ADDR_RPA' bit is set * * Expected behaviour: @@ -71,7 +71,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_dir_adv_with_rpa_no_privacy) struct bt_le_ext_adv adv = {0}; uint8_t own_addr_type = BT_ADDR_LE_ANONYMOUS; - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; bt_dev.le.features[(BT_LE_FEAT_BIT_PRIVACY) >> 3] &= ~BIT((BT_LE_FEAT_BIT_PRIVACY)&7); @@ -87,7 +87,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_dir_adv_with_rpa_no_privacy) * Operation fails if bt_id_set_adv_private_addr() failed and a negative error code is returned. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * - 'CONFIG_BT_PRIVACY' is enabled * - bt_id_set_adv_private_addr() fails and returns a negative error code (failure) @@ -104,7 +104,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_private_addr_fai Z_TEST_SKIP_IFNDEF(CONFIG_BT_PRIVACY); - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; err = bt_id_set_adv_own_addr(&adv, options, true, &own_addr_type); @@ -119,7 +119,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_private_addr_fai * Operation fails if bt_id_set_adv_random_addr() failed and a negative error code is returned. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - 'CONFIG_BT_PRIVACY' isn't enabled * - bt_id_set_adv_random_addr() fails and returns a negative error code (failure) * @@ -137,7 +137,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_random_addr_fail /* If 'CONFIG_BT_EXT_ADV' is defined, it changes bt_id_set_adv_random_addr() behaviour */ Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; adv.id = 0; bt_addr_le_copy(&bt_dev.id_addr[adv.id], BT_RPA_LE_ADDR); @@ -152,14 +152,14 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_random_addr_fail /* * Test setting the advertising private address with a static random address through * bt_id_set_adv_random_addr() when device isn't advertising as a connectable device (i.e. - * BT_LE_ADV_OPT_CONNECTABLE bit in options isn't set) and the advertisement is using the device + * BT_LE_ADV_OPT_CONN bit in options isn't set) and the advertisement is using the device * identity (i.e. BT_LE_ADV_OPT_USE_IDENTITY bit is set in options). * * Operation fails if bt_id_set_adv_random_addr() failed and a negative error code is returned. * * Constraints: * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit is set - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - bt_id_set_adv_random_addr() fails and returns a negative error code (failure) * * Expected behaviour: @@ -176,7 +176,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_random_addr_fail Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); options |= BT_LE_ADV_OPT_USE_IDENTITY; - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; adv.id = 0; bt_addr_le_copy(&bt_dev.id_addr[adv.id], BT_RPA_LE_ADDR); @@ -192,7 +192,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_random_addr_fail * Operation fails if bt_id_set_adv_private_addr() failed and a negative error code is returned. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * - bt_id_set_adv_private_addr() fails and returns a negative error code (failure) * @@ -206,7 +206,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_private_addr_fai struct bt_le_ext_adv adv = {0}; uint8_t own_addr_type = BT_ADDR_LE_ANONYMOUS; - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; options &= ~BT_LE_ADV_OPT_USE_IDENTITY; /* This will cause bt_id_set_adv_private_addr() to return a negative error code */ diff --git a/tests/bluetooth/shell/src/main.c b/tests/bluetooth/shell/src/main.c index b3933335f4e252..87114ad381af39 100644 --- a/tests/bluetooth/shell/src/main.c +++ b/tests/bluetooth/shell/src/main.c @@ -53,7 +53,7 @@ static int cmd_hrs_simulate(const struct shell *sh, if (!hrs_registered && IS_ENABLED(CONFIG_BT_BROADCASTER)) { shell_print(sh, "Registering HRS Service"); hrs_registered = true; - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { shell_error(sh, "Advertising failed to start" diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index f7dfad59418719..f8ed6aa583c61d 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -615,7 +615,7 @@ int tester_gap_create_adv_instance(struct bt_le_adv_param *param, uint8_t own_ad } if (atomic_test_bit(¤t_settings, BTP_GAP_SETTINGS_CONNECTABLE)) { - param->options |= BT_LE_ADV_OPT_CONNECTABLE; + param->options |= BT_LE_ADV_OPT_CONN; if (filter_list_in_use) { param->options |= BT_LE_ADV_OPT_FILTER_CONN; @@ -681,10 +681,8 @@ static uint8_t start_advertising(const void *cmd, uint16_t cmd_len, { const struct btp_gap_start_advertising_cmd *cp = cmd; struct btp_gap_start_advertising_rp *rp = rsp; - struct bt_le_adv_param param = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_ONE_TIME, - BT_GAP_ADV_FAST_INT_MIN_2, - BT_GAP_ADV_FAST_INT_MAX_2, - NULL); + struct bt_le_adv_param param = + BT_LE_ADV_PARAM_INIT(0, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); uint8_t own_addr_type; uint32_t duration; uint8_t adv_len; @@ -1436,10 +1434,8 @@ static struct bt_le_per_adv_sync_cb pa_sync_cb = { int tester_gap_padv_configure(const struct bt_le_per_adv_param *param) { int err; - struct bt_le_adv_param ext_adv_param = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_ONE_TIME, - param->interval_min, - param->interval_max, - NULL); + struct bt_le_adv_param ext_adv_param = + BT_LE_ADV_PARAM_INIT(0, param->interval_min, param->interval_max, NULL); if (ext_adv == NULL) { current_settings = BIT(BTP_GAP_SETTINGS_DISCOVERABLE) | diff --git a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c index f42100b5082b48..6d34ee21a4a1ac 100644 --- a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c @@ -693,7 +693,7 @@ static int common_init(void) bt_le_per_adv_sync_cb_register(&pa_sync_cb); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return err; diff --git a/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c b/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c index c48d86732e7d86..1ef319e9513702 100644 --- a/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c @@ -602,8 +602,8 @@ static void test_main_acl_disconnect(void) */ for (size_t i = 0U; i < ARRAY_SIZE(dummy_ext_adv); i++) { const struct bt_le_adv_param param = BT_LE_ADV_PARAM_INIT( - (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONNECTABLE), - BT_GAP_ADV_SLOW_INT_MAX, BT_GAP_ADV_SLOW_INT_MAX, NULL); + (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN), BT_GAP_ADV_SLOW_INT_MAX, + BT_GAP_ADV_SLOW_INT_MAX, NULL); int err; err = bt_le_ext_adv_create(¶m, NULL, &dummy_ext_adv[i]); diff --git a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c index 7a9dfe2310ad5d..30fb50ee4f07d5 100644 --- a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c @@ -638,7 +638,7 @@ void test_start_adv(void) struct bt_le_ext_adv *ext_adv; /* Create a connectable non-scannable advertising set */ - err = bt_le_ext_adv_create(BT_LE_ADV_CONN_ONE_TIME, NULL, &ext_adv); + err = bt_le_ext_adv_create(BT_LE_ADV_CONN_FAST_1, NULL, &ext_adv); if (err != 0) { FAIL("Failed to create advertising set (err %d)\n", err); @@ -752,7 +752,7 @@ static void init(void) bt_cap_stream_ops_register(&unicast_streams[i], &unicast_stream_ops); } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, cap_acceptor_ad, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, cap_acceptor_ad, ARRAY_SIZE(cap_acceptor_ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/audio/src/csip_notify_server_test.c b/tests/bsim/bluetooth/audio/src/csip_notify_server_test.c index 73b344fda2b5e5..0f804ed15c9b89 100644 --- a/tests/bsim/bluetooth/audio/src/csip_notify_server_test.c +++ b/tests/bsim/bluetooth/audio/src/csip_notify_server_test.c @@ -78,7 +78,7 @@ static void test_main(void) } printk("Start Advertising\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; @@ -119,7 +119,7 @@ static void test_main(void) } printk("Start Advertising\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/csip_set_member_test.c b/tests/bsim/bluetooth/audio/src/csip_set_member_test.c index 2877ea23fa93d6..e144866ab3295f 100644 --- a/tests/bsim/bluetooth/audio/src/csip_set_member_test.c +++ b/tests/bsim/bluetooth/audio/src/csip_set_member_test.c @@ -80,7 +80,7 @@ static void bt_ready(int err) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); } diff --git a/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c b/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c index 09de70135fefa6..5dc1fc7eeb95fd 100644 --- a/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c +++ b/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c @@ -445,8 +445,8 @@ static void test_main(void) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, gmap_acceptor_ad, - ARRAY_SIZE(gmap_acceptor_ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, gmap_acceptor_ad, ARRAY_SIZE(gmap_acceptor_ad), + NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/has_test.c b/tests/bsim/bluetooth/audio/src/has_test.c index cf5aaa45b99892..ca74bb5d345761 100644 --- a/tests/bsim/bluetooth/audio/src/has_test.c +++ b/tests/bsim/bluetooth/audio/src/has_test.c @@ -43,7 +43,7 @@ static void start_adv(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/ias_test.c b/tests/bsim/bluetooth/audio/src/ias_test.c index 9ea8c33f2801f6..b7c93af20d41f3 100644 --- a/tests/bsim/bluetooth/audio/src/ias_test.c +++ b/tests/bsim/bluetooth/audio/src/ias_test.c @@ -58,7 +58,7 @@ static void test_main(void) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/mcs_test.c b/tests/bsim/bluetooth/audio/src/mcs_test.c index 5627f560f95bbd..c049bc911d7b45 100644 --- a/tests/bsim/bluetooth/audio/src/mcs_test.c +++ b/tests/bsim/bluetooth/audio/src/mcs_test.c @@ -20,7 +20,7 @@ static void start_adv(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/media_controller_test.c b/tests/bsim/bluetooth/audio/src/media_controller_test.c index a8e7ead4c91c4f..34faffc0dbb60b 100644 --- a/tests/bsim/bluetooth/audio/src/media_controller_test.c +++ b/tests/bsim/bluetooth/audio/src/media_controller_test.c @@ -1655,7 +1655,7 @@ void test_media_controller_remote_player(void) initialize_bluetooth(); initialize_media(); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); } diff --git a/tests/bsim/bluetooth/audio/src/micp_mic_dev_test.c b/tests/bsim/bluetooth/audio/src/micp_mic_dev_test.c index 9a9bd0466f9406..bc8c820b70222f 100644 --- a/tests/bsim/bluetooth/audio/src/micp_mic_dev_test.c +++ b/tests/bsim/bluetooth/audio/src/micp_mic_dev_test.c @@ -432,7 +432,7 @@ static void test_main(void) printk("MICP initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/pacs_notify_server_test.c b/tests/bsim/bluetooth/audio/src/pacs_notify_server_test.c index a1ce273de955d5..cbd4fc75111f59 100644 --- a/tests/bsim/bluetooth/audio/src/pacs_notify_server_test.c +++ b/tests/bsim/bluetooth/audio/src/pacs_notify_server_test.c @@ -191,7 +191,7 @@ static void test_main(void) } LOG_DBG("Start Advertising"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)", err); return; @@ -225,7 +225,7 @@ static void test_main(void) trigger_notifications(); LOG_DBG("Start Advertising"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)", err); return; @@ -242,7 +242,7 @@ static void test_main(void) } LOG_DBG("Start Advertising"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)", err); return; @@ -276,7 +276,7 @@ static void test_main(void) } LOG_DBG("Start Advertising"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/audio/src/tbs_client_test.c b/tests/bsim/bluetooth/audio/src/tbs_client_test.c index 66a4574647b081..6c1c91b42e3ad1 100644 --- a/tests/bsim/bluetooth/audio/src/tbs_client_test.c +++ b/tests/bsim/bluetooth/audio/src/tbs_client_test.c @@ -503,7 +503,7 @@ static void test_main(void) printk("Audio Server: Bluetooth discovered\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/vcp_vol_rend_test.c b/tests/bsim/bluetooth/audio/src/vcp_vol_rend_test.c index dde6bc3ca075d1..59575f37144bcb 100644 --- a/tests/bsim/bluetooth/audio/src/vcp_vol_rend_test.c +++ b/tests/bsim/bluetooth/audio/src/vcp_vol_rend_test.c @@ -1044,7 +1044,7 @@ static void test_main(void) printk("VCP initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/src/peripheral.c b/tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/src/peripheral.c index fd9b6e9d5f8e77..41362a54789297 100644 --- a/tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/src/peripheral.c +++ b/tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/src/peripheral.c @@ -15,7 +15,7 @@ static void create_adv(struct bt_le_ext_adv **adv) memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.options |= BT_LE_ADV_OPT_EXT_ADV; params.id = BT_ID_DEFAULT; diff --git a/tests/bsim/bluetooth/host/att/eatt/src/common.c b/tests/bsim/bluetooth/host/att/eatt/src/common.c index 487f5c644b850e..271d759dcd6ea8 100644 --- a/tests/bsim/bluetooth/host/att/eatt/src/common.c +++ b/tests/bsim/bluetooth/host/att/eatt/src/common.c @@ -140,7 +140,7 @@ void peripheral_setup_and_connect(void) FAIL("Can't enable Bluetooth (err %d)\n", err); } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); } diff --git a/tests/bsim/bluetooth/host/att/eatt_notif/src/server_test.c b/tests/bsim/bluetooth/host/att/eatt_notif/src/server_test.c index 6cffbdba9ea23e..474fb101113920 100644 --- a/tests/bsim/bluetooth/host/att/eatt_notif/src/server_test.c +++ b/tests/bsim/bluetooth/host/att/eatt_notif/src/server_test.c @@ -189,7 +189,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c b/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c index 6481ce909b4290..a380ff615e2671 100644 --- a/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c +++ b/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c @@ -121,11 +121,6 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, } } -/* In your area */ -#define ADV_PARAM_SINGLE BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static strucc bt_conn *connecc(void) { int err; @@ -133,7 +128,7 @@ static strucc bt_conn *connecc(void) UNSET_FLAG(is_connected); - err = bt_le_adv_start(ADV_PARAM_SINGLE, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); ASSERT(!err, "Adving failed to start (err %d)\n", err); LOG_DBG(" wait connecc..."); diff --git a/tests/bsim/bluetooth/host/central/src/dummy_peripheral.c b/tests/bsim/bluetooth/host/central/src/dummy_peripheral.c index e7a85a80e658b9..6f6cb7ae54323e 100644 --- a/tests/bsim/bluetooth/host/central/src/dummy_peripheral.c +++ b/tests/bsim/bluetooth/host/central/src/dummy_peripheral.c @@ -41,7 +41,7 @@ static void test_peripheral_dummy(void) err = bt_enable(NULL); TEST_ASSERT(err == 0, "Can't enable Bluetooth (err %d)", err); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); TEST_ASSERT(err == 0, "Advertising failed to start (err %d)", err); err = k_sem_take(&sem_connected, K_FOREVER); diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c index 349f69187e6e67..c8a3303a8d9bed 100644 --- a/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c @@ -341,7 +341,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/gatt/caching/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/caching/src/gatt_server_test.c index cb64b53a3158a8..637b7037e2fc4c 100644 --- a/tests/bsim/bluetooth/host/gatt/caching/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/caching/src/gatt_server_test.c @@ -101,7 +101,7 @@ static void test_main_common(bool connect_eatt) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/host/gatt/ccc_store/src/peripheral.c b/tests/bsim/bluetooth/host/gatt/ccc_store/src/peripheral.c index 03344852af9187..873685ecd4fad3 100644 --- a/tests/bsim/bluetooth/host/gatt/ccc_store/src/peripheral.c +++ b/tests/bsim/bluetooth/host/gatt/ccc_store/src/peripheral.c @@ -58,18 +58,8 @@ BT_GATT_SERVICE_DEFINE(dummy_svc, BT_GATT_PRIMARY_SERVICE(&dummy_service), static void create_adv(struct bt_le_ext_adv **adv) { int err; - struct bt_le_adv_param params; - memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - - params.options |= BT_LE_ADV_OPT_CONNECTABLE; - - params.id = BT_ID_DEFAULT; - params.sid = 0; - params.interval_min = BT_GAP_ADV_FAST_INT_MIN_2; - params.interval_max = BT_GAP_ADV_FAST_INT_MAX_2; - - err = bt_le_ext_adv_create(¶ms, NULL, adv); + err = bt_le_ext_adv_create(BT_LE_ADV_CONN_FAST_1, NULL, adv); if (err) { FAIL("Failed to create advertiser (%d)\n", err); } diff --git a/tests/bsim/bluetooth/host/gatt/general/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/general/src/gatt_server_test.c index 3fb080848fce15..476f5bba0ef472 100644 --- a/tests/bsim/bluetooth/host/gatt/general/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/general/src/gatt_server_test.c @@ -161,7 +161,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/gatt/notify/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/notify/src/gatt_server_test.c index d3b345d34d4462..6b4cc13a7c250a 100644 --- a/tests/bsim/bluetooth/host/gatt/notify/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/notify/src/gatt_server_test.c @@ -183,7 +183,7 @@ static void setup(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/gatt/notify_multiple/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/notify_multiple/src/gatt_server_test.c index e1af7319ed2074..1a9a95262d6358 100644 --- a/tests/bsim/bluetooth/host/gatt/notify_multiple/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/notify_multiple/src/gatt_server_test.c @@ -145,7 +145,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/gatt/sc_indicate/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/gatt/sc_indicate/src/bs_bt_utils.c index 31952cbe330b9a..91391b404c7a7b 100644 --- a/tests/bsim/bluetooth/host/gatt/sc_indicate/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/gatt/sc_indicate/src/bs_bt_utils.c @@ -129,7 +129,7 @@ void create_adv(struct bt_le_ext_adv **adv) int err; struct bt_le_adv_param params = {}; - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.options |= BT_LE_ADV_OPT_EXT_ADV; params.id = BT_ID_DEFAULT; diff --git a/tests/bsim/bluetooth/host/gatt/settings/src/utils.c b/tests/bsim/bluetooth/host/gatt/settings/src/utils.c index b1b9262e235436..c7cf895d8a2ca9 100644 --- a/tests/bsim/bluetooth/host/gatt/settings/src/utils.c +++ b/tests/bsim/bluetooth/host/gatt/settings/src/utils.c @@ -121,8 +121,7 @@ void advertise_connectable(void) param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; err = bt_le_adv_start(¶m, NULL, 0, NULL, 0); __ASSERT(err == 0, "Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c b/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c index 64c88e01cfd1fc..56fe4070ad50aa 100644 --- a/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c +++ b/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c @@ -143,7 +143,7 @@ static void adv_connect(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/host/l2cap/credits/src/main.c b/tests/bsim/bluetooth/host/l2cap/credits/src/main.c index 4c649d0d81e4c9..f35abf350ac23b 100644 --- a/tests/bsim/bluetooth/host/l2cap/credits/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/credits/src/main.c @@ -210,11 +210,6 @@ static void disconnect_device(struct bt_conn *conn, void *data) WAIT_FOR_FLAG_UNSET(is_connected); } -#define BT_LE_ADV_CONN_OT BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static void test_peripheral_main(void) { LOG_DBG("*L2CAP CREDITS Peripheral started*"); @@ -233,7 +228,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_OT, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c b/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c index 1187f97241c7a7..b98a79e3555766 100644 --- a/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c @@ -227,10 +227,6 @@ static void disconnect_device(struct bt_conn *conn, void *data) WAIT_FOR_FLAG_UNSET(is_connected); } -#define BT_LE_ADV_CONN_OT \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static void test_peripheral_main(void) { int err; @@ -251,7 +247,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_OT, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/general/src/main_l2cap_ecred.c b/tests/bsim/bluetooth/host/l2cap/general/src/main_l2cap_ecred.c index 521e1a6d63372b..06135e030a5281 100644 --- a/tests/bsim/bluetooth/host/l2cap/general/src/main_l2cap_ecred.c +++ b/tests/bsim/bluetooth/host/l2cap/general/src/main_l2cap_ecred.c @@ -449,7 +449,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c b/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c index 76020b61fdc097..04825306285ae3 100644 --- a/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c @@ -235,11 +235,6 @@ static void disconnect_device(struct bt_conn *conn, void *data) WAIT_FOR_FLAG_UNSET(is_connected); } -#define BT_LE_ADV_CONN_OT BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static void test_peripheral_main(void) { LOG_DBG("L2CAP CONN LATENCY Peripheral started*"); @@ -255,7 +250,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_OT, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); ASSERT(!err, "Advertising failed to start (err %d)", err); LOG_DBG("Advertising started."); diff --git a/tests/bsim/bluetooth/host/l2cap/multilink_peripheral/src/dut.c b/tests/bsim/bluetooth/host/l2cap/multilink_peripheral/src/dut.c index 534b560b81911c..e62eb7f677211c 100644 --- a/tests/bsim/bluetooth/host/l2cap/multilink_peripheral/src/dut.c +++ b/tests/bsim/bluetooth/host/l2cap/multilink_peripheral/src/dut.c @@ -251,7 +251,7 @@ static void start_advertising(void) LOG_DBG("starting advertiser"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); TEST_ASSERT(!err, "Advertising failed to start (err %d)", err); } diff --git a/tests/bsim/bluetooth/host/l2cap/send_on_connect/src/main_l2cap_send_on_connect.c b/tests/bsim/bluetooth/host/l2cap/send_on_connect/src/main_l2cap_send_on_connect.c index a7da6e723a924d..9fd1c4bfcb8625 100644 --- a/tests/bsim/bluetooth/host/l2cap/send_on_connect/src/main_l2cap_send_on_connect.c +++ b/tests/bsim/bluetooth/host/l2cap/send_on_connect/src/main_l2cap_send_on_connect.c @@ -187,7 +187,7 @@ static void test_peripheral_main(void) register_l2cap_server(); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/stress/src/main.c b/tests/bsim/bluetooth/host/l2cap/stress/src/main.c index e0e761a37b9c56..0a9023ecbd31ac 100644 --- a/tests/bsim/bluetooth/host/l2cap/stress/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/stress/src/main.c @@ -293,11 +293,6 @@ static void disconnect_device(struct bt_conn *conn, void *data) WAIT_FOR_FLAG_UNSET(is_connected); } -#define BT_LE_ADV_CONN_OT BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static void test_peripheral_main(void) { LOG_DBG("*L2CAP STRESS Peripheral started*"); @@ -316,7 +311,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_OT, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/userdata/src/main_l2cap_userdata.c b/tests/bsim/bluetooth/host/l2cap/userdata/src/main_l2cap_userdata.c index d7f42d0d28eefc..57e70ae88210d2 100644 --- a/tests/bsim/bluetooth/host/l2cap/userdata/src/main_l2cap_userdata.c +++ b/tests/bsim/bluetooth/host/l2cap/userdata/src/main_l2cap_userdata.c @@ -175,7 +175,7 @@ static void test_peripheral_main(void) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/misc/conn_stress/peripheral/src/main.c b/tests/bsim/bluetooth/host/misc/conn_stress/peripheral/src/main.c index 024f37a378deaa..be11ade9baf8ec 100644 --- a/tests/bsim/bluetooth/host/misc/conn_stress/peripheral/src/main.c +++ b/tests/bsim/bluetooth/host/misc/conn_stress/peripheral/src/main.c @@ -400,7 +400,7 @@ void test_peripheral_main(void) sprintf(name, "per-%d", get_device_nbr()); bt_set_name(name); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); __ASSERT_NO_MSG(err); diff --git a/tests/bsim/bluetooth/host/misc/disable/src/gatt_server_test.c b/tests/bsim/bluetooth/host/misc/disable/src/gatt_server_test.c index 83c9cf744c7607..78cee69024d2e4 100644 --- a/tests/bsim/bluetooth/host/misc/disable/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/misc/disable/src/gatt_server_test.c @@ -144,7 +144,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/misc/hfc/src/main.c b/tests/bsim/bluetooth/host/misc/hfc/src/main.c index 15e2777917033b..7c70511c32f06b 100644 --- a/tests/bsim/bluetooth/host/misc/hfc/src/main.c +++ b/tests/bsim/bluetooth/host/misc/hfc/src/main.c @@ -106,10 +106,6 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, } } -#define ADV_PARAM_SINGLE BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static struct bt_conn *connect_as_peripheral(void) { int err; @@ -117,7 +113,7 @@ static struct bt_conn *connect_as_peripheral(void) UNSET_FLAG(is_connected); - err = bt_le_adv_start(ADV_PARAM_SINGLE, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); ASSERT(!err, "Adving failed to start (err %d)\n", err); LOG_DBG("advertising"); diff --git a/tests/bsim/bluetooth/host/misc/unregister_conn_cb/src/main.c b/tests/bsim/bluetooth/host/misc/unregister_conn_cb/src/main.c index 63aba885565ba7..ac2d919afab4af 100644 --- a/tests/bsim/bluetooth/host/misc/unregister_conn_cb/src/main.c +++ b/tests/bsim/bluetooth/host/misc/unregister_conn_cb/src/main.c @@ -123,7 +123,7 @@ static void start_adv(void) const struct bt_data ad[] = { BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR))}; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/privacy/central/src/tester.c b/tests/bsim/bluetooth/host/privacy/central/src/tester.c index b1c6e9fd1bc6d0..119802c4a0d2e5 100644 --- a/tests/bsim/bluetooth/host/privacy/central/src/tester.c +++ b/tests/bsim/bluetooth/host/privacy/central/src/tester.c @@ -141,9 +141,8 @@ void tester_procedure_periph_delayed_start_of_conn_adv(void) int err; struct bt_le_adv_param params = - BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_IDENTITY, - BT_GAP_ADV_FAST_INT_MIN_2, - BT_GAP_ADV_FAST_INT_MAX_2, NULL); + BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_IDENTITY, + BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); struct bt_data ad; struct bt_le_ext_adv *adv; diff --git a/tests/bsim/bluetooth/host/privacy/device/src/test_undirected_peripheral.c b/tests/bsim/bluetooth/host/privacy/device/src/test_undirected_peripheral.c index 402b590de00e12..fbfc45536addfd 100644 --- a/tests/bsim/bluetooth/host/privacy/device/src/test_undirected_peripheral.c +++ b/tests/bsim/bluetooth/host/privacy/device/src/test_undirected_peripheral.c @@ -166,7 +166,7 @@ static void create_adv(struct bt_le_ext_adv **adv) memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.id = BT_ID_DEFAULT; params.sid = 0; @@ -191,11 +191,11 @@ static void update_adv_params(struct bt_le_ext_adv *adv, enum adv_param_t adv_pa memset(¶ms, 0, sizeof(struct bt_le_adv_param)); if (adv_params == CONN_SCAN) { - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.options |= BT_LE_ADV_OPT_SCANNABLE; LOG_DBG("Advertiser params: CONN_SCAN"); } else if (adv_params == CONN_NSCAN) { - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; LOG_DBG("Advertiser params: CONN_NSCAN"); } else if (adv_params == NCONN_SCAN) { params.options |= BT_LE_ADV_OPT_SCANNABLE; diff --git a/tests/bsim/bluetooth/host/privacy/legacy/src/dut.c b/tests/bsim/bluetooth/host/privacy/legacy/src/dut.c index 5fc79107cee88d..f9530d46ac0b06 100644 --- a/tests/bsim/bluetooth/host/privacy/legacy/src/dut.c +++ b/tests/bsim/bluetooth/host/privacy/legacy/src/dut.c @@ -42,10 +42,8 @@ void start_advertising(uint32_t options) { int err; - struct bt_le_adv_param param = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_ONE_TIME, - BT_GAP_ADV_FAST_INT_MIN_2, - BT_GAP_ADV_FAST_INT_MAX_2, - NULL); + struct bt_le_adv_param param = + BT_LE_ADV_PARAM_INIT(0, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); param.options |= options; err = bt_le_adv_start(¶m, ad, ARRAY_SIZE(ad), NULL, 0); @@ -82,7 +80,7 @@ void dut_procedure(void) generate_new_rpa(); LOG_DBG("start adv with identity"); - start_advertising(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_IDENTITY); + start_advertising(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_IDENTITY); /* wait for the tester to validate we're using our identity address */ LOG_DBG("wait for validation by tester"); @@ -94,7 +92,7 @@ void dut_procedure(void) } LOG_DBG("start adv with RPA"); - start_advertising(BT_LE_ADV_OPT_CONNECTABLE); + start_advertising(BT_LE_ADV_OPT_CONN); /* Test pass verdict is decided by the tester */ PASS("DUT done\n"); diff --git a/tests/bsim/bluetooth/host/security/bond_overwrite_allowed/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/security/bond_overwrite_allowed/src/bs_bt_utils.c index 0fe1f7d3ac625f..d43fb32626a4c4 100644 --- a/tests/bsim/bluetooth/host/security/bond_overwrite_allowed/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/security/bond_overwrite_allowed/src/bs_bt_utils.c @@ -163,8 +163,7 @@ void advertise_connectable(int id, bt_addr_le_t *directed_dst) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; if (directed_dst) { param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; diff --git a/tests/bsim/bluetooth/host/security/bond_overwrite_denied/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/security/bond_overwrite_denied/src/bs_bt_utils.c index 0fe1f7d3ac625f..d43fb32626a4c4 100644 --- a/tests/bsim/bluetooth/host/security/bond_overwrite_denied/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/security/bond_overwrite_denied/src/bs_bt_utils.c @@ -163,8 +163,7 @@ void advertise_connectable(int id, bt_addr_le_t *directed_dst) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; if (directed_dst) { param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; diff --git a/tests/bsim/bluetooth/host/security/bond_per_connection/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/security/bond_per_connection/src/bs_bt_utils.c index 94b27a50b33213..b6ac6315ca9f37 100644 --- a/tests/bsim/bluetooth/host/security/bond_per_connection/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/security/bond_per_connection/src/bs_bt_utils.c @@ -184,8 +184,7 @@ void advertise_connectable(int id, bt_addr_le_t *directed_dst) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; if (directed_dst) { param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; diff --git a/tests/bsim/bluetooth/host/security/ccc_update/src/peripheral.c b/tests/bsim/bluetooth/host/security/ccc_update/src/peripheral.c index 9813a6b0b60bc1..0cae51ba2d96ca 100644 --- a/tests/bsim/bluetooth/host/security/ccc_update/src/peripheral.c +++ b/tests/bsim/bluetooth/host/security/ccc_update/src/peripheral.c @@ -63,7 +63,7 @@ static void create_adv(struct bt_le_ext_adv **adv) memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.id = BT_ID_DEFAULT; params.sid = 0; diff --git a/tests/bsim/bluetooth/host/security/id_addr_update/peripheral/src/utils.c b/tests/bsim/bluetooth/host/security/id_addr_update/peripheral/src/utils.c index 1e566fe1d4b130..83c34361d369a4 100644 --- a/tests/bsim/bluetooth/host/security/id_addr_update/peripheral/src/utils.c +++ b/tests/bsim/bluetooth/host/security/id_addr_update/peripheral/src/utils.c @@ -153,8 +153,7 @@ void advertise_connectable(int id) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; err = bt_le_adv_start(¶m, NULL, 0, NULL, 0); ASSERT(!err, "Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/host/security/security_changed_callback/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/security/security_changed_callback/src/bs_bt_utils.c index 3f9fabe544a43c..6f7f379853b13b 100644 --- a/tests/bsim/bluetooth/host/security/security_changed_callback/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/security/security_changed_callback/src/bs_bt_utils.c @@ -175,8 +175,7 @@ void advertise_connectable(int id, bt_addr_le_t *directed_dst) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; if (directed_dst) { param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; diff --git a/tests/bsim/bluetooth/ll/advx/src/main.c b/tests/bsim/bluetooth/ll/advx/src/main.c index cdc71c90691ef2..a98a55270477a4 100644 --- a/tests/bsim/bluetooth/ll/advx/src/main.c +++ b/tests/bsim/bluetooth/ll/advx/src/main.c @@ -185,7 +185,7 @@ static void test_advx_main(void) printk("success.\n"); printk("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return; @@ -401,7 +401,7 @@ static void test_advx_main(void) k_sleep(K_MSEC(1000)); printk("Create connectable advertising set..."); - err = bt_le_ext_adv_create(BT_LE_ADV_CONN, &adv_callbacks, &adv); + err = bt_le_ext_adv_create(BT_LE_ADV_CONN_FAST_2, &adv_callbacks, &adv); if (err) { goto exit; } @@ -654,7 +654,7 @@ static void test_advx_main(void) } }; const struct bt_le_adv_param adv_param = { - .options = BT_LE_ADV_OPT_CONNECTABLE, + .options = BT_LE_ADV_OPT_CONN, .peer = &direct_addr, }; err = bt_le_adv_start(&adv_param, NULL, 0, NULL, 0); diff --git a/tests/bsim/bluetooth/ll/cis/src/main.c b/tests/bsim/bluetooth/ll/cis/src/main.c index a4d5727a634577..2e5e8eeebf394f 100644 --- a/tests/bsim/bluetooth/ll/cis/src/main.c +++ b/tests/bsim/bluetooth/ll/cis/src/main.c @@ -75,18 +75,12 @@ static bt_addr_le_t peer_addr; BT_LE_CONN_PARAM(CONN_INTERVAL_MIN, CONN_INTERVAL_MAX, 0U, CONN_TIMEOUT) #if defined(CONFIG_TEST_USE_LEGACY_ADVERTISING) -#define BT_LE_ADV_CONN_CUSTOM BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, \ - ADV_INTERVAL_MIN, \ - ADV_INTERVAL_MAX, \ - NULL) +#define BT_LE_ADV_CONN_CUSTOM \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, ADV_INTERVAL_MIN, ADV_INTERVAL_MAX, NULL) #else /* !CONFIG_TEST_USE_LEGACY_ADVERTISING */ -#define BT_LE_ADV_CONN_CUSTOM BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_EXT_ADV | \ - BT_LE_ADV_OPT_ONE_TIME, \ - ADV_INTERVAL_MIN, \ - ADV_INTERVAL_MAX, \ - NULL) +#define BT_LE_ADV_CONN_CUSTOM \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_EXT_ADV, ADV_INTERVAL_MIN, \ + ADV_INTERVAL_MAX, NULL) #endif /* !CONFIG_TEST_USE_LEGACY_ADVERTISING */ #define SEQ_NUM_MAX 1000U diff --git a/tests/bsim/bluetooth/ll/conn/src/test_connect2.c b/tests/bsim/bluetooth/ll/conn/src/test_connect2.c index e8e07280b15c5d..44b7af7a55f5a7 100644 --- a/tests/bsim/bluetooth/ll/conn/src/test_connect2.c +++ b/tests/bsim/bluetooth/ll/conn/src/test_connect2.c @@ -122,9 +122,27 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } +static int start_advertising(void) +{ + int err; + + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); + if (err) { + printk("Advertising failed to start (err %d)\n", err); + } + + return err; +} + +static void recycled(void) +{ + start_advertising(); +} + static struct bt_conn_cb conn_callbacks = { .connected = connected, .disconnected = disconnected, + .recycled = recycled, }; static void bt_ready(void) @@ -133,13 +151,17 @@ static void bt_ready(void) printk("Peripheral Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return; } - printk("Advertising successfully started\n"); + err = start_advertising(); + + if (!err) { + printk("Advertising successfully started\n"); + } } static void bas_notify(void) diff --git a/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/main.c b/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/main.c index 55bb13ab3aa3c2..abd3fb5e868cf0 100644 --- a/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/main.c +++ b/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/main.c @@ -46,6 +46,21 @@ static const struct bt_data sd[] = { static int service_set; +static int start_advertising(void) +{ + int err; + + err = bt_le_adv_start(BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_IDENTITY, + BT_GAP_ADV_FAST_INT_MIN_1, BT_GAP_ADV_FAST_INT_MAX_1, + NULL), + ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + if (err) { + printk("Advertising failed to start (err %d)\n", err); + } + + return err; +} + static void connected(struct bt_conn *conn, uint8_t err) { if (err) { @@ -60,6 +75,11 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason 0x%02x)\n", reason); } +static void recycled(void) +{ + start_advertising(); +} + static void security_changed(struct bt_conn *conn, bt_security_t level, enum bt_security_err err) { @@ -73,6 +93,7 @@ static void security_changed(struct bt_conn *conn, bt_security_t level, BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, + .recycled = recycled, .security_changed = security_changed, }; @@ -226,14 +247,11 @@ static void bt_ready(int err) settings_load(); } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, - ARRAY_SIZE(sd)); - if (err) { - printk("Advertising failed to start (err %d)\n", err); - return; - } + err = start_advertising(); - printk("Advertising successfully started\n"); + if (!err) { + printk("Advertising successfully started\n"); + } } static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) diff --git a/tests/bsim/bluetooth/samples/battery_service/src/peripheral_test.c b/tests/bsim/bluetooth/samples/battery_service/src/peripheral_test.c index 0d7c3a3fdb4509..db6865341f60c5 100644 --- a/tests/bsim/bluetooth/samples/battery_service/src/peripheral_test.c +++ b/tests/bsim/bluetooth/samples/battery_service/src/peripheral_test.c @@ -101,7 +101,7 @@ static void bt_ready(void) LOG_DBG("Peripheral Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { TEST_FAIL("Advertising failed to start (err %d)\n", err); return;