Bluetooth: testlib: Add BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_

This is shorthand for random static addresses. It's similar to
`bt_addr_le_from_str`, but is a macro that results in an object literal,
making it more versatile and less verbose.

This macro only gives access to the first 255 random static addresses,
but this ought to be enough addresses for testing.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This commit is contained in:
Aleksander Wasaznik 2024-08-22 10:19:08 +02:00 committed by Henrik Brix Andersen
commit abeca24702

View file

@ -0,0 +1,20 @@
/* Copyright (c) 2024 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_
#define ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_
#include <stdint.h>
#include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/byteorder.h>
/** Bluetooth LE static random address */
#define BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_(last) \
((bt_addr_le_t){ \
.type = BT_ADDR_LE_RANDOM, \
.a = {{last, 0x00, 0x00, 0x00, 0x00, 0xc0}}, \
})
#endif /* ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_ */