1010000 bt_hci_timeout (opcode|1)
1010001 bt_config_source (opcode|1)
1010002 bt_hci_unknown_type (hci_type|1)
+1010003 bt_conn_param_update_status (status|1)
void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data)
{
if (!L2CA_UpdateBleConnParams(p_data->ble_update_conn_params.bd_addr,
- 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))
+ 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,
+ p_data->ble_update_conn_params.p_conn_param_update_cback))
{
APPL_TRACE_ERROR("Update connection parameters failed!");
}
UNUSED(p_cback);
#endif
}
-/*******************************************************************************
-**
-** Function BTA_DmBleUpdateConnectionParam
-**
-** Description Update connection parameters, can only be used when connection is up.
-**
-** Parameters: bd_addr - BD address of the peer
-** min_int - minimum connection interval, [0x0004~ 0x4000]
-** max_int - maximum connection interval, [0x0004~ 0x4000]
-** latency - slave latency [0 ~ 500]
-** timeout - supervision timeout [0x000a ~ 0xc80]
-**
-** Returns void
-**
-*******************************************************************************/
-void BTA_DmBleUpdateConnectionParam(BD_ADDR bd_addr, UINT16 min_int,
- UINT16 max_int, UINT16 latency,
- UINT16 timeout)
-{
-#if BLE_INCLUDED == TRUE
- tBTA_DM_API_UPDATE_CONN_PARAM *p_msg =
- (tBTA_DM_API_UPDATE_CONN_PARAM *)osi_calloc(sizeof(tBTA_DM_API_UPDATE_CONN_PARAM));
-
- p_msg->hdr.event = BTA_DM_API_UPDATE_CONN_PARAM_EVT;
- bdcpy(p_msg->bd_addr, bd_addr);
- p_msg->min_int = min_int;
- p_msg->max_int = max_int;
- p_msg->latency = latency;
- p_msg->timeout = timeout;
-
- bta_sys_sendmsg(p_msg);
-#endif
-}
/*******************************************************************************
**
**
** Description Update connection parameters, can only be used when connection is up.
**
-** Parameters: bd_addr - BD address of the peer
+** Parameters: bd_addr - BD address of the peer
** min_int - minimum connection interval, [0x0004~ 0x4000]
** max_int - maximum connection interval, [0x0004~ 0x4000]
** latency - slave latency [0 ~ 500]
** timeout - supervision timeout [0x000a ~ 0xc80]
+ p_cback - callback on connection parameters updated
**
** Returns void
**
*******************************************************************************/
-void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int, UINT16 max_int,
- UINT16 latency, UINT16 timeout)
+void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
+ UINT16 max_int, UINT16 latency, UINT16 timeout,
+ tBTA_DM_BLE_CONN_PARAM_CBACK *p_cback)
{
tBTA_DM_API_UPDATE_CONN_PARAM *p_msg =
(tBTA_DM_API_UPDATE_CONN_PARAM *)osi_calloc(sizeof(tBTA_DM_API_UPDATE_CONN_PARAM));
p_msg->max_int = max_int;
p_msg->latency = latency;
p_msg->timeout = timeout;
+ p_msg->p_conn_param_update_cback = p_cback;
bta_sys_sendmsg(p_msg);
}
UINT16 conn_int_max;
UINT16 supervision_tout;
UINT16 slave_latency;
-
}tBTA_DM_API_BLE_CONN_PARAMS;
typedef struct
tBTA_DM_LINK_TYPE link_type;
} tBTA_DM_API_REMOVE_ALL_ACL;
+
+/* data type for BTA_DM_API_UPDATE_CONN_PARAM_EVT */
typedef struct
{
BT_HDR hdr;
UINT16 max_int;
UINT16 latency;
UINT16 timeout;
-}tBTA_DM_API_UPDATE_CONN_PARAM;
+ tBTA_DM_BLE_CONN_PARAM_CBACK *p_conn_param_update_cback;
+} tBTA_DM_API_UPDATE_CONN_PARAM;
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
typedef struct
if (tout < BTM_BLE_CONN_TIMEOUT_MIN_DEF)
tout = BTM_BLE_CONN_TIMEOUT_MIN_DEF;
- BTM_BleSetPrefConnParams (p_dev_cb->addr, min, max, latency, tout);
- L2CA_UpdateBleConnParams(p_dev_cb->addr, min, max, latency, tout);
+ BTM_BleSetPrefConnParams(p_dev_cb->addr, min, max, latency, tout);
+ L2CA_UpdateBleConnParams(p_dev_cb->addr, min, max, latency, tout, NULL);
}
else
{
typedef void (tBTA_DM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTA_STATUS status,
tBTA_DM_BLE_REF_VALUE ref_value);
+/* Connection update callback */
+typedef void (tBTA_DM_BLE_CONN_PARAM_CBACK) (BD_ADDR bd_addr, UINT16 interval, UINT16 latency,
+ UINT16 timeout, tBTA_STATUS status);
#define BTA_DM_BLE_PF_BRDCAST_ADDR_FILT 1
#define BTA_DM_BLE_PF_SERV_DATA_CHG_FILT 2
**
** Description Update connection parameters, can only be used when connection is up.
**
-** Parameters: bd_addr - BD address of the peer
+** Parameters: bd_addr - BD address of the peer
** min_int - minimum connection interval, [0x0004~ 0x4000]
** max_int - maximum connection interval, [0x0004~ 0x4000]
** latency - slave latency [0 ~ 500]
** Returns void
**
*******************************************************************************/
-extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
- UINT16 max_int, UINT16 latency, UINT16 timeout);
+extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int, UINT16 max_int,
+ UINT16 latency, UINT16 timeout,
+ tBTA_DM_BLE_CONN_PARAM_CBACK p_cback);
/*******************************************************************************
**
#define BTA_GATTC_SCAN_FLT_PARAM_EVT 32 /* Param filter event */
#define BTA_GATTC_SCAN_FLT_STATUS_EVT 33 /* Filter status event */
#define BTA_GATTC_ADV_VSC_EVT 34 /* ADV VSC event */
+#define BTA_GATTC_CONN_PARAM_UPD_EVT 35 /* Connection parameter update event */
typedef UINT8 tBTA_GATTC_EVT;
#define BLE_RESOLVE_ADDR_MSB 0x40 /* bit7, bit6 is 01 to be resolvable random */
#define BLE_RESOLVE_ADDR_MASK 0xc0 /* bit 6, and bit7 */
#define BTM_BLE_IS_RESOLVE_BDA(x) ((x[0] & BLE_RESOLVE_ADDR_MASK) == BLE_RESOLVE_ADDR_MSB)
+#define BT_CONN_PARAM_UPDATE_STATUS 1010003
typedef enum {
BTIF_GATTC_REGISTER_APP = 1000,
typedef struct
{
+ uint8_t client_if;
bt_bdaddr_t bd_addr;
- uint16_t min_interval;
- uint16_t max_interval;
+ uint16_t requested_min_interval;
+ uint16_t requested_max_interval;
+ uint16_t configured_interval;
uint16_t timeout;
uint16_t latency;
-} btif_conn_param_cb_t;
+ uint8_t status;
+}__attribute__((packed)) btif_conn_param_cb_t;
typedef struct
{
break;
}
+ case BTA_GATTC_CONN_PARAM_UPD_EVT:
+ {
+ btif_conn_param_cb_t *p_btif_cb = (btif_conn_param_cb_t *)p_param;
+ /* Log update failures */
+ if (p_btif_cb->status != 0)
+ {
+ LOG_EVENT_INT(BT_CONN_PARAM_UPDATE_STATUS, p_btif_cb->status);
+ }
+ break;
+ }
+
case BTIF_GATTC_SCAN_PARAM_EVT:
{
btif_gattc_cb_t *p_btif_cb = (btif_gattc_cb_t *)p_param;
(char*) &btif_cb, sizeof(btgatt_adv_filter_cb_t), NULL);
}
+static void bta_gattc_conn_param_update_cback(BD_ADDR bd_addr, UINT16 interval,
+ UINT16 latency, UINT16 timeout, tBTA_STATUS status)
+{
+ btif_conn_param_cb_t btif_cb;
+
+ bdcpy(btif_cb.bd_addr.address, bd_addr);
+ btif_cb.configured_interval = interval;
+ btif_cb.latency = latency;
+ btif_cb.timeout = timeout;
+ btif_cb.status = status;
+ btif_transfer_context(btif_gattc_upstreams_evt, BTA_GATTC_CONN_PARAM_UPD_EVT,
+ (char*) &btif_cb, sizeof(btif_conn_param_cb_t), NULL);
+}
+
static void btgattc_free_event_data(UINT16 event, char *event_data)
{
switch (event)
if (BTA_DmGetConnectionState(p_conn_param_cb->bd_addr.address))
{
BTA_DmBleUpdateConnectionParams(p_conn_param_cb->bd_addr.address,
- p_conn_param_cb->min_interval, p_conn_param_cb->max_interval,
- p_conn_param_cb->latency, p_conn_param_cb->timeout);
+ p_conn_param_cb->requested_min_interval,
+ p_conn_param_cb->requested_max_interval,
+ p_conn_param_cb->latency, p_conn_param_cb->timeout,
+ bta_gattc_conn_param_update_cback);
} else {
BTA_DmSetBlePrefConnParams(p_conn_param_cb->bd_addr.address,
- p_conn_param_cb->min_interval, p_conn_param_cb->max_interval,
+ p_conn_param_cb->requested_min_interval,
+ p_conn_param_cb->requested_max_interval,
p_conn_param_cb->latency, p_conn_param_cb->timeout);
}
break;
}
static bt_status_t btif_gattc_conn_parameter_update(const bt_bdaddr_t *bd_addr, int min_interval,
- int max_interval, int latency, int timeout)
+ int max_interval, int latency, int timeout)
{
CHECK_BTGATT_INIT();
btif_conn_param_cb_t btif_cb;
- btif_cb.min_interval = min_interval;
- btif_cb.max_interval = max_interval;
+ btif_cb.requested_min_interval = min_interval;
+ btif_cb.requested_max_interval = max_interval;
btif_cb.latency = latency;
btif_cb.timeout = timeout;
bdcpy(btif_cb.bd_addr.address, bd_addr->address);
#include "bt_target.h"
#include "l2cdefs.h"
#include "hcidefs.h"
+#include "bta_api.h"
/*****************************************************************************
** Constants
** Return value: TRUE if update started
**
*******************************************************************************/
-extern BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bdRa, UINT16 min_int,
- UINT16 max_int, UINT16 latency, UINT16 timeout);
+extern BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bdRa, UINT16 min_int, UINT16 max_int,
+ UINT16 latency, UINT16 timeout,
+ tBTA_DM_BLE_CONN_PARAM_CBACK *p_cback);
/*******************************************************************************
**
** Return value: TRUE if update started
**
*******************************************************************************/
-BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bda, UINT16 min_int, UINT16 max_int,
- UINT16 latency, UINT16 timeout)
+BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bda, UINT16 min_int,
+ UINT16 max_int, UINT16 latency, UINT16 timeout,
+ tBTA_DM_BLE_CONN_PARAM_CBACK *p_callback)
{
tL2C_LCB *p_lcb;
tACL_CONN *p_acl_cb = btm_bda_to_acl(rem_bda, BT_TRANSPORT_LE);
p_lcb->latency = latency;
p_lcb->timeout = timeout;
p_lcb->conn_update_mask |= L2C_BLE_NEW_CONN_PARAM;
+ p_lcb->p_conn_param_update_cb = p_callback;
l2cble_start_conn_update(p_lcb);
*******************************************************************************/
static void l2cble_start_conn_update (tL2C_LCB *p_lcb)
{
- UINT16 min_conn_int, max_conn_int, slave_latency, supervision_tout;
tACL_CONN *p_acl_cb = btm_bda_to_acl(p_lcb->remote_bd_addr, BT_TRANSPORT_LE);
// TODO(armansito): The return value of this call wasn't being used but the
if (p_lcb->conn_update_mask & L2C_BLE_CONN_UPDATE_DISABLE)
{
+ UINT16 min_conn_int, max_conn_int, slave_latency, supervision_tout;
/* application requests to disable parameters update.
If parameters are already updated, lets set them
up to what has been requested during connection establishement */
btsnd_hcic_ble_upd_ll_conn_params(p_lcb->handle, p_lcb->min_interval,
p_lcb->max_interval, p_lcb->latency, p_lcb->timeout, 0, 0);
p_lcb->conn_update_mask |= L2C_BLE_UPDATE_PENDING;
+
+ /* Record the BLE connection update request if the role is master device */
+ bt_bdaddr_t bd_addr;
+ bdcpy(bd_addr.address, p_lcb->remote_bd_addr);
+ btif_debug_ble_connection_update_request(bd_addr, p_lcb->min_interval, p_lcb->max_interval,
+ p_lcb->latency, p_lcb->timeout);
}
else
{
}
p_lcb->conn_update_mask &= ~L2C_BLE_NEW_CONN_PARAM;
p_lcb->conn_update_mask |= L2C_BLE_NOT_DEFAULT_PARAM;
- }
- }
- /* Record the BLE connection update request. */
- if (p_lcb->conn_update_mask & L2C_BLE_UPDATE_PENDING) {
- bt_bdaddr_t bd_addr;
- bdcpy(bd_addr.address, p_lcb->remote_bd_addr);
- btif_debug_ble_connection_update_request(bd_addr, min_conn_int, max_conn_int, slave_latency,
- supervision_tout);
+ }
}
+
}
/*******************************************************************************
l2cble_start_conn_update(p_lcb);
+ /* Callback to upper layer */
+ if (p_lcb->p_conn_param_update_cb) {
+ p_lcb->p_conn_param_update_cb(p_lcb->remote_bd_addr, interval, latency,
+ timeout, status);
+ }
+
/* Record the BLE connection update response. */
bt_bdaddr_t bd_addr;
bdcpy(bd_addr.address, p_lcb->remote_bd_addr);
UINT16 latency;
UINT16 timeout;
+ tBTA_DM_BLE_CONN_PARAM_CBACK *p_conn_param_update_cb;
#endif
#if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)