Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f68a751 authored by Myles Watson's avatar Myles Watson
Browse files

btif: Apply clang-format

clang-format doesn't understand block quotes of this form:

/*  This is not handled well
**  because there are two asterisks
**/

cd btif/

 # Replace '**' at the beginning of the line with ' *'

sed 's/^[*][*]/ \*/' -i include/* src/* test/* co/*
clang-format --style=file -i src/* include/* test/* co/*

Test: mma -j32
Change-Id: I2477eae5480602d5b2fee5ec89c9ed7888022341
parent daba1449
Loading
Loading
Loading
Loading
+90 −89
Original line number Diff line number Diff line
@@ -18,60 +18,60 @@

#define LOG_TAG "bt_btif_bta_ag"

#include "bta/include/bta_ag_api.h"
#include "bta/include/bta_ag_co.h"
#include "bta/include/bta_ag_api.h"
#include "hci/include/hci_audio.h"
#include "osi/include/osi.h"

/*******************************************************************************
**
** Function         bta_ag_co_init
**
** Description      This callout function is executed by AG when it is
**                  started by calling BTA_AgEnable().  This function can be
**                  used by the phone to initialize audio paths or for other
**                  initialization purposes.
**
**
** Returns          Void.
**
*******************************************************************************/
void bta_ag_co_init(void)
{
    BTM_WriteVoiceSettings(AG_VOICE_SETTINGS);
}

 *
 * Function         bta_ag_co_init
 *
 * Description      This callout function is executed by AG when it is
 *                  started by calling BTA_AgEnable().  This function can be
 *                  used by the phone to initialize audio paths or for other
 *                  initialization purposes.
 *
 *
 * Returns          Void.
 *
 ******************************************************************************/
void bta_ag_co_init(void) { BTM_WriteVoiceSettings(AG_VOICE_SETTINGS); }

/*******************************************************************************
**
** Function         bta_ag_co_audio_state
**
** Description      This function is called by the AG before the audio connection
**                  is brought up, after it comes up, and after it goes down.
**
** Parameters       handle - handle of the AG instance
**                  state - Audio state
**                  codec - if WBS support is compiled in, codec to going to be used is provided
**                      and when in SCO_STATE_SETUP, BTM_I2SPCMConfig() must be called with
**                      the correct platform parameters.
**                      in the other states codec type should not be ignored
**
** Returns          void
**
*******************************************************************************/
 *
 * Function         bta_ag_co_audio_state
 *
 * Description      This function is called by the AG before the audio
 *connection
 *                  is brought up, after it comes up, and after it goes down.
 *
 * Parameters       handle - handle of the AG instance
 *                  state - Audio state
 *                  codec - if WBS support is compiled in, codec to going to be
 *used is provided
 *                      and when in SCO_STATE_SETUP, BTM_I2SPCMConfig() must be
 *called with
 *                      the correct platform parameters.
 *                      in the other states codec type should not be ignored
 *
 * Returns          void
 *
 ******************************************************************************/
#if (BTM_WBS_INCLUDED == TRUE)
void bta_ag_co_audio_state(uint16_t handle, uint8_t app_id, uint8_t state, tBTA_AG_PEER_CODEC codec)
void bta_ag_co_audio_state(uint16_t handle, uint8_t app_id, uint8_t state,
                           tBTA_AG_PEER_CODEC codec)
