Merge branch 'feature/new_gap_char' into 'master'

Enable characteristic 0x2A04 in GAP service

See merge request espressif/esp-idf!5809
This commit is contained in:
Jiang Jiang Jian 2019-12-05 12:17:15 +08:00
commit 0be0859e73
6 changed files with 66 additions and 0 deletions

View file

@ -121,6 +121,14 @@ config BT_GATTS_ENABLE
help
This option can be disabled when the app work only on gatt client mode
config BT_GATTS_PPCP_CHAR_GAP
bool "Enable Peripheral Preferred Connection Parameters characteristic in GAP service"
depends on BT_GATTS_ENABLE
default n
help
This enables "Peripheral Preferred Connection Parameters" characteristic (UUID: 0x2A04) in GAP service that has
connection parameters like min/max connection interval, slave latency and supervision timeout multiplier
choice BT_GATTS_SEND_SERVICE_CHANGE_MODE
prompt "GATTS Service Change Mode"
default BT_GATTS_SEND_SERVICE_CHANGE_AUTO

View file

@ -4874,6 +4874,9 @@ void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data)
p_data->ble_set_conn_params.conn_int_max,
p_data->ble_set_conn_params.slave_latency,
p_data->ble_set_conn_params.supervision_tout);
BTM_BleConfigConnParams(p_data->ble_set_conn_params.conn_int_min, p_data->ble_set_conn_params.conn_int_max,
p_data->ble_set_conn_params.slave_latency, p_data->ble_set_conn_params.supervision_tout);
}
/*******************************************************************************
@ -4958,6 +4961,9 @@ void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data)
p_data->ble_update_conn_params.latency,
p_data->ble_update_conn_params.timeout)) {
APPL_TRACE_ERROR("Update connection parameters failed!");
} else {
BTM_BleConfigConnParams(p_data->ble_update_conn_params.min_int, p_data->ble_update_conn_params.max_int,
p_data->ble_update_conn_params.latency, p_data->ble_update_conn_params.timeout);
}
}
/*******************************************************************************

View file

@ -159,6 +159,12 @@
#define UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK FALSE
#endif
#ifdef CONFIG_BT_GATTS_PPCP_CHAR_GAP
#define UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP CONFIG_BT_GATTS_PPCP_CHAR_GAP
#else
#define UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP FALSE
#endif
#ifdef CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE
#define UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE
#else

View file

@ -383,6 +383,10 @@
#define SCAN_QUEUE_CONGEST_CHECK FALSE
#endif
#ifdef UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP
#define BTM_PERIPHERAL_ENABLED UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP
#endif
#ifdef UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE
#define GATTS_SEND_SERVICE_CHANGE_MODE UC_BT_GATTS_SEND_SERVICE_CHANGE_MODE
#endif

View file

@ -910,6 +910,34 @@ void BTM_BleConfigLocalIcon(uint16_t icon)
BTM_TRACE_ERROR("%s\n", __func__);
#endif
}
/*******************************************************************************
**
** Function BTM_BleConfigConnParams
**
** Description This function is called to set the connection parameters
**
** Parameters int_min: minimum connection interval
** int_max: maximum connection interval
** latency: slave latency
** timeout: supervision timeout
**
*******************************************************************************/
void BTM_BleConfigConnParams(uint16_t int_min, uint16_t int_max, uint16_t latency, uint16_t timeout)
{
#if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE && GATTS_INCLUDED == TRUE)
tGAP_BLE_ATTR_VALUE p_value;
p_value.conn_param.int_min = int_min;
p_value.conn_param.int_max = int_max;
p_value.conn_param.latency = latency;
p_value.conn_param.sp_tout = timeout;
GAP_BleAttrDBUpdate(GATT_UUID_GAP_PREF_CONN_PARAM, &p_value);
#else
BTM_TRACE_ERROR("%s\n", __func__);
#endif
}
/*******************************************************************************
**
** Function BTM_BleMaxMultiAdvInstanceCount

View file

@ -1718,6 +1718,20 @@ BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable, tBTM_SET_LOCAL_PRIVACY_CBACK *set_l
*******************************************************************************/
void BTM_BleConfigLocalIcon(uint16_t icon);
/*******************************************************************************
**
** Function BTM_BleConfigConnParams
**
** Description This function is called to set the connection parameters
**
** Parameters int_min: minimum connection interval
** int_max: maximum connection interval
** latency: slave latency
** timeout: supervision timeout
**
*******************************************************************************/
void BTM_BleConfigConnParams(uint16_t int_min, uint16_t int_max, uint16_t latency, uint16_t timeout);
/*******************************************************************************
**
** Function BTM_BleLocalPrivacyEnabled