component/bt : run astyle handle the code files

This commit is contained in:
Tian Hao
2016-11-25 02:10:15 +08:00
parent d7eb709a9c
commit 19273c7b2d
268 changed files with 29938 additions and 36146 deletions

109
components/bt/bluedroid/stack/rfcomm/rfc_l2cap_if.c Executable file → Normal file
View File

@@ -91,11 +91,9 @@ void RFCOMM_ConnectInd (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
tRFC_MCB *p_mcb = rfc_alloc_multiplexer_channel(bd_addr, FALSE);
UNUSED(psm);
if ((p_mcb)&&(p_mcb->state != RFC_MX_STATE_IDLE))
{
if ((p_mcb) && (p_mcb->state != RFC_MX_STATE_IDLE)) {
/* if this is collision case */
if ((p_mcb->is_initiator)&&(p_mcb->state == RFC_MX_STATE_WAIT_CONN_CNF))
{
if ((p_mcb->is_initiator) && (p_mcb->state == RFC_MX_STATE_WAIT_CONN_CNF)) {
p_mcb->pending_lcid = lcid;
p_mcb->pending_id = id;
@@ -103,26 +101,21 @@ void RFCOMM_ConnectInd (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
/* if peer gives up then local device rejects incoming connection and continues as initiator */
/* if timeout, local device disconnects outgoing connection and continues as acceptor */
RFCOMM_TRACE_DEBUG ("RFCOMM_ConnectInd start timer for collision, initiator's LCID(0x%x), acceptor's LCID(0x%x)",
p_mcb->lcid, p_mcb->pending_lcid);
p_mcb->lcid, p_mcb->pending_lcid);
rfc_timer_start(p_mcb, (UINT16)(GKI_get_os_tick_count()%10 + 2));
rfc_timer_start(p_mcb, (UINT16)(GKI_get_os_tick_count() % 10 + 2));
return;
}
else
{
} else {
/* we cannot accept connection request from peer at this state */
/* don't update lcid */
p_mcb = NULL;
}
}
else
{
} else {
/* store mcb even if null */
rfc_save_lcid_mcb (p_mcb, lcid);
}
if (p_mcb == NULL)
{
if (p_mcb == NULL) {
L2CA_ConnectRsp (bd_addr, id, lcid, L2CAP_CONN_NO_RESOURCES, 0);
return;
}
@@ -145,17 +138,14 @@ void RFCOMM_ConnectCnf (UINT16 lcid, UINT16 result)
{
tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
if (!p_mcb)
{
if (!p_mcb) {
RFCOMM_TRACE_ERROR ("RFCOMM_ConnectCnf LCID:0x%x", lcid);
return;
}
if (p_mcb->pending_lcid)
{
if (p_mcb->pending_lcid) {
/* if peer rejects our connect request but peer's connect request is pending */
if (result != L2CAP_CONN_OK )
{
if (result != L2CAP_CONN_OK ) {
UINT16 i;
UINT8 idx;
@@ -172,12 +162,10 @@ void RFCOMM_ConnectCnf (UINT16 lcid, UINT16 result)
rfc_save_lcid_mcb (p_mcb, p_mcb->lcid);
/* update direction bit */
for (i = 0; i < RFCOMM_MAX_DLCI; i += 2)
{
if ((idx = p_mcb->port_inx[i]) != 0)
{
for (i = 0; i < RFCOMM_MAX_DLCI; i += 2) {
if ((idx = p_mcb->port_inx[i]) != 0) {
p_mcb->port_inx[i] = 0;
p_mcb->port_inx[i+1] = idx;
p_mcb->port_inx[i + 1] = idx;
rfc_cb.port.port[idx - 1].dlci += 1;
RFCOMM_TRACE_DEBUG ("RFCOMM MX - DLCI:%d -> %d", i, rfc_cb.port.port[idx - 1].dlci);
}
@@ -185,9 +173,7 @@ void RFCOMM_ConnectCnf (UINT16 lcid, UINT16 result)
rfc_mx_sm_execute (p_mcb, RFC_MX_EVENT_CONN_IND, &(p_mcb->pending_id));
return;
}
else
{
} else {
RFCOMM_TRACE_DEBUG ("RFCOMM_ConnectCnf peer gave up pending LCID(0x%x)", p_mcb->pending_lcid);
/* Peer gave up his connection request, make sure cleaning up L2CAP channel */
@@ -217,8 +203,7 @@ void RFCOMM_ConfigInd (UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
{
tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
if (!p_mcb)
{
if (!p_mcb) {
RFCOMM_TRACE_ERROR ("RFCOMM_ConfigInd LCID:0x%x", lcid);
return;
}
@@ -240,8 +225,7 @@ void RFCOMM_ConfigCnf (UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
{
tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
if (!p_mcb)
{
if (!p_mcb) {
RFCOMM_TRACE_ERROR ("RFCOMM_ConfigCnf no MCB LCID:0x%x", lcid);
return;
}
@@ -276,13 +260,11 @@ void RFCOMM_DisconnectInd (UINT16 lcid, BOOLEAN is_conf_needed)
{
tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
if (is_conf_needed)
{
if (is_conf_needed) {
L2CA_DisconnectRsp (lcid);
}
if (!p_mcb)
{
if (!p_mcb) {
RFCOMM_TRACE_WARNING ("RFCOMM_DisconnectInd LCID:0x%x", lcid);
return;
}
@@ -308,8 +290,7 @@ void RFCOMM_BufDataInd (UINT16 lcid, BT_HDR *p_buf)
UINT8 event;
if (!p_mcb)
{
if (!p_mcb) {
RFCOMM_TRACE_WARNING ("RFCOMM_BufDataInd LCID:0x%x", lcid);
GKI_freebuf (p_buf);
return;
@@ -318,17 +299,14 @@ void RFCOMM_BufDataInd (UINT16 lcid, BT_HDR *p_buf)
event = rfc_parse_data (p_mcb, &rfc_cb.rfc.rx_frame, p_buf);
/* If the frame did not pass validation just ignore it */
if (event == RFC_EVENT_BAD_FRAME)
{
if (event == RFC_EVENT_BAD_FRAME) {
GKI_freebuf (p_buf);
return;
}
if (rfc_cb.rfc.rx_frame.dlci == RFCOMM_MX_DLCI)
{
if (rfc_cb.rfc.rx_frame.dlci == RFCOMM_MX_DLCI) {
/* Take special care of the Multiplexer Control Messages */
if (event == RFC_EVENT_UIH)
{
if (event == RFC_EVENT_UIH) {
rfc_process_mx_message (p_mcb, p_buf);
return;
}
@@ -341,20 +319,18 @@ void RFCOMM_BufDataInd (UINT16 lcid, BT_HDR *p_buf)
/* The frame was received on the data channel DLCI, verify that DLC exists */
if (((p_port = port_find_mcb_dlci_port (p_mcb, rfc_cb.rfc.rx_frame.dlci)) == NULL)
|| (!p_port->rfc.p_mcb))
{
|| (!p_port->rfc.p_mcb)) {
/* If this is a SABME on the new port, check if any appl is waiting for it */
if (event != RFC_EVENT_SABME)
{
if (event != RFC_EVENT_SABME) {
if (( p_mcb->is_initiator && !rfc_cb.rfc.rx_frame.cr)
|| (!p_mcb->is_initiator && rfc_cb.rfc.rx_frame.cr))
|| (!p_mcb->is_initiator && rfc_cb.rfc.rx_frame.cr)) {
rfc_send_dm (p_mcb, rfc_cb.rfc.rx_frame.dlci, rfc_cb.rfc.rx_frame.pf);
}
GKI_freebuf (p_buf);
return;
}
if ((p_port = port_find_dlci_port (rfc_cb.rfc.rx_frame.dlci)) == NULL)
{
if ((p_port = port_find_dlci_port (rfc_cb.rfc.rx_frame.dlci)) == NULL) {
rfc_send_dm (p_mcb, rfc_cb.rfc.rx_frame.dlci, TRUE);
GKI_freebuf (p_buf);
return;
@@ -363,15 +339,16 @@ void RFCOMM_BufDataInd (UINT16 lcid, BT_HDR *p_buf)
p_port->rfc.p_mcb = p_mcb;
}
if (event == RFC_EVENT_UIH)
{
if (p_buf->len > 0)
if (event == RFC_EVENT_UIH) {
if (p_buf->len > 0) {
rfc_port_sm_execute (p_port, event, p_buf);
else
} else {
GKI_freebuf (p_buf);
}
if (rfc_cb.rfc.rx_frame.credit != 0)
if (rfc_cb.rfc.rx_frame.credit != 0) {
rfc_inc_credit (p_port, rfc_cb.rfc.rx_frame.credit);
}
return;
}
@@ -391,13 +368,10 @@ void RFCOMM_CongestionStatusInd (UINT16 lcid, BOOLEAN is_congested)
{
tRFC_MCB *p_mcb = rfc_find_lcid_mcb (lcid);
if (!p_mcb)
{
if (!p_mcb) {
RFCOMM_TRACE_ERROR ("RFCOMM_CongestionStatusInd dropped LCID:0x%x", lcid);
return;
}
else
{
} else {
RFCOMM_TRACE_EVENT ("RFCOMM_CongestionStatusInd LCID:0x%x", lcid);
}
rfc_process_l2cap_congestion (p_mcb, is_congested);
@@ -414,17 +388,12 @@ tRFC_MCB *rfc_find_lcid_mcb (UINT16 lcid)
{
tRFC_MCB *p_mcb;
if (lcid - L2CAP_BASE_APPL_CID >= MAX_L2CAP_CHANNELS)
{
if (lcid - L2CAP_BASE_APPL_CID >= MAX_L2CAP_CHANNELS) {
RFCOMM_TRACE_ERROR ("rfc_find_lcid_mcb LCID:0x%x", lcid);
return (NULL);
}
else
{
if ((p_mcb = rfc_cb.rfc.p_rfc_lcid_mcb[lcid - L2CAP_BASE_APPL_CID]) != NULL)
{
if (p_mcb->lcid != lcid)
{
} else {
if ((p_mcb = rfc_cb.rfc.p_rfc_lcid_mcb[lcid - L2CAP_BASE_APPL_CID]) != NULL) {
if (p_mcb->lcid != lcid) {
RFCOMM_TRACE_WARNING ("rfc_find_lcid_mcb LCID reused LCID:0x%x current:0x%x", lcid, p_mcb->lcid);
return (NULL);
}