1 /*
2  * Copyright (c) 2017-2021 Nordic Semiconductor ASA
3  * Copyright (c) 2015-2016 Intel Corporation
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #define RPA_TIMEOUT_MS(_rpa_timeout) (_rpa_timeout * MSEC_PER_SEC)
9 
bt_id_rpa_is_new(void)10 static inline bool bt_id_rpa_is_new(void)
11 {
12 #if defined(CONFIG_BT_PRIVACY)
13 	uint32_t remaining_ms = k_ticks_to_ms_floor32(
14 		k_work_delayable_remaining_get(&bt_dev.rpa_update));
15 	/* RPA is considered new if there is less than half a second since the
16 	 * timeout was started.
17 	 */
18 	return remaining_ms > (RPA_TIMEOUT_MS(bt_dev.rpa_timeout) - 500);
19 #else
20 	return false;
21 #endif
22 }
23 
24 int bt_id_init(void);
25 
26 uint8_t bt_id_read_public_addr(bt_addr_le_t *addr);
27 
28 int bt_id_set_create_conn_own_addr(bool use_filter, uint8_t *own_addr_type);
29 
30 int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type);
31 
32 int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options,
33 			   bool dir_adv, uint8_t *own_addr_type);
34 
35 bool bt_id_adv_random_addr_check(const struct bt_le_adv_param *param);
36 
37 bool bt_id_scan_random_addr_check(void);
38 
39 int bt_id_set_adv_random_addr(struct bt_le_ext_adv *adv,
40 			      const bt_addr_t *addr);
41 int bt_id_set_adv_private_addr(struct bt_le_ext_adv *adv);
42 
43 int bt_id_set_private_addr(uint8_t id);
44 
45 void bt_id_pending_keys_update(void);
46 
47 void bt_id_adv_limited_stopped(struct bt_le_ext_adv *adv);
48