Bluetooth: Controller: Separate address get and read functions

Have separate Bluetooth Device address get and read
functions, remove use of function just to return Extended
Advertising Random address and replace with simple
assignment statement.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2021-09-28 06:09:13 +05:30 committed by Christopher Friedt
commit aa4b75b58c
10 changed files with 36 additions and 45 deletions

View file

@ -34,27 +34,6 @@
static uint8_t pub_addr[BDADDR_SIZE];
static uint8_t rnd_addr[BDADDR_SIZE];
uint8_t *ll_addr_get(uint8_t addr_type, uint8_t *bdaddr)
{
if (addr_type > 1) {
return NULL;
}
if (addr_type) {
if (bdaddr) {
memcpy(bdaddr, rnd_addr, BDADDR_SIZE);
}
return rnd_addr;
}
if (bdaddr) {
memcpy(bdaddr, pub_addr, BDADDR_SIZE);
}
return pub_addr;
}
uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const bdaddr)
{
if (IS_ENABLED(CONFIG_BT_BROADCASTER)) {
@ -81,6 +60,31 @@ uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const bdaddr)
return 0;
}
uint8_t *ll_addr_get(uint8_t addr_type)
{
if (addr_type > BT_ADDR_LE_RANDOM) {
return NULL;
}
if (addr_type) {
return rnd_addr;
}
return pub_addr;
}
uint8_t *ll_addr_read(uint8_t addr_type, uint8_t *const bdaddr)
{
uint8_t *addr;
addr = ll_addr_get(addr_type);
if (addr) {
memcpy(bdaddr, addr, BDADDR_SIZE);
}
return addr;
}
void bt_ctlr_set_public_addr(const uint8_t *addr)
{
(void)memcpy(pub_addr, addr, sizeof(pub_addr));