mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: add link role param for gatt connection event
This commit is contained in:
parent
4322433386
commit
5979111109
@ -209,6 +209,7 @@ typedef union {
|
||||
*/
|
||||
struct gattc_connect_evt_param {
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint8_t link_role; /*!< Link role : master role = 0 ; slave role = 1*/
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
esp_gatt_conn_params_t conn_params; /*!< current connection parameters */
|
||||
} connect; /*!< Gatt client callback param of ESP_GATTC_CONNECT_EVT */
|
||||
|
@ -196,6 +196,7 @@ typedef union {
|
||||
*/
|
||||
struct gatts_connect_evt_param {
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint8_t link_role; /*!< Link role : master role = 0 ; slave role = 1*/
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
esp_gatt_conn_params_t conn_params; /*!< current Connection parameters */
|
||||
} connect; /*!< Gatt server callback param of ESP_GATTS_CONNECT_EVT */
|
||||
|
@ -729,7 +729,7 @@ void bta_gattc_conncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data)
|
||||
if (p_rcb) {
|
||||
bta_gattc_send_connect_cback(p_rcb,
|
||||
p_data->int_conn.remote_bda,
|
||||
p_data->int_conn.hdr.layer_specific, p_data->int_conn.conn_params);
|
||||
p_data->int_conn.hdr.layer_specific, p_data->int_conn.conn_params, p_data->int_conn.role);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ void bta_gattc_send_open_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status
|
||||
** Returns
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id, tBTA_GATT_CONN_PARAMS conn_params)
|
||||
void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id, tBTA_GATT_CONN_PARAMS conn_params, UINT8 link_role)
|
||||
{
|
||||
tBTA_GATTC cb_data;
|
||||
|
||||
@ -771,6 +771,7 @@ void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda,
|
||||
|
||||
cb_data.connect.client_if = p_clreg->client_if;
|
||||
cb_data.connect.conn_id = conn_id;
|
||||
cb_data.connect.link_role = link_role;
|
||||
cb_data.connect.conn_params.interval = conn_params.interval;
|
||||
cb_data.connect.conn_params.latency = conn_params.latency;
|
||||
cb_data.connect.conn_params.timeout = conn_params.timeout;
|
||||
|
@ -1002,6 +1002,7 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
|
||||
cb_data.conn.conn_params.interval = p_lcb->current_used_conn_interval;
|
||||
cb_data.conn.conn_params.latency = p_lcb->current_used_conn_latency;
|
||||
cb_data.conn.conn_params.timeout = p_lcb->current_used_conn_timeout;
|
||||
cb_data.conn.link_role = p_lcb->link_role;
|
||||
}else {
|
||||
APPL_TRACE_WARNING("%s not found connection parameters of the device ", __func__);
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ extern void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *
|
||||
extern void bta_gattc_cancel_bk_conn(tBTA_GATTC_API_CANCEL_OPEN *p_data);
|
||||
extern void bta_gattc_send_open_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
|
||||
BD_ADDR remote_bda, UINT16 conn_id, tBTA_TRANSPORT transport, UINT16 mtu);
|
||||
extern void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id, tBTA_GATT_CONN_PARAMS conn_params);
|
||||
extern void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id, tBTA_GATT_CONN_PARAMS conn_params, UINT8 link_role);
|
||||
extern void bta_gattc_send_disconnect_cback( tBTA_GATTC_RCB *p_clreg, tGATT_DISCONN_REASON reason,
|
||||
BD_ADDR remote_bda, UINT16 conn_id);
|
||||
extern void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
|
@ -406,6 +406,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
UINT8 link_role;
|
||||
tBTA_GATTC_IF client_if;
|
||||
BD_ADDR remote_bda;
|
||||
tBTA_GATT_CONN_PARAMS conn_params;
|
||||
@ -614,6 +615,7 @@ typedef struct {
|
||||
tBTA_GATTS_IF server_if;
|
||||
BD_ADDR remote_bda;
|
||||
UINT16 conn_id;
|
||||
UINT8 link_role;
|
||||
tBTA_GATT_REASON reason; /* report disconnect reason */
|
||||
tBTA_GATT_TRANSPORT transport;
|
||||
tBTA_GATT_CONN_PARAMS conn_params;
|
||||
|
@ -900,6 +900,7 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
|
||||
|
||||
gattc_if = connect->client_if;
|
||||
param.connect.conn_id = BTC_GATT_GET_CONN_ID(connect->conn_id);
|
||||
param.connect.link_role = connect->link_role;
|
||||
memcpy(param.connect.remote_bda, connect->remote_bda, sizeof(esp_bd_addr_t));
|
||||
param.connect.conn_params.interval = connect->conn_params.interval;
|
||||
param.connect.conn_params.latency = connect->conn_params.latency;
|
||||
|
@ -900,6 +900,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
|
||||
case BTA_GATTS_CONNECT_EVT:
|
||||
gatts_if = p_data->conn.server_if;
|
||||
param.connect.conn_id = BTC_GATT_GET_CONN_ID(p_data->conn.conn_id);
|
||||
param.connect.link_role = p_data->conn.link_role;
|
||||
memcpy(param.connect.remote_bda, p_data->conn.remote_bda, ESP_BD_ADDR_LEN);
|
||||
param.connect.conn_params.interval = p_data->conn.conn_params.interval;
|
||||
param.connect.conn_params.latency = p_data->conn.conn_params.latency;
|
||||
|
Loading…
x
Reference in New Issue
Block a user