summaryrefslogtreecommitdiffstats
path: root/bta/ag
diff options
context:
space:
mode:
Diffstat (limited to 'bta/ag')
-rw-r--r--bta/ag/bta_ag_act.c97
-rw-r--r--bta/ag/bta_ag_api.c61
-rw-r--r--bta/ag/bta_ag_at.c49
-rw-r--r--bta/ag/bta_ag_at.h39
-rw-r--r--bta/ag/bta_ag_cfg.c35
-rw-r--r--bta/ag/bta_ag_ci.c44
-rw-r--r--[-rwxr-xr-x]bta/ag/bta_ag_cmd.c290
-rw-r--r--[-rwxr-xr-x]bta/ag/bta_ag_int.h42
-rw-r--r--bta/ag/bta_ag_main.c126
-rw-r--r--bta/ag/bta_ag_rfc.c63
-rw-r--r--bta/ag/bta_ag_sco.c172
-rw-r--r--[-rwxr-xr-x]bta/ag/bta_ag_sdp.c67
12 files changed, 618 insertions, 467 deletions
diff --git a/bta/ag/bta_ag_act.c b/bta/ag/bta_ag_act.c
index de59aa5..5f72444 100644
--- a/bta/ag/bta_ag_act.c
+++ b/bta/ag/bta_ag_act.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_ag_act.c
-**
-** Description: This file contains action functions for the audio gateway.
-**
-** Copyright (c) 2003-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-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 action functions for the audio gateway.
+ *
+ ******************************************************************************/
#include "bta_api.h"
#include "bd.h"
@@ -39,11 +52,11 @@ const UINT16 bta_ag_uuid[BTA_AG_NUM_IDX] =
const UINT8 bta_ag_sec_id[BTA_AG_NUM_IDX] =
{
- BTM_SEC_SERVICE_HEADSET_AG,
+ BTM_SEC_SERVICE_HEADSET_AG,
BTM_SEC_SERVICE_AG_HANDSFREE
};
-const tBTA_SERVICE_ID bta_ag_svc_id[BTA_AG_NUM_IDX] =
+const tBTA_SERVICE_ID bta_ag_svc_id[BTA_AG_NUM_IDX] =
{
BTA_HSP_SERVICE_ID,
BTA_HFP_SERVICE_ID
@@ -53,7 +66,7 @@ const tBTA_SERVICE_MASK bta_ag_svc_mask[BTA_AG_NUM_IDX] =
{
BTA_HSP_SERVICE_MASK,
BTA_HFP_SERVICE_MASK
-};
+};
typedef void (*tBTA_AG_ATCMD_CBACK)(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
char *p_arg, INT16 int_arg);
@@ -69,7 +82,7 @@ const tBTA_AG_ATCMD_CBACK bta_ag_at_cback_tbl[BTA_AG_NUM_IDX] =
** Function bta_ag_cback_open
**
** Description Send open callback event to application.
-**
+**
**
** Returns void
**
@@ -93,7 +106,7 @@ static void bta_ag_cback_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data, tBTA_AG_
bdcpy(open.bd_addr, p_scb->peer_addr);
}
- (*bta_ag_cb.p_cback)(BTA_AG_OPEN_EVT, (tBTA_AG *) &open);
+ (*bta_ag_cb.p_cback)(BTA_AG_OPEN_EVT, (tBTA_AG *) &open);
}
/*******************************************************************************
@@ -102,7 +115,7 @@ static void bta_ag_cback_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data, tBTA_AG_
**
** Description This function initializes values of the AG cb and sets up
** the SDP record for the services.
-**
+**
**
** Returns void
**
@@ -136,7 +149,7 @@ void bta_ag_register(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
**
** Description This function removes the sdp records, closes the RFCOMM
** servers, and deallocates the service control block.
-**
+**
**
** Returns void
**
@@ -161,7 +174,7 @@ void bta_ag_deregister(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_start_dereg
**
** Description Start a deregister event.
-**
+**
**
** Returns void
**
@@ -180,7 +193,7 @@ void bta_ag_start_dereg(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_start_open
**
** Description This starts an AG open.
-**
+**
**
** Returns void
**
@@ -222,7 +235,7 @@ void bta_ag_start_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_disc_int_res
**
** Description This function handles a discovery result when initiator.
-**
+**
**
** Returns void
**
@@ -290,7 +303,7 @@ void bta_ag_disc_int_res(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_disc_acp_res
**
** Description This function handles a discovery result when acceptor.
-**
+**
**
** Returns void
**
@@ -314,7 +327,7 @@ void bta_ag_disc_acp_res(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_disc_fail
**
** Description This function handles a discovery failure.
-**
+**
**
** Returns void
**
@@ -323,7 +336,7 @@ void bta_ag_disc_fail(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
/* reopen registered servers */
bta_ag_start_servers(p_scb, p_scb->reg_services);
-
+
/* reinitialize stuff */
/* call open cback w. failure */
@@ -351,7 +364,7 @@ void bta_ag_open_fail(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_rfc_fail
**
** Description RFCOMM connection failed.
-**
+**
**
** Returns void
**
@@ -372,7 +385,7 @@ void bta_ag_rfc_fail(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
/* reopen registered servers */
bta_ag_start_servers(p_scb, p_scb->reg_services);
-
+
/* call open cback w. failure */
bta_ag_cback_open(p_scb, NULL, BTA_AG_FAIL_RFCOMM);
}
@@ -382,7 +395,7 @@ void bta_ag_rfc_fail(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_rfc_close
**
** Description RFCOMM connection closed.
-**
+**
**
** Returns void
**
@@ -448,7 +461,7 @@ void bta_ag_rfc_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
/* Make sure SCO state is BTA_AG_SCO_SHUTDOWN_ST */
bta_ag_sco_shutdown(p_scb, NULL);
-
+
/* Check if all the SLCs are down */
for (i = 0; i < BTA_AG_NUM_SCB; i++)
{
@@ -460,7 +473,7 @@ void bta_ag_rfc_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
}
-
+
}
/* else close port and deallocate scb */
else
@@ -475,7 +488,7 @@ void bta_ag_rfc_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_rfc_open
**
** Description Handle RFCOMM channel open.
-**
+**
**
** Returns void
**
@@ -521,7 +534,7 @@ void bta_ag_rfc_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_rfc_acp_open
**
** Description Handle RFCOMM channel open when accepting connection.
-**
+**
**
** Returns void
**
@@ -545,7 +558,7 @@ void bta_ag_rfc_acp_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
APPL_TRACE_DEBUG1 ("bta_ag_rfc_acp_open error PORT_CheckConnection returned status %d", status);
}
-
+
/* Collision Handling */
for (i = 0, ag_scb = &bta_ag_cb.scb[0]; i < BTA_AG_NUM_SCB; i++, ag_scb++)
{
@@ -554,7 +567,7 @@ void bta_ag_rfc_acp_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
/* stop collision timer */
ag_scb->colli_tmr_on = FALSE;
bta_sys_stop_timer (&ag_scb->colli_timer);
-
+
if (bdcmp (dev_addr, ag_scb->peer_addr) == 0)
{
/* If incoming and outgoing device are same, nothing more to do. */
@@ -579,7 +592,7 @@ void bta_ag_rfc_acp_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
}
bdcpy (p_scb->peer_addr, dev_addr);
-
+
/* determine connected service from port handle */
for (i = 0; i < BTA_AG_NUM_IDX; i++)
{
@@ -615,7 +628,7 @@ void bta_ag_rfc_acp_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_rfc_data
**
** Description Read and process data from RFCOMM.
-**
+**
**
** Returns void
**
@@ -626,7 +639,7 @@ void bta_ag_rfc_data(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
char buf[BTA_AG_RFC_READ_MAX];
memset(buf, 0, BTA_AG_RFC_READ_MAX);
-
+
/* do the following */
for(;;)
{
@@ -658,7 +671,7 @@ void bta_ag_rfc_data(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_start_close
**
** Description Start the process of closing SCO and RFCOMM connection.
-**
+**
**
** Returns void
**
@@ -689,7 +702,7 @@ void bta_ag_start_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_post_sco_open
**
** Description Perform post-SCO open action, if any
-**
+**
**
** Returns void
**
@@ -718,7 +731,7 @@ void bta_ag_post_sco_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_post_sco_close
**
** Description Perform post-SCO close action, if any
-**
+**
**
** Returns void
**
@@ -742,7 +755,7 @@ void bta_ag_post_sco_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
p_scb->post_sco = BTA_AG_POST_SCO_NONE;
break;
- case BTA_AG_POST_SCO_CALL_END:
+ case BTA_AG_POST_SCO_CALL_END:
bta_ag_send_call_inds(p_scb, BTA_AG_END_CALL_RES);
p_scb->post_sco = BTA_AG_POST_SCO_NONE;
break;
@@ -775,7 +788,7 @@ void bta_ag_post_sco_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_svc_conn_open
**
** Description Service level connection opened
-**
+**
**
** Returns void
**
@@ -809,7 +822,7 @@ void bta_ag_svc_conn_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
}
- (*bta_ag_cb.p_cback)(BTA_AG_CONN_EVT, (tBTA_AG *) &evt);
+ (*bta_ag_cb.p_cback)(BTA_AG_CONN_EVT, (tBTA_AG *) &evt);
}
}
@@ -827,7 +840,7 @@ void bta_ag_ci_rx_data(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
UINT16 len;
tBTA_AG_CI_RX_WRITE *p_rx_write_msg = (tBTA_AG_CI_RX_WRITE *)p_data;
char *p_data_area = (char *)(p_rx_write_msg+1); /* Point to data area after header */
-
+
/* send to RFCOMM */
PORT_WriteData(p_scb->conn_handle, p_data_area, strlen(p_data_area), &len);
}
diff --git a/bta/ag/bta_ag_api.c b/bta/ag/bta_ag_api.c
index d2e38e2..07dceb9 100644
--- a/bta/ag/bta_ag_api.c
+++ b/bta/ag/bta_ag_api.c
@@ -1,15 +1,28 @@
-/*****************************************************************************
-**
-** Name: bta_ag_api.c
-**
-** Description: This is the implementation of the API for the audio gateway
-** (AG) subsystem of BTA, Widcomm's Bluetooth application
-** layer for mobile phones.
-**
-** Copyright (c) 2003-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-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 is the implementation of the API for the audio gateway (AG)
+ * subsystem of BTA, Broadcom's Bluetooth application layer for mobile
+ * phones.
+ *
+ ******************************************************************************/
#include "bta_api.h"
#include "bd.h"
@@ -33,7 +46,7 @@ static const tBTA_SYS_REG bta_ag_reg =
**
** Function BTA_AgEnable
**
-** Description Enable the audio gateway service. When the enable
+** Description Enable the audio gateway service. When the enable
** operation is complete the callback function will be
** called with a BTA_AG_ENABLE_EVT. This function must
** be called before other function in the AG API are
@@ -71,7 +84,7 @@ tBTA_STATUS BTA_AgEnable(tBTA_AG_PARSE_MODE parse_mode, tBTA_AG_CBACK *p_cback)
}
return BTA_SUCCESS;
-
+
}
/*******************************************************************************
@@ -79,7 +92,7 @@ tBTA_STATUS BTA_AgEnable(tBTA_AG_PARSE_MODE parse_mode, tBTA_AG_CBACK *p_cback)
** Function BTA_AgDisable
**
** Description Disable the audio gateway service
-**
+**
**
** Returns void
**
@@ -139,7 +152,7 @@ void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask,tBTA_AG_FEAT f
** Function BTA_AgDeregister
**
** Description Deregister an audio gateway service.
-**
+**
**
** Returns void
**
@@ -164,7 +177,7 @@ void BTA_AgDeregister(UINT16 handle)
** When connection is open callback function is called
** with a BTA_AG_OPEN_EVT. Only the data connection is
** opened. The audio connection is not opened.
-**
+**
**
** Returns void
**
@@ -190,7 +203,7 @@ void BTA_AgOpen(UINT16 handle, BD_ADDR bd_addr, tBTA_SEC sec_mask, tBTA_SERVICE_
**
** Description Close the current connection to a headset or a handsfree
** Any current audio connection will also be closed.
-**
+**
**
** Returns void
**
@@ -213,7 +226,7 @@ void BTA_AgClose(UINT16 handle)
**
** Description Opens an audio connection to the currently connected
** headset or hnadsfree.
-**
+**
**
** Returns void
**
@@ -236,7 +249,7 @@ void BTA_AgAudioOpen(UINT16 handle)
**
** Description Close the currently active audio connection to a headset
** or hnadsfree. The data connection remains open
-**
+**
**
** Returns void
**
@@ -259,7 +272,7 @@ void BTA_AgAudioClose(UINT16 handle)
** Function BTA_AgResult
**
** Description Send an AT result code to a headset or hands-free device.
-** This function is only used when the AG parse mode is set
+** This function is only used when the AG parse mode is set
** to BTA_AG_PARSE.
**
**
@@ -287,9 +300,9 @@ void BTA_AgResult(UINT16 handle, tBTA_AG_RES result, tBTA_AG_RES_DATA *p_data)
**
** Function BTA_AgSetCodec
**
-** Description Specify the codec type to be used for the subsequent
-** audio connection.
-**
+** Description Specify the codec type to be used for the subsequent
+** audio connection.
+**
**
**
** Returns void
diff --git a/bta/ag/bta_ag_at.c b/bta/ag/bta_ag_at.c
index 4d3bcac..74d3948 100644
--- a/bta/ag/bta_ag_at.c
+++ b/bta/ag/bta_ag_at.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_ag_at.c
-**
-** Description: BTA AG AT command interpreter.
-**
-** Copyright (c) 2004-2005, Widcomm Inc., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2004-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.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * BTA AG AT command interpreter.
+ *
+ ******************************************************************************/
#include <string.h>
#include "gki.h"
@@ -23,7 +36,7 @@
** Function bta_ag_at_init
**
** Description Initialize the AT command parser control block.
-**
+**
**
** Returns void
**
@@ -41,7 +54,7 @@ void bta_ag_at_init(tBTA_AG_AT_CB *p_cb)
** Description Re-initialize the AT command parser control block. This
** function resets the AT command parser state and frees
** any GKI buffer.
-**
+**
**
** Returns void
**
@@ -62,7 +75,7 @@ void bta_ag_at_reinit(tBTA_AG_AT_CB *p_cb)
** Description Parse AT commands. This function will take the input
** character string and parse it for AT commands according to
** the AT command table passed in the control block.
-**
+**
**
** Returns void
**
@@ -138,7 +151,7 @@ void bta_ag_process_at(tBTA_AG_AT_CB *p_cb)
}
else
{
-
+
(*p_cb->p_cmd_cback)(p_cb->p_user, idx, arg_type, p_arg, int_arg);
}
}
@@ -167,7 +180,7 @@ void bta_ag_process_at(tBTA_AG_AT_CB *p_cb)
** Description Parse AT commands. This function will take the input
** character string and parse it for AT commands according to
** the AT command table passed in the control block.
-**
+**
**
** Returns void
**
@@ -193,7 +206,7 @@ void bta_ag_at_parse(tBTA_AG_AT_CB *p_cb, char *p_buf, UINT16 len)
i++;
continue;
}
-
+
p_cb->p_cmd_buf[p_cb->cmd_pos] = p_buf[i++];
if ( p_cb->p_cmd_buf[p_cb->cmd_pos] == '\r' || p_cb->p_cmd_buf[p_cb->cmd_pos] == '\n')
{
@@ -209,8 +222,8 @@ void bta_ag_at_parse(tBTA_AG_AT_CB *p_cb, char *p_buf, UINT16 len)
}
p_cb->cmd_pos = 0;
-
- }
+
+ }
else if( p_cb->p_cmd_buf[p_cb->cmd_pos] == 0x1A || p_cb->p_cmd_buf[p_cb->cmd_pos] == 0x1B )
{
p_cb->p_cmd_buf[++p_cb->cmd_pos] = 0;
diff --git a/bta/ag/bta_ag_at.h b/bta/ag/bta_ag_at.h
index 2bdd6ae..90d7b0f 100644
--- a/bta/ag/bta_ag_at.h
+++ b/bta/ag/bta_ag_at.h
@@ -1,13 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_ag_at.h
-**
-** Description: Interface file for BTA AG AT command interpreter.
-**
-** Copyright (c) 2004-2005, Widcomm Inc., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2004-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.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * Interface file for BTA AG AT command interpreter.
+ *
+ ******************************************************************************/
#ifndef BTA_AG_AT_H
#define BTA_AG_AT_H
@@ -69,7 +82,7 @@ typedef struct
** Function bta_ag_at_init
**
** Description Initialize the AT command parser control block.
-**
+**
**
** Returns void
**
@@ -83,7 +96,7 @@ extern void bta_ag_at_init(tBTA_AG_AT_CB *p_cb);
** Description Re-initialize the AT command parser control block. This
** function resets the AT command parser state and frees
** any GKI buffer.
-**
+**
**
** Returns void
**
@@ -97,7 +110,7 @@ extern void bta_ag_at_reinit(tBTA_AG_AT_CB *p_cb);
** Description Parse AT commands. This function will take the input
** character string and parse it for AT commands according to
** the AT command table passed in the control block.
-**
+**
**
** Returns void
**
diff --git a/bta/ag/bta_ag_cfg.c b/bta/ag/bta_ag_cfg.c
index 4f878a4..e02f9f6 100644
--- a/bta/ag/bta_ag_cfg.c
+++ b/bta/ag/bta_ag_cfg.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: bta_ag_cfg.c
-**
-** Description: This file contains compile-time configurable constants
-** for the audio gateway.
-**
-** Copyright (c) 2003-2006, Broadcom Corp., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-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 compile-time configurable constants for the audio
+ * gateway.
+ *
+ ******************************************************************************/
#include "gki.h"
#include "bta_api.h"
diff --git a/bta/ag/bta_ag_ci.c b/bta/ag/bta_ag_ci.c
index bbd1a55..fd39e34 100644
--- a/bta/ag/bta_ag_ci.c
+++ b/bta/ag/bta_ag_ci.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_ag_ci.c
-**
-** Description: This is the implementation file for audio gateway call-in
-** functions.
-**
-** Copyright (c) 2003-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-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 is the implementation file for audio gateway call-in functions.
+ *
+ ******************************************************************************/
#include <string.h>
#include "bta_api.h"
@@ -21,11 +33,11 @@
**
** Function bta_ag_ci_rx_write
**
-** Description This function is called to send data to the AG when the AG
+** Description This function is called to send data to the AG when the AG
** is configured for AT command pass-through. The function
-** copies data to an event buffer and sends it.
+** copies data to an event buffer and sends it.
**
-** Returns void
+** Returns void
**
******************************************************************************/
void bta_ag_ci_rx_write(UINT16 handle, char *p_data, UINT16 len)
@@ -66,11 +78,11 @@ void bta_ag_ci_rx_write(UINT16 handle, char *p_data, UINT16 len)
**
** Function bta_ag_ci_slc_ready
**
-** Description This function is called to notify AG that SLC is up at
+** Description This function is called to notify AG that SLC is up at
** the application. This funcion is only used when the app
** is running in pass-through mode.
**
-** Returns void
+** Returns void
**
******************************************************************************/
void bta_ag_ci_slc_ready(UINT16 handle)
diff --git a/bta/ag/bta_ag_cmd.c b/bta/ag/bta_ag_cmd.c
index 0ee5153..d552eed 100755..100644
--- a/bta/ag/bta_ag_cmd.c
+++ b/bta/ag/bta_ag_cmd.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_ag_cmd.c
-**
-** Description: This file contains functions for processing AT commands
-** and results.
-**
-** Copyright (c) 2004-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2004-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 functions for processing AT commands and results.
+ *
+ ******************************************************************************/
#include "bta_api.h"
#include "bta_sys.h"
@@ -32,13 +44,13 @@
/* clip type constants */
-#define BTA_AG_CLIP_TYPE_MIN 128
-#define BTA_AG_CLIP_TYPE_MAX 175
+#define BTA_AG_CLIP_TYPE_MIN 128
+#define BTA_AG_CLIP_TYPE_MAX 175
#define BTA_AG_CLIP_TYPE_DEFAULT 129
#define BTA_AG_CLIP_TYPE_VOIP 255
#if defined(BTA_AG_MULTI_RESULT_INCLUDED) && (BTA_AG_MULTI_RESULT_INCLUDED == TRUE)
-#define BTA_AG_AT_MULTI_LEN 2
+#define BTA_AG_AT_MULTI_LEN 2
#define AT_SET_RES_CB(res_cb, c, p, i) {res_cb.code = c; res_cb.p_arg = p; res_cb.int_arg = i;}
/* type for AT result code block */
@@ -61,24 +73,24 @@ typedef struct
enum
{
BTA_AG_HS_CMD_CKPD,
- BTA_AG_HS_CMD_VGS,
+ BTA_AG_HS_CMD_VGS,
BTA_AG_HS_CMD_VGM
};
/* enumeration of HFP AT commands matches HFP command interpreter table */
enum
{
- BTA_AG_HF_CMD_A,
- BTA_AG_HF_CMD_D,
- BTA_AG_HF_CMD_VGS,
- BTA_AG_HF_CMD_VGM,
+ BTA_AG_HF_CMD_A,
+ BTA_AG_HF_CMD_D,
+ BTA_AG_HF_CMD_VGS,
+ BTA_AG_HF_CMD_VGM,
BTA_AG_HF_CMD_CCWA,
BTA_AG_HF_CMD_CHLD,
BTA_AG_HF_CMD_CHUP,
BTA_AG_HF_CMD_CIND,
BTA_AG_HF_CMD_CLIP,
BTA_AG_HF_CMD_CMER,
- BTA_AG_HF_CMD_VTS,
+ BTA_AG_HF_CMD_VTS,
BTA_AG_HF_CMD_BINP,
BTA_AG_HF_CMD_BLDN,
BTA_AG_HF_CMD_BVRA,
@@ -180,7 +192,7 @@ enum
};
#if defined(BTA_HSP_RESULT_REPLACE_COLON) && (BTA_HSP_RESULT_REPLACE_COLON == TRUE)
-#define COLON_IDX_4_VGSVGM 4
+#define COLON_IDX_4_VGSVGM 4
#endif
/* AT result code constant table (Indexed by result code) */
const tBTA_AG_RESULT bta_ag_result_tbl[] =
@@ -216,7 +228,7 @@ const tBTA_AG_AT_CMD *bta_ag_at_tbl[BTA_AG_NUM_IDX] =
/* callback event lookup table for HSP */
const tBTA_AG_EVT bta_ag_hsp_cb_evt[] =
-{
+{
BTA_AG_AT_CKPD_EVT, /* BTA_AG_HS_CMD_CKPD */
BTA_AG_SPK_EVT, /* BTA_AG_HS_CMD_VGS */
BTA_AG_MIC_EVT /* BTA_AG_HS_CMD_VGM */
@@ -226,16 +238,16 @@ const tBTA_AG_EVT bta_ag_hsp_cb_evt[] =
const tBTA_AG_EVT bta_ag_hfp_cb_evt[] =
{
BTA_AG_AT_A_EVT, /* BTA_AG_HF_CMD_A */
- BTA_AG_AT_D_EVT, /* BTA_AG_HF_CMD_D */
- BTA_AG_SPK_EVT, /* BTA_AG_HF_CMD_VGS */
- BTA_AG_MIC_EVT, /* BTA_AG_HF_CMD_VGM */
+ BTA_AG_AT_D_EVT, /* BTA_AG_HF_CMD_D */
+ BTA_AG_SPK_EVT, /* BTA_AG_HF_CMD_VGS */
+ BTA_AG_MIC_EVT, /* BTA_AG_HF_CMD_VGM */
0, /* BTA_AG_HF_CMD_CCWA */
BTA_AG_AT_CHLD_EVT, /* BTA_AG_HF_CMD_CHLD */
BTA_AG_AT_CHUP_EVT, /* BTA_AG_HF_CMD_CHUP */
BTA_AG_AT_CIND_EVT, /* BTA_AG_HF_CMD_CIND */
0, /* BTA_AG_HF_CMD_CLIP */
0, /* BTA_AG_HF_CMD_CMER */
- BTA_AG_AT_VTS_EVT, /* BTA_AG_HF_CMD_VTS */
+ BTA_AG_AT_VTS_EVT, /* BTA_AG_HF_CMD_VTS */
BTA_AG_AT_BINP_EVT, /* BTA_AG_HF_CMD_BINP */
BTA_AG_AT_BLDN_EVT, /* BTA_AG_HF_CMD_BLDN */
BTA_AG_AT_BVRA_EVT, /* BTA_AG_HF_CMD_BVRA */
@@ -256,60 +268,60 @@ const tBTA_AG_EVT bta_ag_hfp_cb_evt[] =
/* translation of API result code values to internal values */
const UINT8 bta_ag_trans_result[] =
{
- BTA_AG_RES_VGS, /* BTA_AG_SPK_RES */
- BTA_AG_RES_VGM, /* BTA_AG_MIC_RES */
- BTA_AG_RES_BSIR, /* BTA_AG_INBAND_RING_RES */
- BTA_AG_RES_CIND, /* BTA_AG_CIND_RES */
- BTA_AG_RES_BINP, /* BTA_AG_BINP_RES */
- BTA_AG_RES_CIEV, /* BTA_AG_IND_RES */
- BTA_AG_RES_BVRA, /* BTA_AG_BVRA_RES */
- BTA_AG_RES_CNUM, /* BTA_AG_CNUM_RES */
- BTA_AG_RES_BTRH, /* BTA_AG_BTRH_RES */
- BTA_AG_RES_CLCC, /* BTA_AG_CLCC_RES */
- BTA_AG_RES_COPS, /* BTA_AG_COPS_RES */
- 0, /* BTA_AG_IN_CALL_RES */
- 0, /* BTA_AG_IN_CALL_CONN_RES */
- BTA_AG_RES_CCWA, /* BTA_AG_CALL_WAIT_RES */
- 0, /* BTA_AG_OUT_CALL_ORIG_RES */
+ BTA_AG_RES_VGS, /* BTA_AG_SPK_RES */
+ BTA_AG_RES_VGM, /* BTA_AG_MIC_RES */
+ BTA_AG_RES_BSIR, /* BTA_AG_INBAND_RING_RES */
+ BTA_AG_RES_CIND, /* BTA_AG_CIND_RES */
+ BTA_AG_RES_BINP, /* BTA_AG_BINP_RES */
+ BTA_AG_RES_CIEV, /* BTA_AG_IND_RES */
+ BTA_AG_RES_BVRA, /* BTA_AG_BVRA_RES */
+ BTA_AG_RES_CNUM, /* BTA_AG_CNUM_RES */
+ BTA_AG_RES_BTRH, /* BTA_AG_BTRH_RES */
+ BTA_AG_RES_CLCC, /* BTA_AG_CLCC_RES */
+ BTA_AG_RES_COPS, /* BTA_AG_COPS_RES */
+ 0, /* BTA_AG_IN_CALL_RES */
+ 0, /* BTA_AG_IN_CALL_CONN_RES */
+ BTA_AG_RES_CCWA, /* BTA_AG_CALL_WAIT_RES */
+ 0, /* BTA_AG_OUT_CALL_ORIG_RES */
0, /* BTA_AG_OUT_CALL_ALERT_RES */
- 0, /* BTA_AG_OUT_CALL_CONN_RES */
- 0, /* BTA_AG_CALL_CANCEL_RES */
- 0, /* BTA_AG_END_CALL_RES */
- 0, /* BTA_AG_IN_CALL_HELD_RES */
+ 0, /* BTA_AG_OUT_CALL_CONN_RES */
+ 0, /* BTA_AG_CALL_CANCEL_RES */
+ 0, /* BTA_AG_END_CALL_RES */
+ 0, /* BTA_AG_IN_CALL_HELD_RES */
BTA_AG_RES_UNAT /* BTA_AG_UNAT_RES */
};
/* callsetup indicator value lookup table */
const UINT8 bta_ag_callsetup_ind_tbl[] =
{
- 0, /* BTA_AG_SPK_RES */
- 0, /* BTA_AG_MIC_RES */
- 0, /* BTA_AG_INBAND_RING_RES */
- 0, /* BTA_AG_CIND_RES */
- 0, /* BTA_AG_BINP_RES */
- 0, /* BTA_AG_IND_RES */
- 0, /* BTA_AG_BVRA_RES */
- 0, /* BTA_AG_CNUM_RES */
- 0, /* BTA_AG_BTRH_RES */
- 0, /* BTA_AG_CLCC_RES */
- 0, /* BTA_AG_COPS_RES */
- BTA_AG_CALLSETUP_INCOMING, /* BTA_AG_IN_CALL_RES */
- BTA_AG_CALLSETUP_NONE, /* BTA_AG_IN_CALL_CONN_RES */
- BTA_AG_CALLSETUP_INCOMING, /* BTA_AG_CALL_WAIT_RES */
- BTA_AG_CALLSETUP_OUTGOING, /* BTA_AG_OUT_CALL_ORIG_RES */
+ 0, /* BTA_AG_SPK_RES */
+ 0, /* BTA_AG_MIC_RES */
+ 0, /* BTA_AG_INBAND_RING_RES */
+ 0, /* BTA_AG_CIND_RES */
+ 0, /* BTA_AG_BINP_RES */
+ 0, /* BTA_AG_IND_RES */
+ 0, /* BTA_AG_BVRA_RES */
+ 0, /* BTA_AG_CNUM_RES */
+ 0, /* BTA_AG_BTRH_RES */
+ 0, /* BTA_AG_CLCC_RES */
+ 0, /* BTA_AG_COPS_RES */
+ BTA_AG_CALLSETUP_INCOMING, /* BTA_AG_IN_CALL_RES */
+ BTA_AG_CALLSETUP_NONE, /* BTA_AG_IN_CALL_CONN_RES */
+ BTA_AG_CALLSETUP_INCOMING, /* BTA_AG_CALL_WAIT_RES */
+ BTA_AG_CALLSETUP_OUTGOING, /* BTA_AG_OUT_CALL_ORIG_RES */
BTA_AG_CALLSETUP_ALERTING, /* BTA_AG_OUT_CALL_ALERT_RES */
- BTA_AG_CALLSETUP_NONE, /* BTA_AG_OUT_CALL_CONN_RES */
- BTA_AG_CALLSETUP_NONE, /* BTA_AG_CALL_CANCEL_RES */
- BTA_AG_CALLSETUP_NONE, /* BTA_AG_END_CALL_RES */
- BTA_AG_CALLSETUP_NONE /* BTA_AG_IN_CALL_HELD_RES */
-};
+ BTA_AG_CALLSETUP_NONE, /* BTA_AG_OUT_CALL_CONN_RES */
+ BTA_AG_CALLSETUP_NONE, /* BTA_AG_CALL_CANCEL_RES */
+ BTA_AG_CALLSETUP_NONE, /* BTA_AG_END_CALL_RES */
+ BTA_AG_CALLSETUP_NONE /* BTA_AG_IN_CALL_HELD_RES */
+};
/*******************************************************************************
**
** Function bta_ag_send_result
**
** Description Send an AT result code.
-**
+**
**
** Returns void
**
@@ -342,13 +354,13 @@ static void bta_ag_send_result(tBTA_AG_SCB *p_scb, UINT8 code, char *p_arg,
{
#if defined(BTA_AG_RESULT_DEBUG) && (BTA_AG_RESULT_DEBUG == TRUE)
APPL_TRACE_DEBUG0("[HSP] ':'symbol is changed as '=' for HSP compatibility");
- #endif
+ #endif
*(p+COLON_IDX_4_VGSVGM) = '=';
}
break;
}
}
-#endif
+#endif
p += strlen(bta_ag_result_tbl[code].p_res);
/* copy argument if any */
@@ -368,7 +380,7 @@ static void bta_ag_send_result(tBTA_AG_SCB *p_scb, UINT8 code, char *p_arg,
#if defined(BTA_AG_RESULT_DEBUG) && (BTA_AG_RESULT_DEBUG == TRUE)
APPL_TRACE_DEBUG1("bta_ag_send_result: %s", buf);
-#endif
+#endif
/* send to RFCOMM */
PORT_WriteData(p_scb->conn_handle, buf, (UINT16) (p - buf), &len);
@@ -380,7 +392,7 @@ static void bta_ag_send_result(tBTA_AG_SCB *p_scb, UINT8 code, char *p_arg,
** Function bta_ag_send_multi_result
**
** Description Send multiple AT result codes.
-**
+**
**
** Returns void
**
@@ -397,7 +409,7 @@ static void bta_ag_send_multi_result(tBTA_AG_SCB *p_scb, tBTA_AG_MULTI_RESULT_CB
APPL_TRACE_DEBUG0("m_res_cb is NULL or num_result is out of range.");
return;
}
-
+
#if defined(BTA_AG_RESULT_DEBUG) && (BTA_AG_RESULT_DEBUG == TRUE)
memset(buf, NULL, sizeof(buf));
#endif
@@ -407,11 +419,11 @@ static void bta_ag_send_multi_result(tBTA_AG_SCB *p_scb, tBTA_AG_MULTI_RESULT_CB
/* init with \r\n */
*p++ = '\r';
*p++ = '\n';
-
+
/* copy result code string */
BCM_STRCPY_S(p, sizeof(buf), bta_ag_result_tbl[m_res_cb->res_cb[res_idx].code].p_res);
p += strlen(bta_ag_result_tbl[m_res_cb->res_cb[res_idx].code].p_res);
-
+
/* copy argument if any */
if (bta_ag_result_tbl[m_res_cb->res_cb[res_idx].code].fmt == BTA_AG_RES_FMT_INT)
{
@@ -422,17 +434,17 @@ static void bta_ag_send_multi_result(tBTA_AG_SCB *p_scb, tBTA_AG_MULTI_RESULT_CB
BCM_STRCPY_S(p, sizeof(buf), m_res_cb->res_cb[res_idx].p_arg);
p += strlen(m_res_cb->res_cb[res_idx].p_arg);
}
-
+
/* finish with \r\n */
*p++ = '\r';
*p++ = '\n';
-
+
res_idx++;
}
#if defined(BTA_AG_RESULT_DEBUG) && (BTA_AG_RESULT_DEBUG == TRUE)
APPL_TRACE_DEBUG1("send_result: %s", buf);
-#endif
+#endif
/* send to RFCOMM */
PORT_WriteData(p_scb->conn_handle, buf, (UINT16) (p - buf), &len);
@@ -444,7 +456,7 @@ static void bta_ag_send_multi_result(tBTA_AG_SCB *p_scb, tBTA_AG_MULTI_RESULT_CB
** Function bta_ag_send_ok
**
** Description Send an OK result code.
-**
+**
**
** Returns void
**
@@ -460,7 +472,7 @@ static void bta_ag_send_ok(tBTA_AG_SCB *p_scb)
**
** Description Send an ERROR result code.
** errcode - used to send verbose errocode
-**
+**
**
** Returns void
**
@@ -479,7 +491,7 @@ static void bta_ag_send_error(tBTA_AG_SCB *p_scb, INT16 errcode)
** Function bta_ag_send_ind
**
** Description Send an indicator CIEV result code.
-**
+**
**
** Returns void
**
@@ -565,7 +577,7 @@ static void bta_ag_send_ind(tBTA_AG_SCB *p_scb, UINT16 id, UINT16 value, BOOLEAN
** Function bta_ag_parse_cmer
**
** Description Parse AT+CMER parameter string.
-**
+**
**
** Returns TRUE if parsed ok, FALSE otherwise.
**
@@ -610,7 +622,7 @@ static BOOLEAN bta_ag_parse_cmer(char *p_s, BOOLEAN *p_enabled)
** Function bta_ag_parse_chld
**
** Description Parse AT+CHLD parameter string.
-**
+**
**
** Returns Returns idx (1-7), or 0 if ECC not enabled or idx doesn't exist
**
@@ -627,7 +639,7 @@ static UINT8 bta_ag_parse_chld(tBTA_AG_SCB *p_scb, char *p_s)
if (idx != -1 && idx < 255)
retval = (UINT8)idx;
}
-
+
return (retval);
}
@@ -637,7 +649,7 @@ static UINT8 bta_ag_parse_chld(tBTA_AG_SCB *p_scb, char *p_s)
** Function bta_ag_parse_bac
**
** Description Parse AT+BAC parameter string.
-**
+**
** Returns Returns bitmap of supported codecs.
**
*******************************************************************************/
@@ -649,7 +661,7 @@ static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB *p_scb, char *p_s)
char *p;
while(p_s)
- {
+ {
/* skip to comma delimiter */
for(p = p_s; *p != ',' && *p != 0; p++);
@@ -688,7 +700,7 @@ static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB *p_scb, char *p_s)
**
** Description Process the unat response data and remove extra carriage return
** and line feed
-**
+**
**
** Returns void
**
@@ -703,33 +715,33 @@ static void bta_ag_process_unat_res(char *unat_result)
char trim_data[BTA_AG_AT_MAX_LEN];
-
+
str_leng = strlen(unat_result);
/* If no extra CR and LF, just return */
if(str_leng < 4)
return;
-
- /* Remove the carriage return and left feed */
- while(unat_result[0] =='\r' && unat_result[1] =='\n'
+
+ /* Remove the carriage return and left feed */
+ while(unat_result[0] =='\r' && unat_result[1] =='\n'
&& unat_result[str_leng-2] =='\r' && unat_result[str_leng-1] =='\n')
{
pairs_of_nl_cr = 1;
for (i=0;i<(str_leng-4*pairs_of_nl_cr);i++)
{
trim_data[j++] = unat_result[i+pairs_of_nl_cr*2];
- }
+ }
/* Add EOF */
trim_data[j] = '\0';
str_leng = str_leng - 4;
BCM_STRNCPY_S(unat_result, BTA_AG_AT_MAX_LEN+1, trim_data,str_leng+1);
i=0;
j=0;
-
+
if(str_leng <4)
return;
-
-
+
+
}
return;
}
@@ -740,7 +752,7 @@ static void bta_ag_process_unat_res(char *unat_result)
** Function bta_ag_inband_enabled
**
** Description Determine whether in-band ring can be used.
-**
+**
**
** Returns void
**
@@ -763,7 +775,7 @@ BOOLEAN bta_ag_inband_enabled(tBTA_AG_SCB *p_scb)
** Function bta_ag_send_call_inds
**
** Description Send call and callsetup indicators.
-**
+**
**
** Returns void
**
@@ -780,7 +792,7 @@ void bta_ag_send_call_inds(tBTA_AG_SCB *p_scb, tBTA_AG_RES result)
{
call = BTA_AG_CALL_INACTIVE;
}
- else if (result == BTA_AG_IN_CALL_CONN_RES || result == BTA_AG_OUT_CALL_CONN_RES
+ else if (result == BTA_AG_IN_CALL_CONN_RES || result == BTA_AG_OUT_CALL_CONN_RES
|| result == BTA_AG_IN_CALL_HELD_RES)
{
call = BTA_AG_CALL_ACTIVE;
@@ -800,7 +812,7 @@ void bta_ag_send_call_inds(tBTA_AG_SCB *p_scb, tBTA_AG_RES result)
** Function bta_ag_at_hsp_cback
**
** Description AT command processing callback for HSP.
-**
+**
**
** Returns void
**
@@ -808,7 +820,7 @@ void bta_ag_send_call_inds(tBTA_AG_SCB *p_scb, tBTA_AG_RES result)
void bta_ag_at_hsp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
char *p_arg, INT16 int_arg)
{
- tBTA_AG_VAL val;
+ tBTA_AG_VAL val;
APPL_TRACE_DEBUG4("AT cmd:%d arg_type:%d arg:%d arg:%s", cmd, arg_type,
int_arg, p_arg);
@@ -831,7 +843,7 @@ void bta_ag_at_hsp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
** Function bta_ag_at_hfp_cback
**
** Description AT command processing callback for HFP.
-**
+**
**
** Returns void
**
@@ -839,7 +851,7 @@ void bta_ag_at_hsp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
char *p_arg, INT16 int_arg)
{
- tBTA_AG_VAL val;
+ tBTA_AG_VAL val;
tBTA_AG_EVT event;
tBTA_AG_SCB *ag_scb;
UINT32 i, ind_id;
@@ -862,8 +874,8 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
switch (cmd)
{
case BTA_AG_HF_CMD_A:
- case BTA_AG_HF_CMD_VGS:
- case BTA_AG_HF_CMD_VGM:
+ case BTA_AG_HF_CMD_VGS:
+ case BTA_AG_HF_CMD_VGM:
case BTA_AG_HF_CMD_CHUP:
case BTA_AG_HF_CMD_CBC:
/* send OK */
@@ -871,7 +883,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
break;
case BTA_AG_HF_CMD_BLDN:
- /* Do not send OK, App will send error or OK depending on
+ /* Do not send OK, App will send error or OK depending on
** last dial number enabled or not */
break;
@@ -937,7 +949,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
/* if service level conn. not already open, now it's open */
bta_ag_svc_conn_open(p_scb, NULL);
-
+
}
else
{
@@ -947,7 +959,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
{
/* we do not support ECC, but HF is sending us a CHLD with call index*/
event = 0;
- bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
+ bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
}
else
@@ -957,19 +969,19 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
** Application will set it back to 1
** callheld indicator will be sent across to the peer. */
if(val.str[0] == '2')
- {
+ {
for (i = 0, ag_scb = &bta_ag_cb.scb[0]; i < BTA_AG_NUM_SCB; i++, ag_scb++)
{
if (ag_scb->in_use)
{
- if((ag_scb->call_ind == BTA_AG_CALL_ACTIVE)
+ if((ag_scb->call_ind == BTA_AG_CALL_ACTIVE)
&& (ag_scb->callsetup_ind == BTA_AG_CALLSETUP_NONE))
ag_scb->callheld_ind = BTA_AG_CALLHELD_NOACTIVE + 1;
}
}
}
}
-
+
/* Do not send OK. Let app decide after parsing the val str */
/* bta_ag_send_ok(p_scb); */
}
@@ -1165,7 +1177,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
}
break;
-
+
#if (BTM_WBS_INCLUDED == TRUE )
case BTA_AG_HF_CMD_BAC:
bta_ag_send_ok(p_scb);
@@ -1184,7 +1196,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
else
{
p_scb->sco_codec = UUID_CODEC_CVSD;
- APPL_TRACE_DEBUG0("Received AT+BAC, updating sco codec to CVSD");
+ APPL_TRACE_DEBUG0("Received AT+BAC, updating sco codec to CVSD");
}
/* Received BAC while in codec negotiation. */
@@ -1223,7 +1235,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
bta_ag_sco_codec_nego(p_scb, TRUE);
else
bta_ag_sco_codec_nego(p_scb, FALSE);
-
+
bta_ag_send_ok(p_scb);
break;
@@ -1249,14 +1261,14 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
** Function bta_ag_at_err_cback
**
** Description AT command parser error callback.
-**
+**
**
** Returns void
**
*******************************************************************************/
void bta_ag_at_err_cback(tBTA_AG_SCB *p_scb, BOOLEAN unknown, char *p_arg)
{
- tBTA_AG_VAL val;
+ tBTA_AG_VAL val;
if(unknown && (!strlen(p_arg)))
{
@@ -1286,7 +1298,7 @@ void bta_ag_at_err_cback(tBTA_AG_SCB *p_scb, BOOLEAN unknown, char *p_arg)
** Function bta_ag_hsp_result
**
** Description Handle API result for HSP connections.
-**
+**
**
** Returns void
**
@@ -1322,7 +1334,7 @@ void bta_ag_hsp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
p_scb->post_sco = BTA_AG_POST_SCO_NONE;
else
p_scb->post_sco = BTA_AG_POST_SCO_RING;
-
+
bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
}
break;
@@ -1350,11 +1362,11 @@ void bta_ag_hsp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
}
break;
- case BTA_AG_END_CALL_RES:
+ case BTA_AG_END_CALL_RES:
/* stop ring timer */
bta_sys_stop_timer(&p_scb->act_timer);
-
- /* close sco */
+
+ /* close sco */
if ((bta_ag_sco_is_open(p_scb) || bta_ag_sco_is_opening(p_scb)) && !(p_scb->features & BTA_AG_FEAT_NOSCO))
{
bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
@@ -1399,7 +1411,7 @@ void bta_ag_hsp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
** Function bta_ag_hfp_result
**
** Description Handle API result for HFP connections.
-**
+**
**
** Returns void
**
@@ -1420,7 +1432,7 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
case BTA_AG_IN_CALL_RES:
/* tell sys to stop av if any */
bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
-
+
/* store caller id string.
* append type info at the end.
* make sure a valid type info is passed.
@@ -1495,9 +1507,9 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
bta_sys_stop_timer(&p_scb->act_timer);
bta_ag_send_call_inds(p_scb, p_result->result);
-
+
break;
-
+
case BTA_AG_OUT_CALL_ORIG_RES:
/* if sco open and we need to close it, close sco first
** then send indicators; else send indicators now
@@ -1552,7 +1564,7 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
bta_ag_send_call_inds(p_scb, p_result->result);
break;
- case BTA_AG_END_CALL_RES:
+ case BTA_AG_END_CALL_RES:
/* stop ring timer */
bta_sys_stop_timer(&p_scb->act_timer);
@@ -1571,7 +1583,7 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
else
{
bta_ag_send_call_inds(p_scb, p_result->result);
-
+
/* if av got suspended by this call, let it resume. */
bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
}
@@ -1580,7 +1592,7 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
case BTA_AG_INBAND_RING_RES:
p_scb->inband_enabled = p_result->data.state;
APPL_TRACE_DEBUG1("inband_enabled set to %d", p_scb->inband_enabled);
- bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
+ bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
break;
case BTA_AG_CIND_RES:
@@ -1593,12 +1605,12 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
p_scb->battchg_ind = p_result->data.str[10] - '0';
APPL_TRACE_DEBUG2("cind call:%d callsetup:%d", p_scb->call_ind, p_scb->callsetup_ind);
- bta_ag_send_result(p_scb, code, p_result->data.str, 0);
- bta_ag_send_ok(p_scb);
+ bta_ag_send_result(p_scb, code, p_result->data.str, 0);
+ bta_ag_send_ok(p_scb);
break;
case BTA_AG_BINP_RES:
- case BTA_AG_CNUM_RES:
+ case BTA_AG_CNUM_RES:
case BTA_AG_CLCC_RES:
case BTA_AG_COPS_RES:
if (p_result->data.ok_flag != BTA_AG_OK_ERROR)
@@ -1617,7 +1629,7 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
}
break;
-
+
case BTA_AG_UNAT_RES:
if (p_result->data.ok_flag != BTA_AG_OK_ERROR)
{
@@ -1650,7 +1662,7 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
break;
case BTA_AG_BVRA_RES:
- bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
+ bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
break;
case BTA_AG_BTRH_RES:
@@ -1659,7 +1671,7 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
/* Don't respond to read if not in response & hold state */
if (p_result->data.num != BTA_AG_BTRH_NO_RESP)
{
- bta_ag_send_result(p_scb, code, NULL, p_result->data.num);
+ bta_ag_send_result(p_scb, code, NULL, p_result->data.num);
}
/* In case of a response to a read request we need to send OK */
@@ -1683,7 +1695,7 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
** Function bta_ag_result
**
** Description Handle API result.
-**
+**
**
** Returns void
**
@@ -1705,7 +1717,7 @@ void bta_ag_result(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_setcodec
**
** Description Handle API SetCodec
-**
+**
**
** Returns void
**
@@ -1714,10 +1726,10 @@ void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
#if (BTM_WBS_INCLUDED == TRUE )
tBTA_AG_PEER_CODEC codec_type = p_data->api_setcodec.codec;
-
+
/* Check if the requested codec type is valid */
if((codec_type != BTA_AG_CODEC_NONE) &&
- (codec_type != BTA_AG_CODEC_CVSD) &&
+ (codec_type != BTA_AG_CODEC_CVSD) &&
(codec_type != BTA_AG_CODEC_MSBC))
{
APPL_TRACE_ERROR1("bta_ag_setcodec error: unsupported codec type %d", codec_type);
@@ -1744,7 +1756,7 @@ void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_send_bcs
**
** Description Send +BCS AT command to peer.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1781,7 +1793,7 @@ void bta_ag_send_bcs(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_send_ring
**
** Description Send RING result code to peer.
-**
+**
**
** Returns void
**
@@ -1794,11 +1806,11 @@ void bta_ag_send_ring(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
if (p_scb->conn_service == BTA_AG_HFP && p_scb->clip_enabled && p_scb->clip[0] != 0)
{
memset(&m_res_cb, NULL, sizeof(tBTA_AG_MULTI_RESULT_CB));
-
+
m_res_cb.num_result = 2;
AT_SET_RES_CB(m_res_cb.res_cb[0], BTA_AG_RES_RING, NULL, 0)
AT_SET_RES_CB(m_res_cb.res_cb[1], BTA_AG_RES_CLIP, p_scb->clip, 0)
-
+
bta_ag_send_multi_result(p_scb, &m_res_cb);
}
else
diff --git a/bta/ag/bta_ag_int.h b/bta/ag/bta_ag_int.h
index d953156..b0d1b1d 100755..100644
--- a/bta/ag/bta_ag_int.h
+++ b/bta/ag/bta_ag_int.h
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_ag_int.h
-**
-** Description: This is the private interface file for the BTA audio
-** gateway.
-**
-** Copyright (c) 2003-2005, Widcomm Inc., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-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 is the private interface file for the BTA audio gateway.
+ *
+ ******************************************************************************/
#ifndef BTA_AG_INT_H
#define BTA_AG_INT_H
@@ -283,14 +295,14 @@ typedef struct
typedef struct
{
tBTM_ESCO_CONN_REQ_EVT_DATA conn_data; /* SCO data for pending conn request */
- tBTA_AG_SCB *p_curr_scb; /* SCB associated with SCO connection */
- tBTA_AG_SCB *p_xfer_scb; /* SCB associated with SCO transfer */
+ tBTA_AG_SCB *p_curr_scb; /* SCB associated with SCO connection */
+ tBTA_AG_SCB *p_xfer_scb; /* SCB associated with SCO transfer */
UINT16 cur_idx; /* SCO handle */
UINT8 state; /* SCO state variable */
BOOLEAN param_updated; /* if params were updated to non-default */
tBTM_ESCO_PARAMS params; /* ESCO parameters */
} tBTA_AG_SCO_CB;
-
+
/* type for AG control block */
typedef struct
@@ -336,7 +348,7 @@ extern BOOLEAN bta_ag_other_scb_open(tBTA_AG_SCB *p_curr_scb);
extern tBTA_AG_SCB *bta_ag_get_other_idle_scb (tBTA_AG_SCB *p_curr_scb);
extern void bta_ag_sm_execute(tBTA_AG_SCB *p_scb, UINT16 event, tBTA_AG_DATA *p_data);
extern BOOLEAN bta_ag_hdl_event(BT_HDR *p_msg);
-extern void bta_ag_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
+extern void bta_ag_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
UINT8 app_id, BD_ADDR peer_addr);
extern void bta_ag_resume_open (tBTA_AG_SCB *p_scb);
diff --git a/bta/ag/bta_ag_main.c b/bta/ag/bta_ag_main.c
index 1a3bf71..9b28067 100644
--- a/bta/ag/bta_ag_main.c
+++ b/bta/ag/bta_ag_main.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_ag_main.c
-**
-** Description: This is the main implementation file for the BTA
-** audio gateway.
-**
-** Copyright (c) 2003-2005, Widcomm Inc., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-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 is the main implementation file for the BTA audio gateway.
+ *
+ ******************************************************************************/
#include <string.h>
#include "bta_api.h"
@@ -41,10 +53,10 @@ enum
/* state machine action enumeration list */
enum
{
- BTA_AG_REGISTER,
+ BTA_AG_REGISTER,
BTA_AG_DEREGISTER,
BTA_AG_START_OPEN,
- BTA_AG_RFC_DO_OPEN,
+ BTA_AG_RFC_DO_OPEN,
BTA_AG_RFC_DO_CLOSE,
BTA_AG_START_DEREG,
BTA_AG_START_CLOSE,
@@ -55,7 +67,7 @@ enum
BTA_AG_RFC_FAIL,
BTA_AG_RFC_DATA,
BTA_AG_DISC_INT_RES,
- BTA_AG_DISC_FAIL,
+ BTA_AG_DISC_FAIL,
BTA_AG_DISC_ACP_RES,
BTA_AG_FREE_DB,
BTA_AG_SCO_CONN_OPEN,
@@ -66,7 +78,7 @@ enum
BTA_AG_SCO_SHUTDOWN,
BTA_AG_POST_SCO_OPEN,
BTA_AG_POST_SCO_CLOSE,
- BTA_AG_SVC_CONN_OPEN,
+ BTA_AG_SVC_CONN_OPEN,
BTA_AG_RESULT,
BTA_AG_SETCODEC,
BTA_AG_SEND_RING,
@@ -84,10 +96,10 @@ typedef void (*tBTA_AG_ACTION)(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data);
/* action functions */
const tBTA_AG_ACTION bta_ag_action[] =
{
- bta_ag_register,
+ bta_ag_register,
bta_ag_deregister,
bta_ag_start_open,
- bta_ag_rfc_do_open,
+ bta_ag_rfc_do_open,
bta_ag_rfc_do_close,
bta_ag_start_dereg,
bta_ag_start_close,
@@ -98,7 +110,7 @@ const tBTA_AG_ACTION bta_ag_action[] =
bta_ag_rfc_fail,
bta_ag_rfc_data,
bta_ag_disc_int_res,
- bta_ag_disc_fail,
+ bta_ag_disc_fail,
bta_ag_disc_acp_res,
bta_ag_free_db,
bta_ag_sco_conn_open,
@@ -265,9 +277,9 @@ tBTA_AG_CB bta_ag_cb;
** Function bta_ag_timer_cback
**
** Description AG timer callback.
-**
**
-** Returns void
+**
+** Returns void
**
*******************************************************************************/
static void bta_ag_timer_cback(void *p)
@@ -288,7 +300,7 @@ static void bta_ag_timer_cback(void *p)
** Function bta_ag_scb_alloc
**
** Description Allocate an AG service control block.
-**
+**
**
** Returns pointer to the scb, or NULL if none could be allocated.
**
@@ -314,7 +326,7 @@ static tBTA_AG_SCB *bta_ag_scb_alloc(void)
break;
}
}
-
+
if (i == BTA_AG_NUM_SCB)
{
/* out of scbs */
@@ -329,7 +341,7 @@ static tBTA_AG_SCB *bta_ag_scb_alloc(void)
** Function bta_ag_scb_dealloc
**
** Description Deallocate a service control block.
-**
+**
**
** Returns void
**
@@ -338,15 +350,15 @@ void bta_ag_scb_dealloc(tBTA_AG_SCB *p_scb)
{
UINT8 idx;
BOOLEAN allocated = FALSE;
-
+
APPL_TRACE_DEBUG1("bta_ag_scb_dealloc %d", bta_ag_scb_to_idx(p_scb));
-
+
/* stop timers */
bta_sys_stop_timer(&p_scb->act_timer);
#if (BTM_WBS_INCLUDED == TRUE)
bta_sys_stop_timer(&p_scb->cn_timer);
#endif
-
+
/* initialize control block */
memset(p_scb, 0, sizeof(tBTA_AG_SCB));
p_scb->sco_idx = BTM_INVALID_SCO_INDEX;
@@ -368,7 +380,7 @@ void bta_ag_scb_dealloc(tBTA_AG_SCB *p_scb)
(*bta_ag_cb.p_cback)(BTA_AG_DISABLE_EVT, NULL);
}
}
-
+
}
/*******************************************************************************
@@ -376,7 +388,7 @@ void bta_ag_scb_dealloc(tBTA_AG_SCB *p_scb)
** Function bta_ag_scb_to_idx
**
** Description Given a pointer to an scb, return its index.
-**
+**
**
** Returns Index of scb.
**
@@ -392,7 +404,7 @@ UINT16 bta_ag_scb_to_idx(tBTA_AG_SCB *p_scb)
** Function bta_ag_scb_by_idx
**
** Description Given an scb index return pointer to scb.
-**
+**
**
** Returns Pointer to scb or NULL if not allocated.
**
@@ -424,7 +436,7 @@ tBTA_AG_SCB *bta_ag_scb_by_idx(UINT16 idx)
** Function bta_ag_service_to_idx
**
** Description Given a BTA service mask convert to profile index.
-**
+**
**
** Returns Profile ndex of scb.
**
@@ -446,7 +458,7 @@ UINT8 bta_ag_service_to_idx(tBTA_SERVICE_MASK services)
** Function bta_ag_idx_by_bdaddr
**
** Description Find SCB associated with peer BD address.
-**
+**
**
** Returns Index of SCB or zero if none found.
**
@@ -468,7 +480,7 @@ UINT16 bta_ag_idx_by_bdaddr(BD_ADDR peer_addr)
}
/* no scb found */
- APPL_TRACE_WARNING0("No ag scb for peer addr");
+ APPL_TRACE_WARNING0("No ag scb for peer addr");
return 0;
}
@@ -477,7 +489,7 @@ UINT16 bta_ag_idx_by_bdaddr(BD_ADDR peer_addr)
** Function bta_ag_other_scb_open
**
** Description Check whether any other scb is in open state.
-**
+**
**
** Returns TRUE if another scb is in open state, FALSE otherwise.
**
@@ -496,7 +508,7 @@ BOOLEAN bta_ag_other_scb_open(tBTA_AG_SCB *p_curr_scb)
}
/* no other scb found */
- APPL_TRACE_DEBUG0("No other ag scb open");
+ APPL_TRACE_DEBUG0("No other ag scb open");
return FALSE;
}
@@ -505,7 +517,7 @@ BOOLEAN bta_ag_other_scb_open(tBTA_AG_SCB *p_curr_scb)
** Function bta_ag_get_other_idle_scb
**
** Description Return other scb if it is in INIT st.
-**
+**
**
** Returns Pointer to other scb if INIT st, NULL otherwise.
**
@@ -524,7 +536,7 @@ tBTA_AG_SCB *bta_ag_get_other_idle_scb (tBTA_AG_SCB *p_curr_scb)
}
/* no other scb found */
- APPL_TRACE_DEBUG0("bta_ag_get_other_idle_scb: No idle AG scb");
+ APPL_TRACE_DEBUG0("bta_ag_get_other_idle_scb: No idle AG scb");
return NULL;
}
@@ -533,9 +545,9 @@ tBTA_AG_SCB *bta_ag_get_other_idle_scb (tBTA_AG_SCB *p_curr_scb)
** Function bta_ag_colli_timer_cback
**
** Description AG connection collision timer callback
-**
**
-** Returns void
+**
+** Returns void
**
*******************************************************************************/
static void bta_ag_colli_timer_cback (TIMER_LIST_ENT *p_tle)
@@ -564,12 +576,12 @@ static void bta_ag_colli_timer_cback (TIMER_LIST_ENT *p_tle)
** Function bta_ag_collision_cback
**
** Description Get notified about collision.
-**
+**
**
** Returns void
**
*******************************************************************************/
-void bta_ag_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
+void bta_ag_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
UINT8 app_id, BD_ADDR peer_addr)
{
UINT16 handle;
@@ -578,7 +590,7 @@ void bta_ag_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
/* Check if we have opening scb for the peer device. */
handle = bta_ag_idx_by_bdaddr (peer_addr);
p_scb = bta_ag_scb_by_idx (handle);
-
+
if (p_scb && (p_scb->state == BTA_AG_OPENING_ST))
{
if (id == BTA_ID_SYS) /* ACL collision */
@@ -593,9 +605,9 @@ void bta_ag_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
{
APPL_TRACE_WARNING0 ("AG found collision (\?\?\?) ...");
}
-
+
p_scb->state = BTA_AG_INIT_ST;
-
+
/* Cancel SDP if it had been started. */
if(p_scb->p_disc_db)
{
@@ -614,7 +626,7 @@ void bta_ag_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
bta_sys_start_timer(&p_scb->colli_timer, 0, BTA_AG_COLLISION_TIMER);
p_scb->colli_tmr_on = TRUE;
}
-
+
}
/*******************************************************************************
@@ -622,7 +634,7 @@ void bta_ag_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
** Function bta_ag_resume_open
**
** Description Resume opening process.
-**
+**
**
** Returns void
**
@@ -651,7 +663,7 @@ void bta_ag_resume_open (tBTA_AG_SCB *p_scb)
** Function bta_ag_api_enable
**
** Description Handle an API enable event.
-**
+**
**
** Returns void
**
@@ -669,7 +681,7 @@ static void bta_ag_api_enable(tBTA_AG_DATA *p_data)
bta_ag_co_init();
bta_sys_collision_register (BTA_ID_AG, bta_ag_collision_cback);
-
+
/* call callback with enable event */
(*bta_ag_cb.p_cback)(BTA_AG_ENABLE_EVT, NULL);
}
@@ -679,7 +691,7 @@ static void bta_ag_api_enable(tBTA_AG_DATA *p_data)
** Function bta_ag_api_disable
**
** Description Handle an API disable event.
-**
+**
**
** Returns void
**
@@ -696,12 +708,12 @@ static void bta_ag_api_disable(tBTA_AG_DATA *p_data)
APPL_TRACE_ERROR0("BTA AG is already disabled, ignoring ...");
return;
}
-
+
/* De-register with BTA system manager */
GKI_sched_lock();
bta_sys_deregister(BTA_ID_AG);
GKI_sched_unlock();
-
+
for (i = 0; i < BTA_AG_NUM_SCB; i++, p_scb++)
{
if (p_scb->in_use)
@@ -725,7 +737,7 @@ static void bta_ag_api_disable(tBTA_AG_DATA *p_data)
** Function bta_ag_api_register
**
** Description Handle an API event registers a new service.
-**
+**
**
** Returns void
**
@@ -752,7 +764,7 @@ static void bta_ag_api_register(tBTA_AG_DATA *p_data)
** Function bta_ag_api_result
**
** Description Handle an API result event.
-**
+**
**
** Returns void
**
@@ -786,7 +798,7 @@ static void bta_ag_api_result(tBTA_AG_DATA *p_data)
** Function bta_ag_sm_execute
**
** Description State machine event handling function for AG
-**
+**
**
** Returns void
**
@@ -806,7 +818,7 @@ void bta_ag_sm_execute(tBTA_AG_SCB *p_scb, UINT16 event, tBTA_AG_DATA *p_data)
{
APPL_TRACE_EVENT5("AG evt (hdl 0x%04x): State %d (%s), Event 0x%04x (%s)",
bta_ag_scb_to_idx(p_scb),
- p_scb->state, bta_ag_state_str(p_scb->state),
+ p_scb->state, bta_ag_state_str(p_scb->state),
event, bta_ag_evt_str(event, p_data->api_result.result));
}
#else
@@ -819,7 +831,7 @@ void bta_ag_sm_execute(tBTA_AG_SCB *p_scb, UINT16 event, tBTA_AG_DATA *p_data)
{
APPL_TRACE_ERROR0("AG evt out of range, ignoring...");
return;
- }
+ }
/* look up the state table for the current state */
state_table = bta_ag_st_tbl[p_scb->state];
@@ -855,7 +867,7 @@ void bta_ag_sm_execute(tBTA_AG_SCB *p_scb, UINT16 event, tBTA_AG_DATA *p_data)
** Function bta_ag_hdl_event
**
** Description Data gateway main event handling function.
-**
+**
**
** Returns BOOLEAN
**
@@ -894,7 +906,7 @@ BOOLEAN bta_ag_hdl_event(BT_HDR *p_msg)
}
break;
}
- return TRUE;
+ return TRUE;
}
#if BTA_AG_DEBUG == TRUE
diff --git a/bta/ag/bta_ag_rfc.c b/bta/ag/bta_ag_rfc.c
index bccb2cf..3575020 100644
--- a/bta/ag/bta_ag_rfc.c
+++ b/bta/ag/bta_ag_rfc.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: bta_ag_rfc.c
-**
-** Description: This file contains the audio gateway functions
-** controlling the RFCOMM connections.
-**
-** Copyright (c) 2004-2008, Broadcom Corp., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2004-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 the audio gateway functions controlling the RFCOMM
+ * connections.
+ *
+ ******************************************************************************/
#include <string.h>
#include "bta_api.h"
@@ -67,7 +80,7 @@ const tBTA_AG_DATA_CBACK bta_ag_data_cback_tbl[] =
** Function bta_ag_port_cback
**
** Description RFCOMM Port callback
-**
+**
**
** Returns void
**
@@ -101,7 +114,7 @@ static void bta_ag_port_cback(UINT32 code, UINT16 port_handle, UINT16 handle)
** Function bta_ag_mgmt_cback
**
** Description RFCOMM management callback
-**
+**
**
** Returns void
**
@@ -116,7 +129,7 @@ static void bta_ag_mgmt_cback(UINT32 code, UINT16 port_handle, UINT16 handle)
APPL_TRACE_DEBUG3("ag_mgmt_cback : code = %d, port_handle = %d, handle = %d",
code, port_handle, handle);
-
+
if ((p_scb = bta_ag_scb_by_idx(handle)) != NULL)
{
/* ignore close event for port handles other than connected handle */
@@ -175,7 +188,7 @@ static void bta_ag_mgmt_cback(UINT32 code, UINT16 port_handle, UINT16 handle)
** Function bta_ag_data_cback
**
** Description RFCOMM data callback
-**
+**
**
** Returns void
**
@@ -194,7 +207,7 @@ static int bta_ag_data_cback(UINT16 port_handle, void *p_data, UINT16 len, UINT1
**
** Description RFCOMM callback functions. This is an easy way to
** distinguish scb from the callback.
-**
+**
**
** Returns void
**
@@ -212,7 +225,7 @@ void bta_ag_port_cback_3(UINT32 code, UINT16 handle) {bta_ag_port_cback(code, ha
**
** Description RFCOMM data callback functions. This is an easy way to
** distinguish scb from the callback.
-**
+**
**
** Returns void
**
@@ -235,7 +248,7 @@ int bta_ag_data_cback_3(UINT16 port_handle, void *p_data, UINT16 len)
** Function bta_ag_setup_port
**
** Description Setup RFCOMM port for use by AG.
-**
+**
**
** Returns void
**
@@ -249,7 +262,7 @@ void bta_ag_setup_port(tBTA_AG_SCB *p_scb, UINT16 handle)
{
PORT_SetDataCallback(handle, bta_ag_data_cback_tbl[i]);
}
-
+
PORT_SetEventMask(handle, BTA_AG_PORT_EV_MASK);
PORT_SetEventCallback(handle, bta_ag_port_cback_tbl[i]);
}
@@ -259,7 +272,7 @@ void bta_ag_setup_port(tBTA_AG_SCB *p_scb, UINT16 handle)
** Function bta_ag_start_servers
**
** Description Setup RFCOMM servers for use by AG.
-**
+**
**
** Returns void
**
@@ -300,7 +313,7 @@ void bta_ag_start_servers(tBTA_AG_SCB *p_scb, tBTA_SERVICE_MASK services)
** Function bta_ag_close_servers
**
** Description Close RFCOMM servers port for use by AG.
-**
+**
**
** Returns void
**
@@ -326,7 +339,7 @@ void bta_ag_close_servers(tBTA_AG_SCB *p_scb, tBTA_SERVICE_MASK services)
** Function bta_ag_is_server_closed
**
** Description Returns TRUE if all servers are closed.
-**
+**
**
** Returns TRUE if all servers are closed, FALSE otherwise
**
@@ -350,7 +363,7 @@ BOOLEAN bta_ag_is_server_closed (tBTA_AG_SCB *p_scb)
** Function bta_ag_rfc_do_open
**
** Description Open an RFCOMM connection to the peer device.
-**
+**
**
** Returns void
**
@@ -379,7 +392,7 @@ void bta_ag_rfc_do_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_rfc_do_close
**
** Description Close RFCOMM connection.
-**
+**
**
** Returns void
**
@@ -396,7 +409,7 @@ void bta_ag_rfc_do_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
/* Close API was called while AG is in Opening state. */
/* Need to trigger the state machine to send callback to the app */
- /* and move back to INIT state. */
+ /* and move back to INIT state. */
if ((p_buf = (tBTA_AG_RFC *) GKI_getbuf(sizeof(tBTA_AG_RFC))) != NULL)
{
p_buf->hdr.event = BTA_AG_RFC_CLOSE_EVT;
diff --git a/bta/ag/bta_ag_sco.c b/bta/ag/bta_ag_sco.c
index 021b96c..0c811b4 100644
--- a/bta/ag/bta_ag_sco.c
+++ b/bta/ag/bta_ag_sco.c
@@ -1,19 +1,31 @@
-/*****************************************************************************
-**
-** Name: bta_ag_sco.c
-**
-** Description: This file contains functions for managing the
-** SCO connection used in AG.
-**
-** Copyright (c) 2004-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2004-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 functions for managing the SCO connection used in AG.
+ *
+ ******************************************************************************/
#include "bta_api.h"
#include "bta_ag_api.h"
#include "bta_ag_co.h"
-#if (BTM_SCO_HCI_INCLUDED == TRUE )
+#if (BTM_SCO_HCI_INCLUDED == TRUE )
#include "bta_dm_co.h"
#endif
#include "bta_ag_int.h"
@@ -112,7 +124,7 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params =
** Function bta_ag_sco_conn_cback
**
** Description BTM SCO connection callback.
-**
+**
**
** Returns void
**
@@ -148,7 +160,7 @@ static void bta_ag_sco_conn_cback(UINT16 sco_idx)
}
}
/* no match found; disconnect sco, init sco variables */
- else
+ else
{
bta_ag_cb.sco.p_curr_scb = NULL;
bta_ag_cb.sco.state = BTA_AG_SCO_SHUTDOWN_ST;
@@ -161,7 +173,7 @@ static void bta_ag_sco_conn_cback(UINT16 sco_idx)
** Function bta_ag_sco_disc_cback
**
** Description BTM SCO disconnection callback.
-**
+**
**
** Returns void
**
@@ -192,10 +204,10 @@ static void bta_ag_sco_disc_cback(UINT16 sco_idx)
if (handle != 0)
{
-#if (BTM_SCO_HCI_INCLUDED == TRUE )
+#if (BTM_SCO_HCI_INCLUDED == TRUE )
tBTM_STATUS status = BTM_ConfigScoPath(BTM_SCO_ROUTE_PCM, NULL, NULL, TRUE);
APPL_TRACE_DEBUG1("bta_ag_sco_disc_cback sco close config status = %d", status);
- /* SCO clean up here */
+ /* SCO clean up here */
bta_dm_sco_co_close();
#endif
@@ -225,7 +237,7 @@ static void bta_ag_sco_disc_cback(UINT16 sco_idx)
}
}
/* no match found */
- else
+ else
{
APPL_TRACE_DEBUG0("no scb for ag_sco_disc_cback");
@@ -255,7 +267,7 @@ static void bta_ag_sco_read_cback (UINT16 sco_inx, BT_HDR *p_data, tBTM_SCO_DATA
{
APPL_TRACE_DEBUG1("bta_ag_sco_read_cback: status(%d)", status);
}
-
+
/* Callout function must free the data. */
bta_dm_sco_co_in_data (p_data, status);
}
@@ -279,10 +291,10 @@ static BOOLEAN bta_ag_remove_sco(tBTA_AG_SCB *p_scb, BOOLEAN only_active)
{
if (!only_active || p_scb->sco_idx == bta_ag_cb.sco.cur_idx)
{
- status = BTM_RemoveSco(p_scb->sco_idx);
+ status = BTM_RemoveSco(p_scb->sco_idx);
APPL_TRACE_DEBUG2("ag remove sco: inx 0x%04x, status:0x%x", p_scb->sco_idx, status);
-
+
if (status == BTM_CMD_STARTED)
{
/* Sco is connected; set current control block */
@@ -324,13 +336,13 @@ static void bta_ag_esco_connreq_cback(tBTM_ESCO_EVT event, tBTM_ESCO_EVT_DATA *p
((p_scb = bta_ag_scb_by_idx(handle)) != NULL) && p_scb->svc_conn)
{
p_scb->sco_idx = sco_inx;
-
+
/* If no other SCO active, allow this one */
if (!bta_ag_cb.sco.p_curr_scb)
{
APPL_TRACE_EVENT1("bta_ag_esco_connreq_cback: Accept Conn Request (sco_inx 0x%04x)", sco_inx);
bta_ag_sco_conn_rsp(p_scb, &p_data->conn_evt);
-
+
bta_ag_cb.sco.state = BTA_AG_SCO_OPENING_ST;
bta_ag_cb.sco.p_curr_scb = p_scb;
bta_ag_cb.sco.cur_idx = p_scb->sco_idx;
@@ -364,7 +376,7 @@ static void bta_ag_esco_connreq_cback(tBTM_ESCO_EVT event, tBTM_ESCO_EVT_DATA *p
{
APPL_TRACE_EVENT5("eSCO change event (inx %d): rtrans %d, rxlen %d, txlen %d, txint %d",
p_data->chg_evt.sco_inx,
- p_data->chg_evt.retrans_window, p_data->chg_evt.rx_pkt_len,
+ p_data->chg_evt.retrans_window, p_data->chg_evt.rx_pkt_len,
p_data->chg_evt.tx_pkt_len, p_data->chg_evt.tx_interval);
}
}
@@ -374,7 +386,7 @@ static void bta_ag_esco_connreq_cback(tBTM_ESCO_EVT event, tBTM_ESCO_EVT_DATA *p
** Function bta_ag_cback_sco
**
** Description Call application callback function with SCO event.
-**
+**
**
** Returns void
**
@@ -394,8 +406,8 @@ static void bta_ag_cback_sco(tBTA_AG_SCB *p_scb, UINT8 event)
**
** Function bta_ag_create_sco
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -418,13 +430,13 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
/* Make sure this sco handle is not already in use */
if (p_scb->sco_idx != BTM_INVALID_SCO_INDEX)
{
- APPL_TRACE_WARNING1("bta_ag_create_sco: Index 0x%04x Already In Use!",
+ APPL_TRACE_WARNING1("bta_ag_create_sco: Index 0x%04x Already In Use!",
p_scb->sco_idx);
return;
}
#if (BTM_WBS_INCLUDED == TRUE )
- if ((p_scb->sco_codec == BTM_SCO_CODEC_MSBC) &&
+ if ((p_scb->sco_codec == BTM_SCO_CODEC_MSBC) &&
!p_scb->codec_fallback &&
!p_scb->retry_with_sco_only)
esco_codec = BTM_SCO_CODEC_MSBC;
@@ -439,9 +451,9 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
if (esco_codec == BTM_SCO_CODEC_MSBC)
codec_index = esco_codec - 1;
-
+
params = bta_ag_esco_params[codec_index];
-#else
+#else
params = bta_ag_esco_params;
#endif
@@ -453,7 +465,7 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
#if (BTM_WBS_INCLUDED == TRUE)
if (!codec_index) /* For non-WBS */
#endif
- {
+ {
/* Use the application packet types (5 slot EV packets not allowed) */
params.packet_types = p_bta_ag_cfg->sco_pkt_types |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
@@ -468,10 +480,10 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
/* Need to find out from SIG if HSP can use eSCO; for now use SCO */
if (p_scb->conn_service == BTA_AG_HFP && p_scb->peer_version >= HFP_VERSION_1_5 && !p_scb->retry_with_sco_only)
{
-
+
BTM_SetEScoMode(BTM_LINK_TYPE_ESCO, &params);
/* If ESCO or EDR ESCO, retry with SCO only in case of failure */
- if((params.packet_types & BTM_ESCO_LINK_ONLY_MASK)
+ if((params.packet_types & BTM_ESCO_LINK_ONLY_MASK)
||!((params.packet_types & ~(BTM_ESCO_LINK_ONLY_MASK | BTM_SCO_LINK_ONLY_MASK)) ^ BTA_AG_NO_EDR_ESCO))
{
#if (BTM_WBS_INCLUDED == TRUE )
@@ -485,7 +497,7 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
p_scb->retry_with_sco_only = FALSE;
APPL_TRACE_API0("Setting retry_with_sco_only to FALSE");
}
-#else
+#else
p_scb->retry_with_sco_only = TRUE;
APPL_TRACE_API0("Setting retry_with_sco_only to TRUE");
#endif
@@ -496,7 +508,7 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
if(p_scb->retry_with_sco_only)
APPL_TRACE_API0("retrying with SCO only");
p_scb->retry_with_sco_only = FALSE;
-
+
BTM_SetEScoMode(BTM_LINK_TYPE_SCO, &params);
}
@@ -518,7 +530,7 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
sco_route = bta_dm_sco_co_init(pcm_sample_rate, pcm_sample_rate, &codec_info, p_scb->app_id);
#endif
-
+
#if (BTM_WBS_INCLUDED == TRUE )
if (esco_codec == BTA_AG_CODEC_MSBC)
{
@@ -534,7 +546,7 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
if (esco_codec == BTA_AG_CODEC_MSBC)
BTM_WriteVoiceSettings (BTM_VOICE_SETTING_TRANS);
else
- BTM_WriteVoiceSettings (BTM_VOICE_SETTING_CVSD);
+ BTM_WriteVoiceSettings (BTM_VOICE_SETTING_CVSD);
/* save the current codec because sco_codec can be updated while SCO is open. */
p_scb->inuse_codec = esco_codec;
@@ -575,10 +587,10 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
**
** Function bta_ag_cn_timer_cback
**
-** Description
-**
+** Description
+**
**
-** Returns void
+** Returns void
**
*******************************************************************************/
static void bta_ag_cn_timer_cback (TIMER_LIST_ENT *p_tle)
@@ -613,7 +625,7 @@ static void bta_ag_cn_timer_cback (TIMER_LIST_ENT *p_tle)
void bta_ag_codec_negotiate(tBTA_AG_SCB *p_scb)
{
bta_ag_cb.sco.p_curr_scb = p_scb;
-
+
if (p_scb->codec_updated || p_scb->codec_fallback)
{
/* Change the power mode to Active until sco open is completed. */
@@ -639,8 +651,8 @@ void bta_ag_codec_negotiate(tBTA_AG_SCB *p_scb)
**
** Function bta_ag_sco_event
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -659,7 +671,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
APPL_TRACE_EVENT5("BTA ag sco evt (hdl 0x%04x): State %d (%s), Event %d (%s)",
p_scb->sco_idx,
- p_sco->state, bta_ag_sco_state_str(p_sco->state),
+ p_sco->state, bta_ag_sco_state_str(p_sco->state),
event, bta_ag_sco_evt_str(event));
#else
APPL_TRACE_EVENT3("BTA ag sco evt (hdl 0x%04x): State %d, Event %d",
@@ -758,7 +770,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
break;
}
break;
-
+
#if (BTM_WBS_INCLUDED == TRUE )
case BTA_AG_SCO_CODEC_ST:
switch (event)
@@ -938,7 +950,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
bta_ag_create_sco(p_scb, FALSE); /* Back into listen mode */
/* Accept sco connection with xfer scb */
- bta_ag_sco_conn_rsp(p_sco->p_xfer_scb, &p_sco->conn_data);
+ bta_ag_sco_conn_rsp(p_sco->p_xfer_scb, &p_sco->conn_data);
p_sco->state = BTA_AG_SCO_OPENING_ST;
p_sco->p_curr_scb = p_sco->p_xfer_scb;
p_sco->cur_idx = p_sco->p_xfer_scb->sco_idx;
@@ -1067,7 +1079,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
/* start codec negotiation */
p_sco->state = BTA_AG_SCO_CODEC_ST;
p_cn_scb = p_scb;
-#else
+#else
/* open sco connection */
bta_ag_create_sco(p_scb, TRUE);
p_sco->state = BTA_AG_SCO_OPENING_ST;
@@ -1092,7 +1104,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
switch (event)
{
case BTA_AG_SCO_CONN_OPEN_E:
- /* close sco connection so headset can be transferred
+ /* close sco connection so headset can be transferred
Probably entered this state from "opening state" */
bta_ag_remove_sco(p_scb, TRUE);
break;
@@ -1123,7 +1135,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
p_sco->state = BTA_AG_SCO_CODEC_ST;
p_cn_scb = p_sco->p_xfer_scb;
p_sco->p_xfer_scb = NULL;
-#else
+#else
/* create sco connection to peer */
bta_ag_create_sco(p_sco->p_xfer_scb, TRUE);
p_sco->p_xfer_scb = NULL;
@@ -1193,7 +1205,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
break;
}
break;
-
+
default:
break;
}
@@ -1220,7 +1232,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
** Function bta_ag_sco_is_open
**
** Description Check if sco is open for this scb.
-**
+**
**
** Returns TRUE if sco open for this scb, FALSE otherwise.
**
@@ -1236,7 +1248,7 @@ BOOLEAN bta_ag_sco_is_open(tBTA_AG_SCB *p_scb)
** Function bta_ag_sco_is_opening
**
** Description Check if sco is in Opening state.
-**
+**
**
** Returns TRUE if sco is in Opening state for this scb, FALSE otherwise.
**
@@ -1244,7 +1256,7 @@ BOOLEAN bta_ag_sco_is_open(tBTA_AG_SCB *p_scb)
BOOLEAN bta_ag_sco_is_opening(tBTA_AG_SCB *p_scb)
{
#if (BTM_WBS_INCLUDED == TRUE )
- return (((bta_ag_cb.sco.state == BTA_AG_SCO_OPENING_ST) ||
+ return (((bta_ag_cb.sco.state == BTA_AG_SCO_OPENING_ST) ||
(bta_ag_cb.sco.state == BTA_AG_SCO_OPENING_ST)) &&
(bta_ag_cb.sco.p_curr_scb == p_scb));
#else
@@ -1257,8 +1269,8 @@ BOOLEAN bta_ag_sco_is_opening(tBTA_AG_SCB *p_scb)
**
** Function bta_ag_sco_listen
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -1272,8 +1284,8 @@ void bta_ag_sco_listen(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
**
** Function bta_ag_sco_open
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -1300,8 +1312,8 @@ void bta_ag_sco_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
**
** Function bta_ag_sco_close
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -1309,7 +1321,7 @@ void bta_ag_sco_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
void bta_ag_sco_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
/* if scb is in use */
-#if (BTM_WBS_INCLUDED == TRUE )
+#if (BTM_WBS_INCLUDED == TRUE )
/* sco_idx is not allocated in SCO_CODEC_ST, we still need to move to listening state. */
if ((p_scb->sco_idx != BTM_INVALID_SCO_INDEX) || (bta_ag_cb.sco.state == BTA_AG_SCO_CODEC_ST))
#else
@@ -1327,8 +1339,8 @@ void bta_ag_sco_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
**
** Function bta_ag_sco_codec_nego
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -1339,7 +1351,7 @@ void bta_ag_sco_codec_nego(tBTA_AG_SCB *p_scb, BOOLEAN result)
{
/* Subsequent sco connection will skip codec negotiation */
p_scb->codec_updated = FALSE;
-
+
bta_ag_sco_event(p_scb, BTA_AG_SCO_CN_DONE_E);
}
else /* codec negotiation failed */
@@ -1351,8 +1363,8 @@ void bta_ag_sco_codec_nego(tBTA_AG_SCB *p_scb, BOOLEAN result)
**
** Function bta_ag_sco_shutdown
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -1366,8 +1378,8 @@ void bta_ag_sco_shutdown(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
**
** Function bta_ag_sco_conn_open
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -1395,8 +1407,8 @@ void bta_ag_sco_conn_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
**
** Function bta_ag_sco_conn_close
**
-** Description
-**
+** Description
+**
**
** Returns void
**
@@ -1428,7 +1440,7 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
bta_ag_create_sco(p_scb, TRUE);
}
#endif
- else
+ else
{
/* Indicate if the closing of audio is because of transfer */
if (bta_ag_cb.sco.p_xfer_scb)
@@ -1452,14 +1464,14 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
bta_ag_cback_sco(p_scb, BTA_AG_AUDIO_CLOSE_EVT);
}
p_scb->retry_with_sco_only = FALSE;
-}
+}
/*******************************************************************************
**
** Function bta_ag_sco_conn_rsp
**
** Description Process the SCO connection request
-**
+**
**
** Returns void
**
@@ -1500,7 +1512,7 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
}
else /* Allow controller to use all types available except 5-slot EDR */
{
- resp.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK |
+ resp.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK |
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5);
}
@@ -1521,10 +1533,10 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
pcm_sample_rate = BTA_DM_SCO_SAMP_RATE_8K;
/* initialize SCO setup, no voice setting for AG, data rate <==> sample rate */
- BTM_ConfigScoPath(bta_dm_sco_co_init(pcm_sample_rate, pcm_sample_rate, &codec_info, p_scb->app_id),
+ BTM_ConfigScoPath(bta_dm_sco_co_init(pcm_sample_rate, pcm_sample_rate, &codec_info, p_scb->app_id),
bta_ag_sco_read_cback, NULL, TRUE);
#endif
- }
+ }
else
hci_status = HCI_ERR_HOST_REJECT_DEVICE;
@@ -1532,7 +1544,7 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
/* If SCO open was initiated from HS, it must be CVSD */
p_scb->inuse_codec = BTA_AG_CODEC_NONE;
#endif
-
+
BTM_EScoConnRsp(p_data->sco_inx, hci_status, &resp);
}
@@ -1541,14 +1553,14 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
** Function bta_ag_ci_sco_data
**
** Description Process the SCO data ready callin event
-**
+**
**
** Returns void
**
*******************************************************************************/
void bta_ag_ci_sco_data(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
-#if (BTM_SCO_HCI_INCLUDED == TRUE )
+#if (BTM_SCO_HCI_INCLUDED == TRUE )
bta_ag_sco_event(p_scb, BTA_AG_SCO_CI_DATA_E);
#endif
}
@@ -1558,7 +1570,7 @@ void bta_ag_ci_sco_data(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_set_esco_param
**
** Description Update esco parameters from script wrapper.
-**
+**
**
** Returns void
**
diff --git a/bta/ag/bta_ag_sdp.c b/bta/ag/bta_ag_sdp.c
index 6b7a5ce..d708cf2 100755..100644
--- a/bta/ag/bta_ag_sdp.c
+++ b/bta/ag/bta_ag_sdp.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: bta_ag_sdp.c
-**
-** Description: This file contains the audio gateway functions
-** performing SDP operations.
-**
-** Copyright (c) 2003-2005, Broadcom Corp., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-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 the audio gateway functions performing SDP
+ * operations.
+ *
+ ******************************************************************************/
#include <string.h>
#include "bta_api.h"
@@ -49,7 +62,7 @@ const tBTA_AG_SDP_CBACK bta_ag_sdp_cback_tbl[] =
** Function bta_ag_sdp_cback
**
** Description SDP callback function.
-**
+**
**
** Returns void
**
@@ -89,9 +102,9 @@ static void bta_ag_sdp_cback(UINT16 status, UINT8 idx)
** Function bta_ag_sdp_cback_1 to 3
**
** Description SDP callback functions. Since there is no way to
-** distinguish scb from the callback we need separate
+** distinguish scb from the callback we need separate
** callbacks for each scb.
-**
+**
**
** Returns void
**
@@ -127,14 +140,14 @@ BOOLEAN bta_ag_add_record(UINT16 service_uuid, char *p_service_name, UINT8 scn,
UINT8 buf[2];
APPL_TRACE_DEBUG1("bta_ag_add_record uuid: %x", service_uuid);
-
+
memset( proto_elem_list, 0 , BTA_AG_NUM_PROTO_ELEMS*sizeof(tSDP_PROTOCOL_ELEM));
/* add the protocol element sequence */
proto_elem_list[0].protocol_uuid = UUID_PROTOCOL_L2CAP;
proto_elem_list[0].num_params = 0;
proto_elem_list[1].protocol_uuid = UUID_PROTOCOL_RFCOMM;
- proto_elem_list[1].num_params = 1;
+ proto_elem_list[1].num_params = 1;
proto_elem_list[1].params[0] = scn;
result &= SDP_AddProtocolList(sdp_handle, BTA_AG_NUM_PROTO_ELEMS, proto_elem_list);
@@ -172,13 +185,13 @@ BOOLEAN bta_ag_add_record(UINT16 service_uuid, char *p_service_name, UINT8 scn,
if (features & BTA_AG_FEAT_CODEC)
codec_supported = TRUE;
-
+
features &= BTA_AG_SDP_FEAT_SPEC;
/* Codec bit position is different in SDP and in BRSF */
if (codec_supported)
features |= 0x0020;
-
+
UINT16_TO_BE_FIELD(buf, features);
result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE, 2, buf);
}
@@ -194,7 +207,7 @@ BOOLEAN bta_ag_add_record(UINT16 service_uuid, char *p_service_name, UINT8 scn,
** Function bta_ag_create_records
**
** Description Create SDP records for registered services.
-**
+**
**
** Returns void
**
@@ -224,7 +237,7 @@ void bta_ag_create_records(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
}
p_scb->hsp_version = HSP_VERSION_1_2;
-
+
}
/*******************************************************************************
@@ -232,7 +245,7 @@ void bta_ag_create_records(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
** Function bta_ag_del_records
**
** Description Delete SDP records for any registered services.
-**
+**
**
** Returns void
**
@@ -256,7 +269,7 @@ void bta_ag_del_records(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
others |= p->reg_services;
}
- }
+ }
others >>= BTA_HSP_SERVICE_ID;
services = p_scb->reg_services >> BTA_HSP_SERVICE_ID;
@@ -284,7 +297,7 @@ void bta_ag_del_records(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
**
** Description Process SDP discovery results to find requested attributes
** for requested service.
-**
+**
**
** Returns TRUE if results found, FALSE otherwise.
**
@@ -311,7 +324,7 @@ BOOLEAN bta_ag_sdp_find_attr(tBTA_AG_SCB *p_scb, tBTA_SERVICE_MASK service)
{
return result;
}
-
+
/* loop through all records we found */
while (TRUE)
{
@@ -384,7 +397,7 @@ BOOLEAN bta_ag_sdp_find_attr(tBTA_AG_SCB *p_scb, tBTA_SERVICE_MASK service)
** Function bta_ag_do_disc
**
** Description Do service discovery.
-**
+**
**
** Returns void
**
@@ -422,7 +435,7 @@ void bta_ag_do_disc(tBTA_AG_SCB *p_scb, tBTA_SERVICE_MASK service)
attr_list[0] = ATTR_ID_SERVICE_CLASS_ID_LIST;
attr_list[1] = ATTR_ID_PROTOCOL_DESC_LIST;
attr_list[2] = ATTR_ID_BT_PROFILE_DESC_LIST;
- attr_list[3] = ATTR_ID_REMOTE_AUDIO_VOLUME_CONTROL;
+ attr_list[3] = ATTR_ID_REMOTE_AUDIO_VOLUME_CONTROL;
num_attr = 4;
uuid_list[0].uu.uuid16 = UUID_SERVCLASS_HEADSET; /* Legacy from HSP v1.0 */
@@ -472,7 +485,7 @@ void bta_ag_do_disc(tBTA_AG_SCB *p_scb, tBTA_SERVICE_MASK service)
** Function bta_ag_free_db
**
** Description Free discovery database.
-**
+**
**
** Returns void
**