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:
parent
5f89a6b8f1
commit
abeca24702
1 changed files with 20 additions and 0 deletions
20
tests/bluetooth/common/testlib/include/testlib/addr.h
Normal file
20
tests/bluetooth/common/testlib/include/testlib/addr.h
Normal 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_ */
|
Loading…
Add table
Add a link
Reference in a new issue