20#ifndef H_BLE_GAP_CONN_
21#define H_BLE_GAP_CONN_
24#include "nimble/porting/nimble/include/syscfg/syscfg.h"
25#include "nimble/porting/nimble/include/stats/stats.h"
26#include "nimble/nimble/host/include/host/ble_gap.h"
31struct hci_le_conn_upd_complete;
32struct hci_le_conn_param_req;
33struct hci_le_conn_complete;
34struct hci_disconn_complete;
35struct hci_encrypt_change;
39STATS_SECT_START(ble_gap_stats)
40 STATS_SECT_ENTRY(wl_set)
41 STATS_SECT_ENTRY(wl_set_fail)
42 STATS_SECT_ENTRY(adv_stop)
43 STATS_SECT_ENTRY(adv_stop_fail)
44 STATS_SECT_ENTRY(adv_start)
45 STATS_SECT_ENTRY(adv_start_fail)
46 STATS_SECT_ENTRY(adv_set_data)
47 STATS_SECT_ENTRY(adv_set_data_fail)
48 STATS_SECT_ENTRY(adv_rsp_set_data)
49 STATS_SECT_ENTRY(adv_rsp_set_data_fail)
50 STATS_SECT_ENTRY(discover)
51 STATS_SECT_ENTRY(discover_fail)
52 STATS_SECT_ENTRY(initiate)
53 STATS_SECT_ENTRY(initiate_fail)
54 STATS_SECT_ENTRY(terminate)
55 STATS_SECT_ENTRY(terminate_fail)
56 STATS_SECT_ENTRY(cancel)
57 STATS_SECT_ENTRY(cancel_fail)
58 STATS_SECT_ENTRY(update)
59 STATS_SECT_ENTRY(update_fail)
60 STATS_SECT_ENTRY(connect_mst)
61 STATS_SECT_ENTRY(connect_slv)
62 STATS_SECT_ENTRY(disconnect)
63 STATS_SECT_ENTRY(rx_disconnect)
64 STATS_SECT_ENTRY(rx_update_complete)
65 STATS_SECT_ENTRY(rx_adv_report)
66 STATS_SECT_ENTRY(rx_conn_complete)
67 STATS_SECT_ENTRY(discover_cancel)
68 STATS_SECT_ENTRY(discover_cancel_fail)
69 STATS_SECT_ENTRY(security_initiate)
70 STATS_SECT_ENTRY(security_initiate_fail)
73extern STATS_SECT_DECL(ble_gap_stats) ble_gap_stats;
75#define BLE_GAP_CONN_MODE_MAX 3
76#define BLE_GAP_DISC_MODE_MAX 3
78#if MYNEWT_VAL(BLE_EXT_ADV) && NIMBLE_BLE_SCAN
79void ble_gap_rx_le_scan_timeout(
void);
82#if MYNEWT_VAL(BLE_EXT_ADV)
83void ble_gap_rx_ext_adv_report(
struct ble_gap_ext_disc_desc *desc);
84void ble_gap_rx_adv_set_terminated(
const struct ble_hci_ev_le_subev_adv_set_terminated *ev);
85#if MYNEWT_VAL(BLE_PERIODIC_ADV)
86void ble_gap_rx_peroidic_adv_sync_estab(
const struct ble_hci_ev_le_subev_periodic_adv_sync_estab *ev);
87void ble_gap_rx_periodic_adv_rpt(
const struct ble_hci_ev_le_subev_periodic_adv_rpt *ev);
88void ble_gap_rx_periodic_adv_sync_lost(
const struct ble_hci_ev_le_subev_periodic_adv_sync_lost *ev);
89void ble_gap_rx_periodic_adv_sync_transfer(
const struct ble_hci_ev_le_subev_periodic_adv_sync_transfer *ev);
91void ble_gap_rx_scan_req_rcvd(
const struct ble_hci_ev_le_subev_scan_req_rcvd *ev);
94void ble_gap_rx_rd_rem_sup_feat_complete(
const struct ble_hci_ev_le_subev_rd_rem_used_feat *ev);
95#if MYNEWT_VAL(BLE_CONN_SUBRATING)
96void ble_gap_rx_subrate_change(
const struct ble_hci_ev_le_subev_subrate_change *ev);
98#if MYNEWT_VAL(BLE_POWER_CONTROL)
99void ble_gap_rx_transmit_power_report(
const struct ble_hci_ev_le_subev_transmit_power_report *ev);
100void ble_gap_rx_le_pathloss_threshold(
const struct ble_hci_ev_le_subev_path_loss_threshold *ev);
103struct ble_gap_conn_complete
106 uint16_t connection_handle;
108 uint8_t peer_addr_type;
109 uint8_t peer_addr[BLE_DEV_ADDR_LEN];
111 uint16_t conn_latency;
112 uint16_t supervision_timeout;
113 uint8_t master_clk_acc;
114 uint8_t local_rpa[BLE_DEV_ADDR_LEN];
115 uint8_t peer_rpa[BLE_DEV_ADDR_LEN];
118int ble_gap_rx_conn_complete(
struct ble_gap_conn_complete *evt, uint8_t instance);
119void ble_gap_rx_disconn_complete(
const struct ble_hci_ev_disconn_cmp *ev);
120void ble_gap_rx_update_complete(
const struct ble_hci_ev_le_subev_conn_upd_complete *ev);
121void ble_gap_rx_param_req(
const struct ble_hci_ev_le_subev_rem_conn_param_req *ev);
122int ble_gap_rx_l2cap_update_req(uint16_t conn_handle,
124void ble_gap_rx_phy_update_complete(
const struct ble_hci_ev_le_subev_phy_update_complete *ev);
125void ble_gap_enc_event(uint16_t conn_handle,
int status,
126 int security_restored,
int bonded);
127void ble_gap_passkey_event(uint16_t conn_handle,
129void ble_gap_notify_rx_event(uint16_t conn_handle, uint16_t attr_handle,
130 struct os_mbuf *om,
int is_indication);
131void ble_gap_notify_tx_event(
int status, uint16_t conn_handle,
132 uint16_t attr_handle,
int is_indication);
133void ble_gap_subscribe_event(uint16_t conn_handle, uint16_t attr_handle,
135 uint8_t prev_notify, uint8_t cur_notify,
136 uint8_t prev_indicate, uint8_t cur_indicate);
137void ble_gap_mtu_event(uint16_t conn_handle, uint16_t cid, uint16_t mtu);
138void ble_gap_identity_event(uint16_t conn_handle);
139int ble_gap_repeat_pairing_event(
const struct ble_gap_repeat_pairing *rp);
140void ble_gap_vs_hci_event(
const void *buf, uint8_t len);
141int ble_gap_authorize_event(uint16_t conn_handle, uint16_t attr_handle,
int is_read);
142int ble_gap_master_in_progress(
void);
144void ble_gap_preempt(
void);
145void ble_gap_preempt_done(
void);
147int ble_gap_terminate_with_conn(
struct ble_hs_conn *conn, uint8_t hci_reason);
148void ble_gap_reset_state(
int reason);
149void ble_gap_conn_broken(uint16_t conn_handle,
int reason);
150void ble_gap_reset_state(
int reason);
151int32_t ble_gap_timer(
void);
153int ble_gap_init(
void);
154void ble_gap_deinit(
void);
156#if MYNEWT_VAL(BLE_HS_DEBUG)
157int ble_gap_dbg_update_active(uint16_t conn_handle);
160#if MYNEWT_VAL(BLE_ENABLE_CONN_REATTEMPT)
161void ble_gap_reattempt_count(uint16_t conn_handle, uint8_t count);
164void ble_gap_rx_data_len_change(
const struct ble_hci_ev_le_subev_data_len_chg *ev);
Advertising report.
Definition ble_gap.h:458
Passkey query.
Definition ble_gap.h:368
Connection parameters update parameters.
Definition ble_gap.h:347