Contiki-NG
Loading...
Searching...
No Matches
ble-addr.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016, Michael Spoerk
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30/**
31 * \addtogroup cc13xx-cc26xx-rf
32 * @{
33 *
34 * \defgroup cc13xx-cc26xx-rf-ble-addr Driver for CC13xx/CC26xx BLE addresses
35 *
36 * @{
37 *
38 * \file
39 * Header file for the CC13xx/CC26xx BLE address driver.
40 * \author
41 * Michael Spoerk <mi.spoerk@gmail.com>
42 * Edvard Pettersen <e.pettersen@ti.com>
43 */
44/*---------------------------------------------------------------------------*/
45#ifndef BLE_ADDR_H_
46#define BLE_ADDR_H_
47/*---------------------------------------------------------------------------*/
48#include "contiki.h"
49
50#include <stdint.h>
51/*---------------------------------------------------------------------------*/
52/**
53 * \brief Retrieve the pointer to where the BLE address is stored.
54 *
55 * This function will return the primary address from info page, unless a
56 * valid address is found in the secondary address from CCFG.
57 */
58uint8_t *ble_addr_ptr(void);
59/*---------------------------------------------------------------------------*/
60/**
61 * \brief Copy the node's factory BLE address to a destination memory area
62 * in big-endian (be) order.
63 * \param dst A pointer to the destination area where the BLE address is to be
64 * written
65 * \return 0 : Returned successfully
66 * -1 : Returned with error
67 *
68 * This function will copy 6 bytes and it will invert byte order in
69 * the process. The factory address on devices is normally little-endian,
70 * therefore you should expect dst to store the address in a big-endian order.
71 */
72int ble_addr_be_cpy(uint8_t *dst);
73/*---------------------------------------------------------------------------*/
74/**
75 * \brief Copy the node's factory BLE address to a destination memory area
76 * in little-endian (le) order.
77 * \param dst A pointer to the destination area where the BLE address is to be
78 * written
79 * \return 0 : Returned successfully
80 * -1 : Returned with error
81 *
82 * This function will copy 6 bytes, but will **not** invert the byte order.
83 * This is usefull for the RF core which assumes the BLE MAC address in
84 * little-endian order.
85 */
86int ble_addr_le_cpy(uint8_t *dst);
87/*---------------------------------------------------------------------------*/
88/**
89 * \brief Copy the node's BLE address to a destination memory area and converts
90 * it into a EUI64 address in the process
91 * \param dst A pointer to the destination area where the EUI64 address is to be
92 * written
93 * \param src A pointer to the BLE address that is to be copied
94 * \return 0 : Returned successfully
95 * -1 : Returned with error
96 */
97int ble_addr_to_eui64(uint8_t *dst, uint8_t *src);
98/*---------------------------------------------------------------------------*/
99/**
100 * \brief Copy the node's EUI64 address that is based on its factory BLE address
101 * to a destination memory area
102 * \param dst A pointer to the destination area where the EUI64 address is to be
103 * written
104 * \return 0 : Returned successfully
105 * -1 : Returned with error
106 */
107int ble_addr_to_eui64_cpy(uint8_t *dst);
108/*---------------------------------------------------------------------------*/
109#endif /* BLE_ADDR_H_ */
110/*---------------------------------------------------------------------------*/
111/**
112 * @}
113 * @}
114 */
int ble_addr_le_cpy(uint8_t *dst)
Copy the node's factory BLE address to a destination memory area in little-endian (le) order.
Definition ble-addr.c:105
int ble_addr_to_eui64(uint8_t *dst, uint8_t *src)
Copy the node's BLE address to a destination memory area and converts it into a EUI64 address in the ...
Definition ble-addr.c:58
int ble_addr_to_eui64_cpy(uint8_t *dst)
Copy the node's EUI64 address that is based on its factory BLE address to a destination memory area.
Definition ble-addr.c:137
uint8_t * ble_addr_ptr(void)
Retrieve the pointer to where the BLE address is stored.
Definition ble-addr.c:58
int ble_addr_be_cpy(uint8_t *dst)
Copy the node's factory BLE address to a destination memory area in big-endian (be) order.
Definition ble-addr.c:84