Contiki-NG
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 /**
32  * \file
33  * Driver for the retrieval of an BLE address from flash
34  *
35  * \author
36  * Michael Spoerk <mi.spoerk@gmail.com>
37  */
38 /*---------------------------------------------------------------------------*/
39 #ifndef BLE_ADDR_H_
40 #define BLE_ADDR_H_
41 /*---------------------------------------------------------------------------*/
42 #include "contiki-conf.h"
43 #include <stdint.h>
44 /*---------------------------------------------------------------------------*/
45 /* primary BLE address location */
46 #define BLE_ADDR_LOCATION 0x500012E8
47 
48 /*---------------------------------------------------------------------------*/
49 /**
50  * \brief Copy the node's factory BLE address to a destination memory area
51  * \param dst A pointer to the destination area where the BLE address is to be
52  * written
53  *
54  * This function will copy 6 bytes and it will invert byte order in
55  * the process. The factory address on devices is normally little-endian,
56  * therefore you should expect dst to store the address in a big-endian order.
57  */
58 void ble_addr_cpy_to(uint8_t *dst);
59 
60 /*---------------------------------------------------------------------------*/
61 /**
62  * \brief Copy the node's BLE address to a destination memory area and converts
63  * it into a EUI64 address in the process
64  * \param dst A pointer to the destination area where the EUI64 address is to be
65  * written
66  * \param src A pointer to the BLE address that is to be copied
67  */
68 void ble_addr_to_eui64(uint8_t *dst, uint8_t *src);
69 
70 /*---------------------------------------------------------------------------*/
71 /**
72  * \brief Copy the node's EUI64 address that is based on its factory BLE address
73  * to a destination memory area
74  * \param dst A pointer to the destination area where the EUI64 address is to be
75  * written
76  */
77 void ble_eui64_addr_cpy_to(uint8_t *dst);
78 /*---------------------------------------------------------------------------*/
79 
80 #endif /* BLE_ADDR_H_ */
void ble_addr_to_eui64(uint8_t *dst, uint8_t *src)
Copy the node&#39;s BLE address to a destination memory area and converts it into a EUI64 address in the ...
Definition: ble-addr.c:58
void ble_addr_cpy_to(uint8_t *dst)
Copy the node&#39;s factory BLE address to a destination memory area.
Definition: ble-addr.c:47
void ble_eui64_addr_cpy_to(uint8_t *dst)
Copy the node&#39;s EUI64 address that is based on its factory BLE address to a destination memory area...
Definition: ble-addr.c:67