NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
ble_esp_gap.h
1/*
2 * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
3 *
4 * SPDX-License-Identifier: Unlicense OR CC0-1.0
5 */
6
7#ifndef H_BLE_ESP_GAP_
8#define H_BLE_ESP_GAP_
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14enum gap_status {
15 BLE_GAP_STATUS_ADV = 0,
16 BLE_GAP_STATUS_EXT_ADV,
17 BLE_GAP_STATUS_SCAN,
18 BLE_GAP_STATUS_CONN,
19 BLE_GAP_STATUS_PAIRED,
20 BLE_GAP_STATUS_GATTS,
21 BLE_GAP_STATUS_HOST_PRIVACY,
22 BLE_GAP_STATUS_PERIODIC,
23};
24
25typedef enum gap_status gap_status_t;
26
27#define BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR 0
28#define BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID 1
29#define BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE 2
30#define BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV 3
31#define BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV 4
32
47int ble_hs_hci_util_set_data_len(uint16_t conn_handle, uint16_t tx_octets,
48 uint16_t tx_time);
49
64int ble_hs_hci_util_read_sugg_def_data_len(uint16_t *out_sugg_max_tx_octets,
65 uint16_t *out_sugg_max_tx_time);
80int ble_hs_hci_util_write_sugg_def_data_len(uint16_t sugg_max_tx_octets, uint16_t sugg_max_tx_time);
81
89int ble_gap_wl_tx_rmv(const ble_addr_t *addrs);
90
96int ble_gap_wl_tx_clear(void);
97
105int ble_gap_wl_read_size(uint8_t *size);
106
113int ble_gap_host_check_status(void);
114
122int ble_gap_get_local_used_addr(ble_addr_t *addr);
123
135uint8_t* ble_resolve_adv_data(const uint8_t *adv_data, uint8_t adv_type, uint8_t adv_data_len , uint8_t * length);
136
137#if MYNEWT_VAL(BLE_HCI_VS)
138#if MYNEWT_VAL(BLE_POWER_CONTROL)
139
140#define ESP_1M_LOW (-70)
141#define ESP_1M_HIGH (-60)
142#define ESP_2M_LOW (-68)
143#define ESP_2M_HIGH (-58)
144#define ESP_S2_LOW (-75)
145#define ESP_S2_HIGH (-65)
146#define ESP_S8_LOW (-80)
147#define ESP_S8_HIGH (-70)
148#define ESP_MIN_TIME (15)
149
150/* Represents the set of lower / upper values of rssi of given chip
151 *
152 * Lower Limit Values Range: -54 to -80
153 * Upper Limit Values Range: -40 to -70
154 *
155 * */
156struct ble_gap_set_auto_pcl_params {
157
158 /* Connection Handle of the ACL Link */
159 int16_t conn_handle;
160
161 /* The Lower RSSI limit when 1M phy is used */
162 int8_t m1_lower_limit;
163
164 /* The Upper RSSI limit when 1M phy is used */
165 int8_t m1_upper_limit;
166
167#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_2M_PHY)
168 /* The Lower RSSI limit when 2M phy is used */
169 int8_t m2_lower_limit;
170
171 /* The Upper RSSI limit when 2M phy is used */
172 int8_t m2_upper_limit;
173#endif
174
175#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)
176 /* The Lower RSSI limit when S2 Coded phy is used */
177 int8_t s2_lower_limit;
178
179 /* The Upper RSSI limit when S2 Coded phy is used */
180 int8_t s2_upper_limit;
181
182 /* The Lower RSSI limit when S8 Coded phy is used */
183 int8_t s8_lower_limit;
184
185 /* The Upper RSSI limit when S8 Coded phy is used */
186 int8_t s8_upper_limit;
187#endif
188
189 /* Number of tx/rx packets to wait before initiating the LE power control Request.
190 * The default value is (min time spent variable = (tx/rxpackets 15)).*/
191 uint8_t min_time_spent;
192};
193
209int ble_gap_set_auto_pcl_param(struct ble_gap_set_auto_pcl_params *params);
210#endif
211
225int ble_gap_duplicate_exception_list(uint8_t subcode, uint8_t type, uint8_t *value, void *cb);
226
232int ble_gap_clear_legacy_adv(void);
233
239int ble_gap_set_chan_select(uint8_t select);
240
241#endif
242
257int
258ble_gap_dev_authorization(uint16_t conn_handle, bool authorized);
259
260void ble_gap_rx_test_evt(const void *buf, uint8_t len);
261void ble_gap_tx_test_evt(const void *buf, uint8_t len);
262void ble_gap_end_test_evt(const void *buf, uint8_t len);
263
264#ifdef __cplusplus
265}
266#endif
267
268#endif