xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/host/src/ble_gap_priv.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1*042d53a7SEvalZero /*
2*042d53a7SEvalZero  * Licensed to the Apache Software Foundation (ASF) under one
3*042d53a7SEvalZero  * or more contributor license agreements.  See the NOTICE file
4*042d53a7SEvalZero  * distributed with this work for additional information
5*042d53a7SEvalZero  * regarding copyright ownership.  The ASF licenses this file
6*042d53a7SEvalZero  * to you under the Apache License, Version 2.0 (the
7*042d53a7SEvalZero  * "License"); you may not use this file except in compliance
8*042d53a7SEvalZero  * with the License.  You may obtain a copy of the License at
9*042d53a7SEvalZero  *
10*042d53a7SEvalZero  *  http://www.apache.org/licenses/LICENSE-2.0
11*042d53a7SEvalZero  *
12*042d53a7SEvalZero  * Unless required by applicable law or agreed to in writing,
13*042d53a7SEvalZero  * software distributed under the License is distributed on an
14*042d53a7SEvalZero  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15*042d53a7SEvalZero  * KIND, either express or implied.  See the License for the
16*042d53a7SEvalZero  * specific language governing permissions and limitations
17*042d53a7SEvalZero  * under the License.
18*042d53a7SEvalZero  */
19*042d53a7SEvalZero 
20*042d53a7SEvalZero #ifndef H_BLE_GAP_CONN_
21*042d53a7SEvalZero #define H_BLE_GAP_CONN_
22*042d53a7SEvalZero 
23*042d53a7SEvalZero #include <inttypes.h>
24*042d53a7SEvalZero #include "syscfg/syscfg.h"
25*042d53a7SEvalZero #include "stats/stats.h"
26*042d53a7SEvalZero #include "host/ble_gap.h"
27*042d53a7SEvalZero #ifdef __cplusplus
28*042d53a7SEvalZero extern "C" {
29*042d53a7SEvalZero #endif
30*042d53a7SEvalZero 
31*042d53a7SEvalZero struct hci_le_conn_upd_complete;
32*042d53a7SEvalZero struct hci_le_conn_param_req;
33*042d53a7SEvalZero struct hci_le_conn_complete;
34*042d53a7SEvalZero struct hci_disconn_complete;
35*042d53a7SEvalZero struct hci_encrypt_change;
36*042d53a7SEvalZero struct ble_hs_hci_ack;
37*042d53a7SEvalZero struct ble_hs_adv;
38*042d53a7SEvalZero 
39*042d53a7SEvalZero STATS_SECT_START(ble_gap_stats)
40*042d53a7SEvalZero     STATS_SECT_ENTRY(wl_set)
41*042d53a7SEvalZero     STATS_SECT_ENTRY(wl_set_fail)
42*042d53a7SEvalZero     STATS_SECT_ENTRY(adv_stop)
43*042d53a7SEvalZero     STATS_SECT_ENTRY(adv_stop_fail)
44*042d53a7SEvalZero     STATS_SECT_ENTRY(adv_start)
45*042d53a7SEvalZero     STATS_SECT_ENTRY(adv_start_fail)
46*042d53a7SEvalZero     STATS_SECT_ENTRY(adv_set_data)
47*042d53a7SEvalZero     STATS_SECT_ENTRY(adv_set_data_fail)
48*042d53a7SEvalZero     STATS_SECT_ENTRY(adv_rsp_set_data)
49*042d53a7SEvalZero     STATS_SECT_ENTRY(adv_rsp_set_data_fail)
50*042d53a7SEvalZero     STATS_SECT_ENTRY(discover)
51*042d53a7SEvalZero     STATS_SECT_ENTRY(discover_fail)
52*042d53a7SEvalZero     STATS_SECT_ENTRY(initiate)
53*042d53a7SEvalZero     STATS_SECT_ENTRY(initiate_fail)
54*042d53a7SEvalZero     STATS_SECT_ENTRY(terminate)
55*042d53a7SEvalZero     STATS_SECT_ENTRY(terminate_fail)
56*042d53a7SEvalZero     STATS_SECT_ENTRY(cancel)
57*042d53a7SEvalZero     STATS_SECT_ENTRY(cancel_fail)
58*042d53a7SEvalZero     STATS_SECT_ENTRY(update)
59*042d53a7SEvalZero     STATS_SECT_ENTRY(update_fail)
60*042d53a7SEvalZero     STATS_SECT_ENTRY(connect_mst)
61*042d53a7SEvalZero     STATS_SECT_ENTRY(connect_slv)
62*042d53a7SEvalZero     STATS_SECT_ENTRY(disconnect)
63*042d53a7SEvalZero     STATS_SECT_ENTRY(rx_disconnect)
64*042d53a7SEvalZero     STATS_SECT_ENTRY(rx_update_complete)
65*042d53a7SEvalZero     STATS_SECT_ENTRY(rx_adv_report)
66*042d53a7SEvalZero     STATS_SECT_ENTRY(rx_conn_complete)
67*042d53a7SEvalZero     STATS_SECT_ENTRY(discover_cancel)
68*042d53a7SEvalZero     STATS_SECT_ENTRY(discover_cancel_fail)
69*042d53a7SEvalZero     STATS_SECT_ENTRY(security_initiate)
70*042d53a7SEvalZero     STATS_SECT_ENTRY(security_initiate_fail)
71*042d53a7SEvalZero STATS_SECT_END
72*042d53a7SEvalZero 
73*042d53a7SEvalZero extern STATS_SECT_DECL(ble_gap_stats) ble_gap_stats;
74*042d53a7SEvalZero 
75*042d53a7SEvalZero #define BLE_GAP_CONN_MODE_MAX               3
76*042d53a7SEvalZero #define BLE_GAP_DISC_MODE_MAX               3
77*042d53a7SEvalZero 
78*042d53a7SEvalZero #if MYNEWT_VAL(BLE_EXT_ADV) && NIMBLE_BLE_SCAN
79*042d53a7SEvalZero void ble_gap_rx_le_scan_timeout(void);
80*042d53a7SEvalZero #endif
81*042d53a7SEvalZero 
82*042d53a7SEvalZero #if MYNEWT_VAL(BLE_EXT_ADV)
83*042d53a7SEvalZero void ble_gap_rx_ext_adv_report(struct ble_gap_ext_disc_desc *desc);
84*042d53a7SEvalZero void ble_gap_rx_adv_set_terminated(struct hci_le_adv_set_terminated *evt);
85*042d53a7SEvalZero #endif
86*042d53a7SEvalZero void ble_gap_rx_adv_report(struct ble_gap_disc_desc *desc);
87*042d53a7SEvalZero void ble_gap_rx_rd_rem_sup_feat_complete(struct hci_le_rd_rem_supp_feat_complete *evt);
88*042d53a7SEvalZero int ble_gap_rx_conn_complete(struct hci_le_conn_complete *evt, uint8_t instance);
89*042d53a7SEvalZero void ble_gap_rx_disconn_complete(struct hci_disconn_complete *evt);
90*042d53a7SEvalZero void ble_gap_rx_update_complete(struct hci_le_conn_upd_complete *evt);
91*042d53a7SEvalZero void ble_gap_rx_param_req(struct hci_le_conn_param_req *evt);
92*042d53a7SEvalZero int ble_gap_rx_l2cap_update_req(uint16_t conn_handle,
93*042d53a7SEvalZero                                 struct ble_gap_upd_params *params);
94*042d53a7SEvalZero void ble_gap_rx_phy_update_complete(struct hci_le_phy_upd_complete *evt);
95*042d53a7SEvalZero void ble_gap_enc_event(uint16_t conn_handle, int status,
96*042d53a7SEvalZero                        int security_restored);
97*042d53a7SEvalZero void ble_gap_passkey_event(uint16_t conn_handle,
98*042d53a7SEvalZero                            struct ble_gap_passkey_params *passkey_params);
99*042d53a7SEvalZero void ble_gap_notify_rx_event(uint16_t conn_handle, uint16_t attr_handle,
100*042d53a7SEvalZero                              struct os_mbuf *om, int is_indication);
101*042d53a7SEvalZero void ble_gap_notify_tx_event(int status, uint16_t conn_handle,
102*042d53a7SEvalZero                              uint16_t attr_handle, int is_indication);
103*042d53a7SEvalZero void ble_gap_subscribe_event(uint16_t conn_handle, uint16_t attr_handle,
104*042d53a7SEvalZero                              uint8_t reason,
105*042d53a7SEvalZero                              uint8_t prev_notify, uint8_t cur_notify,
106*042d53a7SEvalZero                              uint8_t prev_indicate, uint8_t cur_indicate);
107*042d53a7SEvalZero void ble_gap_mtu_event(uint16_t conn_handle, uint16_t cid, uint16_t mtu);
108*042d53a7SEvalZero void ble_gap_identity_event(uint16_t conn_handle);
109*042d53a7SEvalZero int ble_gap_repeat_pairing_event(const struct ble_gap_repeat_pairing *rp);
110*042d53a7SEvalZero int ble_gap_master_in_progress(void);
111*042d53a7SEvalZero 
112*042d53a7SEvalZero void ble_gap_preempt(void);
113*042d53a7SEvalZero void ble_gap_preempt_done(void);
114*042d53a7SEvalZero 
115*042d53a7SEvalZero void ble_gap_conn_broken(uint16_t conn_handle, int reason);
116*042d53a7SEvalZero int32_t ble_gap_timer(void);
117*042d53a7SEvalZero 
118*042d53a7SEvalZero int ble_gap_init(void);
119*042d53a7SEvalZero 
120*042d53a7SEvalZero #if MYNEWT_VAL(BLE_HS_DEBUG)
121*042d53a7SEvalZero int ble_gap_dbg_update_active(uint16_t conn_handle);
122*042d53a7SEvalZero #endif
123*042d53a7SEvalZero 
124*042d53a7SEvalZero #ifdef __cplusplus
125*042d53a7SEvalZero }
126*042d53a7SEvalZero #endif
127*042d53a7SEvalZero 
128*042d53a7SEvalZero #endif
129