Skip to content

Commit

Permalink
bta: Apply clang-format
Browse files Browse the repository at this point in the history
clang-format -i --style=file bta/*/*

(twice)

Test: mma -j32
Change-Id: Ib118b1dfb6a34f9a5bfe153d65841e9041165264
  • Loading branch information
myles-android committed Nov 10, 2016
1 parent f355ef5 commit cd1fd07
Show file tree
Hide file tree
Showing 121 changed files with 42,084 additions and 46,268 deletions.
1,125 changes: 524 additions & 601 deletions bta/ag/bta_ag_act.cc

Large diffs are not rendered by default.

201 changes: 95 additions & 106 deletions bta/ag/bta_ag_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@
*
******************************************************************************/

#include "bta_api.h"
#include "bta_sys.h"
#include "bta_ag_api.h"
#include "bta_ag_int.h"
#include "bt_common.h"
#include <string.h>
#include "bt_common.h"
#include "bta_ag_int.h"
#include "bta_api.h"
#include "bta_sys.h"

/*****************************************************************************
* Constants
****************************************************************************/

static const tBTA_SYS_REG bta_ag_reg =
{
bta_ag_hdl_event,
BTA_AgDisable
};
static const tBTA_SYS_REG bta_ag_reg = {bta_ag_hdl_event, BTA_AgDisable};

/*******************************************************************************
*
Expand All @@ -54,28 +50,28 @@ static const tBTA_SYS_REG bta_ag_reg =
* Returns BTA_SUCCESS if OK, BTA_FAILURE otherwise.
*
******************************************************************************/
tBTA_STATUS BTA_AgEnable(tBTA_AG_PARSE_MODE parse_mode, tBTA_AG_CBACK *p_cback)
{
/* Error if AG is already enabled, or AG is in the middle of disabling. */
for (int idx = 0; idx < BTA_AG_NUM_SCB; idx++) {
if (bta_ag_cb.scb[idx].in_use) {
APPL_TRACE_ERROR ("BTA_AgEnable: FAILED, AG already enabled.");
return BTA_FAILURE;
}
tBTA_STATUS BTA_AgEnable(tBTA_AG_PARSE_MODE parse_mode,
tBTA_AG_CBACK* p_cback) {
/* Error if AG is already enabled, or AG is in the middle of disabling. */
for (int idx = 0; idx < BTA_AG_NUM_SCB; idx++) {
if (bta_ag_cb.scb[idx].in_use) {
APPL_TRACE_ERROR("BTA_AgEnable: FAILED, AG already enabled.");
return BTA_FAILURE;
}
}

/* register with BTA system manager */
bta_sys_register(BTA_ID_AG, &bta_ag_reg);
/* register with BTA system manager */
bta_sys_register(BTA_ID_AG, &bta_ag_reg);

tBTA_AG_API_ENABLE *p_buf =
(tBTA_AG_API_ENABLE *)osi_malloc(sizeof(tBTA_AG_API_ENABLE));
p_buf->hdr.event = BTA_AG_API_ENABLE_EVT;
p_buf->parse_mode = parse_mode;
p_buf->p_cback = p_cback;
tBTA_AG_API_ENABLE* p_buf =
(tBTA_AG_API_ENABLE*)osi_malloc(sizeof(tBTA_AG_API_ENABLE));
p_buf->hdr.event = BTA_AG_API_ENABLE_EVT;
p_buf->parse_mode = parse_mode;
p_buf->p_cback = p_cback;

bta_sys_sendmsg(p_buf);
bta_sys_sendmsg(p_buf);

return BTA_SUCCESS;
return BTA_SUCCESS;
}

/*******************************************************************************
Expand All @@ -88,13 +84,12 @@ tBTA_STATUS BTA_AgEnable(tBTA_AG_PARSE_MODE parse_mode, tBTA_AG_CBACK *p_cback)
* Returns void
*
******************************************************************************/
void BTA_AgDisable(void)
{
BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
void BTA_AgDisable(void) {
BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR));

p_buf->event = BTA_AG_API_DISABLE_EVT;
p_buf->event = BTA_AG_API_DISABLE_EVT;

bta_sys_sendmsg(p_buf);
bta_sys_sendmsg(p_buf);
}

/*******************************************************************************
Expand All @@ -107,25 +102,25 @@ void BTA_AgDisable(void)
* Returns void
*
******************************************************************************/
void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask,tBTA_AG_FEAT features,
const char * p_service_names[], uint8_t app_id)
{
tBTA_AG_API_REGISTER *p_buf =
(tBTA_AG_API_REGISTER *)osi_malloc(sizeof(tBTA_AG_API_REGISTER));

p_buf->hdr.event = BTA_AG_API_REGISTER_EVT;
p_buf->features = features;
p_buf->sec_mask = sec_mask;
p_buf->services = services;
p_buf->app_id = app_id;
for (int i = 0; i < BTA_AG_NUM_IDX; i++) {
if (p_service_names[i])
strlcpy(p_buf->p_name[i], p_service_names[i], BTA_SERVICE_NAME_LEN);
else
p_buf->p_name[i][0] = 0;
}

bta_sys_sendmsg(p_buf);
void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask,
tBTA_AG_FEAT features, const char* p_service_names[],
uint8_t app_id) {
tBTA_AG_API_REGISTER* p_buf =
(tBTA_AG_API_REGISTER*)osi_malloc(sizeof(tBTA_AG_API_REGISTER));

p_buf->hdr.event = BTA_AG_API_REGISTER_EVT;
p_buf->features = features;
p_buf->sec_mask = sec_mask;
p_buf->services = services;
p_buf->app_id = app_id;
for (int i = 0; i < BTA_AG_NUM_IDX; i++) {
if (p_service_names[i])
strlcpy(p_buf->p_name[i], p_service_names[i], BTA_SERVICE_NAME_LEN);
else
p_buf->p_name[i][0] = 0;
}

bta_sys_sendmsg(p_buf);
}

