Enabling this option will release about 30K DRAM from Classic BT.
The released DRAM will be used as system heap memory.
+config GATTS_ENABLE
+ bool "Set if enable the gatt server module(GATTS) in the stack or not"
+ depends on BLUEDROID_ENABLED
+ default y
+ help
+ This option can be close when the app work only on gatt client mode
+
+config GATTC_ENABLE
+ bool "Set if enable the gatt server module(GATTC) in the stack or not"
+ depends on BLUEDROID_ENABLED
+ default y
+ help
+ This option can be close when the app work only on gatt server mode
+
+config SMP_ENABLE
+ bool "Set if enable the ble security module (SMP module) or not"
+ depends on BLUEDROID_ENABLED
+ default y
+ help
+ This option can be close when the app not used the ble security connect.
+
+config BT_ACL_CONNECTIONS
+ int "Set the max connection number for the bt/ble device can accept, up to 7."
+ depends on BLUEDROID_ENABLED
+ default 4
+ help
+ This setting is used for the max connection link for the bt/ble device
+
config BT_STACK_NO_LOG
bool "Close the bluedroid bt stack log print"
depends on BLUEDROID_ENABLED
#include "btc_manage.h"
#include "btc_gatts.h"
#include "btc_gatt_util.h"
-
+#include "bt_target.h"
+#if (GATTS_INCLUDED == TRUE)
#define COPY_TO_GATTS_ARGS(_gatt_args, _arg, _arg_type) memcpy(_gatt_args, _arg, sizeof(_arg_type))
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t), NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
+
+#endif ///GATTS_INCLUDED
\ No newline at end of file
static void bta_dm_disable_conn_down_timer_cback (TIMER_LIST_ENT *p_tle);
static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
static void bta_dm_adjust_roles(BOOLEAN delay_role_switch);
+#if (SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE)
static char *bta_dm_get_remname(void);
+#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
static void bta_dm_bond_cancel_complete_cback(tBTM_STATUS result);
static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT transport);
BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback);
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
if (bta_dm_search_cb.transport == BT_TRANSPORT_LE ) {
GAP_BleReadPeerPrefConnParams (bta_dm_search_cb.peer_bdaddr);
}
**
** Returns char * - Pointer to the remote device name
*******************************************************************************/
+#if (SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE)
static char *bta_dm_get_remname(void)
{
char *p_name = (char *)bta_dm_search_cb.peer_name;
return p_name;
}
+#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
/*******************************************************************************
**
#include "bt_target.h"
-#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
+#if defined(GATTS_INCLUDED) && (GATTS_INCLUDED == TRUE)
#include "utl.h"
#include "gki.h"
}
}
}
-#endif /* BTA_GATT_INCLUDED */
+#endif /* GATTS_INCLUDED */
#include "bt_target.h"
-#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
+#if defined(GATTS_INCLUDED) && (GATTS_INCLUDED == TRUE)
#include <string.h>
#include "gki.h"
#include "bt_target.h"
-#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
+#if defined(GATTS_INCLUDED) && (GATTS_INCLUDED == TRUE)
#include <string.h>
return (TRUE);
}
-#endif /* BTA_GATT_INCLUDED */
+#endif /* GATTS_INCLUDED */
#include "bt_target.h"
-#if defined(BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)
+#if defined(GATTS_INCLUDED) && (GATTS_INCLUDED == TRUE)
#include <string.h>
#include "utl.h"
-#endif
+#endif /* GATTS_INCLUDED */
\ No newline at end of file
#ifndef BTA_GATT_DEBUG
-#define BTA_GATT_DEBUG TRUE
+#define BTA_GATT_DEBUG FALSE
#endif
/*****************************************************************************
static btc_func_t profile_tab[BTC_PID_NUM] = {
[BTC_PID_MAIN_INIT] = {btc_main_call_handler, NULL },
[BTC_PID_DEV] = {btc_dev_call_handler, NULL },
+#if (GATTS_INCLUDED == TRUE)
[BTC_PID_GATTS] = {btc_gatts_call_handler, btc_gatts_cb_handler },
+#endif ///GATTS_INCLUDED == TRUE
#if (GATTC_INCLUDED == TRUE)
[BTC_PID_GATTC] = {btc_gattc_call_handler, btc_gattc_cb_handler },
#endif ///GATTC_INCLUDED == TRUE
[BTC_PID_GAP_BLE] = {btc_gap_ble_call_handler, btc_gap_ble_cb_handler },
[BTC_PID_BLE_HID] = {NULL, NULL},
[BTC_PID_SPPLIKE] = {NULL, NULL},
+#if (GATTS_INCLUDED == TRUE)
[BTC_PID_BLUFI] = {btc_blufi_call_handler, btc_blufi_cb_handler },
+#endif ///GATTS_INCLUDED == TRUE
[BTC_PID_DM_SEC] = {NULL, btc_dm_sec_cb_handler },
#if CONFIG_CLASSIC_BT_ENABLED
[BTC_PID_GAP_BT] = {btc_gap_bt_call_handler, NULL },
#include "esp_blufi_api.h"
+#if (GATTS_INCLUDED == TRUE)
+
#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
{
return BTC_BLUFI_VERSION;
}
+
+#endif ///GATTS_INCLUDED == TRUE
#include "esp_wifi.h"
+#if (GATTS_INCLUDED == TRUE)
extern tBLUFI_ENV blufi_env;
void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len)
break;
}
}
+
+#endif ///(GATTS_INCLUDED == TRUE)
#include "btc_main.h"
#include "esp_gatts_api.h"
+#if (GATTS_INCLUDED == TRUE)
+
#define A2C_GATTS_EVT(_bta_event) (_bta_event) //BTA TO BTC EVT
#define C2A_GATTS_EVT(_btc_event) (_btc_event) //BTC TO BTA EVT
btc_gatts_cb_param_copy_free(msg, p_data);
}
+
+#endif ///GATTS_INCLUDED
\ No newline at end of file
#include "bta_api.h"
#if( defined BLE_INCLUDED ) && (BLE_INCLUDED == TRUE)
-#if( defined BTA_GATT_INCLUDED ) && (BTA_GATT_INCLUDED == TRUE)
+#if( defined GATTS_INCLUDED ) && (GATTS_INCLUDED == TRUE)
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "bt_defs.h"
+#include "bt_target.h"
typedef enum {
// Disable secure connections
#define CASE_RETURN_STR(const) case const: return #const;
+#if (SMP_INCLUDED == TRUE)
static const char *interop_feature_string(const interop_feature_t feature)
{
switch (feature) {
}
// Interface functions
-
bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
{
assert(addr);
return false;
}
+#endif ///SMP_INCLUDED == TRUE
packet->offset++;
packet->len--;
if (type == HCI_BLE_EVENT) {
- uint8_t len;
+ uint8_t len = 0;
STREAM_TO_UINT8(len, stream);
LOG_ERROR("Workround stream corrupted during LE SCAN: pkt_len=%d ble_event_len=%d\n",
packet->len, len);
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
+#if (CONFIG_GATTS_ENABLE)
+#define GATTS_INCLUDED TRUE
+#else
+#define GATTS_INCLUDED FALSE
+#endif /* CONFIG_GATTS_ENABLE */
+
+#if (CONFIG_GATTC_ENABLE)
+#define GATTC_INCLUDED TRUE
+#else
+#define GATTC_INCLUDED FALSE
+#endif /* CONFIG_GATTC_ENABLE */
+
+#if (CONFIG_SMP_ENABLE)
+#define SMP_INCLUDED TRUE
+#define BLE_PRIVACY_SPT TRUE
+#else
+#define SMP_INCLUDED FALSE
+#define BLE_PRIVACY_SPT FALSE
+#endif /* CONFIG_GATTC_ENABLE */
+
+
//------------------Added from bdroid_buildcfg.h---------------------
#ifndef L2CAP_EXTFEA_SUPPORTED_MASK
#define L2CAP_EXTFEA_SUPPORTED_MASK (L2CAP_EXTFEA_ENH_RETRANS | L2CAP_EXTFEA_STREAM_MODE | L2CAP_EXTFEA_NO_CRC | L2CAP_EXTFEA_FIXED_CHNLS)
/* The size in bytes of the BTM inquiry database. 40 As Default */
#ifndef BTM_INQ_DB_SIZE
-#define BTM_INQ_DB_SIZE 1//32
+#define BTM_INQ_DB_SIZE 5//32
#endif
/* The default scan mode */
#if (CLASSIC_BT_INCLUDED == TRUE)
#define L2CAP_NUM_FIXED_CHNLS 32
#else
-#define L2CAP_NUM_FIXED_CHNLS 2 //There are just two fix channel in the BLE only mode(gatt,smp)
+#define L2CAP_NUM_FIXED_CHNLS 3 //There are just three fix channel in the BLE only mode(gatt,signal,smp)
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif
/* Enables or disables all trace messages. */
#ifndef BT_USE_TRACES
-#define BT_USE_TRACES TRUE
+#define BT_USE_TRACES FALSE
#endif
/******************************************************************************
#endif
#ifndef BTM_INITIAL_TRACE_LEVEL
-#define BTM_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
+#define BTM_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
#endif
#ifndef L2CAP_INITIAL_TRACE_LEVEL
-#define L2CAP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
+#define L2CAP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
#endif
#ifndef RFCOMM_INITIAL_TRACE_LEVEL
#endif
#ifndef APPL_INITIAL_TRACE_LEVEL
-#define APPL_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
+#define APPL_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
#endif
#ifndef BT_TRACE_APPL
#endif
#ifndef GATT_INITIAL_TRACE_LEVEL
-#define GATT_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
+#define GATT_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
#endif
#ifndef SMP_INITIAL_TRACE_LEVEL
return BTM_BUSY;
}
-#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE)
+#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
if (!GAP_BleReadPeerDevName(remote_bda, btm_ble_read_remote_name_cmpl)) {
return BTM_BUSY;
}
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
BOOLEAN status = TRUE;
-#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE)
+#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
status = GAP_BleCancelReadPeerDevName(remote_bda);
#endif
l2c_free();
#if BLE_INCLUDED == TRUE
-#if (defined(GATT_INCLUDED) && GATT_INCLUDED == true)
+#if (defined(GATTS_INCLUDED) && GATTS_INCLUDED == true)
gatt_free();
#endif
#endif
gap_conn_init();
#endif
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
gap_attr_db_init();
#endif
}
******************************************************************************/
#include "bt_target.h"
-#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
+#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
#include "bt_defs.h"
#include <string.h>
param.service.s_handle = 1;
param.service.e_handle = 0xFFFF;
param.service.auth_req = 0;
-
+#if (GATTC_INCLUDED == TRUE)
if (GATTC_Read(p_clcb->conn_id, GATT_READ_BY_TYPE, ¶m) == GATT_SUCCESS) {
p_clcb->cl_op_uuid = uuid;
started = TRUE;
}
+#endif ///GATTC_INCLUDED == TRUE
}
return started;
return (TRUE);
}
-#endif /* BLE_INCLUDED */
+#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE*/
#endif
/* LE GAP attribute database */
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
tGAP_ATTR gatt_attr[GAP_MAX_CHAR_NUM];
tGAP_CLCB clcb[GAP_MAX_CL]; /* connection link*/
tGATT_IF gatt_if;
#if (GAP_CONN_INCLUDED == TRUE)
extern void gap_conn_init(void);
#endif
-#if (BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
extern void gap_attr_db_init(void);
#endif
return (gatt_cb.trace_level);
}
+
+#if (GATTS_INCLUDED == TRUE)
/*****************************************************************************
**
** GATT SERVER API
tGATT_SR_REG *p_sreg;
tGATT_HDL_LIST_ELEM *p_list = NULL;
UINT8 i_sreg;
+#if (SDP_INCLUDED == TRUE)
tBT_UUID *p_uuid;
+#endif ///SDP_INCLUDED == TRUE
tGATT_REG *p_reg = gatt_get_regcb(gatt_if);
tGATTS_PENDING_NEW_SRV_START *p_buf;
case GATT_TRANSPORT_BR_EDR:
case GATT_TRANSPORT_LE_BR_EDR:
if (p_sreg->type == GATT_UUID_PRI_SERVICE) {
- p_uuid = gatts_get_service_uuid (p_sreg->p_db);
#if (SDP_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
}
status = gatts_get_attribute_value(&p_decl->svc_db, attr_handle, length, value);
return status;
}
+#endif ///GATTS_INCLUDED == TRUE
+
+#if (GATTC_INCLUDED == TRUE)
/*******************************************************************************/
/* GATT Profile Srvr Functions */
/*******************************************************************************/
return ret;
}
+#endif ///GATTC_INCLUDED == TRUE
/*******************************************************************************/
/* */
{
tGATT_REG *p_reg = gatt_get_regcb(gatt_if);
tGATT_TCB *p_tcb;
- tGATT_CLCB *p_clcb;
- UINT8 i, ii, j;
+ tGATT_CLCB *p_clcb;
+ UINT8 i, j;
+#if (GATTS_INCLUDED == TRUE)
+ UINT8 ii;
tGATT_SR_REG *p_sreg;
-
+#endif ///GATTS_INCLUDED == TRUE
GATT_TRACE_API ("GATT_Deregister gatt_if=%d", gatt_if);
/* Index 0 is GAP and is never deregistered */
if ( (gatt_if == 0) || (p_reg == NULL) ) {
/* todo an applcaiton can not be deregistered if its services is also used by other application
deregisteration need to bed performed in an orderly fashion
no check for now */
-
+#if (GATTS_INCLUDED == TRUE)
for (ii = 0, p_sreg = gatt_cb.sr_reg; ii < GATT_MAX_SR_PROFILES; ii++, p_sreg++) {
if (p_sreg->in_use && (p_sreg->gatt_if == gatt_if)) {
GATTS_StopService(p_sreg->s_hdl);
}
}
-
/* free all services db buffers if owned by this application */
gatt_free_srvc_db_buffer_app_id(&p_reg->app_uuid128);
-
+#endif ///GATTS_INCLUDED == TRUE
/* When an application deregisters, check remove the link associated with the app */
for (i = 0, p_tcb = gatt_cb.tcb; i < GATT_MAX_PHY_CHANNEL; i++, p_tcb++) {
#include "gatt_int.h"
#include "sdpdefs.h"
-#if BLE_INCLUDED == TRUE
+#if (BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
#define GATTP_MAX_NUM_INC_SVR 0
#define GATTP_MAX_CHAR_NUM 2
** Returns Connection ID
**
*******************************************************************************/
+#if (GATTS_INCLUDED == TRUE)
UINT16 gatt_profile_find_conn_id_by_bd_addr(BD_ADDR remote_bda)
{
UINT16 conn_id = GATT_INVALID_CONN_ID;
GATT_GetConnIdIfConnected (gatt_cb.gatt_if, remote_bda, &conn_id, BT_TRANSPORT_LE);
return conn_id;
}
-
+#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
** Function gatt_profile_find_clcb_by_conn_id
srvc_disc_param.e_handle = 0xffff;
srvc_disc_param.service.len = 2;
srvc_disc_param.service.uu.uuid16 = UUID_SERVCLASS_GATT_SERVER;
+#if (GATTC_INCLUDED == TRUE)
if (GATTC_Discover (p_clcb->conn_id, GATT_DISC_SRVC_BY_UUID, &srvc_disc_param) != GATT_SUCCESS) {
GATT_TRACE_ERROR("%s() - ccc service error", __FUNCTION__);
gatt_config_ccc_complete(p_clcb);
}
+#endif ///GATTC_INCLUDED == TRUE
break;
case GATT_SVC_CHANGED_CHARACTERISTIC: /* discover service change char */
srvc_disc_param.e_handle = p_clcb->e_handle;
srvc_disc_param.service.len = 2;
srvc_disc_param.service.uu.uuid16 = GATT_UUID_GATT_SRV_CHGD;
+#if (GATTC_INCLUDED == TRUE)
if (GATTC_Discover (p_clcb->conn_id, GATT_DISC_CHAR, &srvc_disc_param) != GATT_SUCCESS) {
GATT_TRACE_ERROR("%s() - ccc char error", __FUNCTION__);
gatt_config_ccc_complete(p_clcb);
}
+#endif ///GATTC_INCLUDED == TRUE
break;
case GATT_SVC_CHANGED_DESCRIPTOR: /* discover service change ccc */
srvc_disc_param.s_handle = p_clcb->s_handle;
srvc_disc_param.e_handle = p_clcb->e_handle;
+#if (GATTC_INCLUDED == TRUE)
if (GATTC_Discover (p_clcb->conn_id, GATT_DISC_CHAR_DSCPT, &srvc_disc_param) != GATT_SUCCESS) {
GATT_TRACE_ERROR("%s() - ccc char descriptor error", __FUNCTION__);
gatt_config_ccc_complete(p_clcb);
}
+#endif ///GATTC_INCLUDED == TRUE
break;
case GATT_SVC_CHANGED_CONFIGURE_CCCD: /* write ccc */
ccc_value.handle = p_clcb->s_handle;
ccc_value.len = 2;
ccc_value.value[0] = GATT_CLT_CONFIG_INDICATION;
+#if (GATTC_INCLUDED == TRUE)
if (GATTC_Write (p_clcb->conn_id, GATT_WRITE, &ccc_value) != GATT_SUCCESS) {
GATT_TRACE_ERROR("%s() - write ccc error", __FUNCTION__);
gatt_config_ccc_complete(p_clcb);
}
+#endif ///GATTC_INCLUDED == TRUE
break;
}
}
gatt_cl_start_config_ccc(p_clcb);
}
-#endif /* BLE_INCLUDED */
+#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE */
p_signature)) {
p_attr->len += BTM_BLE_AUTH_SIGN_LEN;
gatt_set_ch_state(p_clcb->p_tcb, GATT_CH_OPEN);
+#if (GATTC_INCLUDED == TRUE)
gatt_act_write(p_clcb, GATT_SEC_SIGN_DATA);
+#endif ///GATTC_INCLUDED == TRUE
} else {
gatt_end_operation(p_clcb, GATT_INTERNAL_ERROR, NULL);
}
void gatt_verify_signature(tGATT_TCB *p_tcb, BT_HDR *p_buf)
{
UINT16 cmd_len;
+#if (GATTS_INCLUDED == TRUE)
UINT8 op_code;
+#endif ///GATTS_INCLUDED == TRUE
UINT8 *p, *p_orig = (UINT8 *)(p_buf + 1) + p_buf->offset;
UINT32 counter;
STREAM_TO_UINT32(counter, p);
if (BTM_BleVerifySignature(p_tcb->peer_bda, p_orig, cmd_len, counter, p)) {
+#if (GATTS_INCLUDED == TRUE)
STREAM_TO_UINT8(op_code, p_orig);
gatt_server_handle_client_req (p_tcb, op_code, (UINT16)(p_buf->len - 1), p_orig);
+#endif ///GATTS_INCLUDED == TRUE
} else {
/* if this is a bad signature, assume from attacker, ignore it */
GATT_TRACE_ERROR("Signature Verification Failed, data ignored");
if (p_clcb && p_clcb->p_tcb && GKI_queue_is_empty(&p_clcb->p_tcb->pending_enc_clcb)) {
gatt_set_sec_act(p_clcb->p_tcb, GATT_SEC_NONE);
}
-
+#if (GATTC_INCLUDED == TRUE)
if (!sec_check_ok) {
gatt_end_operation(p_clcb, GATT_AUTH_FAIL, NULL);
} else if (p_clcb->operation == GATTC_OPTYPE_WRITE) {
gatt_act_write(p_clcb, sec_act);
} else if (p_clcb->operation == GATTC_OPTYPE_READ) {
gatt_act_read(p_clcb, p_clcb->counter);
- }
+ }\r
+#endif ///GATTC_INCLUDED == TRUE
}
/*******************************************************************************
**
#include "bt_target.h"
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
#include <string.h>
//#include "bt_utils.h"
return;
}
-#endif /* BLE_INCLUDED */
+#endif /* BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE */
#include "bt_target.h"
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
#include "bt_trace.h"
//#include "bt_utils.h"
return rt;
}
-#endif /* BLE_INCLUDED */
+#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE */
gatt_cb.hdl_cfg.gatt_start_hdl = GATT_GATT_START_HANDLE;
gatt_cb.hdl_cfg.gap_start_hdl = GATT_GAP_START_HANDLE;
gatt_cb.hdl_cfg.app_start_hdl = GATT_APP_START_HANDLE;
+#if (GATTS_INCLUDED == TRUE)
gatt_profile_db_init();
+#endif ///GATTS_INCLUDED == TRUE
}
** Returns void
**
*******************************************************************************/
+#if (GATTS_INCLUDED == TRUE)
void gatt_free(void)
{
int i;
gatt_free_hdl_buffer(&gatt_cb.hdl_list[i]);
}
}
+#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
UINT8 i = 0;
tGATT_REG *p_reg = NULL;
UINT16 conn_id;
-
+#if (GATTC_INCLUDED == TRUE)
/* if uncongested, check to see if there is any more pending data */
if (p_tcb != NULL && congested == FALSE) {
gatt_cl_send_next_cmd_inq(p_tcb);
}
+#endif ///GATTC_INCLUDED == TRUE
/* notifying all applications for the connection up event */
for (i = 0, p_reg = gatt_cb.cl_rcb ; i < GATT_MAX_APPS; i++, p_reg++) {
if (p_reg->in_use) {
} else {
/* message from client */
if ((op_code % 2) == 0) {
+#if (GATTS_INCLUDED == TRUE)
gatt_server_handle_client_req (p_tcb, op_code, msg_len, p);
+#endif ///GATTS_INCLUDED == TRUE
} else {
+#if (GATTC_INCLUDED == TRUE)
gatt_client_handle_server_rsp (p_tcb, op_code, msg_len, p);
+#endif ///GATTC_INCLUDED == TRUE
}
}
} else {
*******************************************************************************/
void gatt_send_srv_chg_ind (BD_ADDR peer_bda)
{
+#if (GATTS_INCLUDED == TRUE)
UINT8 handle_range[GATT_SIZE_OF_SRV_CHG_HNDL_RANGE];
UINT8 *p = handle_range;
UINT16 conn_id;
(peer_bda[4] << 8) + peer_bda[5] );
}
}
+#endif ///GATTS_INCLUDED == TRUE
}
/*******************************************************************************
#include "bt_target.h"
//#include "bt_utils.h"
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE
#include <string.h>
#include "gatt_int.h"
#include "l2c_api.h"
*******************************************************************************/
static void gatts_chk_pending_ind(tGATT_TCB *p_tcb )
{
+#if (GATTS_INCLUDED == TRUE)
tGATT_VALUE *p_buf = (tGATT_VALUE *)GKI_getfirst(&p_tcb->pending_ind_q);
GATT_TRACE_DEBUG("gatts_chk_pending_ind");
p_buf->value);
GKI_freebuf(GKI_remove_from_queue (&p_tcb->pending_ind_q, p_buf));
}
+#endif ///GATTS_INCLUDED == TRUE
}
/*******************************************************************************
}
}
-#endif /* BLE_INCLUDED */
+#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE */
** Returns Pointer to the allocated buffer, NULL no buffer available
**
*******************************************************************************/
+#if (GATTS_INCLUDED == TRUE)
tGATT_HDL_LIST_ELEM *gatt_alloc_hdl_buffer(void)
{
UINT8 i;
}
return NULL;
}
+#endif ///GATTS_INCLUDED == TRUE
+
/*******************************************************************************
**
** Function gatt_free_attr_value_buffer
** Returns None
**
*******************************************************************************/
+#if (GATTS_INCLUDED == TRUE)
void gatt_free_srvc_db_buffer_app_id(tBT_UUID *p_app_id)
{
tGATT_HDL_LIST_ELEM *p_elem = &gatt_cb.hdl_list[0];
return is_last_attribute;
}
-
/*******************************************************************************
**
** Function gatt_update_last_pri_srv_info
return;
}
+#endif ///GATTS_INCLUDED == TRUE
+
/*******************************************************************************
**
** Function gatt_add_a_srv_to_list
GATT_TRACE_ERROR("gatt_rsp_timeout command queue out of sync, disconnect");
} else {
p_clcb->retry_count++;
+#if (GATTC_INCLUDED == TRUE)
gatt_act_discovery(p_clcb);
+#endif ///GATTC_INCLUDED == TRUE
return;
}
}
** Returns 0 if not found. Otherwise index of th eservice.
**
*******************************************************************************/
+#if (GATTS_INCLUDED == TRUE)
UINT8 gatt_sr_find_i_rcb_by_app_id(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 svc_inst)
{
UINT8 i_rcb = 0;
}
return i_rcb;
}
+#endif ///GATTS_INCLUDED == TRUE
/*******************************************************************************
**
** Function gatt_sr_find_i_rcb_by_handle
} else {
status = GATT_INSUF_RESOURCE;
}
-
+#if (GATTS_INCLUDED == TRUE)
if (deq) {
gatt_dequeue_sr_cmd(p_tcb);
}
-
+#endif ///GATTS_INCLUDED == TRUE
return status;
}
*******************************************************************************/
void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
{
+#if (GATTS_INCLUDED == TRUE)
UINT8 i;
if (p_tcb) {
}
}
}
-
+#endif ///GATTS_INCLUDED == TRUE
}
/*******************************************************************************
BOOLEAN gatt_sr_is_cback_cnt_zero(tGATT_TCB *p_tcb )
{
BOOLEAN status = TRUE;
+#if (GATTS_INCLUDED == TRUE)
UINT8 i;
if (p_tcb) {
} else {
status = FALSE;
}
+#endif ///GATTS_INCLUDED == TRUE
return status;
}
*******************************************************************************/
void gatt_sr_reset_cback_cnt(tGATT_TCB *p_tcb )
{
+#if (GATTS_INCLUDED == TRUE)
UINT8 i;
if (p_tcb) {
p_tcb->sr_cmd.cback_cnt[i] = 0;
}
}
+#endif ///GATTS_INCLUDED == TRUE
}
/*******************************************************************************
*******************************************************************************/
void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc, BOOLEAN is_reset_first)
{
-
+#if (GATTS_INCLUDED == TRUE)
UINT8 idx = ((UINT8) gatt_if) - 1 ;
if (p_tcb) {
}
}
}
+#endif ///GATTS_INCLUDED == TRUE
}
/* server needs */
/* server response data */
+#if (GATTS_INCLUDED == TRUE)
tGATT_SR_CMD sr_cmd;
+#endif ///GATTS_INCLUDED == TRUE
UINT16 indicate_handle;
BUFFER_Q pending_ind_q;
UINT16 next_handle; /* next available handle */
tGATT_SVC_CHG gattp_attr; /* GATT profile attribute service change */
tGATT_IF gatt_if;
+#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;
tGATT_SRV_LIST_ELEM srv_list[GATT_MAX_SR_PROFILES];
-
+#endif ///GATTS_INCLUDED == TRUE
BUFFER_Q srv_chg_clt_q; /* service change clients queue */
BUFFER_Q pending_new_srv_start_q; /* pending new service start queue */
tGATT_REG cl_rcb[GATT_MAX_APPS];
UINT8 err_status;
UINT16 handle;
#endif
-
+#if (GATTS_INCLUDED == TRUE)
tGATT_PROFILE_CLCB profile_clcb[GATT_MAX_APPS];
+#endif ///GATTS_INCLUDED == TRUE
UINT16 handle_of_h_r; /* Handle of the handles reused characteristic value */
tGATT_APPL_INFO cb_info;
{
int xx;
BOOLEAN single_write = FALSE;
- L2CAP_TRACE_ERROR("%s",__func__);
+ L2CAP_TRACE_DEBUG("%s",__func__);
/* Save the channel ID for faster counting */
if (p_buf) {
if (p_ccb != NULL) {
{
#if (L2CAP_NUM_FIXED_CHNLS > 0)
tL2C_CCB *p_ccb;
- L2CAP_TRACE_ERROR("%s,fixed_cid=%d,p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] = %p",__func__,fixed_cid,p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]);
/* If we already have a CCB, then simply return */
if (p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] != NULL) {
return (TRUE);
return (p_ccb);
}
-#if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)
+#if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE && CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************
**