Skip to content

Commit abeca24

Browse files
alwa-nordichenrikbrixandersen
authored andcommitted
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 <[email protected]>
1 parent 5f89a6b commit abeca24

File tree

1 file changed

+20
-0
lines changed
  • tests/bluetooth/common/testlib/include/testlib

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* Copyright (c) 2024 Nordic Semiconductor ASA
2+
* SPDX-License-Identifier: Apache-2.0
3+
*/
4+
5+
#ifndef ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_
6+
#define ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_
7+
8+
#include <stdint.h>
9+
10+
#include <zephyr/bluetooth/addr.h>
11+
#include <zephyr/bluetooth/byteorder.h>
12+
13+
/** Bluetooth LE static random address */
14+
#define BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_(last) \
15+
((bt_addr_le_t){ \
16+
.type = BT_ADDR_LE_RANDOM, \
17+
.a = {{last, 0x00, 0x00, 0x00, 0x00, 0xc0}}, \
18+
})
19+
20+
#endif /* ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_ */

0 commit comments

Comments
 (0)