|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
Bluetooth device address definitions and utilities. More...
Data Structures | |
| struct | bt_addr_t |
| Bluetooth Device Address. More... | |
| struct | bt_addr_le_t |
| Bluetooth LE Device Address. More... | |
Macros | |
| #define | BT_ADDR_LE_PUBLIC 0x00 |
| #define | BT_ADDR_LE_RANDOM 0x01 |
| #define | BT_ADDR_LE_PUBLIC_ID 0x02 |
| #define | BT_ADDR_LE_RANDOM_ID 0x03 |
| #define | BT_ADDR_LE_UNRESOLVED |
| #define | BT_ADDR_LE_ANONYMOUS |
| #define | BT_ADDR_SIZE 6 |
| Length in bytes of a standard Bluetooth address. | |
| #define | BT_ADDR_LE_SIZE 7 |
| Length in bytes of an LE Bluetooth address. | |
| #define | BT_ADDR_ANY (&bt_addr_any) |
| Bluetooth device "any" address, not a valid address. | |
| #define | BT_ADDR_NONE (&bt_addr_none) |
| Bluetooth device "none" address, not a valid address. | |
| #define | BT_ADDR_LE_ANY (&bt_addr_le_any) |
| Bluetooth LE device "any" address, not a valid address. | |
| #define | BT_ADDR_LE_NONE (&bt_addr_le_none) |
| Bluetooth LE device "none" address, not a valid address. | |
| #define | BT_ADDR_IS_RPA(a) |
| Check if a Bluetooth LE random address is resolvable private address. | |
| #define | BT_ADDR_IS_NRPA(a) |
| Check if a Bluetooth LE random address is a non-resolvable private address. | |
| #define | BT_ADDR_IS_STATIC(a) |
| Check if a Bluetooth LE random address is a static address. | |
| #define | BT_ADDR_SET_RPA(a) |
| Set a Bluetooth LE random address as a resolvable private address. | |
| #define | BT_ADDR_SET_NRPA(a) |
| Set a Bluetooth LE random address as a non-resolvable private address. | |
| #define | BT_ADDR_SET_STATIC(a) |
| Set a Bluetooth LE random address as a static address. | |
| #define | BT_ADDR_STR_LEN 18 |
| Recommended length of user string buffer for Bluetooth address. | |
| #define | BT_ADDR_LE_STR_LEN 20 |
| Recommended length of user string buffer for Bluetooth LE address. | |
| #define | bt_addr_str(_addr) |
| Convert a Bluetooth address to a string. | |
| #define | bt_addr_le_str(_addr) |
| Convert a Bluetooth LE address to a string. | |
| #define | BT_IRK_SIZE 16U |
| Size of an Identity Resolving Key in octets. | |
Functions | |
| static int | bt_addr_cmp (const bt_addr_t *a, const bt_addr_t *b) |
| Compare Bluetooth device addresses. | |
| static bool | bt_addr_eq (const bt_addr_t *a, const bt_addr_t *b) |
| Determine equality of two Bluetooth device addresses. | |
| static int | bt_addr_le_cmp (const bt_addr_le_t *a, const bt_addr_le_t *b) |
| Compare Bluetooth LE device addresses. | |
| static bool | bt_addr_le_eq (const bt_addr_le_t *a, const bt_addr_le_t *b) |
| Determine equality of two Bluetooth LE device addresses. | |
| static void | bt_addr_copy (bt_addr_t *dst, const bt_addr_t *src) |
| Copy Bluetooth device address. | |
| static void | bt_addr_le_copy (bt_addr_le_t *dst, const bt_addr_le_t *src) |
| Copy Bluetooth LE device address. | |
| static void | bt_addr_le_copy_addr (bt_addr_le_t *dst, const bt_addr_t *src, uint8_t src_type) |
| Copy Bluetooth LE device address from Bluetooth device address and type. | |
| int | bt_addr_le_create_nrpa (bt_addr_le_t *addr) |
| Create a Bluetooth LE random non-resolvable private address. | |
| int | bt_addr_le_create_static (bt_addr_le_t *addr) |
| Create a Bluetooth LE random static address. | |
| static bool | bt_addr_le_is_rpa (const bt_addr_le_t *addr) |
| Check if a Bluetooth LE address is a random private resolvable address. | |
| static bool | bt_addr_le_is_identity (const bt_addr_le_t *addr) |
| Check if a Bluetooth LE address is valid identity address. | |
| static int | bt_addr_to_str (const bt_addr_t *addr, char *str, size_t len) |
| Converts binary Bluetooth address to string. | |
| static int | bt_addr_le_to_str (const bt_addr_le_t *addr, char *str, size_t len) |
| Converts binary LE Bluetooth address to string. | |
| int | bt_addr_from_str (const char *str, bt_addr_t *addr) |
| Convert Bluetooth address from string to binary. | |
| int | bt_addr_le_from_str (const char *str, bt_addr_le_t *addr) |
| Convert LE Bluetooth address from string to binary. | |
| int | bt_addr_le_rpa_resolve (uint8_t id, const bt_addr_le_t *addr, bt_addr_le_t *resolved_addr) |
| Resolve a Bluetooth LE Resolvable Private Address (RPA) to its identity address. | |
| bool | bt_addr_matches_irk (const bt_addr_t *rpa, const uint8_t irk[16U]) |
| Check whether a Resolvable Private Address was generated from an IRK. | |
Variables | |
| const bt_addr_t | bt_addr_any |
| const bt_addr_t | bt_addr_none |
| const bt_addr_le_t | bt_addr_le_any |
| const bt_addr_le_t | bt_addr_le_none |
Bluetooth device address definitions and utilities.
| #define BT_ADDR_ANY (&bt_addr_any) |
#include <zephyr/bluetooth/addr.h>
Bluetooth device "any" address, not a valid address.
| #define BT_ADDR_IS_NRPA | ( | a | ) |
#include <zephyr/bluetooth/addr.h>
Check if a Bluetooth LE random address is a non-resolvable private address.
| #define BT_ADDR_IS_RPA | ( | a | ) |
#include <zephyr/bluetooth/addr.h>
Check if a Bluetooth LE random address is resolvable private address.
| #define BT_ADDR_IS_STATIC | ( | a | ) |
#include <zephyr/bluetooth/addr.h>
Check if a Bluetooth LE random address is a static address.
| #define BT_ADDR_LE_ANONYMOUS |
#include <zephyr/bluetooth/addr.h>
| #define BT_ADDR_LE_ANY (&bt_addr_le_any) |
#include <zephyr/bluetooth/addr.h>
Bluetooth LE device "any" address, not a valid address.
| #define BT_ADDR_LE_NONE (&bt_addr_le_none) |
#include <zephyr/bluetooth/addr.h>
Bluetooth LE device "none" address, not a valid address.
| #define BT_ADDR_LE_PUBLIC 0x00 |
#include <zephyr/bluetooth/addr.h>
| #define BT_ADDR_LE_PUBLIC_ID 0x02 |
#include <zephyr/bluetooth/addr.h>
| #define BT_ADDR_LE_RANDOM 0x01 |
#include <zephyr/bluetooth/addr.h>
| #define BT_ADDR_LE_RANDOM_ID 0x03 |
#include <zephyr/bluetooth/addr.h>
| #define BT_ADDR_LE_SIZE 7 |
#include <zephyr/bluetooth/addr.h>
Length in bytes of an LE Bluetooth address.
Not packed, so no sizeof()
| #define bt_addr_le_str | ( | _addr | ) |
#include <zephyr/bluetooth/addr.h>
Convert a Bluetooth LE address to a string.
| _addr | Pointer to the Bluetooth LE address (bt_addr_le_t) |
| #define BT_ADDR_LE_STR_LEN 20 |
#include <zephyr/bluetooth/addr.h>
Recommended length of user string buffer for Bluetooth LE address.
The recommended length guarantee the output of address conversion will not lose valuable information about address being processed. Format: "P:XX:XX:XX:XX:XX:XX" or "R:XX:XX:XX:XX:XX:XX"
| #define BT_ADDR_LE_UNRESOLVED |
#include <zephyr/bluetooth/addr.h>
| #define BT_ADDR_NONE (&bt_addr_none) |
#include <zephyr/bluetooth/addr.h>
Bluetooth device "none" address, not a valid address.
| #define BT_ADDR_SET_NRPA | ( | a | ) |
#include <zephyr/bluetooth/addr.h>
Set a Bluetooth LE random address as a non-resolvable private address.
| #define BT_ADDR_SET_RPA | ( | a | ) |
#include <zephyr/bluetooth/addr.h>
Set a Bluetooth LE random address as a resolvable private address.
| #define BT_ADDR_SET_STATIC | ( | a | ) |
#include <zephyr/bluetooth/addr.h>
Set a Bluetooth LE random address as a static address.
| #define BT_ADDR_SIZE 6 |
#include <zephyr/bluetooth/addr.h>
Length in bytes of a standard Bluetooth address.
| #define bt_addr_str | ( | _addr | ) |
#include <zephyr/bluetooth/addr.h>
Convert a Bluetooth address to a string.
| _addr | Pointer to the Bluetooth address (bt_addr_t) |
| #define BT_ADDR_STR_LEN 18 |
#include <zephyr/bluetooth/addr.h>
Recommended length of user string buffer for Bluetooth address.
The recommended length guarantee the output of address conversion will not lose valuable information about address being processed.
| #define BT_IRK_SIZE 16U |
#include <zephyr/bluetooth/addr.h>
Size of an Identity Resolving Key in octets.
#include <zephyr/bluetooth/addr.h>
Compare Bluetooth device addresses.
| a | First Bluetooth device address to compare |
| b | Second Bluetooth device address to compare |
#include <zephyr/bluetooth/addr.h>
Copy Bluetooth device address.
| dst | Bluetooth device address destination buffer. |
| src | Bluetooth device address source buffer. |
#include <zephyr/bluetooth/addr.h>
Determine equality of two Bluetooth device addresses.
| int bt_addr_from_str | ( | const char * | str, |
| bt_addr_t * | addr ) |
#include <zephyr/bluetooth/addr.h>
Convert Bluetooth address from string to binary.
| [in] | str | The string representation of a Bluetooth address. |
| [out] | addr | Address of buffer to store the Bluetooth address |
| 0 | Success. The parsed address is stored in addr. |
str is not a well-formed Bluetooth address.
|
inlinestatic |
#include <zephyr/bluetooth/addr.h>
Compare Bluetooth LE device addresses.
| a | First Bluetooth LE device address to compare |
| b | Second Bluetooth LE device address to compare |
|
inlinestatic |
#include <zephyr/bluetooth/addr.h>
Copy Bluetooth LE device address.
| dst | Bluetooth LE device address destination buffer. |
| src | Bluetooth LE device address source buffer. |
|
inlinestatic |
#include <zephyr/bluetooth/addr.h>
Copy Bluetooth LE device address from Bluetooth device address and type.
| dst | Bluetooth LE device address destination buffer. |
| src | Bluetooth device address source buffer. |
| src_type | Bluetooth device address source type. |
| int bt_addr_le_create_nrpa | ( | bt_addr_le_t * | addr | ) |
#include <zephyr/bluetooth/addr.h>
Create a Bluetooth LE random non-resolvable private address.
| int bt_addr_le_create_static | ( | bt_addr_le_t * | addr | ) |
#include <zephyr/bluetooth/addr.h>
Create a Bluetooth LE random static address.
|
inlinestatic |
#include <zephyr/bluetooth/addr.h>
Determine equality of two Bluetooth LE device addresses.
The Bluetooth LE addresses are equal if and only if both the types and the 48-bit addresses are numerically equal.
| int bt_addr_le_from_str | ( | const char * | str, |
| bt_addr_le_t * | addr ) |
#include <zephyr/bluetooth/addr.h>
Convert LE Bluetooth address from string to binary.
The string must use the format produced by bt_addr_le_to_str(): "P:XX:XX:XX:XX:XX:XX" for a public address or "R:XX:XX:XX:XX:XX:XX" for a random address. The type prefix and the hexadecimal digits are case-insensitive.
| [in] | str | The string representation of an LE Bluetooth address. |
| [out] | addr | Address of buffer to store the LE Bluetooth address |
| 0 | Success. The parsed address is stored in addr. |
| -EINVAL | Invalid address string. str has an unknown type prefix or is not a well-formed Bluetooth address. |
|
inlinestatic |
#include <zephyr/bluetooth/addr.h>
Check if a Bluetooth LE address is valid identity address.
Valid Bluetooth LE identity addresses are either public address or random static address.
| addr | Bluetooth LE device address. |
|
inlinestatic |
#include <zephyr/bluetooth/addr.h>
Check if a Bluetooth LE address is a random private resolvable address.
| addr | Bluetooth LE device address. |
| int bt_addr_le_rpa_resolve | ( | uint8_t | id, |
| const bt_addr_le_t * | addr, | ||
| bt_addr_le_t * | resolved_addr ) |
#include <zephyr/bluetooth/addr.h>
Resolve a Bluetooth LE Resolvable Private Address (RPA) to its identity address.
This function attempts to resolve a RPA to its corresponding identity address (public or random static) using the host Identity Resolving Key (IRK) database.
CONFIG_BT_PRIVACY, CONFIG_BT_SMP.| [in] | id | Local identity whose IRK database is used. Must be less than CONFIG_BT_ID_MAX. |
| [in] | addr | The RPA to resolve. |
| [out] | resolved_addr | On success, contains the resolved identity address. This will be either a public address (BT_ADDR_LE_PUBLIC) or random static address (BT_ADDR_LE_RANDOM). |
| 0 | Success. The address has been resolved. resolved_addr contains the identity address. |
| -ENOENT | addr is an RPA but no matching IRK was found in the database. The address could not be resolved. |
| -EINVAL | Invalid arguments: addr or resolved_addr is NULL, id is invalid, or addr is not an RPA. |
|
inlinestatic |
#include <zephyr/bluetooth/addr.h>
Converts binary LE Bluetooth address to string.
Converts the LE Bluetooth address to a string representation in the format:
Address type values that carry additional HCI-level information, such as BT_ADDR_LE_PUBLIC_ID and BT_ADDR_LE_RANDOM_ID, are formatted according to their base type (public or random). The HCI sentinels for an unresolved RPA (BT_ADDR_LE_UNRESOLVED) and an anonymous advertiser (BT_ADDR_LE_ANONYMOUS) are formatted as random addresses. The additional information is not part of the string and has to be conveyed separately by the caller.
| addr | Address of buffer containing binary LE Bluetooth address. |
| str | Address of user buffer with enough room to store formatted string containing binary LE address. |
| len | Length of data to be copied to user string buffer. Refer to BT_ADDR_LE_STR_LEN about recommended value. |
#include <zephyr/bluetooth/addr.h>
Check whether a Resolvable Private Address was generated from an IRK.
Computes the hash of the random part of rpa with irk and compares it with the hash part of rpa.
Available when the Host or the Controller provides AES, that is with CONFIG_BT_HOST_CRYPTO or CONFIG_BT_CTLR_CRYPTO.
| rpa | Resolvable private address to check. |
| irk | Identity Resolving Key, least significant octet first, in the same byte order as the IRK used by bt_id_create() and bt_id_reset_irk(). |
| true | rpa was generated from irk. |
| false | rpa is not a resolvable private address (see BT_ADDR_IS_RPA()), was not generated from irk, or the AES operation failed. |
|
inlinestatic |
#include <zephyr/bluetooth/addr.h>
Converts binary Bluetooth address to string.
| addr | Address of buffer containing binary Bluetooth address. |
| str | Address of user buffer with enough room to store formatted string containing binary address. |
| len | Length of data to be copied to user string buffer. Refer to BT_ADDR_STR_LEN about recommended value. |
|
extern |
#include <zephyr/bluetooth/addr.h>
|
extern |
#include <zephyr/bluetooth/addr.h>
|
extern |
#include <zephyr/bluetooth/addr.h>
|
extern |
#include <zephyr/bluetooth/addr.h>