1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 14:03:55 +01:00

net/bluetil/addr: add addr swapped copy function

This commit is contained in:
Hauke Petersen 2019-08-15 17:41:04 +02:00
parent 9df583457f
commit 218b547b3c
2 changed files with 19 additions and 0 deletions

View File

@ -39,6 +39,15 @@ extern "C" {
*/
#define BLUETIL_IPV6_IID_STRLEN (28U)
/**
* @brief Copy address and swap the byte order in the target buffer
*
* @param[in] src buffer with source address, *must* hold BLE_ADDR_LEN
* bytes
* @param[out] dst target buffer, *must* be able to hold BLE_ADDR_LEN bytes
*/
void bluetil_addr_swapped_cp(const uint8_t *src, uint8_t *dst);
/**
* @brief Convert the given BLE address to a human readable string
*

View File

@ -33,6 +33,16 @@ static int _is_hex_char(char c)
((c >= 'a') && (c <= 'f')));
}
void bluetil_addr_swapped_cp(const uint8_t *src, uint8_t *dst)
{
dst[0] = src[5];
dst[1] = src[4];
dst[2] = src[3];
dst[3] = src[2];
dst[4] = src[1];
dst[5] = src[0];
}
void bluetil_addr_sprint(char *out, const uint8_t *addr)
{
assert(out);