Loading...
Searching...
No Matches
nimble_autoadv.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 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
28#ifndef NIMBLE_AUTOADV_H
29#define NIMBLE_AUTOADV_H
30
31#include "host/ble_gap.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
42#ifndef CONFIG_NIMBLE_AUTOADV_DEVICE_NAME
43#define CONFIG_NIMBLE_AUTOADV_DEVICE_NAME "NimBLE on RIOT"
44#endif
45
55#ifndef CONFIG_NIMBLE_AUTOADV_START_MANUALLY
56#define CONFIG_NIMBLE_AUTOADV_START_MANUALLY 0
57#endif
58
66#ifndef CONFIG_NIMBLE_AUTOADV_FLAG_FIELD
67#define CONFIG_NIMBLE_AUTOADV_FLAG_FIELD 1
68#endif
69
78#define NIMBLE_AUTOADV_FLAG_LEGACY (1 << 0)
79#define NIMBLE_AUTOADV_FLAG_HD_MODE (1 << 1)
81#define NIMBLE_AUTOADV_FLAG_CONNECTABLE (1 << 2)
82#define NIMBLE_AUTOADV_FLAG_SCANNABLE (1 << 3)
83#define NIMBLE_AUTOADV_FLAG_ANONYMOUS (1 << 4)
85#define NIMBLE_AUTOADV_FLAG_SCAN_REQ_NOTIF (1 << 5)
92typedef struct {
93 uint32_t adv_itvl_ms;
95 uint8_t flags;
96 uint8_t phy;
97 int8_t tx_power;
98 uint8_t channel_map;
99 uint8_t own_addr_type;
102
109
119
127
140int nimble_autoadv_add_field(uint8_t type, const void *data, size_t data_len);
141
156void nimble_autoadv_set_gap_cb(ble_gap_event_fn *cb, void *cb_arg);
157
167void nimble_autoadv_start(ble_addr_t *addr);
168
174
181
189
190#ifdef __cplusplus
191}
192#endif
194#endif /* NIMBLE_AUTOADV_H */
int nimble_autoadv_get_adv_instance(void)
Return the advertisement instance.
void nimble_autoadv_cfg_update(nimble_autoadv_cfg_t *cfg)
Set struct for additional arguments specifying the particulars of the advertising procedure.
void nimble_autoadv_reset(nimble_autoadv_cfg_t *cfg)
Reset all data regarding the advertising process.
int nimble_autoadv_add_field(uint8_t type, const void *data, size_t data_len)
Add a new field to the given advertising data.
void nimble_autoadv_init(const nimble_autoadv_cfg_t *cfg)
Initialize autoadv module.
void nimble_autoadv_stop(void)
Stop the automated advertising procedure.
void nimble_autoadv_set_gap_cb(ble_gap_event_fn *cb, void *cb_arg)
Set the callback for gap events.
void nimble_autoadv_start(ble_addr_t *addr)
Start the automated advertising procedure.
void nimble_autoadv_get_cfg(nimble_autoadv_cfg_t *cfg)
Gets struct for additional arguments specifying the particulars of the advertising procedure.
Parameter set used to configure accepting connections (advertising)
uint8_t channel_map
specify custom channel map
uint8_t flags
advertising flags
int8_t tx_power
specify TX power to be used
uint8_t filter_policy
Advertising Filter policy.
uint8_t own_addr_type
specify our own address type to use
uint32_t adv_itvl_ms
advertising interval [ms]
uint8_t phy
PHY mode.
int32_t adv_duration_ms
advertising interval [ms]