Lines Matching refs:adv
175 enum adv_name_type get_adv_name_type(const struct bt_le_ext_adv *adv) in get_adv_name_type() argument
177 if (atomic_test_bit(adv->flags, BT_ADV_INCLUDE_NAME_SD)) { in get_adv_name_type()
181 if (atomic_test_bit(adv->flags, BT_ADV_INCLUDE_NAME_AD)) { in get_adv_name_type()
212 uint8_t bt_le_ext_adv_get_index(struct bt_le_ext_adv *adv) in bt_le_ext_adv_get_index() argument
214 ptrdiff_t index = adv - adv_pool; in bt_le_ext_adv_get_index()
223 struct bt_le_ext_adv *adv = NULL; in adv_new() local
228 adv = &adv_pool[i]; in adv_new()
233 if (!adv) { in adv_new()
237 (void)memset(adv, 0, sizeof(*adv)); in adv_new()
239 adv->handle = i; in adv_new()
241 return adv; in adv_new()
244 static void adv_delete(struct bt_le_ext_adv *adv) in adv_delete() argument
246 atomic_clear_bit(adv->flags, BT_ADV_CREATED); in adv_delete()
262 void bt_le_ext_adv_foreach(void (*func)(struct bt_le_ext_adv *adv, void *data), in bt_le_ext_adv_foreach() argument
272 func(&bt_dev.adv, data); in bt_le_ext_adv_foreach()
282 (void)memset(&bt_dev.adv, 0, sizeof(bt_dev.adv)); in bt_adv_reset_adv_pool()
288 if (bt_dev.adv) { in adv_create_legacy()
292 bt_dev.adv = adv_new(); in adv_create_legacy()
293 if (bt_dev.adv == NULL) { in adv_create_legacy()
303 if (bt_dev.adv) { in bt_le_adv_delete_legacy()
304 atomic_clear_bit(bt_dev.adv->flags, BT_ADV_CREATED); in bt_le_adv_delete_legacy()
305 bt_dev.adv = NULL; in bt_le_adv_delete_legacy()
313 return bt_dev.adv; in bt_le_adv_lookup_legacy()
315 return &bt_dev.adv; in bt_le_adv_lookup_legacy()
319 int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable) in bt_le_adv_set_enable_legacy() argument
336 bt_hci_cmd_state_set_init(buf, &state, adv->flags, BT_ADV_ENABLED, enable); in bt_le_adv_set_enable_legacy()
346 int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv, in bt_le_adv_set_enable_ext() argument
367 net_buf_add_u8(buf, adv->handle); in bt_le_adv_set_enable_ext()
371 bt_hci_cmd_state_set_init(buf, &state, adv->flags, BT_ADV_ENABLED, enable); in bt_le_adv_set_enable_ext()
381 int bt_le_adv_set_enable(struct bt_le_ext_adv *adv, bool enable) in bt_le_adv_set_enable() argument
385 return bt_le_adv_set_enable_ext(adv, enable, NULL); in bt_le_adv_set_enable()
388 return bt_le_adv_set_enable_legacy(adv, enable); in bt_le_adv_set_enable()
559 static int hci_set_adv_ext_complete(struct bt_le_ext_adv *adv, uint16_t hci_op, in hci_set_adv_ext_complete() argument
568 if (!atomic_test_bit(adv->flags, BT_ADV_EXT_ADV) && in hci_set_adv_ext_complete()
590 set_data->handle = adv->handle; in hci_set_adv_ext_complete()
597 static int hci_set_adv_ext_fragmented(struct bt_le_ext_adv *adv, uint16_t hci_op, in hci_set_adv_ext_fragmented() argument
622 set_data->handle = adv->handle; in hci_set_adv_ext_fragmented()
647 static int hci_set_ad_ext(struct bt_le_ext_adv *adv, uint16_t hci_op, in hci_set_ad_ext() argument
659 atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in hci_set_ad_ext()
676 return hci_set_adv_ext_complete(adv, hci_op, total_len_bytes, ad, ad_len); in hci_set_ad_ext()
678 return hci_set_adv_ext_fragmented(adv, hci_op, ad, ad_len); in hci_set_ad_ext()
684 static int set_ad(struct bt_le_ext_adv *adv, const struct bt_ad *ad, in set_ad() argument
689 return hci_set_ad_ext(adv, BT_HCI_OP_LE_SET_EXT_ADV_DATA, in set_ad()
696 static int set_sd(struct bt_le_ext_adv *adv, const struct bt_ad *sd, in set_sd() argument
701 return hci_set_ad_ext(adv, BT_HCI_OP_LE_SET_EXT_SCAN_RSP_DATA, in set_sd()
709 static int hci_set_per_adv_data(const struct bt_le_ext_adv *adv, in hci_set_per_adv_data() argument
736 set_data->handle = adv->handle; in hci_set_per_adv_data()
792 static int le_adv_update(struct bt_le_ext_adv *adv, in le_adv_update() argument
828 err = set_ad(adv, d, d_len); in le_adv_update()
845 err = set_sd(adv, d, d_len); in le_adv_update()
851 atomic_set_bit(adv->flags, BT_ADV_DATA_SET); in le_adv_update()
858 struct bt_le_ext_adv *adv = bt_le_adv_lookup_legacy(); in bt_le_adv_update_data() local
861 if (!adv) { in bt_le_adv_update_data()
865 if (!atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_le_adv_update_data()
869 scannable = atomic_test_bit(adv->flags, BT_ADV_SCANNABLE); in bt_le_adv_update_data()
871 return le_adv_update(adv, ad, ad_len, sd, sd_len, false, scannable, in bt_le_adv_update_data()
872 get_adv_name_type(adv)); in bt_le_adv_update_data()
910 static inline bool adv_is_directed(const struct bt_le_ext_adv *adv) in adv_is_directed() argument
915 return !bt_addr_le_eq(&adv->target_addr, BT_ADDR_LE_ANY); in adv_is_directed()
918 static int le_adv_start_add_conn(const struct bt_le_ext_adv *adv, in le_adv_start_add_conn() argument
923 bt_dev.adv_conn_id = adv->id; in le_adv_start_add_conn()
925 if (!adv_is_directed(adv)) { in le_adv_start_add_conn()
927 conn = bt_conn_add_le(adv->id, BT_ADDR_LE_NONE); in le_adv_start_add_conn()
937 if (bt_conn_exists_le(adv->id, &adv->target_addr)) { in le_adv_start_add_conn()
941 conn = bt_conn_add_le(adv->id, &adv->target_addr); in le_adv_start_add_conn()
951 static void le_adv_stop_free_conn(const struct bt_le_ext_adv *adv, uint8_t status) in le_adv_stop_free_conn() argument
955 if (!adv_is_directed(adv)) { in le_adv_stop_free_conn()
956 conn = bt_conn_lookup_state_le(adv->id, BT_ADDR_LE_NONE, in le_adv_stop_free_conn()
959 conn = bt_conn_lookup_state_le(adv->id, &adv->target_addr, in le_adv_stop_free_conn()
970 int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, in bt_le_adv_start_legacy() argument
995 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_le_adv_start_legacy()
1008 adv->id = param->id; in bt_le_adv_start_legacy()
1009 bt_dev.adv_conn_id = adv->id; in bt_le_adv_start_legacy()
1011 err = bt_id_set_adv_own_addr(adv, param->options, dir_adv, in bt_le_adv_start_legacy()
1018 bt_addr_le_copy(&adv->target_addr, param->peer); in bt_le_adv_start_legacy()
1020 bt_addr_le_copy(&adv->target_addr, BT_ADDR_LE_ANY); in bt_le_adv_start_legacy()
1059 err = le_adv_update(adv, ad, ad_len, sd, sd_len, false, in bt_le_adv_start_legacy()
1068 err = le_adv_start_add_conn(adv, &conn); in bt_le_adv_start_legacy()
1079 err = bt_le_adv_set_enable(adv, true); in bt_le_adv_start_legacy()
1100 atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && in bt_le_adv_start_legacy()
1103 atomic_set_bit_to(adv->flags, BT_ADV_INCLUDE_NAME_AD, in bt_le_adv_start_legacy()
1106 atomic_set_bit_to(adv->flags, BT_ADV_INCLUDE_NAME_SD, in bt_le_adv_start_legacy()
1109 atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, in bt_le_adv_start_legacy()
1112 atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); in bt_le_adv_start_legacy()
1114 atomic_set_bit_to(adv->flags, BT_ADV_USE_IDENTITY, in bt_le_adv_start_legacy()
1120 static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, in le_ext_adv_param_set() argument
1139 adv->options = param->options; in le_ext_adv_param_set()
1141 err = bt_id_set_adv_own_addr(adv, param->options, dir_adv, in le_ext_adv_param_set()
1149 bt_addr_le_copy(&adv->target_addr, param->peer); in le_ext_adv_param_set()
1151 bt_addr_le_copy(&adv->target_addr, BT_ADDR_LE_ANY); in le_ext_adv_param_set()
1156 cp->handle = adv->handle; in le_ext_adv_param_set()
1233 adv->tx_power = rp->tx_power; in le_ext_adv_param_set()
1238 atomic_set_bit(adv->flags, BT_ADV_PARAMS_SET); in le_ext_adv_param_set()
1240 if (atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_PENDING)) { in le_ext_adv_param_set()
1241 err = bt_id_set_adv_random_addr(adv, &adv->random_addr.a); in le_ext_adv_param_set()
1248 atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, false); in le_ext_adv_param_set()
1250 atomic_set_bit_to(adv->flags, BT_ADV_INCLUDE_NAME_AD, in le_ext_adv_param_set()
1253 atomic_set_bit_to(adv->flags, BT_ADV_INCLUDE_NAME_SD, in le_ext_adv_param_set()
1256 atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, in le_ext_adv_param_set()
1259 atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); in le_ext_adv_param_set()
1261 atomic_set_bit_to(adv->flags, BT_ADV_USE_IDENTITY, in le_ext_adv_param_set()
1264 atomic_set_bit_to(adv->flags, BT_ADV_EXT_ADV, in le_ext_adv_param_set()
1270 int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, in bt_le_adv_start_ext() argument
1291 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_le_adv_start_ext()
1295 adv->id = param->id; in bt_le_adv_start_ext()
1296 err = le_ext_adv_param_set(adv, param, sd != NULL); in bt_le_adv_start_ext()
1303 err = bt_le_ext_adv_set_data(adv, ad, ad_len, sd, sd_len); in bt_le_adv_start_ext()
1312 atomic_set_bit(adv->flags, BT_ADV_LIMITED); in bt_le_adv_start_ext()
1318 err = le_adv_start_add_conn(adv, &conn); in bt_le_adv_start_ext()
1329 err = bt_le_adv_set_enable_ext(adv, true, &start_param); in bt_le_adv_start_ext()
1351 atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && in bt_le_adv_start_ext()
1359 int bt_le_lim_adv_cancel_timeout(struct bt_le_ext_adv *adv) in bt_le_lim_adv_cancel_timeout() argument
1361 return k_work_cancel_delayable(&adv->lim_adv_timeout_work); in bt_le_lim_adv_cancel_timeout()
1368 struct bt_le_ext_adv *adv; in bt_le_adv_start() local
1376 adv = bt_le_adv_lookup_legacy(); in bt_le_adv_start()
1380 err = bt_le_adv_start_ext(adv, param, ad, ad_len, sd, sd_len); in bt_le_adv_start()
1382 err = bt_le_adv_start_legacy(adv, param, ad, ad_len, sd, sd_len); in bt_le_adv_start()
1390 k_work_init_delayable(&adv->lim_adv_timeout_work, adv_timeout); in bt_le_adv_start()
1391 k_work_reschedule(&adv->lim_adv_timeout_work, in bt_le_adv_start()
1400 struct bt_le_ext_adv *adv = bt_le_adv_lookup_legacy(); in bt_le_adv_stop() local
1403 if (!adv) { in bt_le_adv_stop()
1408 (void)bt_le_lim_adv_cancel_timeout(adv); in bt_le_adv_stop()
1413 atomic_clear_bit(adv->flags, BT_ADV_PERSIST); in bt_le_adv_stop()
1415 if (!atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_le_adv_stop()
1425 atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { in bt_le_adv_stop()
1426 le_adv_stop_free_conn(adv, 0); in bt_le_adv_stop()
1431 err = bt_le_adv_set_enable_ext(adv, false, NULL); in bt_le_adv_stop()
1436 err = bt_le_adv_set_enable_legacy(adv, false); in bt_le_adv_stop()
1462 static uint32_t adv_get_options(const struct bt_le_ext_adv *adv) in adv_get_options() argument
1466 if (!atomic_test_bit(adv->flags, BT_ADV_PERSIST)) { in adv_get_options()
1470 if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { in adv_get_options()
1474 if (atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in adv_get_options()
1483 struct bt_le_ext_adv *adv = bt_le_adv_lookup_legacy(); in bt_le_adv_resume() local
1488 if (!adv) { in bt_le_adv_resume()
1493 if (!(atomic_test_bit(adv->flags, BT_ADV_PERSIST) && in bt_le_adv_resume()
1494 !atomic_test_bit(adv->flags, BT_ADV_ENABLED))) { in bt_le_adv_resume()
1498 if (!atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { in bt_le_adv_resume()
1502 err = le_adv_start_add_conn(adv, &conn); in bt_le_adv_resume()
1511 !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in bt_le_adv_resume()
1512 bt_id_set_adv_private_addr(adv); in bt_le_adv_resume()
1515 bool dir_adv = adv_is_directed(adv); in bt_le_adv_resume()
1516 uint32_t options = adv_get_options(adv); in bt_le_adv_resume()
1519 err = bt_id_set_adv_own_addr(adv, options, dir_adv, &own_addr_type); in bt_le_adv_resume()
1526 err = bt_le_adv_set_enable(adv, true); in bt_le_adv_resume()
1534 persist_paused = atomic_test_and_clear_bit(adv->flags, in bt_le_adv_resume()
1543 atomic_set_bit(adv->flags, BT_ADV_PERSIST); in bt_le_adv_resume()
1549 int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv, in bt_le_ext_adv_get_info() argument
1552 info->id = adv->id; in bt_le_ext_adv_get_info()
1553 info->tx_power = adv->tx_power; in bt_le_ext_adv_get_info()
1554 info->addr = &adv->random_addr; in bt_le_ext_adv_get_info()
1563 struct bt_le_ext_adv *adv; in bt_le_ext_adv_create() local
1580 adv = adv_new(); in bt_le_ext_adv_create()
1581 if (!adv) { in bt_le_ext_adv_create()
1585 adv->id = param->id; in bt_le_ext_adv_create()
1586 adv->cb = cb; in bt_le_ext_adv_create()
1588 err = le_ext_adv_param_set(adv, param, false); in bt_le_ext_adv_create()
1590 adv_delete(adv); in bt_le_ext_adv_create()
1594 *out_adv = adv; in bt_le_ext_adv_create()
1598 int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv, in bt_le_ext_adv_update_param() argument
1601 CHECKIF(adv == NULL) { in bt_le_ext_adv_update_param()
1612 atomic_test_bit(adv->flags, BT_PER_ADV_PARAMS_SET)) { in bt_le_ext_adv_update_param()
1624 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_le_ext_adv_update_param()
1628 if (param->id != adv->id) { in bt_le_ext_adv_update_param()
1629 atomic_clear_bit(adv->flags, BT_ADV_RPA_VALID); in bt_le_ext_adv_update_param()
1632 return le_ext_adv_param_set(adv, param, false); in bt_le_ext_adv_update_param()
1635 int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, in bt_le_ext_adv_start() argument
1641 CHECKIF(adv == NULL) { in bt_le_ext_adv_start()
1647 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_le_ext_adv_start()
1652 atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { in bt_le_ext_adv_start()
1653 err = le_adv_start_add_conn(adv, &conn); in bt_le_ext_adv_start()
1659 atomic_set_bit_to(adv->flags, BT_ADV_LIMITED, param && in bt_le_ext_adv_start()
1662 if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { in bt_le_ext_adv_start()
1664 !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in bt_le_ext_adv_start()
1665 bt_id_set_adv_private_addr(adv); in bt_le_ext_adv_start()
1668 if (!atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in bt_le_ext_adv_start()
1669 bt_id_set_adv_private_addr(adv); in bt_le_ext_adv_start()
1673 if (get_adv_name_type(adv) != ADV_NAME_TYPE_NONE && in bt_le_ext_adv_start()
1674 !atomic_test_bit(adv->flags, BT_ADV_DATA_SET)) { in bt_le_ext_adv_start()
1676 bt_le_ext_adv_set_data(adv, NULL, 0, NULL, 0); in bt_le_ext_adv_start()
1679 err = bt_le_adv_set_enable_ext(adv, true, param); in bt_le_ext_adv_start()
1702 int bt_le_ext_adv_stop(struct bt_le_ext_adv *adv) in bt_le_ext_adv_stop() argument
1704 CHECKIF(adv == NULL) { in bt_le_ext_adv_stop()
1710 (void)bt_le_lim_adv_cancel_timeout(adv); in bt_le_ext_adv_stop()
1712 atomic_clear_bit(adv->flags, BT_ADV_PERSIST); in bt_le_ext_adv_stop()
1714 if (!atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_le_ext_adv_stop()
1718 if (atomic_test_and_clear_bit(adv->flags, BT_ADV_LIMITED)) { in bt_le_ext_adv_stop()
1719 bt_id_adv_limited_stopped(adv); in bt_le_ext_adv_stop()
1727 atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { in bt_le_ext_adv_stop()
1728 le_adv_stop_free_conn(adv, 0); in bt_le_ext_adv_stop()
1731 return bt_le_adv_set_enable_ext(adv, false, NULL); in bt_le_ext_adv_stop()
1734 int bt_le_ext_adv_set_data(struct bt_le_ext_adv *adv, in bt_le_ext_adv_set_data() argument
1740 CHECKIF(adv == NULL) { in bt_le_ext_adv_set_data()
1746 ext_adv = atomic_test_bit(adv->flags, BT_ADV_EXT_ADV); in bt_le_ext_adv_set_data()
1747 scannable = atomic_test_bit(adv->flags, BT_ADV_SCANNABLE); in bt_le_ext_adv_set_data()
1756 return le_adv_update(adv, ad, ad_len, sd, sd_len, ext_adv, scannable, in bt_le_ext_adv_set_data()
1757 get_adv_name_type(adv)); in bt_le_ext_adv_set_data()
1760 int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv) in bt_le_ext_adv_delete() argument
1770 CHECKIF(adv == NULL) { in bt_le_ext_adv_delete()
1777 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_le_ext_adv_delete()
1788 cp->handle = adv->handle; in bt_le_ext_adv_delete()
1795 adv_delete(adv); in bt_le_ext_adv_delete()
1806 struct bt_le_ext_adv *adv; in adv_timeout() local
1809 adv = CONTAINER_OF(dwork, struct bt_le_ext_adv, lim_adv_timeout_work); in adv_timeout()
1812 if (adv == bt_dev.adv) { in adv_timeout()
1815 err = bt_le_ext_adv_stop(adv); in adv_timeout()
1826 int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv, in bt_le_per_adv_set_param() argument
1855 CHECKIF(adv == NULL) { in bt_le_per_adv_set_param()
1861 if (atomic_test_bit(adv->flags, BT_ADV_SCANNABLE)) { in bt_le_per_adv_set_param()
1863 } else if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { in bt_le_per_adv_set_param()
1865 } else if (!atomic_test_bit(adv->flags, BT_ADV_EXT_ADV)) { in bt_le_per_adv_set_param()
1888 cp->handle = adv->handle; in bt_le_per_adv_set_param()
1914 atomic_set_bit(adv->flags, BT_PER_ADV_INCLUDE_ADI); in bt_le_per_adv_set_param()
1916 atomic_clear_bit(adv->flags, BT_PER_ADV_INCLUDE_ADI); in bt_le_per_adv_set_param()
1919 atomic_set_bit(adv->flags, BT_PER_ADV_PARAMS_SET); in bt_le_per_adv_set_param()
1924 int bt_le_per_adv_set_data(const struct bt_le_ext_adv *adv, in bt_le_per_adv_set_data() argument
1933 CHECKIF(adv == NULL) { in bt_le_per_adv_set_data()
1939 if (!atomic_test_bit(adv->flags, BT_PER_ADV_PARAMS_SET)) { in bt_le_per_adv_set_data()
1952 atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED)) { in bt_le_per_adv_set_data()
1959 return hci_set_per_adv_data(adv, ad, ad_len); in bt_le_per_adv_set_data()
1962 int bt_le_per_adv_set_subevent_data(const struct bt_le_ext_adv *adv, uint8_t num_subevents, in bt_le_per_adv_set_subevent_data() argument
1974 CHECKIF(adv == NULL) { in bt_le_per_adv_set_subevent_data()
1995 cp->adv_handle = adv->handle; in bt_le_per_adv_set_subevent_data()
2010 static int bt_le_per_adv_enable(struct bt_le_ext_adv *adv, bool enable) in bt_le_per_adv_enable() argument
2021 CHECKIF(adv == NULL) { in bt_le_per_adv_enable()
2028 if (!atomic_test_bit(adv->flags, BT_PER_ADV_PARAMS_SET)) { in bt_le_per_adv_enable()
2032 if (atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED) == enable) { in bt_le_per_adv_enable()
2044 cp->handle = adv->handle; in bt_le_per_adv_enable()
2049 if (atomic_test_bit(adv->flags, BT_PER_ADV_INCLUDE_ADI)) { in bt_le_per_adv_enable()
2056 bt_hci_cmd_state_set_init(buf, &state, adv->flags, in bt_le_per_adv_enable()
2067 int bt_le_per_adv_start(struct bt_le_ext_adv *adv) in bt_le_per_adv_start() argument
2069 return bt_le_per_adv_enable(adv, true); in bt_le_per_adv_start()
2072 int bt_le_per_adv_stop(struct bt_le_ext_adv *adv) in bt_le_per_adv_stop() argument
2074 return bt_le_per_adv_enable(adv, false); in bt_le_per_adv_stop()
2082 struct bt_le_ext_adv *adv; in bt_hci_le_per_adv_subevent_data_request() local
2091 adv = bt_hci_adv_lookup_handle(evt->adv_handle); in bt_hci_le_per_adv_subevent_data_request()
2092 if (!adv) { in bt_hci_le_per_adv_subevent_data_request()
2101 if (adv->cb && adv->cb->pawr_data_request) { in bt_hci_le_per_adv_subevent_data_request()
2102 adv->cb->pawr_data_request(adv, &request); in bt_hci_le_per_adv_subevent_data_request()
2110 struct bt_le_ext_adv *adv; in bt_hci_le_per_adv_response_report() local
2121 adv = bt_hci_adv_lookup_handle(evt->adv_handle); in bt_hci_le_per_adv_response_report()
2122 if (!adv) { in bt_hci_le_per_adv_response_report()
2156 if (adv->cb && adv->cb->pawr_response) { in bt_hci_le_per_adv_response_report()
2157 adv->cb->pawr_response(adv, &info, NULL); in bt_hci_le_per_adv_response_report()
2164 if (adv->cb && adv->cb->pawr_response) { in bt_hci_le_per_adv_response_report()
2165 adv->cb->pawr_response(adv, &info, &data); in bt_hci_le_per_adv_response_report()
2176 int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv, in bt_le_per_adv_set_info_transfer() argument
2200 cp->adv_handle = adv->handle; in bt_le_per_adv_set_info_transfer()
2214 struct bt_le_ext_adv *adv; in bt_hci_le_adv_set_terminated() local
2221 adv = bt_hci_adv_lookup_handle(evt->adv_handle); in bt_hci_le_adv_set_terminated()
2228 if (!adv) { in bt_hci_le_adv_set_terminated()
2233 (void)bt_le_lim_adv_cancel_timeout(adv); in bt_hci_le_adv_set_terminated()
2236 was_adv_enabled = atomic_test_bit(adv->flags, BT_ADV_ENABLED); in bt_hci_le_adv_set_terminated()
2239 atomic_clear_bit(adv->flags, BT_ADV_ENABLED); in bt_hci_le_adv_set_terminated()
2242 bt_dev.adv_conn_id = adv->id; in bt_hci_le_adv_set_terminated()
2262 atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { in bt_hci_le_adv_set_terminated()
2266 le_adv_stop_free_conn(adv, evt->status); in bt_hci_le_adv_set_terminated()
2274 !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in bt_hci_le_adv_set_terminated()
2279 &adv->random_addr.a); in bt_hci_le_adv_set_terminated()
2281 } else if (adv->options & BT_LE_ADV_OPT_USE_NRPA) { in bt_hci_le_adv_set_terminated()
2283 &adv->random_addr); in bt_hci_le_adv_set_terminated()
2289 if (adv->cb && adv->cb->connected) { in bt_hci_le_adv_set_terminated()
2294 adv->cb->connected(adv, &info); in bt_hci_le_adv_set_terminated()
2301 if (atomic_test_and_clear_bit(adv->flags, BT_ADV_LIMITED)) { in bt_hci_le_adv_set_terminated()
2302 bt_id_adv_limited_stopped(adv); in bt_hci_le_adv_set_terminated()
2308 if (adv->cb && adv->cb->sent) { in bt_hci_le_adv_set_terminated()
2313 adv->cb->sent(adv, &info); in bt_hci_le_adv_set_terminated()
2317 if (adv == bt_dev.adv) { in bt_hci_le_adv_set_terminated()
2318 if (atomic_test_bit(adv->flags, BT_ADV_PERSIST)) { in bt_hci_le_adv_set_terminated()
2331 struct bt_le_ext_adv *adv; in bt_hci_le_scan_req_received() local
2334 adv = bt_hci_adv_lookup_handle(evt->handle); in bt_hci_le_scan_req_received()
2338 if (!adv) { in bt_hci_le_scan_req_received()
2343 if (adv->cb && adv->cb->scanned) { in bt_hci_le_scan_req_received()
2351 bt_lookup_id_addr(adv->id, &evt->addr)); in bt_hci_le_scan_req_received()
2355 adv->cb->scanned(adv, &info); in bt_hci_le_scan_req_received()