mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/bt: Disable BR/EDR GATT
This commit is contained in:
parent
23f45235de
commit
171489153d
@ -94,6 +94,10 @@
|
||||
#define CLASSIC_BT_INCLUDED FALSE
|
||||
#endif /* CLASSIC_BT_INCLUDED */
|
||||
|
||||
#ifndef CLASSIC_BT_GATT_INCLUDED
|
||||
#define CLASSIC_BT_GATT_INCLUDED FALSE
|
||||
#endif /* CLASSIC_BT_GATT_INCLUDED */
|
||||
|
||||
#ifndef CONFIG_GATTC_CACHE_NVS_FLASH
|
||||
#define CONFIG_GATTC_CACHE_NVS_FLASH FALSE
|
||||
#endif /* CONFIG_GATTC_CACHE_NVS_FLASH */
|
||||
@ -147,13 +151,13 @@
|
||||
|
||||
#ifndef CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM 100
|
||||
#else
|
||||
#else
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
|
||||
#endif /* CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM */
|
||||
|
||||
#ifndef CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
|
||||
#define BLE_ADV_REPORT_DISCARD_THRSHOLD 20
|
||||
#else
|
||||
#else
|
||||
#define BLE_ADV_REPORT_DISCARD_THRSHOLD CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
|
||||
#endif /* CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD */
|
||||
|
||||
|
@ -441,9 +441,9 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
tGATT_SR_REG *p_sreg;
|
||||
tGATT_HDL_LIST_ELEM *p_list = NULL;
|
||||
UINT8 i_sreg;
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#if (SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
tBT_UUID *p_uuid;
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
tGATT_REG *p_reg = gatt_get_regcb(gatt_if);
|
||||
|
||||
tGATTS_PENDING_NEW_SRV_START *p_buf;
|
||||
@ -482,10 +482,10 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
case GATT_TRANSPORT_BR_EDR:
|
||||
case GATT_TRANSPORT_LE_BR_EDR:
|
||||
if (p_sreg->type == GATT_UUID_PRI_SERVICE) {
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#if (SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
p_uuid = gatts_get_service_uuid (p_sreg->p_db);
|
||||
p_sreg->sdp_handle = gatt_add_sdp_record(p_uuid, p_sreg->s_hdl, p_sreg->e_hdl);
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -535,11 +535,11 @@ void GATTS_StopService (UINT16 service_handle)
|
||||
|
||||
/* Index 0 is reserved for GATT, and is never stopped */
|
||||
if ( (ii > 0) && (ii < GATT_MAX_SR_PROFILES) && (gatt_cb.sr_reg[ii].in_use) ) {
|
||||
#if(SDP_INCLUDED == TRUE)
|
||||
#if(SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
if (gatt_cb.sr_reg[ii].sdp_handle) {
|
||||
SDP_DeleteRecord(gatt_cb.sr_reg[ii].sdp_handle);
|
||||
}
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
gatt_remove_a_srv_from_list(&gatt_cb.srv_list_info, &gatt_cb.srv_list[ii]);
|
||||
gatt_cb.srv_list[ii].in_use = FALSE;
|
||||
memset (&gatt_cb.sr_reg[ii], 0, sizeof(tGATT_SR_REG));
|
||||
|
@ -47,7 +47,7 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect
|
||||
UINT16 reason, tBT_TRANSPORT transport);
|
||||
static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf);
|
||||
static void gatt_le_cong_cback(BD_ADDR remote_bda, BOOLEAN congest);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 l2cap_cid,
|
||||
UINT16 psm, UINT8 l2cap_id);
|
||||
static void gatt_l2cif_connect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
|
||||
@ -56,9 +56,9 @@ static void gatt_l2cif_config_cfm_cback (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cf
|
||||
static void gatt_l2cif_disconnect_ind_cback (UINT16 l2cap_cid, BOOLEAN ack_needed);
|
||||
static void gatt_l2cif_disconnect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
|
||||
static void gatt_l2cif_data_ind_cback (UINT16 l2cap_cid, BT_HDR *p_msg);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
static void gatt_send_conn_cback (tGATT_TCB *p_tcb);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
static void gatt_l2cif_congest_cback (UINT16 cid, BOOLEAN congested);
|
||||
static const tL2CAP_APPL_INFO dyn_info = {
|
||||
gatt_l2cif_connect_ind_cback,
|
||||
@ -73,7 +73,7 @@ static const tL2CAP_APPL_INFO dyn_info = {
|
||||
gatt_l2cif_congest_cback,
|
||||
NULL
|
||||
} ;
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
|
||||
#if GATT_DYNAMIC_MEMORY == FALSE
|
||||
tGATT_CB gatt_cb;
|
||||
@ -125,12 +125,13 @@ void gatt_init (void)
|
||||
fixed_reg.default_idle_tout = 0xffff; /* 0xffff default idle timeout */
|
||||
|
||||
L2CA_RegisterFixedChannel (L2CAP_ATT_CID, &fixed_reg);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
/* Now, register with L2CAP for ATT PSM over BR/EDR */
|
||||
if (!L2CA_Register (BT_PSM_ATT, (tL2CAP_APPL_INFO *) &dyn_info)) {
|
||||
GATT_TRACE_ERROR ("ATT Dynamic Registration failed");
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
|
||||
BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
|
||||
|
||||
@ -219,12 +220,12 @@ BOOLEAN gatt_connect (BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, tGATT_TCB *p
|
||||
if (transport == BT_TRANSPORT_LE) {
|
||||
p_tcb->att_lcid = L2CAP_ATT_CID;
|
||||
gatt_ret = L2CA_ConnectFixedChnl (L2CAP_ATT_CID, rem_bda, bd_addr_type);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
} else {
|
||||
if ((p_tcb->att_lcid = L2CA_ConnectReq(BT_PSM_ATT, rem_bda)) != 0) {
|
||||
gatt_ret = TRUE;
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
|
||||
}
|
||||
|
||||
@ -260,10 +261,10 @@ BOOLEAN gatt_disconnect (tGATT_TCB *p_tcb)
|
||||
gatt_set_ch_state(p_tcb, GATT_CH_CLOSING);
|
||||
ret = L2CA_CancelBleConnectReq (p_tcb->peer_bda);
|
||||
}
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
} else {
|
||||
ret = L2CA_DisconnectReq(p_tcb->att_lcid);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
}
|
||||
} else {
|
||||
GATT_TRACE_DEBUG ("gatt_disconnect already in closing state");
|
||||
@ -579,7 +580,7 @@ static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
|
||||
{
|
||||
/* do we already have a control channel for this peer? */
|
||||
@ -885,7 +886,7 @@ static void gatt_l2cif_congest_cback (UINT16 lcid, BOOLEAN congested)
|
||||
}
|
||||
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -1493,7 +1493,7 @@ tGATT_STATUS gatt_send_error_rsp (tGATT_TCB *p_tcb, UINT8 err_code, UINT8 op_cod
|
||||
return status;
|
||||
}
|
||||
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#if (SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function gatt_add_sdp_record
|
||||
@ -1559,7 +1559,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl)
|
||||
|
||||
return (sdp_handle);
|
||||
}
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
|
||||
#if GATT_CONFORMANCE_TESTING == TRUE
|
||||
/*******************************************************************************
|
||||
|
@ -504,7 +504,7 @@ typedef struct {
|
||||
UINT16 next_handle; /* next available handle */
|
||||
tGATT_SVC_CHG gattp_attr; /* GATT profile attribute service change */
|
||||
tGATT_IF gatt_if;
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
tGATT_HDL_LIST_INFO hdl_list_info;
|
||||
tGATT_HDL_LIST_ELEM hdl_list[GATT_MAX_SR_PROFILES];
|
||||
tGATT_SRV_LIST_INFO srv_list_info;
|
||||
@ -598,9 +598,9 @@ extern tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB *p_tcb, BT_HDR *p_toL2CAP);
|
||||
|
||||
/* utility functions */
|
||||
extern UINT8 *gatt_dbg_op_name(UINT8 op_code);
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#if (SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
extern UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl);
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
extern BOOLEAN gatt_parse_uuid_from_cmd(tBT_UUID *p_uuid, UINT16 len, UINT8 **p_data);
|
||||
extern UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid);
|
||||
extern BOOLEAN gatt_uuid_compare(tBT_UUID src, tBT_UUID tar);
|
||||
@ -722,16 +722,16 @@ extern BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, B
|
||||
extern UINT16 gatts_add_included_service (tGATT_SVC_DB *p_db, UINT16 s_handle, UINT16 e_handle, tBT_UUID service);
|
||||
extern UINT16 gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm,
|
||||
tGATT_CHAR_PROP property,
|
||||
tBT_UUID *p_char_uuid, tGATT_ATTR_VAL *attr_val,
|
||||
tBT_UUID *p_char_uuid, tGATT_ATTR_VAL *attr_val,
|
||||
tGATTS_ATTR_CONTROL *control);
|
||||
extern UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm,
|
||||
extern UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm,
|
||||
tBT_UUID *p_dscp_uuid, tGATT_ATTR_VAL *attr_val,
|
||||
tGATTS_ATTR_CONTROL *control);
|
||||
|
||||
extern tGATT_STATUS gatts_set_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
extern tGATT_STATUS gatts_set_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
UINT16 length, UINT8 *value);
|
||||
|
||||
extern tGATT_STATUS gatts_get_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
extern tGATT_STATUS gatts_get_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
UINT16 *length, UINT8 **value);
|
||||
extern BOOLEAN gatts_is_auto_response(UINT16 attr_handle);
|
||||
extern tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb, tGATT_SVC_DB *p_db, UINT8 op_code, BT_HDR *p_rsp, UINT16 s_handle,
|
||||
|
Loading…
Reference in New Issue
Block a user