skald.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
44 #ifndef NET_SKALD_H
45 #define NET_SKALD_H
46 
47 #include <stdint.h>
48 
49 #include "xtimer.h"
50 #include "net/ble.h"
51 #include "net/netdev/ble.h"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
65 #ifndef CONFIG_SKALD_INTERVAL
66 #define CONFIG_SKALD_INTERVAL (1 * US_PER_SEC)
67 #endif
68 
74 #ifdef DOXYGEN
75 #define CONFIG_ADV_CH_37_DISABLE
76 #endif
77 
83 #ifdef DOXYGEN
84 #define CONFIG_ADV_CH_38_DISABLE
85 #endif
86 
92 #ifdef DOXYGEN
93 #define CONFIG_ADV_CH_39_DISABLE
94 #endif
95 
101 #if !defined(CONFIG_ADV_CH_37_DISABLE) || defined(DOXYGEN)
102 #define ADV_CH_37 37,
103 #else
104 #define ADV_CH_37
105 #endif
106 
111 #if !defined(CONFIG_ADV_CH_38_DISABLE) || defined(DOXYGEN)
112 #define ADV_CH_38 38,
113 #else
114 #define ADV_CH_38
115 #endif
116 
121 #if !defined(CONFIG_ADV_CH_39_DISABLE) || defined(DOXYGEN)
122 #define ADV_CH_39 39
123 #else
124 #define ADV_CH_39
125 #endif
126 
130 #ifndef SKALD_ADV_CHAN
131 #define SKALD_ADV_CHAN { ADV_CH_37 ADV_CH_38 ADV_CH_39 }
132 #endif
133 
137 typedef struct {
138  uint8_t u8[16];
139 } skald_uuid_t;
140 
144 typedef struct {
147  uint32_t last;
148  uint8_t cur_chan;
149 } skald_ctx_t;
150 
154 void skald_init(void);
155 
164 void skald_adv_start(skald_ctx_t *ctx);
165 
171 void skald_adv_stop(skald_ctx_t *ctx);
172 
180 void skald_generate_random_addr(uint8_t *buf);
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif /* NET_SKALD_H */
187 
xtimer
xtimer timer structure
Definition: xtimer.h:81
ble.h
General BLE values as defined by the BT standard.
skald_ctx_t
Advertising context holding the advertising data and state.
Definition: skald.h:144
skald_adv_start
void skald_adv_start(skald_ctx_t *ctx)
Start advertising the given packet.
skald_ctx_t::timer
xtimer_t timer
timer for scheduling advertising events
Definition: skald.h:146
skald_ctx_t::cur_chan
uint8_t cur_chan
keep track of advertising channels
Definition: skald.h:148
skald_generate_random_addr
void skald_generate_random_addr(uint8_t *buf)
Generate a random public address.
skald_ctx_t::last
uint32_t last
last timer trigger (for offset compensation)
Definition: skald.h:147
skald_init
void skald_init(void)
Initialize Skald and the underlying radio.
ble.h
BLE specific adaption for the Netdev API.
skald_ctx_t::pkt
netdev_ble_pkt_t pkt
packet holding the advertisement (GAP) data
Definition: skald.h:145
skald_uuid_t
UUID representation format used by Skald.
Definition: skald.h:137
netdev_ble_pkt_t
BLE packet structure (as defined by the BLE standard)
Definition: ble.h:104
skald_adv_stop
void skald_adv_stop(skald_ctx_t *ctx)
Stop the ongoing advertisement.
xtimer.h
xtimer interface definitions