#else
void bta_ag_co_audio_state(uint16_t handle, uint8_t app_id, uint8_t state)
#endif
{
  BTIF_TRACE_DEBUG("bta_ag_co_audio_state: handle %d, state %d", handle, state);
    switch (state)
    {
  switch (state) {
    case SCO_STATE_OFF:
#if (BTM_WBS_INCLUDED == TRUE)
        BTIF_TRACE_DEBUG("bta_ag_co_audio_state(handle %d)::Closed (OFF), codec: 0x%x",
                        handle, codec);
      BTIF_TRACE_DEBUG(
          "bta_ag_co_audio_state(handle %d)::Closed (OFF), codec: 0x%x", handle,
          codec);
      set_audio_state(handle, (sco_codec_t)codec, (sco_state_t)state);
#else
      BTIF_TRACE_DEBUG("bta_ag_co_audio_state(handle %d)::Closed (OFF)",
@@ -79,76 +79,77 @@ void bta_ag_co_audio_state(uint16_t handle, uint8_t app_id, uint8_t state)
#endif
      break;
    case SCO_STATE_OFF_TRANSFER:
        BTIF_TRACE_DEBUG("bta_ag_co_audio_state(handle %d)::Closed (XFERRING)", handle);
      BTIF_TRACE_DEBUG("bta_ag_co_audio_state(handle %d)::Closed (XFERRING)",
                       handle);
      break;
    case SCO_STATE_SETUP:
#if (BTM_WBS_INCLUDED == TRUE)
      set_audio_state(handle, (sco_codec_t)codec, (sco_state_t)state);
#else
        set_audio_state(handle, (sco_codec_t) BTA_AG_CODEC_CVSD, (sco_state_t) state);
      set_audio_state(handle, (sco_codec_t)BTA_AG_CODEC_CVSD,
                      (sco_state_t)state);
#endif
      break;
    default:
      break;
  }
#if (BTM_WBS_INCLUDED == TRUE)
    APPL_TRACE_DEBUG("bta_ag_co_audio_state(handle %d, app_id: %d, state %d, codec: 0x%x)",
  APPL_TRACE_DEBUG(
      "bta_ag_co_audio_state(handle %d, app_id: %d, state %d, codec: 0x%x)",
      handle, app_id, state, codec);
#else
    APPL_TRACE_DEBUG("bta_ag_co_audio_state(handle %d, app_id: %d, state %d)", \
  APPL_TRACE_DEBUG("bta_ag_co_audio_state(handle %d, app_id: %d, state %d)",
                   handle, app_id, state);
#endif
}


/*******************************************************************************
**
** Function         bta_ag_co_data_open
**
** Description      This function is executed by AG when a service level connection
**                  is opened.  The phone can use this function to set
**                  up data paths or perform any required initialization or
**                  set up particular to the connected service.
**
**
** Returns          void
**
*******************************************************************************/
void bta_ag_co_data_open(uint16_t handle, tBTA_SERVICE_ID service)
{
 *
 * Function         bta_ag_co_data_open
 *
 * Description      This function is executed by AG when a service level
 *connection
 *                  is opened.  The phone can use this function to set
 *                  up data paths or perform any required initialization or
 *                  set up particular to the connected service.
 *
 *
 * Returns          void
 *
 ******************************************************************************/
void bta_ag_co_data_open(uint16_t handle, tBTA_SERVICE_ID service) {
  BTIF_TRACE_DEBUG("bta_ag_co_data_open handle:%d service:%d", handle, service);
}

/*******************************************************************************
**
** Function         bta_ag_co_data_close
**
** Description      This function is called by AG when a service level
**                  connection is closed
**
**
** Returns          void
**
*******************************************************************************/
void bta_ag_co_data_close(uint16_t handle)
{
 *
 * Function         bta_ag_co_data_close
 *
 * Description      This function is called by AG when a service level
 *                  connection is closed
 *
 *
 * Returns          void
 *
 ******************************************************************************/
void bta_ag_co_data_close(uint16_t handle) {
  BTIF_TRACE_DEBUG("bta_ag_co_data_close handle:%d", handle);
}


/*******************************************************************************
 **
 ** Function         bta_ag_co_tx_write
 **
 ** Description      This function is called by the AG to send data to the
 **                  phone when the AG is configured for AT command pass-through.
 **                  phone when the AG is configured for AT command
 *pass-through.
 **                  The implementation of this function must copy the data to
 **                  the phones memory.
 **
 ** Returns          void
 **
 *******************************************************************************/
void bta_ag_co_tx_write(uint16_t handle, UNUSED_ATTR uint8_t * p_data, uint16_t len)
{
void bta_ag_co_tx_write(uint16_t handle, UNUSED_ATTR uint8_t* p_data,
                        uint16_t len) {
  BTIF_TRACE_DEBUG("bta_ag_co_tx_write: handle: %d, len: %d", handle, len);
}
+702 −770

File changed.

Preview size limit exceeded, changes collapsed.

+332 −342

File changed.

Preview size limit exceeded, changes collapsed.

+98 −104
Original line number Diff line number Diff line
@@ -27,64 +27,56 @@
#include "btif_util.h"

/*****************************************************************************
**  Local type definitions
*****************************************************************************/
 *  Local type definitions
 ****************************************************************************/

#define BTIF_GATTS_MAX_SRV_CHG_CLT_SIZE 50

typedef struct
{
typedef struct {
  bool enable;
  uint8_t num_clients;
  tBTA_GATTS_SRV_CHG srv_chg[BTIF_GATTS_MAX_SRV_CHG_CLT_SIZE];
} __attribute__((packed)) btif_gatts_srv_chg_cb_t;

/*****************************************************************************
**  Static variables
*****************************************************************************/
 *  Static variables
 ****************************************************************************/

static btif_gatts_srv_chg_cb_t btif_gatts_srv_chg_cb;

/*****************************************************************************
**  Static functions
*****************************************************************************/
 *  Static functions
 ****************************************************************************/

static void btif_gatts_check_init(void)
{
static void btif_gatts_check_init(void) {
  btif_gatts_srv_chg_cb_t* p_cb = &btif_gatts_srv_chg_cb;

    if (!p_cb->enable)
    {
  if (!p_cb->enable) {
    memset(p_cb, 0, sizeof(btif_gatts_srv_chg_cb_t));
    p_cb->enable = true;
  }
}

/*****************************************************************************
**  Externally called functions
*****************************************************************************/
 *  Externally called functions
 ****************************************************************************/

void btif_gatts_add_bonded_dev_from_nv(BD_ADDR bda)
{
void btif_gatts_add_bonded_dev_from_nv(BD_ADDR bda) {
  btif_gatts_srv_chg_cb_t* p_cb = &btif_gatts_srv_chg_cb;
  bool found = false;
  uint8_t i;

  btif_gatts_check_init();

    for (i=0; i != p_cb->num_clients; ++i)
    {
        if (!memcmp(p_cb->srv_chg[i].bda,  bda, sizeof(BD_ADDR)))
        {
  for (i = 0; i != p_cb->num_clients; ++i) {
    if (!memcmp(p_cb->srv_chg[i].bda, bda, sizeof(BD_ADDR))) {
      found = true;
      break;
    }
  }

    if (!found)
    {
        if (p_cb->num_clients < BTIF_GATTS_MAX_SRV_CHG_CLT_SIZE)
        {
  if (!found) {
    if (p_cb->num_clients < BTIF_GATTS_MAX_SRV_CHG_CLT_SIZE) {
      bdcpy(p_cb->srv_chg[p_cb->num_clients].bda, bda);
      p_cb->srv_chg[p_cb->num_clients].srv_changed = false;
      p_cb->num_clients++;
@@ -93,49 +85,51 @@ void btif_gatts_add_bonded_dev_from_nv(BD_ADDR bda)
}

/*****************************************************************************
**  Call-out functions
*****************************************************************************/
 *  Call-out functions
 ****************************************************************************/

/*******************************************************************************
**
** Function         bta_gatts_co_update_handle_range
**
** Description      This callout function is executed by GATTS when a GATT server
**                  handle range ios to be added or removed.
**
** Parameter        is_add: true is to add a handle range; otherwise is to delete.
**                  p_hndl_range: handle range.
**
** Returns          void.
**
*******************************************************************************/
void bta_gatts_co_update_handle_range(bool is_add, tBTA_GATTS_HNDL_RANGE *p_hndl_range)
{
 *
 * Function         bta_gatts_co_update_handle_range
 *
 * Description      This callout function is executed by GATTS when a GATT
 *server
 *                  handle range ios to be added or removed.
 *
 * Parameter        is_add: true is to add a handle range; otherwise is to
 *delete.
 *                  p_hndl_range: handle range.
 *
 * Returns          void.
 *
 ******************************************************************************/
void bta_gatts_co_update_handle_range(bool is_add,
                                      tBTA_GATTS_HNDL_RANGE* p_hndl_range) {
  UNUSED(is_add);
  UNUSED(p_hndl_range);
}

/*******************************************************************************
**
** Function         bta_gatts_co_srv_chg
**
** Description      This call-out is to read/write/remove service change related
**                  informaiton. The request consists of the cmd and p_req and the
**                  response is returned in p_rsp
**
** Parameter        cmd - request command
**                  p_req - request paramters
**                  p_rsp - response data for the request
**
** Returns          true - if the request is processed successfully and
**                         the response is returned in p_rsp.
**                  false - if the request can not be processed
**
*******************************************************************************/
 *
 * Function         bta_gatts_co_srv_chg
 *
 * Description      This call-out is to read/write/remove service change related
 *                  informaiton. The request consists of the cmd and p_req and
 *the
 *                  response is returned in p_rsp
 *
 * Parameter        cmd - request command
 *                  p_req - request paramters
 *                  p_rsp - response data for the request
 *
 * Returns          true - if the request is processed successfully and
 *                         the response is returned in p_rsp.
 *                  false - if the request can not be processed
 *
 ******************************************************************************/
bool bta_gatts_co_srv_chg(tBTA_GATTS_SRV_CHG_CMD cmd,
                          tBTA_GATTS_SRV_CHG_REQ* p_req,
                             tBTA_GATTS_SRV_CHG_RSP *p_rsp)
{
                          tBTA_GATTS_SRV_CHG_RSP* p_rsp) {
  UNUSED(cmd);
  UNUSED(p_req);
  UNUSED(p_rsp);
@@ -144,20 +138,20 @@ bool bta_gatts_co_srv_chg(tBTA_GATTS_SRV_CHG_CMD cmd,
}

/*******************************************************************************
**
** Function         bta_gatts_co_load_handle_range
**
** Description      This callout function is executed by GATTS when a GATT server
**                  handle range is requested to be loaded from NV.
**
** Parameter
**
** Returns          void.
**
*******************************************************************************/
 *
 * Function         bta_gatts_co_load_handle_range
 *
 * Description      This callout function is executed by GATTS when a GATT
 *server
 *                  handle range is requested to be loaded from NV.
 *
 * Parameter
 *
 * Returns          void.
 *
 ******************************************************************************/
bool bta_gatts_co_load_handle_range(uint8_t index,
                                       tBTA_GATTS_HNDL_RANGE *p_handle_range)
{
                                    tBTA_GATTS_HNDL_RANGE* p_handle_range) {
  UNUSED(index);
  UNUSED(p_handle_range);

+497 −499

File changed.

Preview size limit exceeded, changes collapsed.

Loading