BTM_SecDeleteDevice(bd_addr);
/* remove all cached GATT information */
- BTA_GATTC_Refresh(bd_addr);
+ bt_bdaddr_t tmp_addr;
+ memcpy(tmp_addr.address, bd_addr, BD_ADDR_LEN);
+ BTA_GATTC_Refresh(tmp_addr);
if (bta_dm_cb.p_sec_cback) {
tBTA_DM_SEC sec_event;
/* need to remove all pending background connection if any */
BTA_GATTC_CancelOpen(0, p_remove_acl->bd_addr, false);
/* remove all cached GATT information */
- BTA_GATTC_Refresh(p_remove_acl->bd_addr);
+ bt_bdaddr_t tmp_addr;
+ memcpy(tmp_addr.address, p_remove_acl->bd_addr, BD_ADDR_LEN);
+ BTA_GATTC_Refresh(tmp_addr);
}
/* otherwise, no action needed */
}
/* need to remove all pending background connection */
BTA_GATTC_CancelOpen(0, p_bda, false);
/* remove all cached GATT information */
- BTA_GATTC_Refresh(p_bda);
+ bt_bdaddr_t tmp_addr;
+ memcpy(tmp_addr.address, p_bda, BD_ADDR_LEN);
+ BTA_GATTC_Refresh(tmp_addr);
}
bdcpy(conn.link_down.bd_addr, p_bda);
/* need to remove all pending background connection */
BTA_GATTC_CancelOpen(0, remote_bd_addr, false);
/* remove all cached GATT information */
- BTA_GATTC_Refresh(remote_bd_addr);
+ bt_bdaddr_t tmp_addr;
+ memcpy(tmp_addr.address, remote_bd_addr, BD_ADDR_LEN);
+ BTA_GATTC_Refresh(tmp_addr);
}
}
* Returns None.
*
******************************************************************************/
-void bta_gattc_process_api_refresh(tBTA_GATTC_DATA* p_msg) {
- tBTA_GATTC_SERV* p_srvc_cb =
- bta_gattc_find_srvr_cache(p_msg->api_conn.remote_bda);
+void bta_gattc_process_api_refresh(bt_bdaddr_t remote_bda) {
+ tBTA_GATTC_SERV* p_srvc_cb = bta_gattc_find_srvr_cache(remote_bda.address);
tBTA_GATTC_CLCB* p_clcb = &bta_gattc_cb.clcb[0];
bool found = false;
uint8_t i;
}
}
/* used to reset cache in application */
- bta_gattc_cache_reset(p_msg->api_conn.remote_bda);
+ bta_gattc_cache_reset(remote_bda.address);
}
/*******************************************************************************
*
* Returns void
*
******************************************************************************/
-void BTA_GATTC_Refresh(const BD_ADDR remote_bda) {
- tBTA_GATTC_API_OPEN* p_buf =
- (tBTA_GATTC_API_OPEN*)osi_malloc(sizeof(tBTA_GATTC_API_OPEN));
-
- p_buf->hdr.event = BTA_GATTC_API_REFRESH_EVT;
- memcpy(p_buf->remote_bda, remote_bda, BD_ADDR_LEN);
-
- bta_sys_sendmsg(p_buf);
+void BTA_GATTC_Refresh(const bt_bdaddr_t& remote_bda) {
+ do_in_bta_thread(FROM_HERE,
+ base::Bind(&bta_gattc_process_api_refresh, remote_bda));
}
BTA_GATTC_API_SEARCH_EVT,
BTA_GATTC_API_CONFIRM_EVT,
BTA_GATTC_API_READ_MULTI_EVT,
- BTA_GATTC_API_REFRESH_EVT,
BTA_GATTC_INT_CONN_EVT,
BTA_GATTC_INT_DISCOVER_EVT,
tBTA_GATT_STATUS status,
BD_ADDR remote_bda, uint16_t conn_id,
tBTA_TRANSPORT transport, uint16_t mtu);
-extern void bta_gattc_process_api_refresh(tBTA_GATTC_DATA* p_msg);
+extern void bta_gattc_process_api_refresh(bt_bdaddr_t remote_bda);
extern void bta_gattc_cfg_mtu(tBTA_GATTC_CLCB* p_clcb, tBTA_GATTC_DATA* p_data);
extern void bta_gattc_listen(tBTA_GATTC_DATA* p_msg);
extern void bta_gattc_broadcast(tBTA_GATTC_DATA* p_msg);
/* BTA_GATTC_API_SEARCH_EVT */ {BTA_GATTC_FAIL, BTA_GATTC_IDLE_ST},
/* BTA_GATTC_API_CONFIRM_EVT */ {BTA_GATTC_FAIL, BTA_GATTC_IDLE_ST},
/* BTA_GATTC_API_READ_MULTI_EVT */ {BTA_GATTC_FAIL, BTA_GATTC_IDLE_ST},
- /* BTA_GATTC_API_REFRESH_EVT */ {BTA_GATTC_IGNORE,
- BTA_GATTC_IDLE_ST},
/* BTA_GATTC_INT_CONN_EVT */ {BTA_GATTC_CONN, BTA_GATTC_CONN_ST},
/* BTA_GATTC_INT_DISCOVER_EVT */ {BTA_GATTC_IGNORE,
BTA_GATTC_W4_CONN_ST},
/* BTA_GATTC_API_READ_MULTI_EVT */ {BTA_GATTC_FAIL,
BTA_GATTC_W4_CONN_ST},
- /* BTA_GATTC_API_REFRESH_EVT */ {BTA_GATTC_IGNORE,
- BTA_GATTC_W4_CONN_ST},
/* BTA_GATTC_INT_CONN_EVT */ {BTA_GATTC_CONN, BTA_GATTC_CONN_ST},
/* BTA_GATTC_INT_DISCOVER_EVT */ {BTA_GATTC_IGNORE,
BTA_GATTC_CONN_ST},
/* BTA_GATTC_API_READ_MULTI_EVT */ {BTA_GATTC_READ_MULTI,
BTA_GATTC_CONN_ST},
- /* BTA_GATTC_API_REFRESH_EVT */ {BTA_GATTC_IGNORE,
- BTA_GATTC_CONN_ST},
/* BTA_GATTC_INT_CONN_EVT */ {BTA_GATTC_IGNORE,
BTA_GATTC_CONN_ST},
BTA_GATTC_DISCOVER_ST},
/* BTA_GATTC_API_READ_MULTI_EVT */ {BTA_GATTC_Q_CMD,
BTA_GATTC_DISCOVER_ST},
- /* BTA_GATTC_API_REFRESH_EVT */ {BTA_GATTC_IGNORE,
- BTA_GATTC_DISCOVER_ST},
/* BTA_GATTC_INT_CONN_EVT */ {BTA_GATTC_CONN,
BTA_GATTC_DISCOVER_ST},
bta_gattc_process_api_open_cancel((tBTA_GATTC_DATA*)p_msg);
break;
- case BTA_GATTC_API_REFRESH_EVT:
- bta_gattc_process_api_refresh((tBTA_GATTC_DATA*)p_msg);
- break;
-
default:
if (p_msg->event == BTA_GATTC_INT_CONN_EVT)
p_clcb = bta_gattc_find_int_conn_clcb((tBTA_GATTC_DATA*)p_msg);
return "BTA_GATTC_OP_CMPL_EVT";
case BTA_GATTC_INT_DISCONN_EVT:
return "BTA_GATTC_INT_DISCONN_EVT";
- case BTA_GATTC_API_REFRESH_EVT:
- return "BTA_GATTC_API_REFRESH_EVT";
case BTA_GATTC_API_CFG_MTU_EVT:
return "BTA_GATTC_API_CFG_MTU_EVT";
default:
* Returns void
*
******************************************************************************/
-extern void BTA_GATTC_Refresh(const BD_ADDR remote_bda);
+extern void BTA_GATTC_Refresh(const bt_bdaddr_t& remote_bda);
/*******************************************************************************
*
state = BT_BOND_STATE_NONE;
} else {
btif_dm_save_ble_bonding_keys();
- BTA_GATTC_Refresh(bd_addr.address);
+ BTA_GATTC_Refresh(bd_addr);
btif_dm_get_remote_services_by_transport(&bd_addr, BTA_GATT_TRANSPORT_LE);
}
} else {
bt_status_t btif_gattc_refresh(int client_if, const bt_bdaddr_t* bd_addr) {
CHECK_BTGATT_INIT();
- // Closure will own this value and free it.
- uint8_t* address = new BD_ADDR;
- bdcpy(address, bd_addr->address);
- return do_in_jni_thread(Bind(&BTA_GATTC_Refresh, base::Owned(address)));
+ return do_in_jni_thread(Bind(&BTA_GATTC_Refresh, *bd_addr));
}
bt_status_t btif_gattc_search_service(int conn_id, bt_uuid_t* filter_uuid) {