"//utils/include",
"//vnd/include",
]
-
- # TODO(armansito): Remove all of the flags below, since we want to enable all
- # warnings.
- cflags = [
- "-Wno-int-to-pointer-cast",
- ]
-
- cflags_c = [
- "-Wno-pointer-to-int-cast",
- ]
}
p_scb->codec_updated = FALSE;
#endif
/* set up timers */
- p_scb->act_timer.param = (UINT32) p_scb;
+ p_scb->act_timer.param = p_scb;
p_scb->act_timer.p_cback = bta_ag_timer_cback;
#if (BTM_WBS_INCLUDED == TRUE)
/* set eSCO mSBC setting to T2 as the preferred */
/* Start timer to han */
p_scb->colli_timer.p_cback = (TIMER_CBACK*)&bta_ag_colli_timer_cback;
- p_scb->colli_timer.param = (INT32)p_scb;
+ p_scb->colli_timer.param = p_scb;
bta_sys_start_timer(&p_scb->colli_timer, 0, BTA_AG_COLLISION_TIMER);
p_scb->colli_tmr_on = TRUE;
}
/* Start timer to handle timeout */
p_scb->cn_timer.p_cback = (TIMER_CBACK*)&bta_ag_cn_timer_cback;
- p_scb->cn_timer.param = (INT32)p_scb;
+ p_scb->cn_timer.param = p_scb;
bta_sys_start_timer(&p_scb->cn_timer, 0, BTA_AG_CODEC_NEGO_TIMEOUT);
}
else
#include "utl.h"
#include "l2c_api.h"
#include "osi/include/list.h"
+#include "osi/include/osi.h"
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
#include "bta_ar_api.h"
#endif
/* Possible collision : need to avoid outgoing processing while the timer is running */
p_cb->p_scb[xx]->coll_mask = BTA_AV_COLL_INC_TMR;
- p_cb->acp_sig_tmr.param = (UINT32)xx;
+
+ // TODO(armansito): Why is this variable called "xx" and
+ // why is it a signed integer? The callback reinterprets
+ // it as a UINT8 and then reassigns it as param that
+ // way, so should this be unsigned?
+ p_cb->acp_sig_tmr.param = INT_TO_PTR(xx);
p_cb->acp_sig_tmr.p_cback = (TIMER_CBACK*)&bta_av_acp_sig_timer_cback;
bta_sys_start_timer(&p_cb->acp_sig_tmr, 0, BTA_AV_ACP_SIG_TIME_VAL);
}
*******************************************************************************/
static void bta_av_acp_sig_timer_cback (TIMER_LIST_ENT *p_tle)
{
- UINT8 inx = (UINT8)p_tle->param;
+ UINT8 inx = PTR_TO_UINT(p_tle->param);
tBTA_AV_CB *p_cb = &bta_av_cb;
tBTA_AV_SCB *p_scb = NULL;
tBTA_AV_API_OPEN *p_buf;
/* We are still doing SDP. Run the timer again. */
p_scb->coll_mask |= BTA_AV_COLL_INC_TMR;
- p_cb->acp_sig_tmr.param = (UINT32)inx;
+ p_cb->acp_sig_tmr.param = UINT_TO_PTR(inx);
p_cb->acp_sig_tmr.p_cback = (TIMER_CBACK *)&bta_av_acp_sig_timer_cback;
bta_sys_start_timer(&p_cb->acp_sig_tmr, 0, BTA_AV_ACP_SIG_TIME_VAL);
}
#define LOG_TAG "bt_bta_dm"
#include "osi/include/log.h"
+#include "osi/include/osi.h"
#if (GAP_INCLUDED == TRUE)
#include "gap_api.h"
else
{
bta_dm_cb.disable_timer.p_cback = (TIMER_CBACK*)&bta_dm_disable_timer_cback;
- bta_dm_cb.disable_timer.param = 0;
+ bta_dm_cb.disable_timer.param = INT_TO_PTR(0);
bta_sys_start_timer(&bta_dm_cb.disable_timer, 0, 5000);
}
APPL_TRACE_EVENT(" bta_dm_disable_timer_cback trial %d ", p_tle->param);
- if(BTM_GetNumAclLinks() && p_tle->param == 0)
+ if(BTM_GetNumAclLinks() && PTR_TO_INT(p_tle->param) == 0)
{
for(i=0; i<bta_dm_cb.device_list.count; i++)
{
if (trigger_disc)
{
bta_dm_cb.disable_timer.p_cback = (TIMER_CBACK*)&bta_dm_disable_timer_cback;
- bta_dm_cb.disable_timer.param = 1;
+ bta_dm_cb.disable_timer.param = INT_TO_PTR(1);
bta_sys_start_timer(&bta_dm_cb.disable_timer, 0, 1500);
}
}
#include <arpa/inet.h>
#include <pthread.h>
#include <stdlib.h>
+#include <string.h>
#include "osi/include/allocator.h"
#include "bt_types.h"
#include "sdp_api.h"
#include "l2c_api.h"
#include "port_api.h"
-#include <string.h>
#include "rfcdefs.h"
#include "avct_api.h"
#include "avdt_api.h"
#include "gap_api.h"
#include "l2c_api.h"
+#include "osi/include/osi.h"
+
/* one of these exists for each client */
struct fc_client {
return 1;
}
}
- APPL_TRACE_DEBUG("find_rfc_pcb: cannot find rfc_cb from user data:%d", (UINT32)user_data);
+ APPL_TRACE_DEBUG("find_rfc_pcb: cannot find rfc_cb from user data: %u", PTR_TO_UINT(user_data));
return 0;
}
"//utils/include",
"//vnd/include",
]
-
- # TODO(armansito): Remove all of these flags below. We want to enable all
- # warnings that we can.
- cflags = [
- "-Wno-int-to-pointer-cast",
- ]
-
- cflags_c = [
- "-Wno-pointer-to-int-cast",
- ]
}
BTIF_TRACE_DEBUG("BTA_AV_RC_OPEN_EVT received w/o AV");
memset(&tle_av_open_on_rc, 0, sizeof(tle_av_open_on_rc));
- tle_av_open_on_rc.param = (UINT32)btif_initiate_av_open_tmr_hdlr;
+ tle_av_open_on_rc.param = btif_initiate_av_open_tmr_hdlr;
btu_start_timer(&tle_av_open_on_rc, BTU_TTYPE_USER_FUNC,
BTIF_TIMEOUT_AV_OPEN_ON_RC_SECS);
btif_rc_handler(event, p_data);
static bt_status_t btif_gattc_multi_adv_disable(int client_if);
static void btif_multi_adv_stop_cb(void *p_tle)
{
- int client_if = ((TIMER_LIST_ENT*)p_tle)->data;
+ int client_if = PTR_TO_INT(((TIMER_LIST_ENT*)p_tle)->data);
btif_gattc_multi_adv_disable(client_if); // Does context switch
}
btu_stop_timer_oneshot(&p_multi_adv_data_cb->inst_cb[cbindex].tle_limited_timer);
memset(&p_multi_adv_data_cb->inst_cb[cbindex].tle_limited_timer, 0, sizeof(TIMER_LIST_ENT));
- p_multi_adv_data_cb->inst_cb[cbindex].tle_limited_timer.param = (UINT32)cb;
- p_multi_adv_data_cb->inst_cb[cbindex].tle_limited_timer.data = (UINT32)client_if;
+ p_multi_adv_data_cb->inst_cb[cbindex].tle_limited_timer.param = cb;
+ p_multi_adv_data_cb->inst_cb[cbindex].tle_limited_timer.data = INT_TO_PTR(client_if);
btu_start_timer_oneshot(&p_multi_adv_data_cb->inst_cb[cbindex].tle_limited_timer,
BTU_TTYPE_USER_FUNC, p_multi_adv_data_cb->inst_cb[cbindex].timeout_s);
}
{
BTIF_TRACE_DEBUG("Start VUP timer ");
memset(&p_dev->vup_timer, 0, sizeof(TIMER_LIST_ENT));
- p_dev->vup_timer.param = (UINT32)btif_hh_tmr_hdlr;
+ p_dev->vup_timer.param = btif_hh_tmr_hdlr;
btu_start_timer(&p_dev->vup_timer, BTU_TTYPE_USER_FUNC,
BTIF_TIMEOUT_VUP_SECS);
}
{
BTIF_TRACE_DEBUG("Start CCH timer ");
memset(&p_mcb->cch_timer, 0, sizeof(TIMER_LIST_ENT));
- p_mcb->cch_timer.param = (UINT32)btif_hl_tmr_hdlr;
+ p_mcb->cch_timer.param = btif_hl_tmr_hdlr;
btu_start_timer(&p_mcb->cch_timer, BTU_TTYPE_USER_FUNC,
BTIF_TIMEOUT_CCH_NO_DCH_SECS);
}
btpan_cb.flow = enable;
if (enable) {
btsock_thread_add_fd(pan_pth, btpan_cb.tap_fd, 0, SOCK_THREAD_FD_RD, 0);
- bta_dmexecutecallback(btu_exec_tap_fd_read, (void *)btpan_cb.tap_fd);
+ bta_dmexecutecallback(btu_exec_tap_fd_read, INT_TO_PTR(btpan_cb.tap_fd));
}
}
#define IS_EXCEPTION(e) ((e) & (POLLHUP | POLLRDHUP | POLLERR | POLLNVAL))
static void btu_exec_tap_fd_read(void *p_param) {
struct pollfd ufd;
- int fd = (int)p_param;
+ int fd = PTR_TO_INT(p_param);
if (fd == INVALID_FD || fd != btpan_cb.tap_fd)
return;
btpan_tap_close(fd);
btif_pan_close_all_conns();
} else if (flags & SOCK_THREAD_FD_RD)
- bta_dmexecutecallback(btu_exec_tap_fd_read, (void *)fd);
+ bta_dmexecutecallback(btu_exec_tap_fd_read, INT_TO_PTR(fd));
}
}
case BTA_SDP_CREATE_RECORD_USER_EVT:
{
- on_create_record_event((int)user_data);
+ on_create_record_event(PTR_TO_INT(user_data));
break;
}
case BTA_SDP_REMOVE_RECORD_USER_EVT:
{
- on_remove_record_event((int)user_data);
+ on_remove_record_event(PTR_TO_INT(user_data));
break;
}
default:
if(handle < 0)
return BT_STATUS_FAIL;
- BTA_SdpCreateRecordByUser((void*) handle);
+ BTA_SdpCreateRecordByUser(INT_TO_PTR(handle));
*record_handle = handle;
/* Pass the actual record handle */
if(handle > 0) {
- BTA_SdpRemoveRecordByUser((void*) handle);
+ BTA_SdpRemoveRecordByUser(INT_TO_PTR(handle));
return BT_STATUS_SUCCESS;
}
BTIF_TRACE_DEBUG("Sdp Server %s - record already removed - or never created", __FUNCTION__);
//if we do not set a callback, this socket will be dropped */
*(p_open->p_p_cback) = (void*)btsock_l2cap_cbk;
- *(p_open->p_user_data) = (void*)accept_rs->id;
+ *(p_open->p_user_data) = UINT_TO_PTR(accept_rs->id);
//start monitor the socket
btsock_thread_add_fd(pth, sock->our_fd, BTSOCK_L2CAP, SOCK_THREAD_FD_EXCEPTION, sock->id);
static void btsock_l2cap_cbk(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data)
{
+ uint32_t sock_id = PTR_TO_UINT(user_data);
+
switch (event) {
case BTA_JV_L2CAP_START_EVT:
- on_srv_l2cap_listen_started(&p_data->l2c_start, (uint32_t)user_data);
+ on_srv_l2cap_listen_started(&p_data->l2c_start, sock_id);
break;
case BTA_JV_L2CAP_CL_INIT_EVT:
- on_cl_l2cap_init(&p_data->l2c_cl_init, (uint32_t)user_data);
+ on_cl_l2cap_init(&p_data->l2c_cl_init, sock_id);
break;
case BTA_JV_L2CAP_OPEN_EVT:
- on_l2cap_connect(p_data, (uint32_t)user_data);
- BTA_JvSetPmProfile(p_data->l2c_open.handle,BTA_JV_PM_ID_1,BTA_JV_CONN_OPEN);
+ on_l2cap_connect(p_data, sock_id);
+ BTA_JvSetPmProfile(p_data->l2c_open.handle, BTA_JV_PM_ID_1,BTA_JV_CONN_OPEN);
break;
case BTA_JV_L2CAP_CLOSE_EVT:
- APPL_TRACE_DEBUG("BTA_JV_L2CAP_CLOSE_EVT: user_data:%d", (uint32_t)user_data);
- on_l2cap_close(&p_data->l2c_close, (uint32_t)user_data);
+ APPL_TRACE_DEBUG("BTA_JV_L2CAP_CLOSE_EVT: id: %u", sock_id);
+ on_l2cap_close(&p_data->l2c_close, sock_id);
break;
case BTA_JV_L2CAP_DATA_IND_EVT:
- on_l2cap_data_ind(p_data, (uint32_t)user_data);
+ on_l2cap_data_ind(p_data, sock_id);
APPL_TRACE_DEBUG("BTA_JV_L2CAP_DATA_IND_EVT");
break;
break;
case BTA_JV_L2CAP_WRITE_EVT:
- APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_EVT id: %d", (int)user_data);
- on_l2cap_write_done((void*)p_data->l2c_write.req_id, (uint32_t)user_data);
+ APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_EVT: id: %u", sock_id);
+ on_l2cap_write_done(UINT_TO_PTR(p_data->l2c_write.req_id), sock_id);
break;
case BTA_JV_L2CAP_WRITE_FIXED_EVT:
- APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_FIXED_EVT id: %d", (int)user_data);
- on_l2cap_write_fixed_done((void*)p_data->l2c_write_fixed.req_id, (uint32_t)user_data);
+ APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_FIXED_EVT: id: %u", sock_id);
+ on_l2cap_write_fixed_done(UINT_TO_PTR(p_data->l2c_write_fixed.req_id), sock_id);
break;
case BTA_JV_L2CAP_CONG_EVT:
- on_l2cap_outgoing_congest(&p_data->l2c_cong, (uint32_t)user_data);
+ on_l2cap_outgoing_congest(&p_data->l2c_cong, sock_id);
break;
default:
- APPL_TRACE_ERROR("unhandled event %d, slot id:%d", event, (uint32_t)user_data);
+ APPL_TRACE_ERROR("unhandled event %d, slot id: %u", event, sock_id);
break;
}
}
if (sock->fixed_chan) {
if (BTA_JvL2capStartServerLE(sock->security, 0, NULL, sock->channel,
- L2CAP_DEFAULT_MTU, NULL, btsock_l2cap_cbk, (void*)sock->id)
+ L2CAP_DEFAULT_MTU, NULL, btsock_l2cap_cbk, UINT_TO_PTR(sock->id))
!= BTA_JV_SUCCESS)
stat = BT_STATUS_FAIL;
/* If we have a channel specified in the request, just start the server,
* else we request a PSM and start the server after we receive a PSM. */
if(sock->channel < 0) {
- if(BTA_JvGetChannelId(BTA_JV_CONN_TYPE_L2CAP, (void*)sock->id, 0)
+ if(BTA_JvGetChannelId(BTA_JV_CONN_TYPE_L2CAP, UINT_TO_PTR(sock->id), 0)
!= BTA_JV_SUCCESS)
stat = BT_STATUS_FAIL;
} else {
if (BTA_JvL2capStartServer(sock->security, 0, &obex_l2c_etm_opt,
- sock->channel, L2CAP_MAX_SDU_LENGTH, &cfg, btsock_l2cap_cbk, (void*)sock->id)
+ sock->channel, L2CAP_MAX_SDU_LENGTH, &cfg, btsock_l2cap_cbk, UINT_TO_PTR(sock->id))
!= BTA_JV_SUCCESS)
stat = BT_STATUS_FAIL;
}
if (fixed_chan) {
if (BTA_JvL2capConnectLE(sock->security, 0, NULL, channel,
L2CAP_DEFAULT_MTU, NULL, sock->addr.address, btsock_l2cap_cbk,
- (void*)sock->id) != BTA_JV_SUCCESS)
+ UINT_TO_PTR(sock->id)) != BTA_JV_SUCCESS)
stat = BT_STATUS_FAIL;
} else {
if (BTA_JvL2capConnect(sock->security, 0, &obex_l2c_etm_opt,
channel, L2CAP_MAX_SDU_LENGTH, &cfg, sock->addr.address,
- btsock_l2cap_cbk, (void*)sock->id) != BTA_JV_SUCCESS)
+ btsock_l2cap_cbk, UINT_TO_PTR(sock->id)) != BTA_JV_SUCCESS)
stat = BT_STATUS_FAIL;
}
}
* be wrong
* UPDATE: Since we are responsible for freeing the buffer in the
* write_complete_ind, it is OK to use malloc. */
-
int count = recv(fd, buffer, L2CAP_MAX_SDU_LENGTH,
MSG_NOSIGNAL | MSG_DONTWAIT);
APPL_TRACE_DEBUG("btsock_l2cap_signaled - %d bytes received from socket",
count);
+
+ // TODO(armansito): |buffer|, which is created above via
+ // malloc, is being cast below to UINT32 to be used as
+ // the |req_id| parameter of BTA_JvL2capWriteFixed and
+ // BTA_JvL2capWrite. The "id" then gets freed in an
+ // obscure callback elsewhere. We need to watch out for
+ // this type of unsafe practice, as this is error prone
+ // and difficult to follow.
if (sock->fixed_chan) {
if(BTA_JvL2capWriteFixed(sock->channel, (BD_ADDR*)&sock->addr,
- (UINT32)buffer, btsock_l2cap_cbk, buffer, count,
- (void *)user_id) != BTA_JV_SUCCESS) {
+ PTR_TO_UINT(buffer), btsock_l2cap_cbk, buffer, count,
+ UINT_TO_PTR(user_id)) != BTA_JV_SUCCESS) {
// On fail, free the buffer
on_l2cap_write_fixed_done(buffer, user_id);
}
} else {
- if(BTA_JvL2capWrite(sock->handle, (UINT32)buffer, buffer, count,
- (void *)user_id) != BTA_JV_SUCCESS) {
+ if(BTA_JvL2capWrite(sock->handle, PTR_TO_UINT(buffer), buffer, count,
+ UINT_TO_PTR(user_id)) != BTA_JV_SUCCESS) {
// On fail, free the buffer
on_l2cap_write_done(buffer, user_id);
}
goto out;
}
APPL_TRACE_DEBUG("BTA_JvGetChannelId: service_name: %s - channel: %d", service_name, channel);
- BTA_JvGetChannelId(BTA_JV_CONN_TYPE_RFCOMM, (void*) slot->id, channel);
+ BTA_JvGetChannelId(BTA_JV_CONN_TYPE_RFCOMM, UINT_TO_PTR(slot->id), channel);
*sock_fd = slot->app_fd; // Transfer ownership of fd to caller.
/*TODO:
* We are leaking one of the app_fd's - either the listen socket, or the connection socket.
}
static void jv_dm_cback(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data) {
- uint32_t id = (uintptr_t)user_data;
+ uint32_t id = PTR_TO_UINT(user_data);
switch(event) {
case BTA_JV_GET_SCN_EVT:
{
} else {
if(rs->is_service_uuid_valid == true) {
// We already have data for SDP record, create it (RFC-only profiles)
- BTA_JvCreateRecordByUser((void *)rs->id);
+ BTA_JvCreateRecordByUser(UINT_TO_PTR(rs->id));
} else {
APPL_TRACE_DEBUG("is_service_uuid_valid==false - don't set SDP-record, "
"just start the RFCOMM server", rs->id);
//now start the rfcomm server after sdp & channel # assigned
BTA_JvRfcommStartServer(rs->security, rs->role, rs->scn, MAX_RFC_SESSION,
- rfcomm_cback, (void*)rs->id);
+ rfcomm_cback, UINT_TO_PTR(rs->id));
}
}
} else if(rs) {
*/
typedef void (TIMER_CBACK)(void *p_tle);
#ifndef TIMER_PARAM_TYPE
-#define TIMER_PARAM_TYPE UINT32
+#define TIMER_PARAM_TYPE void*
#endif
/* Define a timer list entry
*/
#ifndef TIMER_PARAM_TYPE
-#define TIMER_PARAM_TYPE UINT32
+#define TIMER_PARAM_TYPE void*
#endif
/******************************************************************************
"//utils",
]
- # TODO(armansito): Remove all of the flags below, as we want to be able to
- # compile the source code with as many warnings enabled as possible.
- cflags = [
- "-Wno-int-to-pointer-cast",
- ]
-
- cflags_c = [
- "-Wno-pointer-to-int-cast",
- ]
-
libs = [ "-lpthread", "-lrt", "-ldl" ]
}
"//utils/include",
"//",
]
-
- # TODO(armansito): Remove all of these flags.
- cflags = [
- "-Wno-pointer-to-int-cast",
- "-Wno-int-to-pointer-cast",
- ]
}
memcpy(p_ccb->peer_addr, bd_addr, BD_ADDR_LEN);
GKI_init_q(&p_ccb->cmd_q);
GKI_init_q(&p_ccb->rsp_q);
- p_ccb->timer_entry.param = (UINT32) p_ccb;
+ p_ccb->timer_entry.param = p_ccb;
AVDT_TRACE_DEBUG("avdt_ccb_alloc %d", i);
break;
}
#endif
}
#endif
- p_scb->timer_entry.param = (UINT32) p_scb;
+ p_scb->timer_entry.param = p_scb;
AVDT_TRACE_DEBUG("avdt_scb_alloc hdl=%d, psc_mask:0x%x", i+1, p_cs->cfg.psc_mask);
break;
}
{
memset ((UINT8 *)p_bcb, 0, sizeof (tBNEP_CONN));
- p_bcb->conn_tle.param = (UINT32) p_bcb;
+ p_bcb->conn_tle.param = p_bcb;
memcpy ((UINT8 *)(p_bcb->rem_bda), (UINT8 *)p_rem_bda, BD_ADDR_LEN);
p_bcb->handle = xx + 1;
btsnd_hcic_disconnect(p_dev_rec->hci_handle, HCI_ERR_PEER_USER);
}
BTM_TRACE_ERROR("btm_acl_encrypt_change: tBTM_SEC_DEV:0x%x rs_disc_pending=%d",
- (UINT32)p_dev_rec, p_dev_rec->rs_disc_pending);
+ PTR_TO_UINT(p_dev_rec), p_dev_rec->rs_disc_pending);
p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
}
#endif
btsnd_hcic_disconnect(p_dev_rec->hci_handle, HCI_ERR_PEER_USER);
}
BTM_TRACE_ERROR("tBTM_SEC_DEV:0x%x rs_disc_pending=%d",
- (UINT32)p_dev_rec, p_dev_rec->rs_disc_pending);
+ PTR_TO_UINT(p_dev_rec), p_dev_rec->rs_disc_pending);
p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
}
p_dev_rec->sec_state = 0;
btm_cb.p_collided_dev_rec = p_dev_rec;
- btm_cb.sec_collision_tle.param = (UINT32) btm_sec_collision_timeout;
+ btm_cb.sec_collision_tle.param = UINT_TO_PTR(btm_sec_collision_timeout);
btu_start_timer (&btm_cb.sec_collision_tle, BTU_TTYPE_USER_FUNC, BT_1SEC_TIMEOUT);
}
}
/* Start timer with 0 to initiate connection with new LCB */
/* because L2CAP will delete current LCB with this event */
btm_cb.p_collided_dev_rec = p_dev_rec;
- btm_cb.sec_collision_tle.param = (UINT32) btm_sec_connect_after_reject_timeout;
+ btm_cb.sec_collision_tle.param = UINT_TO_PTR(btm_sec_connect_after_reject_timeout);
btu_start_timer (&btm_cb.sec_collision_tle, BTU_TTYPE_USER_FUNC, 0);
}
else
/* Start timer with 0 to initiate connection with new LCB */
/* because L2CAP will delete current LCB with this event */
btm_cb.p_collided_dev_rec = p_dev_rec;
- btm_cb.sec_collision_tle.param = (UINT32) btm_sec_connect_after_reject_timeout;
+ btm_cb.sec_collision_tle.param = UINT_TO_PTR(btm_sec_connect_after_reject_timeout);
btu_start_timer (&btm_cb.sec_collision_tle, BTU_TTYPE_USER_FUNC, 0);
}
#include "hidh_int.h"
#include "bt_utils.h"
+#include "osi/include/osi.h"
+
static UINT8 find_conn_by_cid (UINT16 cid);
static void hidh_conn_retry (UINT8 dhandle);
*******************************************************************************/
void hidh_proc_repage_timeout (TIMER_LIST_ENT *p_tle)
{
- hidh_conn_initiate( (UINT8) p_tle->param ) ;
- hh_cb.devices[p_tle->param].conn_tries++;
- hh_cb.callback( (UINT8) p_tle->param, hh_cb.devices[p_tle->param].addr,
- HID_HDEV_EVT_RETRYING, hh_cb.devices[p_tle->param].conn_tries, NULL ) ;
+ tHID_HOST_DEV_CTB *device;
+ UINT8 dhandle = PTR_TO_UINT(p_tle->param);
+
+ hidh_conn_initiate(dhandle);
+
+ device = &hh_cb.devices[dhandle];
+ device->conn_tries++;
+
+ hh_cb.callback(dhandle, device->addr, HID_HDEV_EVT_RETRYING,
+ device->conn_tries, NULL ) ;
}
/*******************************************************************************
UNUSED(bd_addr);
UNUSED (transport);
- dhandle = ((UINT32)p_dev - (UINT32)&(hh_cb.devices[0]))/ sizeof(tHID_HOST_DEV_CTB);
+ // TODO(armansito): This kind of math to determine a device handle is way
+ // too dirty and unnecessary. Why can't |p_dev| store it's handle?
+ dhandle = (PTR_TO_UINT(p_dev) - PTR_TO_UINT(&(hh_cb.devices[0])))/ sizeof(tHID_HOST_DEV_CTB);
if( res == BTM_SUCCESS && p_dev->conn.conn_state == HID_CONN_STATE_SECURITY )
{
HIDH_TRACE_EVENT ("HID-Host Originator security pass.");
(hh_cb.devices[dhandle].attr_mask & HID_NORMALLY_CONNECTABLE))
{
hh_cb.devices[dhandle].conn_tries = 0;
- hh_cb.devices[dhandle].conn.timer_entry.param = (UINT32) dhandle;
+ hh_cb.devices[dhandle].conn.timer_entry.param = UINT_TO_PTR(dhandle);
btu_start_timer (&(hh_cb.devices[dhandle].conn.timer_entry), BTU_TTYPE_HID_HOST_REPAGE_TO, HID_HOST_REPAGE_WIN);
hh_cb.callback( dhandle, hh_cb.devices[dhandle].addr, HID_HDEV_EVT_CLOSE, disc_res, NULL);
}
tHID_HOST_DEV_CTB *p_dev = &hh_cb.devices[dhandle];
p_dev->conn.conn_state = HID_CONN_STATE_UNUSED;
- p_dev->conn.timer_entry.param = (UINT32) dhandle;
+ p_dev->conn.timer_entry.param = UINT_TO_PTR(dhandle);
#if (HID_HOST_REPAGE_WIN > 0)
btu_start_timer (&(p_dev->conn.timer_entry), BTU_TTYPE_HID_HOST_REPAGE_TO, HID_HOST_REPAGE_WIN);
#else
RFCOMM_TRACE_EVENT ("rfc_timer_start - timeout:%d", timeout);
- p_tle->param = (UINT32)p_mcb;
+ p_tle->param = p_mcb;
btu_start_timer (p_tle, BTU_TTYPE_RFCOMM_MFC, timeout);
}
RFCOMM_TRACE_EVENT ("rfc_port_timer_start - timeout:%d", timeout);
- p_tle->param = (UINT32)p_port;
+ p_tle->param = p_port;
btu_start_timer (p_tle, BTU_TTYPE_RFCOMM_PORT, timeout);
}
#include "sdpint.h"
#include "btu.h"
+#include "osi/include/osi.h"
+
/**********************************************************************
** C L I E N T F U N C T I O N P R O T O T Y P E S *
***********************************************************************/
num_attr > SDP_MAX_ATTR_FILTERS || num_uuid > SDP_MAX_UUID_FILTERS)
{
SDP_TRACE_ERROR("SDP_InitDiscoveryDb Illegal param: p_db 0x%x, len %d, num_uuid %d, num_attr %d",
- (UINT32)p_db, len, num_uuid, num_attr);
+ PTR_TO_UINT(p_db), len, num_uuid, num_attr);
return(FALSE);
}
{
memset (p_ccb, 0, sizeof (tCONN_CB));
- p_ccb->timer_entry.param = (UINT32) p_ccb;
+ p_ccb->timer_entry.param = p_ccb;
return (p_ccb);
}