summaryrefslogtreecommitdiffstats
path: root/stack/avdt
diff options
context:
space:
mode:
authorAndre Eisenbach <andre@broadcom.com>2012-09-18 01:35:44 -0700
committerMatthew Xie <mattx@google.com>2012-09-18 16:26:28 -0700
commit6ef101187774e30ddba6b46bbedef549a42196ad (patch)
treef36eb347f03083671640fbc750171e3b951e0082 /stack/avdt
parentf80d3d045eab5f002be4b5e8a3d2d376fdf7581a (diff)
downloadexternal_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.zip
external_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.tar.gz
external_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.tar.bz2
Initual Bluetooth open source release
First release under Apache source license with updated header files and whitespace cleanups. Also fixed file permission to remove executable bit from source files. Change-Id: I7155903edfc2f491c1cbbd0db108f207852caaa0
Diffstat (limited to 'stack/avdt')
-rw-r--r--stack/avdt/avdt_ad.c67
-rw-r--r--stack/avdt/avdt_api.c71
-rw-r--r--stack/avdt/avdt_ccb.c110
-rw-r--r--stack/avdt/avdt_ccb_act.c135
-rw-r--r--stack/avdt/avdt_defs.h41
-rw-r--r--stack/avdt/avdt_int.h34
-rw-r--r--stack/avdt/avdt_l2c.c79
-rw-r--r--stack/avdt/avdt_msg.c152
-rw-r--r--stack/avdt/avdt_scb.c57
-rw-r--r--stack/avdt/avdt_scb_act.c105
10 files changed, 488 insertions, 363 deletions
diff --git a/stack/avdt/avdt_ad.c b/stack/avdt/avdt_ad.c
index cebbb93..92f429a 100644
--- a/stack/avdt/avdt_ad.c
+++ b/stack/avdt/avdt_ad.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-**
-** Name: avdt_ad.c
-**
-** Description: This module contains the AVDTP adaption layer.
-**
-** Copyright (c) 2002-2004, WIDCOMM Inc., All Rights Reserved.
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This module contains the AVDTP adaption layer.
+ *
+ ******************************************************************************/
#include <string.h>
#include "data_types.h"
@@ -25,7 +38,7 @@
** Function avdt_ad_type_to_tcid
**
** Description Derives the TCID from the channel type and SCB.
-**
+**
**
** Returns TCID value.
**
@@ -53,7 +66,7 @@ UINT8 avdt_ad_type_to_tcid(UINT8 type, tAVDT_SCB *p_scb)
** Function avdt_ad_tcid_to_type
**
** Description Derives the channel type from the TCID.
-**
+**
**
** Returns Channel type value.
**
@@ -85,7 +98,7 @@ static UINT8 avdt_ad_tcid_to_type(UINT8 tcid)
** Function avdt_ad_init
**
** Description Initialize adaption layer.
-**
+**
**
** Returns Nothing.
**
@@ -110,7 +123,7 @@ void avdt_ad_init(void)
**
** Description Find adaption layer transport channel table entry matching
** the given state.
-**
+**
**
** Returns Pointer to matching entry. For control channel it returns
** the matching entry. For media or other it returns the
@@ -180,7 +193,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(UINT8 type, tAVDT_CCB *p_ccb, UINT8 state)
** Function avdt_ad_tc_tbl_by_lcid
**
** Description Find adaption layer transport channel table entry by LCID.
-**
+**
**
** Returns Pointer to entry.
**
@@ -188,7 +201,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(UINT8 type, tAVDT_CCB *p_ccb, UINT8 state)
tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(UINT16 lcid)
{
UINT8 idx;
-
+
idx = avdt_cb.ad.lcid_tbl[lcid - L2CAP_BASE_APPL_CID];
if (idx < AVDT_NUM_TC_TBL)
@@ -208,7 +221,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(UINT16 lcid)
**
** Description This function retrieves the transport channel table entry
** for a particular channel.
-**
+**
**
** Returns Pointer to transport channel table entry.
**
@@ -242,7 +255,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_
** Function avdt_ad_tc_tbl_alloc
**
** Description Allocate an entry in the traffic channel table.
-**
+**
**
** Returns Pointer to entry.
**
@@ -278,7 +291,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_alloc(tAVDT_CCB *p_ccb)
** Function avdt_ad_tc_tbl_to_idx
**
** Description Convert a transport channel table entry to an index.
-**
+**
**
** Returns Index value.
**
@@ -299,7 +312,7 @@ UINT8 avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl)
** the channel and sends it a close event. The reason
** parameter is the same value passed by the L2CAP
** callback function.
-**
+**
**
** Returns Nothing.
**
@@ -345,7 +358,7 @@ void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, UINT16 reason)
** Description This function is called by the L2CAP interface when
** the L2CAP channel is opened. It looks up the CCB or SCB
** for the channel and sends it an open event.
-**
+**
**
** Returns Nothing.
**
@@ -402,7 +415,7 @@ void avdt_ad_tc_open_ind(tAVDT_TC_TBL *p_tbl)
** or SCB for the channel and sends it a congestion event.
** The is_congested parameter is the same value passed by
** the L2CAP callback function.
-**
+**
**
** Returns Nothing.
**
@@ -438,7 +451,7 @@ void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, BOOLEAN is_congested)
** Description This function is called by the L2CAP interface layer when
** incoming data is received from L2CAP. It looks up the CCB
** or SCB for the channel and routes the data accordingly.
-**
+**
**
** Returns Nothing.
**
@@ -479,7 +492,7 @@ void avdt_ad_tc_data_ind(tAVDT_TC_TBL *p_tbl, BT_HDR *p_buf)
** transport channel. It looks up the LCID of the channel
** based on the type, CCB, and SCB (if present). Then it
** passes the data to L2CA_DataWrite().
-**
+**
**
** Returns AVDT_AD_SUCCESS, if data accepted, else FALSE
** AVDT_AD_CONGESTED, if data accepted and the channel is congested
@@ -509,7 +522,7 @@ UINT8 avdt_ad_write_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, BT_HDR *
** as an initiator the function will start an L2CAP connection.
** When opened as an acceptor the function simply configures
** the table entry to listen for an incoming channel.
-**
+**
**
** Returns Nothing.
**
@@ -536,7 +549,7 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
/* otherwise get mtu from scb */
p_tbl->my_mtu = p_scb->cs.mtu;
p_tbl->my_flush_to = p_scb->cs.flush_to;
-
+
/* also set scb_hdl in rt_tbl */
avdt_cb.ad.rt_tbl[avdt_ccb_to_idx(p_ccb)][p_tbl->tcid].scb_hdl = avdt_scb_to_hdl(p_scb);
AVDT_TRACE_DEBUG3("avdt_cb.ad.rt_tbl[%d][%d].scb_hdl = %d",
@@ -582,7 +595,7 @@ void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role
** Description This function is called by a CCB or SCB to close a
** transport channel. The function looks up the LCID for the
** channel and calls L2CA_DisconnectReq().
-**
+**
**
** Returns Nothing.
**
diff --git a/stack/avdt/avdt_api.c b/stack/avdt/avdt_api.c
index 02e9e57..67fe452 100644
--- a/stack/avdt/avdt_api.c
+++ b/stack/avdt/avdt_api.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: avdt_api.c
-**
-** Description: This module contains API of the audio/video distribution
-** transport protocol.
-**
-** Copyright (c) 2002-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This module contains API of the audio/video distribution transport
+ * protocol.
+ *
+ ******************************************************************************/
#include <string.h>
#include "data_types.h"
@@ -40,7 +53,7 @@ tAVDT_CB avdt_cb;
** appropriate CCB or SCB state machine.
**
** This function is for use internal to the stack only.
-**
+**
**
** Returns void
**
@@ -92,7 +105,7 @@ void avdt_process_timeout(TIMER_LIST_ENT *p_tle)
** prepares the protocol stack for its use. This function
** must be called once by the system or platform using AVDTP
** before the other functions of the API an be used.
-**
+**
**
** Returns void
**
@@ -104,7 +117,7 @@ void AVDT_Register(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback)
/* register PSM with L2CAP */
L2CA_Register(AVDT_PSM, (tL2CAP_APPL_INFO *) &avdt_l2c_appl);
-
+
/* set security level */
BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVDTP, p_reg->sec_mask,
AVDT_PSM, BTM_SEC_PROTO_AVDT, AVDT_CHAN_SIG);
@@ -148,7 +161,7 @@ void AVDT_Register(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback)
** It is called when AVDTP is no longer being used by any
** application in the system. Before this function can be
** called, all streams must be removed with AVDT_RemoveStream().
-**
+**
**
** Returns void
**
@@ -170,7 +183,7 @@ void AVDT_Deregister(void)
** this endpoint and an endpoint on a peer device. In
** addition, a peer device can discover, get the capabilities,
** and connect to this endpoint.
-**
+**
**
** Returns AVDT_SUCCESS if successful, otherwise error.
**
@@ -186,7 +199,7 @@ UINT16 AVDT_CreateStream(UINT8 *p_handle, tAVDT_CS *p_cs)
if (((p_cs->cfg.psc_mask & (~AVDT_PSC)) != 0) || (p_cs->p_ctrl_cback == NULL))
{
result = AVDT_BAD_PARAMS;
- }
+ }
/* Allocate scb; if no scbs, return failure */
else if ((p_scb = avdt_scb_alloc(p_cs)) == NULL)
{
@@ -208,7 +221,7 @@ UINT16 AVDT_CreateStream(UINT8 *p_handle, tAVDT_CS *p_cs)
** If this function is called when the endpoint is connected
** the connection is closed and then the stream endpoint
** is removed.
-**
+**
**
** Returns AVDT_SUCCESS if successful, otherwise error.
**
@@ -244,7 +257,7 @@ UINT16 AVDT_RemoveStream(UINT8 handle)
** that AVDTP discovery is unrelated to SDP discovery).
** This function can be called at any time regardless of whether
** there is an AVDTP connection to the peer device.
-**
+**
** When discovery is complete, an AVDT_DISCOVER_CFM_EVT
** is sent to the application via its callback function.
** The application must not call AVDT_GetCapReq() or
@@ -354,7 +367,7 @@ static UINT16 avdt_get_cap_req(BD_ADDR bd_addr, tAVDT_CCB_API_GETCAP *p_evt)
** capabilities of a stream endpoint on the peer device.
** This function can be called at any time regardless of
** whether there is an AVDTP connection to the peer device.
-**
+**
** When the procedure is complete, an AVDT_GETCAP_CFM_EVT is
** sent to the application via its callback function. The
** application must not call AVDT_GetCapReq() or
@@ -391,7 +404,7 @@ UINT16 AVDT_GetCapReq(BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg, tAVDT_CTRL_
** capabilities of a stream endpoint on the peer device.
** This function can be called at any time regardless of
** whether there is an AVDTP connection to the peer device.
-**
+**
** When the procedure is complete, an AVDT_GETCAP_CFM_EVT is
** sent to the application via its callback function. The
** application must not call AVDT_GetCapReq() or
@@ -582,7 +595,7 @@ UINT16 AVDT_StartReq(UINT8 *p_handles, UINT8 num_handles)
tAVDT_CCB_EVT evt;
UINT16 result = AVDT_SUCCESS;
int i;
-
+
BTTRC_AVDT_API0(AVDT_TRACE_API_START_REQ);
if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS))
@@ -640,7 +653,7 @@ UINT16 AVDT_SuspendReq(UINT8 *p_handles, UINT8 num_handles)
tAVDT_CCB_EVT evt;
UINT16 result = AVDT_SUCCESS;
int i;
-
+
BTTRC_AVDT_API0(AVDT_TRACE_API_SUSPEND_REQ);
if ((num_handles == 0) || (num_handles > AVDT_NUM_SEPS))
@@ -967,7 +980,7 @@ UINT16 AVDT_ConnectReq(BD_ADDR bd_addr, UINT8 sec_mask, tAVDT_CTRL_CBACK *p_cbac
/* ccb was already allocated for the incoming signalling. */
result = AVDT_BUSY;
}
-
+
if (result == AVDT_SUCCESS)
{
/* send event to ccb */
@@ -1177,10 +1190,10 @@ AVDT_API extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 dat
** buffer if argument p_buf is NULL. This function can only
** be called if the stream is a SNK.
**
-** AVDTP uses this buffer to reassemble fragmented media packets.
+** AVDTP uses this buffer to reassemble fragmented media packets.
** When AVDTP receives a complete media packet, it calls the
** p_media_cback assigned by AVDT_CreateStream().
-** This function can be called during callback to assign a
+** This function can be called during callback to assign a
** different buffer for next media packet or can leave the current
** buffer for next packet.
**
@@ -1219,11 +1232,11 @@ AVDT_API extern UINT16 AVDT_SetMediaBuf(UINT8 handle, UINT8 *p_buf, UINT32 buf_l
**
** Function AVDT_SendReport
**
-** Description
-**
+** Description
+**
**
**
-** Returns
+** Returns
**
*******************************************************************************/
UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
diff --git a/stack/avdt/avdt_ccb.c b/stack/avdt/avdt_ccb.c
index ea1990d..9cb40b2 100644
--- a/stack/avdt/avdt_ccb.c
+++ b/stack/avdt/avdt_ccb.c
@@ -1,15 +1,27 @@
-/*****************************************************************************
-**
-** Name: avdt_ccb.c
-**
-** Description: This module contains the channel control block state
-** machine and functions which operate on the channel
-** control block.
-**
-** Copyright (c) 2002-2008, Broadcom Corp., All Rights Reserved.
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This module contains the channel control block state machine and
+ * functions which operate on the channel control block.
+ *
+ ******************************************************************************/
#include <string.h>
#include "data_types.h"
@@ -35,33 +47,33 @@ const char * const avdt_ccb_st_str[] = {
/* verbose event strings for trace */
const char * const avdt_ccb_evt_str[] = {
- "API_DISCOVER_REQ_EVT",
- "API_GETCAP_REQ_EVT",
- "API_START_REQ_EVT",
- "API_SUSPEND_REQ_EVT",
- "API_DISCOVER_RSP_EVT",
- "API_GETCAP_RSP_EVT",
- "API_START_RSP_EVT",
- "API_SUSPEND_RSP_EVT",
- "API_CONNECT_REQ_EVT",
+ "API_DISCOVER_REQ_EVT",
+ "API_GETCAP_REQ_EVT",
+ "API_START_REQ_EVT",
+ "API_SUSPEND_REQ_EVT",
+ "API_DISCOVER_RSP_EVT",
+ "API_GETCAP_RSP_EVT",
+ "API_START_RSP_EVT",
+ "API_SUSPEND_RSP_EVT",
+ "API_CONNECT_REQ_EVT",
"API_DISCONNECT_REQ_EVT",
- "MSG_DISCOVER_CMD_EVT",
- "MSG_GETCAP_CMD_EVT",
- "MSG_START_CMD_EVT",
- "MSG_SUSPEND_CMD_EVT",
- "MSG_DISCOVER_RSP_EVT",
- "MSG_GETCAP_RSP_EVT",
- "MSG_START_RSP_EVT",
- "MSG_SUSPEND_RSP_EVT",
- "RCVRSP_EVT",
- "SENDMSG_EVT",
- "RET_TOUT_EVT",
- "RSP_TOUT_EVT",
- "IDLE_TOUT_EVT",
- "UL_OPEN_EVT",
- "UL_CLOSE_EVT",
- "LL_OPEN_EVT",
- "LL_CLOSE_EVT",
+ "MSG_DISCOVER_CMD_EVT",
+ "MSG_GETCAP_CMD_EVT",
+ "MSG_START_CMD_EVT",
+ "MSG_SUSPEND_CMD_EVT",
+ "MSG_DISCOVER_RSP_EVT",
+ "MSG_GETCAP_RSP_EVT",
+ "MSG_START_RSP_EVT",
+ "MSG_SUSPEND_RSP_EVT",
+ "RCVRSP_EVT",
+ "SENDMSG_EVT",
+ "RET_TOUT_EVT",
+ "RSP_TOUT_EVT",
+ "IDLE_TOUT_EVT",
+ "UL_OPEN_EVT",
+ "UL_CLOSE_EVT",
+ "LL_OPEN_EVT",
+ "LL_CLOSE_EVT",
"LL_CONG_EVT"
};
@@ -261,7 +273,7 @@ const tAVDT_CCB_ST_TBL avdt_ccb_st_tbl[] = {
** Function avdt_ccb_init
**
** Description Initialize channel control block module.
-**
+**
**
** Returns Nothing.
**
@@ -277,7 +289,7 @@ void avdt_ccb_init(void)
** Function avdt_ccb_event
**
** Description State machine event handling function for ccb
-**
+**
**
** Returns Nothing.
**
@@ -306,7 +318,7 @@ void avdt_ccb_event(tAVDT_CCB *p_ccb, UINT8 event, tAVDT_CCB_EVT *p_data)
{
if ((action = state_table[event][i]) != AVDT_CCB_IGNORE)
{
- BTTRC_AVDT_CCB_ACTION(action);
+ BTTRC_AVDT_CCB_ACTION(action);
(*avdt_cb.p_ccb_act[action])(p_ccb, p_data);
}
else
@@ -322,7 +334,7 @@ void avdt_ccb_event(tAVDT_CCB *p_ccb, UINT8 event, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_by_bd
**
** Description This lookup function finds the ccb for a BD address.
-**
+**
**
** Returns pointer to the ccb, or NULL if none found.
**
@@ -340,7 +352,7 @@ tAVDT_CCB *avdt_ccb_by_bd(BD_ADDR bd_addr)
break;
}
}
-
+
if (i == AVDT_NUM_LINKS)
{
/* if no ccb found */
@@ -357,7 +369,7 @@ tAVDT_CCB *avdt_ccb_by_bd(BD_ADDR bd_addr)
** Function avdt_ccb_alloc
**
** Description Allocate a channel control block.
-**
+**
**
** Returns pointer to the ccb, or NULL if none could be allocated.
**
@@ -380,7 +392,7 @@ tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr)
break;
}
}
-
+
if (i == AVDT_NUM_LINKS)
{
/* out of ccbs */
@@ -395,7 +407,7 @@ tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr)
** Function avdt_ccb_dealloc
**
** Description Deallocate a stream control block.
-**
+**
**
** Returns void.
**
@@ -412,7 +424,7 @@ void avdt_ccb_dealloc(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_to_idx
**
** Description Given a pointer to an ccb, return its index.
-**
+**
**
** Returns Index of ccb.
**
@@ -428,7 +440,7 @@ UINT8 avdt_ccb_to_idx(tAVDT_CCB *p_ccb)
** Function avdt_ccb_by_idx
**
** Description Return ccb pointer based on ccb index.
-**
+**
**
** Returns pointer to the ccb, or NULL if none found.
**
@@ -440,7 +452,7 @@ tAVDT_CCB *avdt_ccb_by_idx(UINT8 idx)
/* verify index */
if (idx < AVDT_NUM_LINKS)
{
- p_ccb = &avdt_cb.ccb[idx];
+ p_ccb = &avdt_cb.ccb[idx];
}
else
{
diff --git a/stack/avdt/avdt_ccb_act.c b/stack/avdt/avdt_ccb_act.c
index 87de480..5719be9 100644
--- a/stack/avdt/avdt_ccb_act.c
+++ b/stack/avdt/avdt_ccb_act.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: avdt_ccb_act.c
-**
-** Description: This module contains the action functions associated
-** with the channel control block state machine.
-**
-** Copyright (c) 2006-2008, Broadcom Corp., All Rights Reserved.
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2006-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This module contains the action functions associated with the channel
+ * control block state machine.
+ *
+ ******************************************************************************/
#include <string.h>
#include "data_types.h"
@@ -24,9 +37,9 @@
**
** Function avdt_ccb_clear_ccb
**
-** Description This function clears out certain buffers, queues, and
+** Description This function clears out certain buffers, queues, and
** other data elements of a ccb.
-**
+**
**
** Returns void.
**
@@ -66,7 +79,7 @@ static void avdt_ccb_clear_ccb(tAVDT_CCB *p_ccb)
**
** Description This function calls avdt_ad_open_req() to
** initiate a signaling channel connection.
-**
+**
**
** Returns void.
**
@@ -83,7 +96,7 @@ void avdt_ccb_chan_open(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
**
** Description This function calls avdt_ad_close_req() to close a
** signaling channel connection.
-**
+**
**
** Returns void.
**
@@ -100,7 +113,7 @@ void avdt_ccb_chan_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
**
** Description This function checks for active streams on this CCB.
** If there are none, it starts an idle timer.
-**
+**
**
** Returns void.
**
@@ -134,7 +147,7 @@ void avdt_ccb_chk_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** received from the peer. It gathers up the stream
** information for all allocated streams and initiates
** sending of a discover response.
-**
+**
**
** Returns void.
**
@@ -144,7 +157,7 @@ void avdt_ccb_hdl_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
tAVDT_SEP_INFO sep_info[AVDT_NUM_SEPS];
tAVDT_SCB *p_scb = &avdt_cb.scb[0];
int i;
-
+
p_data->msg.discover_rsp.p_sep_info = sep_info;
p_data->msg.discover_rsp.num_seps = 0;
@@ -174,7 +187,7 @@ void avdt_ccb_hdl_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Description This function is called when a discover response or
** reject is received from the peer. It calls the application
** callback function with the results.
-**
+**
**
** Returns void.
**
@@ -185,7 +198,7 @@ void avdt_ccb_hdl_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
p_ccb->proc_busy = FALSE;
/* call app callback with results */
- (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_DISCOVER_CFM_EVT,
+ (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_DISCOVER_CFM_EVT,
(tAVDT_CTRL *)(&p_data->msg.discover_rsp));
}
@@ -197,7 +210,7 @@ void avdt_ccb_hdl_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** is received from the peer. It retrieves the stream
** configuration for the requested stream and initiates
** sending of a get capabilities response.
-**
+**
**
** Returns void.
**
@@ -221,7 +234,7 @@ void avdt_ccb_hdl_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Description This function is called with a get capabilities response
** or reject is received from the peer. It calls the
** application callback function with the results.
-**
+**
**
** Returns void.
**
@@ -232,7 +245,7 @@ void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
p_ccb->proc_busy = FALSE;
/* call app callback with results */
- (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_GETCAP_CFM_EVT,
+ (*p_ccb->proc_cback)(0, p_ccb->peer_addr, AVDT_GETCAP_CFM_EVT,
(tAVDT_CTRL *)(&p_data->msg.svccap));
}
@@ -244,7 +257,7 @@ void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** from the peer. It verifies that all requested streams
** are in the proper state. If so, it initiates sending of
** a start response. Otherwise it sends a start reject.
-**
+**
**
** Returns void.
**
@@ -278,7 +291,7 @@ void avdt_ccb_hdl_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** is received from the peer. Using the SEIDs stored in the
** current command message, it sends a start response or start
** reject event to each SCB associated with the command.
-**
+**
**
** Returns void.
**
@@ -316,7 +329,7 @@ void avdt_ccb_hdl_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** in the proper state. If so, it initiates sending of a
** suspend response. Otherwise it sends a suspend reject.
-**
+**
**
** Returns void.
**
@@ -351,7 +364,7 @@ void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** current command message, it sends a suspend response or
** suspend reject event to each SCB associated with the command.
**
-**
+**
**
** Returns void.
**
@@ -388,7 +401,7 @@ void avdt_ccb_hdl_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** peer. It copies variables needed for the procedure from
** the event to the CCB. It marks the CCB as busy and then
** sends a discover command.
-**
+**
**
** Returns void.
**
@@ -414,7 +427,7 @@ void avdt_ccb_snd_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Description This function is called to send a discover response to
** the peer. It takes the stream information passed in the
** event and sends a discover response.
-**
+**
**
** Returns void.
**
@@ -433,7 +446,7 @@ void avdt_ccb_snd_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** to the peer. It copies variables needed for the procedure
** from the event to the CCB. It marks the CCB as busy and
** then sends a get capabilities command.
-**
+**
**
** Returns void.
**
@@ -463,7 +476,7 @@ void avdt_ccb_snd_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Description This function is called to send a get capabilities response
** to the peer. It takes the stream information passed in the
** event and sends a get capabilities response.
-**
+**
**
** Returns void.
**
@@ -487,7 +500,7 @@ void avdt_ccb_snd_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** peer. It verifies that all requested streams are in the
** proper state. If so, it sends a start command. Otherwise
** send ourselves back a start reject.
-**
+**
**
** Returns void.
**
@@ -533,7 +546,7 @@ void avdt_ccb_snd_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** peer. It takes the stream information passed in the event
** and sends a start response. Then it sends a start event
** to the SCB for each stream.
-**
+**
**
** Returns void.
**
@@ -565,7 +578,7 @@ void avdt_ccb_snd_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** proper state. If so, it sends a suspend command.
** Otherwise it calls the callback function for each requested
** stream and sends a suspend confirmation with failure.
-**
+**
**
** Returns void.
**
@@ -611,14 +624,14 @@ void avdt_ccb_snd_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** peer. It takes the stream information passed in the event
** and sends a suspend response. Then it sends a suspend event
** to the SCB for each stream.
-**
+**
**
** Returns void.
**
*******************************************************************************/
void avdt_ccb_snd_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
{
- tAVDT_SCB *p_scb;
+ tAVDT_SCB *p_scb;
int i;
/* send response message */
@@ -643,7 +656,7 @@ void avdt_ccb_snd_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** command in the command queue, it frees the command and
** calls the application callback function indicating failure.
** Certain CCB variables are also initialized.
-**
+**
**
** Returns void.
**
@@ -686,9 +699,9 @@ void avdt_ccb_clear_cmds(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_cmd_fail
**
** Description This function is called when there is a response timeout.
-** The currently pending command is freed and we fake a
+** The currently pending command is freed and we fake a
** reject message back to ourselves.
-**
+**
**
** Returns void.
**
@@ -705,7 +718,7 @@ void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
msg.hdr.err_code = p_data->err_code;
msg.hdr.err_param = 0;
msg.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb);
-
+
/* pretend that we received a rej message */
evt = avdt_msg_rej_2_evt[p_ccb->p_curr_cmd->event - 1];
@@ -722,7 +735,7 @@ void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
avdt_scb_event(p_scb, evt, (tAVDT_SCB_EVT *) &msg);
}
}
-
+
GKI_freebuf(p_ccb->p_curr_cmd);
p_ccb->p_curr_cmd = NULL;
}
@@ -734,7 +747,7 @@ void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
**
** Description This function is called when a response is received for a
** currently pending command. The command is freed.
-**
+**
**
** Returns void.
**
@@ -754,7 +767,7 @@ void avdt_ccb_free_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
**
** Description This function is called to set the congestion state for
** the CCB.
-**
+**
**
** Returns void.
**
@@ -772,7 +785,7 @@ void avdt_ccb_cong_state(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** pending command. The retransmission count is incremented.
** If the count reaches the maximum number of retransmissions,
** the event is treated as a response timeout.
-**
+**
**
** Returns void.
**
@@ -805,7 +818,7 @@ void avdt_ccb_ret_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
avdt_msg_send(p_ccb, p_msg);
}
}
-
+
/* restart timer */
btu_start_timer(&p_ccb->timer_entry, BTU_TTYPE_AVDT_CCB_RET, avdt_cb.rcb.ret_tout);
}
@@ -817,7 +830,7 @@ void avdt_ccb_ret_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
**
** Description This function is called the send the next command,
** if any, in the command queue.
-**
+**
**
** Returns void.
**
@@ -848,8 +861,8 @@ void avdt_ccb_snd_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
**
** Function avdt_ccb_snd_msg
**
-** Description
-**
+** Description
+**
**
** Returns void.
**
@@ -878,7 +891,7 @@ void avdt_ccb_snd_msg(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
}
}
}
-
+
/* do we have commands to send? send next command */
avdt_ccb_snd_cmd(p_ccb, NULL);
}
@@ -891,7 +904,7 @@ void avdt_ccb_snd_msg(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Description This function is called to enable a reconnect attempt when
** a channel transitions from closing to idle state. It sets
** the reconn variable to TRUE.
-**
+**
**
** Returns void.
**
@@ -906,7 +919,7 @@ void avdt_ccb_set_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_clr_reconn
**
** Description This function is called to clear the reconn variable.
-**
+**
**
** Returns void.
**
@@ -923,7 +936,7 @@ void avdt_ccb_clr_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Description This function is called to check if a reconnect attempt
** is enabled. If enabled, it sends an AVDT_CCB_UL_OPEN_EVT
** to the CCB. If disabled, the CCB is deallocated.
-**
+**
**
** Returns void.
**
@@ -957,7 +970,7 @@ void avdt_ccb_chk_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
**
** Description This function stops the CCB timer if the idle timer is
** running.
-**
+**
**
** Returns void.
**
@@ -975,7 +988,7 @@ void avdt_ccb_chk_timer(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_set_conn
**
** Description Set CCB variables associated with AVDT_ConnectReq().
-**
+**
**
** Returns void.
**
@@ -995,7 +1008,7 @@ void avdt_ccb_set_conn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_set_disconn
**
** Description Set CCB variables associated with AVDT_DisconnectReq().
-**
+**
**
** Returns void.
**
@@ -1016,7 +1029,7 @@ void avdt_ccb_set_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_do_disconn
**
** Description Do action associated with AVDT_DisconnectReq().
-**
+**
**
** Returns void.
**
@@ -1035,7 +1048,7 @@ void avdt_ccb_do_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_ll_closed
**
** Description Clear commands from and deallocate CCB.
-**
+**
**
** Returns void.
**
@@ -1063,7 +1076,7 @@ void avdt_ccb_ll_closed(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
{
avdt_ctrl.hdr.err_code = 0;
(*p_cback)(0, bd_addr, AVDT_DISCONNECT_IND_EVT, &avdt_ctrl);
- }
+ }
}
/*******************************************************************************
@@ -1071,7 +1084,7 @@ void avdt_ccb_ll_closed(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
** Function avdt_ccb_ll_opened
**
** Description Call callback on open.
-**
+**
**
** Returns void.
**
@@ -1081,7 +1094,7 @@ void avdt_ccb_ll_opened(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
tAVDT_CTRL avdt_ctrl;
p_ccb->ll_opened = TRUE;
-
+
if (!p_ccb->p_conn_cback)
p_ccb->p_conn_cback = avdt_cb.p_conn_cback;
@@ -1091,5 +1104,5 @@ void avdt_ccb_ll_opened(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
avdt_ctrl.hdr.err_code = 0;
avdt_ctrl.hdr.err_param = p_data->msg.hdr.err_param;
(*p_ccb->p_conn_cback)(0, p_ccb->peer_addr, AVDT_CONNECT_IND_EVT, &avdt_ctrl);
- }
+ }
}
diff --git a/stack/avdt/avdt_defs.h b/stack/avdt/avdt_defs.h
index 4f67853..b6dbbc4 100644
--- a/stack/avdt/avdt_defs.h
+++ b/stack/avdt/avdt_defs.h
@@ -1,16 +1,27 @@
-/*****************************************************************************
-**
-** Name: avdt_defs.h
-**
-** Description: This contains constants definitions and other information
-** from the AVDTP specification. This file is intended for
-** use internal to AVDT only.
-**
-**
-** Copyright (c) 2002-2010, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This contains constants definitions and other information from the AVDTP
+ * specification. This file is intended for use internal to AVDT only.
+ *
+ ******************************************************************************/
#ifndef AVDT_DEFS_H
#define AVDT_DEFS_H
@@ -165,7 +176,7 @@
#define AVDT_MSG_PRS_M_PT(p, m_pt, marker) \
marker = *(p) >> 7; \
m_pt = *(p)++ & 0x7F;
-
+
#define AVDT_MSG_BLD_HDR(p, lbl, pkt, msg) \
*(p)++ = (UINT8) ((lbl) << 4) | ((pkt) << 2) | (msg);
@@ -187,6 +198,6 @@
#define AVDT_MSG_BLD_NOSP(p, nosp) \
*(p)++ = (UINT8) (nosp);
-
+
#endif /* AVDT_DEFS_H */
diff --git a/stack/avdt/avdt_int.h b/stack/avdt/avdt_int.h
index cb62e31..9b101fc 100644
--- a/stack/avdt/avdt_int.h
+++ b/stack/avdt/avdt_int.h
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: avdt_int.h
-**
-** Description: This file contains interfaces which are internal to AVDTP.
-**
-**
-** Copyright (c) 2002-2009, Broadcom Corp., All Rights Reserved.
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains interfaces which are internal to AVDTP.
+ *
+ ******************************************************************************/
#ifndef AVDT_INT_H
#define AVDT_INT_H
diff --git a/stack/avdt/avdt_l2c.c b/stack/avdt/avdt_l2c.c
index ecab37d..20979b4 100644
--- a/stack/avdt/avdt_l2c.c
+++ b/stack/avdt/avdt_l2c.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-**
-** Name: avdt_l2c.c
-**
-** Description: This AVDTP adaption layer module interfaces to L2CAP
-**
-** Copyright (c) 2002-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This AVDTP adaption layer module interfaces to L2CAP
+ *
+ ******************************************************************************/
#include <string.h>
#include "data_types.h"
@@ -50,8 +63,8 @@ const tL2CAP_APPL_INFO avdt_l2c_appl = {
**
** Function avdt_sec_check_complete_term
**
-** Description The function called when Security Manager finishes
-** verification of the service side connection
+** Description The function called when Security Manager finishes
+** verification of the service side connection
**
** Returns void
**
@@ -70,7 +83,7 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, void *p_ref_data, UIN
}
p_ccb = avdt_ccb_by_bd(bd_addr);
-
+
p_tbl = avdt_ad_tc_tbl_by_st(AVDT_CHAN_SIG, p_ccb, AVDT_AD_ST_SEC_ACP);
if (p_tbl == NULL)
return;
@@ -78,7 +91,7 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, void *p_ref_data, UIN
if (res == BTM_SUCCESS)
{
/* Send response to the L2CAP layer. */
- L2CA_ConnectRsp (bd_addr, p_tbl->id, p_tbl->lcid, L2CAP_CONN_OK, L2CAP_CONN_OK);
+ L2CA_ConnectRsp (bd_addr, p_tbl->id, p_tbl->lcid, L2CAP_CONN_OK, L2CAP_CONN_OK);
/* store idx in LCID table, store LCID in routing table */
avdt_cb.ad.lcid_tbl[p_tbl->lcid - L2CAP_BASE_APPL_CID] = avdt_ad_tc_tbl_to_idx(p_tbl);
@@ -97,7 +110,7 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, void *p_ref_data, UIN
}
else
{
- L2CA_ConnectRsp (bd_addr, p_tbl->id, p_tbl->lcid, L2CAP_CONN_SECURITY_BLOCK, L2CAP_CONN_OK);
+ L2CA_ConnectRsp (bd_addr, p_tbl->id, p_tbl->lcid, L2CAP_CONN_SECURITY_BLOCK, L2CAP_CONN_OK);
avdt_ad_tc_close_ind(p_tbl, L2CAP_CONN_SECURITY_BLOCK);
}
}
@@ -106,8 +119,8 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, void *p_ref_data, UIN
**
** Function avdt_sec_check_complete_orig
**
-** Description The function called when Security Manager finishes
-** verification of the service side connection
+** Description The function called when Security Manager finishes
+** verification of the service side connection
**
** Returns void
**
@@ -149,7 +162,7 @@ static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, void *p_ref_data, UIN
** Function avdt_l2c_connect_ind_cback
**
** Description This is the L2CAP connect indication callback function.
-**
+**
**
** Returns void
**
@@ -184,13 +197,13 @@ void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
p_tbl->cfg_flags = AVDT_L2C_CFG_CONN_ACP;
/* Check the security */
- rc = btm_sec_mx_access_request (bd_addr, AVDT_PSM,
- FALSE, BTM_SEC_PROTO_AVDT,
+ rc = btm_sec_mx_access_request (bd_addr, AVDT_PSM,
+ FALSE, BTM_SEC_PROTO_AVDT,
AVDT_CHAN_SIG,
&avdt_sec_check_complete_term, NULL);
if(rc == BTM_CMD_STARTED)
{
- L2CA_ConnectRsp (p_ccb->peer_addr, p_tbl->id, lcid, L2CAP_CONN_PENDING, L2CAP_CONN_OK);
+ L2CA_ConnectRsp (p_ccb->peer_addr, p_tbl->id, lcid, L2CAP_CONN_PENDING, L2CAP_CONN_OK);
}
return;
}
@@ -226,7 +239,7 @@ void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
}
/* Send L2CAP connect rsp */
- L2CA_ConnectRsp(bd_addr, id, lcid, result, 0);
+ L2CA_ConnectRsp(bd_addr, id, lcid, result, 0);
/* if result ok, proceed with connection */
if (result == L2CAP_CONN_OK)
@@ -253,7 +266,7 @@ void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
** Function avdt_l2c_connect_cfm_cback
**
** Description This is the L2CAP connect confirm callback function.
-**
+**
**
** Returns void
**
@@ -303,8 +316,8 @@ void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
p_tbl->cfg_flags = AVDT_L2C_CFG_CONN_INT;
/* Check the security */
- btm_sec_mx_access_request (p_ccb->peer_addr, AVDT_PSM,
- TRUE, BTM_SEC_PROTO_AVDT,
+ btm_sec_mx_access_request (p_ccb->peer_addr, AVDT_PSM,
+ TRUE, BTM_SEC_PROTO_AVDT,
AVDT_CHAN_SIG,
&avdt_sec_check_complete_orig, NULL);
}
@@ -325,7 +338,7 @@ void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
** Function avdt_l2c_config_cfm_cback
**
** Description This is the L2CAP config confirm callback function.
-**
+**
**
** Returns void
**
@@ -367,7 +380,7 @@ void avdt_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
** Function avdt_l2c_config_ind_cback
**
** Description This is the L2CAP config indication callback function.
-**
+**
**
** Returns void
**
@@ -415,7 +428,7 @@ void avdt_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg)
** Function avdt_l2c_disconnect_ind_cback
**
** Description This is the L2CAP disconnect indication callback function.
-**
+**
**
** Returns void
**
@@ -434,7 +447,7 @@ void avdt_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
/* send L2CAP disconnect response */
L2CA_DisconnectRsp(lcid);
}
-
+
avdt_ad_tc_close_ind(p_tbl, 0);
}
}
@@ -444,7 +457,7 @@ void avdt_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed)
** Function avdt_l2c_disconnect_cfm_cback
**
** Description This is the L2CAP disconnect confirm callback function.
-**
+**
**
** Returns void
**
@@ -457,7 +470,7 @@ void avdt_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
lcid, result);
/* look up info for this channel */
if ((p_tbl = avdt_ad_tc_tbl_by_lcid(lcid)) != NULL)
- {
+ {
avdt_ad_tc_close_ind(p_tbl, result);
}
}
@@ -467,7 +480,7 @@ void avdt_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result)
** Function avdt_l2c_congestion_ind_cback
**
** Description This is the L2CAP congestion indication callback function.
-**
+**
**
** Returns void
**
@@ -488,7 +501,7 @@ void avdt_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested)
** Function avdt_l2c_data_ind_cback
**
** Description This is the L2CAP data indication callback function.
-**
+**
**
** Returns void
**
diff --git a/stack/avdt/avdt_msg.c b/stack/avdt/avdt_msg.c
index 35066f9..5d9c2fb 100644
--- a/stack/avdt/avdt_msg.c
+++ b/stack/avdt/avdt_msg.c
@@ -1,18 +1,30 @@
-/*****************************************************************************
-**
-** Name: avdt_msg.c
-**
-** Description: This module contains functions for parsing and building
-** AVDTP signaling messages. It also contains functions
-** called by the SCB or CCB state machines for sending
-** command, response, and reject messages. It also contains
-** a function that processes incoming messages and dispatches
-** them to the appropriate SCB or CCB.
-**
-** Copyright (c) 2002-2010, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This module contains functions for parsing and building AVDTP signaling
+ * messages. It also contains functions called by the SCB or CCB state
+ * machines for sending command, response, and reject messages. It also
+ * contains a function that processes incoming messages and dispatches them
+ * to the appropriate SCB or CCB.
+ *
+ ******************************************************************************/
#include <string.h>
#include "data_types.h"
@@ -138,7 +150,7 @@ const tAVDT_MSG_BLD avdt_msg_bld_cmd[] = {
avdt_msg_bld_single, /* abort */
avdt_msg_bld_security_cmd, /* security control */
avdt_msg_bld_single, /* get all capabilities */
- avdt_msg_bld_delay_rpt /* delay report */
+ avdt_msg_bld_delay_rpt /* delay report */
};
/* function table for building response messages */
@@ -249,7 +261,7 @@ const UINT8 avdt_msg_rej_2_evt[] = {
**
** Description This function builds the configuration parameters contained
** in a command or response message.
-**
+**
**
** Returns void.
**
@@ -280,22 +292,22 @@ static void avdt_msg_bld_cfg(UINT8 **p, tAVDT_CFG *p_cfg)
if (p_cfg->num_codec != 0)
{
*(*p)++ = AVDT_CAT_CODEC;
- len = p_cfg->codec_info[0] + 1;
- if( len > AVDT_CODEC_SIZE )
+ len = p_cfg->codec_info[0] + 1;
+ if( len > AVDT_CODEC_SIZE )
len = AVDT_CODEC_SIZE;
memcpy(*p, p_cfg->codec_info, len);
*p += len;
}
-
+
/* content protection */
if (p_cfg->num_protect != 0)
- {
+ {
*(*p)++ = AVDT_CAT_PROTECT;
- len = p_cfg->protect_info[0] + 1;
+ len = p_cfg->protect_info[0] + 1;
if( len > AVDT_PROTECT_SIZE )
len = AVDT_PROTECT_SIZE;
-
+
memcpy(*p, p_cfg->protect_info, len);
*p += len;
}
@@ -354,7 +366,7 @@ static void avdt_msg_bld_cfg(UINT8 **p, tAVDT_CFG *p_cfg)
** Function avdt_msg_bld_none
**
** Description This message building function builds an empty message.
-**
+**
**
** Returns void.
**
@@ -370,7 +382,7 @@ static void avdt_msg_bld_none(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a message containing
** a single SEID.
-**
+**
**
** Returns void.
**
@@ -386,7 +398,7 @@ static void avdt_msg_bld_single(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a set configuration
** command message.
-**
+**
**
** Returns void.
**
@@ -404,7 +416,7 @@ static void avdt_msg_bld_setconfig_cmd(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a reconfiguration
** command message.
-**
+**
**
** Returns void.
**
@@ -424,7 +436,7 @@ static void avdt_msg_bld_reconfig_cmd(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a message containing
** multiple SEID's.
-**
+**
**
** Returns void.
**
@@ -445,7 +457,7 @@ static void avdt_msg_bld_multi(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a security
** command message.
-**
+**
** Returns void.
**
*******************************************************************************/
@@ -478,7 +490,7 @@ static void avdt_msg_bld_delay_rpt(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a discover
** response message.
-**
+**
**
** Returns void.
**
@@ -503,7 +515,7 @@ static void avdt_msg_bld_discover_rsp(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a message containing
** service capabilities parameters.
-**
+**
**
** Returns void.
**
@@ -524,7 +536,7 @@ static void avdt_msg_bld_svccap(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a message containing
** service capabilities parameters.
-**
+**
**
** Returns void.
**
@@ -540,7 +552,7 @@ static void avdt_msg_bld_all_svccap(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message building function builds a security
** response message.
-**
+**
**
** Returns void.
**
@@ -557,9 +569,9 @@ static void avdt_msg_bld_security_rsp(UINT8 **p, tAVDT_MSG *p_msg)
**
** Description This message parsing function parses the configuration
** parameters field of a message.
-**
**
-** Returns Error code or zero if no error, and element that failed
+**
+** Returns Error code or zero if no error, and element that failed
** in p_elem.
**
*******************************************************************************/
@@ -622,7 +634,7 @@ static UINT8 avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, UINT8 *p, UINT16 len, UINT8* p_e
continue;
}
}
-
+
if ((elem_len > avdt_msg_ie_len_max[elem]) ||
(elem_len < avdt_msg_ie_len_min[elem]))
{
@@ -675,8 +687,8 @@ static UINT8 avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, UINT8 *p, UINT16 len, UINT8* p_e
case AVDT_CAT_MUX:
/* verify length */
AVDT_TRACE_WARNING2("psc_mask=0x%x elem_len=%d", p_cfg->psc_mask, elem_len);
- if( ((0 == (p_cfg->psc_mask & (AVDT_PSC_RECOV|AVDT_PSC_REPORT))) && (elem_len != 3))
- || ((p_cfg->psc_mask & AVDT_PSC_RECOV) && (elem_len != 7))
+ if( ((0 == (p_cfg->psc_mask & (AVDT_PSC_RECOV|AVDT_PSC_REPORT))) && (elem_len != 3))
+ || ((p_cfg->psc_mask & AVDT_PSC_RECOV) && (elem_len != 7))
|| ((p_cfg->psc_mask & AVDT_PSC_REPORT) && (elem_len != 5)) )
{
err = AVDT_ERR_MUX_FMT;
@@ -752,7 +764,7 @@ static UINT8 avdt_msg_prs_cfg(tAVDT_CFG *p_cfg, UINT8 *p, UINT16 len, UINT8* p_e
**
** Description This message parsing function parses a message with no parameters.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -768,7 +780,7 @@ static UINT8 avdt_msg_prs_none(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parses a message with a
** single SEID.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -800,7 +812,7 @@ static UINT8 avdt_msg_prs_single(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parses a set configuration
** command message.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -808,7 +820,7 @@ static UINT8 avdt_msg_prs_single(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
static UINT8 avdt_msg_prs_setconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
{
UINT8 err = 0;
-
+
p_msg->hdr.err_param = 0;
/* verify len */
@@ -817,7 +829,7 @@ static UINT8 avdt_msg_prs_setconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
err = AVDT_ERR_LENGTH;
}
else
- {
+ {
/* get seids */
AVDT_MSG_PRS_SEID(p, p_msg->config_cmd.hdr.seid);
if (avdt_scb_by_hdl(p_msg->config_cmd.hdr.seid) == NULL)
@@ -859,7 +871,7 @@ static UINT8 avdt_msg_prs_setconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parses a reconfiguration
** command message.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -867,7 +879,7 @@ static UINT8 avdt_msg_prs_setconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
static UINT8 avdt_msg_prs_reconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
{
UINT8 err = 0;
-
+
p_msg->hdr.err_param = 0;
/* verify len */
@@ -876,7 +888,7 @@ static UINT8 avdt_msg_prs_reconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
err = AVDT_ERR_LENGTH;
}
else
- {
+ {
/* get seid */
AVDT_MSG_PRS_SEID(p, p_msg->reconfig_cmd.hdr.seid);
if (avdt_scb_by_hdl(p_msg->reconfig_cmd.hdr.seid) == NULL)
@@ -910,7 +922,7 @@ static UINT8 avdt_msg_prs_reconfig_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parses a message containing
** multiple SEID's.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -952,7 +964,7 @@ static UINT8 avdt_msg_prs_multi(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parses a security
** command message.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -989,7 +1001,7 @@ static UINT8 avdt_msg_prs_security_cmd(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parses a discover
** response message.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -1034,7 +1046,7 @@ static UINT8 avdt_msg_prs_discover_rsp(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parses a message containing
** service capabilities parameters.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -1057,7 +1069,7 @@ static UINT8 avdt_msg_prs_svccap(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parses a message containing
** service capabilities parameters.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -1078,7 +1090,7 @@ static UINT8 avdt_msg_prs_all_svccap(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Description This message parsing function parsing a security
** response message.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -1095,8 +1107,8 @@ static UINT8 avdt_msg_prs_security_rsp(tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
**
** Function avdt_msg_prs_rej
**
-** Description
-**
+** Description
+**
**
** Returns Error code or zero if no error.
**
@@ -1117,7 +1129,7 @@ static UINT8 avdt_msg_prs_rej(tAVDT_MSG *p_msg, UINT8 *p, UINT8 sig)
{
p_msg->hdr.err_code = *p;
}
-
+
return 0;
}
@@ -1127,7 +1139,7 @@ static UINT8 avdt_msg_prs_rej(tAVDT_MSG *p_msg, UINT8 *p, UINT8 sig)
**
** Description This message parsing function parses a security
** command message.
-**
+**
**
** Returns Error code or zero if no error.
**
@@ -1166,7 +1178,7 @@ static UINT8 avdt_msg_prs_delay_rpt (tAVDT_MSG *p_msg, UINT8 *p, UINT16 len)
** Function avdt_msg_send
**
** Description Send, and if necessary fragment the next message.
-**
+**
**
** Returns Congested state; TRUE if CCB congested, FALSE if not.
**
@@ -1183,7 +1195,7 @@ BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg)
UINT8 msg;
UINT8 sig;
UINT8 nosp = 0; /* number of subsequent packets */
-
+
/* look up transport channel table entry to get peer mtu */
p_tbl = avdt_ad_tc_tbl_by_type(AVDT_CHAN_SIG, p_ccb, NULL);
@@ -1325,7 +1337,7 @@ BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg)
** Function avdt_msg_asmbl
**
** Description Reassemble incoming message.
-**
+**
**
** Returns Pointer to reassembled message; NULL if no message
** available.
@@ -1447,7 +1459,7 @@ BT_HDR *avdt_msg_asmbl(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
** from the AVDTP command pool, executes the message building
** function for this message type. It then queues the message
** in the command queue for this CCB.
-**
+**
**
** Returns Nothing.
**
@@ -1516,7 +1528,7 @@ void avdt_msg_send_cmd(tAVDT_CCB *p_ccb, void *p_scb, UINT8 sig_id, tAVDT_MSG *p
** from the AVDTP command pool, executes the message building
** function for this message type. It then queues the message
** in the response queue for this CCB.
-**
+**
**
** Returns Nothing.
**
@@ -1561,7 +1573,7 @@ void avdt_msg_send_rsp(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params)
** message based on the message type and the error code.
** It then queues the message in the response queue for
** this CCB.
-**
+**
**
** Returns Nothing.
**
@@ -1579,7 +1591,7 @@ void avdt_msg_send_rej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params)
/* set up gki buf pointer and offset */
p_buf->offset = AVDT_MSG_OFFSET;
p_start = p = (UINT8 *)(p_buf + 1) + p_buf->offset;
-
+
/* if sig id included, build into message */
if (sig_id != AVDT_SIG_NONE)
{
@@ -1622,7 +1634,7 @@ void avdt_msg_send_rej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params)
** message based on the message type and the error code.
** It then queues the message in the response queue for
** this CCB.
-**
+**
**
** Returns Nothing.
**
@@ -1640,7 +1652,7 @@ void avdt_msg_send_grej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params)
/* set up gki buf pointer and offset */
p_buf->offset = AVDT_MSG_OFFSET;
p_start = p = (UINT8 *)(p_buf + 1) + p_buf->offset;
-
+
/* calculate length */
p_buf->len = (UINT16) (p - p_start);
@@ -1664,7 +1676,7 @@ void avdt_msg_send_grej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params)
** incoming message is received on the signaling channel.
** It parses the message and sends an event to the appropriate
** SCB or CCB for the message.
-**
+**
**
** Returns Nothing.
**
@@ -1750,7 +1762,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
msg.discover_rsp.p_sep_info = (tAVDT_SEP_INFO *) p_ccb->p_proc_data;
msg.discover_rsp.num_seps = p_ccb->proc_param;
}
- else if ((msg_type == AVDT_MSG_TYPE_RSP) &&
+ else if ((msg_type == AVDT_MSG_TYPE_RSP) &&
((sig == AVDT_SIG_GETCAP) || (sig == AVDT_SIG_GET_ALLCAP)))
{
/* parse discover rsp message to struct supplied by app */
@@ -1764,7 +1776,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
else if ((msg_type == AVDT_MSG_TYPE_CMD) && (sig == AVDT_SIG_SETCONFIG))
{
/* parse config cmd message to struct allocated locally */
- msg.config_cmd.p_cfg = &cfg;
+ msg.config_cmd.p_cfg = &cfg;
}
else if ((msg_type == AVDT_MSG_TYPE_CMD) && (sig == AVDT_SIG_RECONFIG))
{
@@ -1833,7 +1845,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
}
}
}
-
+
if (ok)
{
/* if it's a ccb event send to ccb */
@@ -1844,7 +1856,7 @@ void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf)
/* if it's a scb event */
else
{
- /* Scb events always have a single seid. For cmd, get seid from
+ /* Scb events always have a single seid. For cmd, get seid from
** message. For rej and rsp, get seid from p_curr_cmd.
*/
if (msg_type == AVDT_MSG_TYPE_CMD)
diff --git a/stack/avdt/avdt_scb.c b/stack/avdt/avdt_scb.c
index 346d1ad..b44af06 100644
--- a/stack/avdt/avdt_scb.c
+++ b/stack/avdt/avdt_scb.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: avdt_scb.c
-**
-** Description: This module contains the stream control block and
-** functions which operate on the stream control block.
-**
-** Copyright (c) 2002-2008, Broadcom Corp., All Rights Reserved.
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This module contains the stream control block and functions which
+ * operate on the stream control block.
+ *
+ ******************************************************************************/
#include <string.h>
#include "data_types.h"
@@ -86,7 +99,7 @@ const char * const avdt_scb_evt_str[] = {
"CC_CLOSE_EVT"
};
-#endif
+#endif
/* action function list */
@@ -503,7 +516,7 @@ const tAVDT_SCB_ST_TBL avdt_scb_st_tbl[] = {
** Function avdt_scb_event
**
** Description State machine event handling function for scb
-**
+**
**
** Returns Nothing.
**
@@ -552,7 +565,7 @@ void avdt_scb_event(tAVDT_SCB *p_scb, UINT8 event, tAVDT_SCB_EVT *p_data)
** Function avdt_scb_init
**
** Description Initialize stream control block module.
-**
+**
**
** Returns Nothing.
**
@@ -569,7 +582,7 @@ void avdt_scb_init(void)
** Function avdt_scb_alloc
**
** Description Allocate a stream control block.
-**
+**
**
** Returns pointer to the scb, or NULL if none could be allocated.
**
@@ -608,7 +621,7 @@ tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs)
break;
}
}
-
+
if (i == AVDT_NUM_SEPS)
{
/* out of ccbs */
@@ -624,7 +637,7 @@ tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs)
** Function avdt_scb_dealloc
**
** Description Deallocate a stream control block.
-**
+**
**
** Returns void.
**
@@ -652,7 +665,7 @@ void avdt_scb_dealloc(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
** Function avdt_scb_to_hdl
**
** Description Given a pointer to an scb, return its handle (or seid).
-**
+**
**
** Returns Index of scb.
**
@@ -667,7 +680,7 @@ UINT8 avdt_scb_to_hdl(tAVDT_SCB *p_scb)
** Function avdt_scb_by_hdl
**
** Description Given an scb handle (or seid), return a pointer to the scb.
-**
+**
**
** Returns Pointer to scb or NULL if index is out of range or scb
** is not allocated.
@@ -681,7 +694,7 @@ tAVDT_SCB *avdt_scb_by_hdl(UINT8 hdl)
if ((hdl > 0) && (hdl <= AVDT_NUM_SEPS))
{
p_scb = &avdt_cb.scb[hdl - 1];
-
+
/* verify scb is allocated */
if (!p_scb->allocated)
{
@@ -702,7 +715,7 @@ tAVDT_SCB *avdt_scb_by_hdl(UINT8 hdl)
** Function avdt_scb_verify
**
** Description Verify the condition of a list of scbs.
-**
+**
**
** Returns SEID that failed, or 0 if success.
**
@@ -766,7 +779,7 @@ UINT8 avdt_scb_verify(tAVDT_CCB *p_ccb, UINT8 state, UINT8 *p_seid, UINT16 num_s
**
** Description Given a list of SCB handles, return a list of peer SEIDs
** for the handles, copied in place into the struct passed in.
-**
+**
**
** Returns Nothing.
**
diff --git a/stack/avdt/avdt_scb_act.c b/stack/avdt/avdt_scb_act.c
index 1784713..c2ced74 100644
--- a/stack/avdt/avdt_scb_act.c
+++ b/stack/avdt/avdt_scb_act.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: avdt_scb_act.c
-**
-** Description: This module contains the action functions associated
-** with the stream control block state machine.
-**
-** Copyright (c) 2002-2008, Broadcom Corp., All Rights Reserved.
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This module contains the action functions associated with the stream
+ * control block state machine.
+ *
+ ******************************************************************************/
#include <string.h>
#include "data_types.h"
@@ -25,15 +38,15 @@
** allowing for this table.
*/
const UINT8 avdt_scb_cback_evt[] = {
- 0, /* API_REMOVE_EVT (no event) */
- AVDT_WRITE_CFM_EVT, /* API_WRITE_REQ_EVT */
- 0, /* API_GETCONFIG_REQ_EVT (no event) */
+ 0, /* API_REMOVE_EVT (no event) */
+ AVDT_WRITE_CFM_EVT, /* API_WRITE_REQ_EVT */
+ 0, /* API_GETCONFIG_REQ_EVT (no event) */
0, /* API_DELAY_RPT_REQ_EVT (no event) */
- AVDT_OPEN_CFM_EVT, /* API_SETCONFIG_REQ_EVT */
- AVDT_OPEN_CFM_EVT, /* API_OPEN_REQ_EVT */
- AVDT_CLOSE_CFM_EVT, /* API_CLOSE_REQ_EVT */
- AVDT_RECONFIG_CFM_EVT, /* API_RECONFIG_REQ_EVT */
- AVDT_SECURITY_CFM_EVT, /* API_SECURITY_REQ_EVT */
+ AVDT_OPEN_CFM_EVT, /* API_SETCONFIG_REQ_EVT */
+ AVDT_OPEN_CFM_EVT, /* API_OPEN_REQ_EVT */
+ AVDT_CLOSE_CFM_EVT, /* API_CLOSE_REQ_EVT */
+ AVDT_RECONFIG_CFM_EVT, /* API_RECONFIG_REQ_EVT */
+ AVDT_SECURITY_CFM_EVT, /* API_SECURITY_REQ_EVT */
0 /* API_ABORT_REQ_EVT (no event) */
};
@@ -214,7 +227,7 @@ void avdt_scb_hdl_open_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
**
** Function avdt_scb_hdl_pkt_no_frag
**
-** Description
+** Description
**
** Returns Nothing.
**
@@ -261,7 +274,7 @@ void avdt_scb_hdl_pkt_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
/* padding length in last byte of packet */
pad_len = *(p_start + p_data->p_pkt->len);
}
-
+
/* do sanity check */
if ((offset > p_data->p_pkt->len) || ((pad_len + offset) > p_data->p_pkt->len))
{
@@ -285,7 +298,7 @@ void avdt_scb_hdl_pkt_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
{
#if AVDT_MULTIPLEXING == TRUE
if ((p_scb->cs.p_media_cback != NULL)
- && (p_scb->p_media_buf != NULL)
+ && (p_scb->p_media_buf != NULL)
&& (p_scb->media_buf_len > p_data->p_pkt->len))
{
/* media buffer enough length is assigned by application. Lets use it*/
@@ -305,7 +318,7 @@ void avdt_scb_hdl_pkt_no_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
**
** Function avdt_scb_hdl_report
**
-** Description
+** Description
**
** Returns Nothing.
**
@@ -382,7 +395,7 @@ UINT8 * avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
**
** Function avdt_scb_hdl_pkt_frag
**
-** Description
+** Description
**
** Returns Nothing.
**
@@ -423,7 +436,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
al_tsid = (*p)>>3;
al_frag = ( (*p) >> 2 ) & 0x01;
al_lcode = (*p++) & AVDT_ALH_LCODE_MASK;
-
+
/* in case of TSID=00000, a second AL header byte, before the length field,
** is expected and contains the actual TSID, aligned with MSB */
if(al_tsid == 0)
@@ -451,8 +464,8 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
if(frag_len >= al_len)
frag_len = al_len;
- /* check TSID corresponds to config */
- if (al_tsid != p_scb->curr_cfg.mux_tsid_media)
+ /* check TSID corresponds to config */
+ if (al_tsid != p_scb->curr_cfg.mux_tsid_media)
{
#if AVDT_REPORTING == TRUE
if((p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT) &&
@@ -470,7 +483,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
}
}
/* check are buffer for assembling and related callback set */
- else if ((p_scb->p_media_buf == NULL) || (p_scb->cs.p_media_cback == NULL))
+ else if ((p_scb->p_media_buf == NULL) || (p_scb->cs.p_media_cback == NULL))
{
AVDT_TRACE_WARNING0("NULL p_media_buf or p_media_cback");
break;
@@ -486,19 +499,19 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
p_scb->frag_off = 0;
p_scb->frag_org_len = al_len; /* total length of original media packet */
/* length check: minimum length of media header is 12 */
- if (p_scb->frag_org_len < 12)
+ if (p_scb->frag_org_len < 12)
{
AVDT_TRACE_WARNING1("bad al_len: %d(<12)", al_len);
break;
}
/* check that data fit into buffer */
- if (al_len > p_scb->media_buf_len)
+ if (al_len > p_scb->media_buf_len)
{
AVDT_TRACE_WARNING2("bad al_len: %d(>%d)", al_len, p_scb->media_buf_len);
break;
}
/* make sure it is the last fragment in l2cap packet */
- if (p + al_len < p_end)
+ if (p + al_len < p_end)
{
AVDT_TRACE_WARNING2("bad al_len: %d(>%d)", al_len, p_scb->media_buf_len);
break;
@@ -513,13 +526,13 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
if(al_len != p_scb->frag_org_len - p_scb->frag_off)
{
AVDT_TRACE_WARNING4("al_len:%d != (frag_org_len:%d - frag_off:%d) %d",
- al_len, p_scb->frag_org_len, p_scb->frag_off,
+ al_len, p_scb->frag_org_len, p_scb->frag_off,
(p_scb->frag_org_len- p_scb->frag_off));
break;
}
/* do sanity check */
- if (p_scb->frag_off == 0)
+ if (p_scb->frag_off == 0)
{
AVDT_TRACE_WARNING0("frag_off=0");
break;
@@ -532,7 +545,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
p_scb->frag_off, p_scb->frag_org_len, p_scb->media_buf_len);
break;
}
-
+
AVDT_TRACE_DEBUG4("Received fragment org_len=%d off=%d al_len=%d frag_len=%d",
p_scb->frag_org_len, p_scb->frag_off, al_len, frag_len);
@@ -612,7 +625,7 @@ void avdt_scb_hdl_pkt_frag(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
**
** Function avdt_scb_hdl_pkt
**
-** Description
+** Description
**
** Returns Nothing.
**
@@ -629,7 +642,7 @@ void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
{
avdt_scb_hdl_pkt_frag(p_scb, p_data);
}
- else
+ else
#endif
#if AVDT_REPORTING == TRUE
if(p_data->p_pkt->layer_specific == AVDT_CHAN_REPORT)
@@ -718,7 +731,7 @@ void avdt_scb_hdl_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
memcpy(p_scb->curr_cfg.protect_info, p_scb->req_cfg.protect_info, AVDT_PROTECT_SIZE);
}
}
-
+
p_data->msg.svccap.p_cfg = &p_scb->curr_cfg;
/* call application callback */
@@ -861,7 +874,7 @@ void avdt_scb_hdl_setconfig_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
void avdt_scb_hdl_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
{
tAVDT_EVT_HDR single;
-
+
if (p_scb->p_ccb != NULL)
{
/* save configuration */
@@ -950,9 +963,9 @@ void avdt_scb_hdl_suspend_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
** Function avdt_scb_hdl_tc_close
**
** Description This function is called when the transport channel is
-** closed. It marks the SCB as not in use and
-** initializes certain SCB parameters. It then sends
-** an AVDT_CCB_UL_CLOSE_EVT to the CCB if the SCB
+** closed. It marks the SCB as not in use and
+** initializes certain SCB parameters. It then sends
+** an AVDT_CCB_UL_CLOSE_EVT to the CCB if the SCB
** initiated the close. It then checks to see if the SCB
** is to be removed. If it is it deallocates the SCB. Finally,
** it calls the application callback with a close indication.
@@ -1000,7 +1013,7 @@ void avdt_scb_hdl_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
if (p_scb->remove)
{
- avdt_scb_dealloc(p_scb, NULL);
+ avdt_scb_dealloc(p_scb, NULL);
}
/* call app callback */
@@ -1122,7 +1135,7 @@ void avdt_scb_hdl_tc_open(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
/* stop transport channel connect timer */
btu_stop_timer(&p_scb->timer_entry);
-
+
event = (p_scb->role == AVDT_OPEN_INT) ? AVDT_OPEN_CFM_EVT : AVDT_OPEN_IND_EVT;
p_data->open.hdr.err_code = 0;
@@ -1330,7 +1343,7 @@ void avdt_scb_snd_abort_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
tAVDT_EVT_HDR hdr;
if (p_scb->p_ccb != NULL)
- {
+ {
p_scb->role = AVDT_CLOSE_INT;
hdr.seid = p_scb->peer_seid;
@@ -1493,7 +1506,7 @@ void avdt_scb_snd_open_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
/* send response */
avdt_msg_send_rsp(p_scb->p_ccb, AVDT_SIG_OPEN, &p_data->msg);
-
+
/* start tc connect timer */
btu_start_timer(&p_scb->timer_entry, BTU_TTYPE_AVDT_SCB_TC, AVDT_SCB_TC_CONN_TOUT);
}
@@ -1548,7 +1561,7 @@ void avdt_scb_snd_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
{
/* send reject */
avdt_msg_send_rej(p_scb->p_ccb, AVDT_SIG_RECONFIG, &p_data->msg);
- }
+ }
}
/*******************************************************************************