/*******************************************************************************
Expand All @@ -138,14 +133,13 @@ void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask,tBTA_AG_FEAT f
* Returns void
*
******************************************************************************/
void BTA_AgDeregister(uint16_t handle)
{
BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
void BTA_AgDeregister(uint16_t handle) {
BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR));

p_buf->event = BTA_AG_API_DEREGISTER_EVT;
p_buf->layer_specific = handle;
p_buf->event = BTA_AG_API_DEREGISTER_EVT;
p_buf->layer_specific = handle;

bta_sys_sendmsg(p_buf);
bta_sys_sendmsg(p_buf);
}

/*******************************************************************************
Expand All @@ -161,18 +155,18 @@ void BTA_AgDeregister(uint16_t handle)
* Returns void
*
******************************************************************************/
void BTA_AgOpen(uint16_t handle, BD_ADDR bd_addr, tBTA_SEC sec_mask, tBTA_SERVICE_MASK services)
{
tBTA_AG_API_OPEN *p_buf =
(tBTA_AG_API_OPEN *)osi_malloc(sizeof(tBTA_AG_API_OPEN));

p_buf->hdr.event = BTA_AG_API_OPEN_EVT;
p_buf->hdr.layer_specific = handle;
bdcpy(p_buf->bd_addr, bd_addr);
p_buf->services = services;
p_buf->sec_mask = sec_mask;

bta_sys_sendmsg(p_buf);
void BTA_AgOpen(uint16_t handle, BD_ADDR bd_addr, tBTA_SEC sec_mask,
tBTA_SERVICE_MASK services) {
tBTA_AG_API_OPEN* p_buf =
(tBTA_AG_API_OPEN*)osi_malloc(sizeof(tBTA_AG_API_OPEN));

p_buf->hdr.event = BTA_AG_API_OPEN_EVT;
p_buf->hdr.layer_specific = handle;
bdcpy(p_buf->bd_addr, bd_addr);
p_buf->services = services;
p_buf->sec_mask = sec_mask;

bta_sys_sendmsg(p_buf);
}

/*******************************************************************************
Expand All @@ -186,14 +180,13 @@ void BTA_AgOpen(uint16_t handle, BD_ADDR bd_addr, tBTA_SEC sec_mask, tBTA_SERVIC
* Returns void
*
******************************************************************************/
void BTA_AgClose(uint16_t handle)
{
BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
void BTA_AgClose(uint16_t handle) {
BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR));

p_buf->event = BTA_AG_API_CLOSE_EVT;
p_buf->layer_specific = handle;
p_buf->event = BTA_AG_API_CLOSE_EVT;
p_buf->layer_specific = handle;

bta_sys_sendmsg(p_buf);
bta_sys_sendmsg(p_buf);
}

