Lines Matching refs:adv
70 static void adv_id_check_func(struct bt_le_ext_adv *adv, void *data) in adv_id_check_func() argument
78 if (check_data->id == adv->id) { in adv_id_check_func()
82 if (check_data->id == adv->id && in adv_id_check_func()
83 atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in adv_id_check_func()
89 static void adv_is_private_enabled(struct bt_le_ext_adv *adv, void *data) in adv_is_private_enabled() argument
93 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED) && in adv_is_private_enabled()
94 !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in adv_is_private_enabled()
100 static void adv_is_limited_enabled(struct bt_le_ext_adv *adv, void *data) in adv_is_limited_enabled() argument
104 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED) && in adv_is_limited_enabled()
105 atomic_test_bit(adv->flags, BT_ADV_LIMITED)) { in adv_is_limited_enabled()
110 static void adv_pause_enabled(struct bt_le_ext_adv *adv, void *data) in adv_pause_enabled() argument
112 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in adv_pause_enabled()
113 atomic_set_bit(adv->flags, BT_ADV_PAUSED); in adv_pause_enabled()
114 bt_le_adv_set_enable(adv, false); in adv_pause_enabled()
118 static void adv_unpause_enabled(struct bt_le_ext_adv *adv, void *data) in adv_unpause_enabled() argument
120 if (atomic_test_and_clear_bit(adv->flags, BT_ADV_PAUSED)) { in adv_unpause_enabled()
121 bt_le_adv_set_enable(adv, true); in adv_unpause_enabled()
164 int bt_id_set_adv_random_addr(struct bt_le_ext_adv *adv, in bt_id_set_adv_random_addr() argument
171 CHECKIF(adv == NULL || addr == NULL) { in bt_id_set_adv_random_addr()
182 if (!atomic_test_bit(adv->flags, BT_ADV_PARAMS_SET)) { in bt_id_set_adv_random_addr()
183 bt_addr_copy(&adv->random_addr.a, addr); in bt_id_set_adv_random_addr()
184 adv->random_addr.type = BT_ADDR_LE_RANDOM; in bt_id_set_adv_random_addr()
185 atomic_set_bit(adv->flags, BT_ADV_RANDOM_ADDR_PENDING); in bt_id_set_adv_random_addr()
197 cp->handle = adv->handle; in bt_id_set_adv_random_addr()
206 if (&adv->random_addr.a != addr) { in bt_id_set_adv_random_addr()
207 bt_addr_copy(&adv->random_addr.a, addr); in bt_id_set_adv_random_addr()
209 adv->random_addr.type = BT_ADDR_LE_RANDOM; in bt_id_set_adv_random_addr()
217 static void adv_rpa_expired(struct bt_le_ext_adv *adv, void *data) in adv_rpa_expired() argument
222 if (atomic_test_bit(adv->flags, BT_ADV_RPA_VALID) && in adv_rpa_expired()
223 adv->cb && adv->cb->rpa_expired) { in adv_rpa_expired()
224 rpa_invalid = adv->cb->rpa_expired(adv); in adv_rpa_expired()
230 if (adv->id >= bt_dev.id_count) { in adv_rpa_expired()
236 rpa_invalid_set_ptr[adv->id] = false; in adv_rpa_expired()
240 atomic_clear_bit(adv->flags, BT_ADV_RPA_VALID); in adv_rpa_expired()
245 static void adv_rpa_invalidate(struct bt_le_ext_adv *adv, void *data) in adv_rpa_invalidate() argument
250 if (!atomic_test_bit(adv->flags, BT_ADV_LIMITED) && in adv_rpa_invalidate()
251 !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in adv_rpa_invalidate()
252 adv_rpa_expired(adv, data); in adv_rpa_invalidate()
257 static void adv_rpa_clear_data(struct bt_le_ext_adv *adv, void *data) in adv_rpa_clear_data() argument
259 if (adv->id >= bt_dev.id_count) { in adv_rpa_clear_data()
264 if (rpa_invalid_set_ptr[adv->id]) { in adv_rpa_clear_data()
265 atomic_clear_bit(adv->flags, BT_ADV_RPA_VALID); in adv_rpa_clear_data()
266 bt_addr_copy(&bt_dev.rpa[adv->id], BT_ADDR_NONE); in adv_rpa_clear_data()
268 LOG_WRN("Adv sets rpa expired cb with id %d returns false\n", adv->id); in adv_rpa_clear_data()
377 static int adv_rpa_get(struct bt_le_ext_adv *adv, bt_addr_t *rpa) in adv_rpa_get() argument
381 if (bt_addr_eq(&bt_dev.rpa[adv->id], BT_ADDR_NONE)) { in adv_rpa_get()
382 err = bt_rpa_create(bt_dev.irk[adv->id], &bt_dev.rpa[adv->id]); in adv_rpa_get()
388 bt_addr_copy(rpa, &bt_dev.rpa[adv->id]); in adv_rpa_get()
393 static int adv_rpa_get(struct bt_le_ext_adv *adv, bt_addr_t *rpa) in adv_rpa_get() argument
397 err = bt_rpa_create(bt_dev.irk[adv->id], rpa); in adv_rpa_get()
406 int bt_id_set_adv_private_addr(struct bt_le_ext_adv *adv) in bt_id_set_adv_private_addr() argument
411 CHECKIF(adv == NULL) { in bt_id_set_adv_private_addr()
416 (adv->options & BT_LE_ADV_OPT_USE_NRPA)) { in bt_id_set_adv_private_addr()
427 return bt_id_set_private_addr(adv->id); in bt_id_set_adv_private_addr()
431 if (atomic_test_bit(adv->flags, BT_ADV_RPA_VALID)) { in bt_id_set_adv_private_addr()
435 if (!atomic_test_bit(adv->flags, BT_ADV_LIMITED)) { in bt_id_set_adv_private_addr()
442 if (adv == bt_le_adv_lookup_legacy() && adv->id == BT_ID_DEFAULT) { in bt_id_set_adv_private_addr()
451 err = bt_id_set_adv_random_addr(adv, &bt_dev.random_addr.a); in bt_id_set_adv_private_addr()
453 atomic_set_bit(adv->flags, BT_ADV_RPA_VALID); in bt_id_set_adv_private_addr()
459 err = adv_rpa_get(adv, &rpa); in bt_id_set_adv_private_addr()
461 err = bt_id_set_adv_random_addr(adv, &rpa); in bt_id_set_adv_private_addr()
463 atomic_set_bit(adv->flags, BT_ADV_RPA_VALID); in bt_id_set_adv_private_addr()
467 if (!atomic_test_bit(adv->flags, BT_ADV_LIMITED)) { in bt_id_set_adv_private_addr()
510 int bt_id_set_adv_private_addr(struct bt_le_ext_adv *adv) in bt_id_set_adv_private_addr() argument
515 CHECKIF(adv == NULL) { in bt_id_set_adv_private_addr()
526 err = bt_id_set_adv_random_addr(adv, &nrpa); in bt_id_set_adv_private_addr()
539 static void adv_pause_rpa(struct bt_le_ext_adv *adv, void *data) in adv_pause_rpa() argument
544 if (atomic_test_bit(adv->flags, BT_ADV_ENABLED) && in adv_pause_rpa()
545 !atomic_test_bit(adv->flags, BT_ADV_LIMITED) && in adv_pause_rpa()
546 !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in adv_pause_rpa()
549 err = bt_le_adv_set_enable_ext(adv, false, NULL); in adv_pause_rpa()
554 atomic_set_bit(adv->flags, BT_ADV_RPA_UPDATE); in adv_pause_rpa()
577 static void adv_enable_rpa(struct bt_le_ext_adv *adv, void *data) in adv_enable_rpa() argument
579 if (atomic_test_and_clear_bit(adv->flags, BT_ADV_RPA_UPDATE)) { in adv_enable_rpa()
582 err = bt_id_set_adv_private_addr(adv); in adv_enable_rpa()
587 err = bt_le_adv_set_enable_ext(adv, true, NULL); in adv_enable_rpa()
596 struct bt_le_ext_adv *adv = NULL; in le_update_private_addr() local
622 adv = bt_le_adv_lookup_legacy(); in le_update_private_addr()
624 if (adv && in le_update_private_addr()
625 atomic_test_bit(adv->flags, BT_ADV_ENABLED) && in le_update_private_addr()
626 !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in le_update_private_addr()
628 id = adv->id; in le_update_private_addr()
629 bt_le_adv_set_enable_legacy(adv, false); in le_update_private_addr()
650 adv && adv_enabled) { in le_update_private_addr()
651 bt_le_adv_set_enable_legacy(adv, true); in le_update_private_addr()
708 struct bt_le_ext_adv *adv; in bt_id_scan_random_addr_check() local
719 adv = bt_le_adv_lookup_legacy(); in bt_id_scan_random_addr_check()
720 if (!adv) { in bt_id_scan_random_addr_check()
725 if (!atomic_test_bit(adv->flags, BT_ADV_ENABLED)) { in bt_id_scan_random_addr_check()
738 if ((atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && in bt_id_scan_random_addr_check()
739 bt_dev.id_addr[adv->id].type == BT_ADDR_LE_RANDOM) || in bt_id_scan_random_addr_check()
740 adv->id != BT_ID_DEFAULT) { in bt_id_scan_random_addr_check()
820 void bt_id_adv_limited_stopped(struct bt_le_ext_adv *adv) in bt_id_adv_limited_stopped() argument
822 adv_rpa_expired(adv, NULL); in bt_id_adv_limited_stopped()
1775 struct bt_le_ext_adv *adv; in is_adv_using_rand_addr() local
1787 adv = bt_le_adv_lookup_legacy(); in is_adv_using_rand_addr()
1789 return adv && atomic_test_bit(adv->flags, BT_ADV_ENABLED); in is_adv_using_rand_addr()
1858 int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, in bt_id_set_adv_own_addr() argument
1864 CHECKIF(adv == NULL || own_addr_type == NULL) { in bt_id_set_adv_own_addr()
1869 id_addr = &bt_dev.id_addr[adv->id]; in bt_id_set_adv_own_addr()
1879 err = bt_id_set_adv_private_addr(adv); in bt_id_set_adv_own_addr()
1896 err = bt_id_set_adv_private_addr(adv); in bt_id_set_adv_own_addr()
1914 err = bt_id_set_adv_random_addr(adv, &id_addr->a); in bt_id_set_adv_own_addr()
1931 err = bt_id_set_adv_random_addr(adv, &id_addr->a); in bt_id_set_adv_own_addr()
1961 err = bt_id_set_adv_private_addr(adv); in bt_id_set_adv_own_addr()
1970 err = bt_id_set_adv_private_addr(adv); in bt_id_set_adv_own_addr()
1997 struct bt_le_ext_adv *adv = NULL; in bt_le_oob_get_local() local
2013 adv = bt_le_adv_lookup_legacy(); in bt_le_oob_get_local()
2017 !(adv && adv->id == id && in bt_le_oob_get_local()
2018 atomic_test_bit(adv->flags, BT_ADV_ENABLED) && in bt_le_oob_get_local()
2019 atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && in bt_le_oob_get_local()
2036 if (adv && in bt_le_oob_get_local()
2037 atomic_test_bit(adv->flags, BT_ADV_ENABLED) && in bt_le_oob_get_local()
2038 atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) && in bt_le_oob_get_local()
2074 int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv, in bt_le_ext_adv_oob_get_local() argument
2079 CHECKIF(adv == NULL || oob == NULL) { in bt_le_ext_adv_oob_get_local()
2088 !atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { in bt_le_ext_adv_oob_get_local()
2094 if (!atomic_test_bit(adv->flags, BT_ADV_LIMITED) && in bt_le_ext_adv_oob_get_local()
2116 bt_addr_le_copy(&oob->addr, &adv->random_addr); in bt_le_ext_adv_oob_get_local()
2118 bt_addr_le_copy(&oob->addr, &bt_dev.id_addr[adv->id]); in bt_le_ext_adv_oob_get_local()