Skip to content

Commit

Permalink
[nrf fromtree] Bluetooth: testlib: Add `BT_TESTLIB_ADDR_LE_RANDOM_C0_…
Browse files Browse the repository at this point in the history
…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]>
(cherry picked from commit abeca24)
  • Loading branch information
alwa-nordic authored and jukkar committed Dec 20, 2024
1 parent 9f0c4ec commit dcdfa00
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/bluetooth/common/testlib/include/testlib/addr.h
Original file line number Diff line number Diff line change
@@ -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_ */

0 comments on commit dcdfa00

Please sign in to comment.