/*******************************************************************************
Expand All @@ -207,14 +200,13 @@ void BTA_AgClose(uint16_t handle)
* Returns void
*
******************************************************************************/
void BTA_AgAudioOpen(uint16_t handle)
{
BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
void BTA_AgAudioOpen(uint16_t handle) {
BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR));

p_buf->event = BTA_AG_API_AUDIO_OPEN_EVT;
p_buf->layer_specific = handle;
p_buf->event = BTA_AG_API_AUDIO_OPEN_EVT;
p_buf->layer_specific = handle;

bta_sys_sendmsg(p_buf);
bta_sys_sendmsg(p_buf);
}

/*******************************************************************************
Expand All @@ -228,14 +220,13 @@ void BTA_AgAudioOpen(uint16_t handle)
* Returns void
*
******************************************************************************/
void BTA_AgAudioClose(uint16_t handle)
{
BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
void BTA_AgAudioClose(uint16_t handle) {
BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR));

p_buf->event = BTA_AG_API_AUDIO_CLOSE_EVT;
p_buf->layer_specific = handle;
p_buf->event = BTA_AG_API_AUDIO_CLOSE_EVT;
p_buf->layer_specific = handle;

bta_sys_sendmsg(p_buf);
bta_sys_sendmsg(p_buf);
}

/*******************************************************************************
Expand All @@ -250,18 +241,17 @@ void BTA_AgAudioClose(uint16_t handle)
* Returns void
*
******************************************************************************/
void BTA_AgResult(uint16_t handle, tBTA_AG_RES result, tBTA_AG_RES_DATA *p_data)
{
tBTA_AG_API_RESULT *p_buf =
(tBTA_AG_API_RESULT *)osi_malloc(sizeof(tBTA_AG_API_RESULT));

p_buf->hdr.event = BTA_AG_API_RESULT_EVT;
p_buf->hdr.layer_specific = handle;
p_buf->result = result;
if (p_data)
memcpy(&p_buf->data, p_data, sizeof(p_buf->data));

bta_sys_sendmsg(p_buf);
void BTA_AgResult(uint16_t handle, tBTA_AG_RES result,
tBTA_AG_RES_DATA* p_data) {
tBTA_AG_API_RESULT* p_buf =
(tBTA_AG_API_RESULT*)osi_malloc(sizeof(tBTA_AG_API_RESULT));

p_buf->hdr.event = BTA_AG_API_RESULT_EVT;
p_buf->hdr.layer_specific = handle;
p_buf->result = result;
if (p_data) memcpy(&p_buf->data, p_data, sizeof(p_buf->data));

bta_sys_sendmsg(p_buf);
}

/*******************************************************************************
Expand All @@ -276,14 +266,13 @@ void BTA_AgResult(uint16_t handle, tBTA_AG_RES result, tBTA_AG_RES_DATA *p_data)
* Returns void
*
******************************************************************************/
void BTA_AgSetCodec(uint16_t handle, tBTA_AG_PEER_CODEC codec)
{
tBTA_AG_API_SETCODEC *p_buf =
(tBTA_AG_API_SETCODEC *)osi_malloc(sizeof(tBTA_AG_API_SETCODEC));
void BTA_AgSetCodec(uint16_t handle, tBTA_AG_PEER_CODEC codec) {
tBTA_AG_API_SETCODEC* p_buf =
(tBTA_AG_API_SETCODEC*)osi_malloc(sizeof(tBTA_AG_API_SETCODEC));

p_buf->hdr.event = BTA_AG_API_SETCODEC_EVT;
p_buf->hdr.layer_specific = handle;
p_buf->codec = codec;
p_buf->hdr.event = BTA_AG_API_SETCODEC_EVT;
p_buf->hdr.layer_specific = handle;
p_buf->codec = codec;

bta_sys_sendmsg(p_buf);
bta_sys_sendmsg(p_buf);
}
Loading

0 comments on commit cd1fd07

Please sign in to comment.