Generic BLE address handling functions. More...

Detailed Description

Generic BLE address handling functions.

Files

file  addr.h
 Interface for the generic BLE address helper functions.
 

Macros

#define BLUETIL_ADDR_STRLEN   (18U)
 The length of a BLE address string in bytes (including '\0')
 
#define BLUETIL_IPV6_IID_STRLEN   (28U)
 The length of an IPv6 IID string in bytes (including '\0')
 

Functions

void bluetil_addr_swapped_cp (const uint8_t *src, uint8_t *dst)
 Copy address and swap the byte order in the target buffer. More...
 
void bluetil_addr_sprint (char *out, const uint8_t *addr)
 Convert the given BLE address to a human readable string. More...
 
void bluetil_addr_print (const uint8_t *addr)
 Print the given BLE address to STDOUT. More...
 
uint8_t * bluetil_addr_from_str (uint8_t *addr, const char *addr_str)
 Parse a BLE address from the given string. More...
 
void bluetil_addr_ipv6_l2ll_sprint (char *out, const uint8_t *addr)
 Get a string representation of the given BLE addresses IID-based link local address. More...
 
void bluetil_addr_ipv6_l2ll_print (const uint8_t *addr)
 Dump the given BLE addresses IPv6 IID-based link local address to STDIO. More...
 

Function Documentation

◆ bluetil_addr_from_str()

uint8_t* bluetil_addr_from_str ( uint8_t *  addr,
const char *  addr_str 
)

Parse a BLE address from the given string.

Note
The address is expected most significant byte first and is written to addr in network byte order
Parameters
[out]addrbuffer to write the BLE address, must be able to hold BLE_ADDR_LEN bytes
[in]addr_straddress string, must be at least of length (BLUETIL_ADDR_STRLEN - 1)
Returns
a pointer to the resulting address on success
NULL on parsing error

◆ bluetil_addr_ipv6_l2ll_print()

void bluetil_addr_ipv6_l2ll_print ( const uint8_t *  addr)

Dump the given BLE addresses IPv6 IID-based link local address to STDIO.

Note
The address is expected to be in network byte order
Parameters
[in]addrgenerate IID for this address

◆ bluetil_addr_ipv6_l2ll_sprint()

void bluetil_addr_ipv6_l2ll_sprint ( char *  out,
const uint8_t *  addr 
)

Get a string representation of the given BLE addresses IID-based link local address.

Note
The address is expected to be in network byte order
Parameters
[out]out'\0' terminated string, must be able to hold BLUETIL_IPV6_IID_STRLEN bytes
[in]addraddress to convert, , must hold BLE_ADDR_LEN bytes

◆ bluetil_addr_print()

void bluetil_addr_print ( const uint8_t *  addr)

Print the given BLE address to STDOUT.

Note
The address is expected to be in network byte order
Parameters
[in]addraddress to print, is expected to hold BLE_ADDR_LEN bytes

◆ bluetil_addr_sprint()

void bluetil_addr_sprint ( char *  out,
const uint8_t *  addr 
)

Convert the given BLE address to a human readable string.

Note
The address is expected to be in network byte order
Parameters
[out]out'\0' terminated address string, must be able to hold BLUETIL_ADDR_STRLEN bytes
[in]addraddress buffer, must hold BLE_ADDR_LEN bytes

◆ bluetil_addr_swapped_cp()

void bluetil_addr_swapped_cp ( const uint8_t *  src,
uint8_t *  dst 
)

Copy address and swap the byte order in the target buffer.

Parameters
[in]srcbuffer with source address, must hold BLE_ADDR_LEN bytes
[out]dsttarget buffer, must be able to hold BLE_ADDR_LEN bytes