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

Commit 00b0492c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes Iccb0a4b6,I04a65e1c,Iadb4a68c,Ia6366db2,I81a5f03c, ...

* changes:
  Remove unused file bta/include/bta_gatts_co.h
  Remove unused api bta_gatts_co_srv_chg
  Remove unused bta_gatts_co_srv_chg
  Remove unused bta_gatts_co_load_handle_range
  Add API check_cod_hid
  Add API is_main_thread() check
  Fix gatt_disconnection_reason_text
parents bc566dfe bc4989ff
Loading
Loading
Loading
Loading
+2 −19
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@

#include "bta/gatt/bta_gatts_int.h"
#include "bta/include/bta_api.h"
#include "bta/include/bta_gatts_co.h"
#include "btif/include/btif_debug_conn.h"
#include "osi/include/osi.h"
#include "stack/include/gatt_api.h"
@@ -82,10 +81,7 @@ tGATT_APPL_INFO bta_gatts_nv_cback = {bta_gatts_nv_save_cback,
 *
 ******************************************************************************/
static void bta_gatts_nv_save_cback(bool is_add,
                                    tGATTS_HNDL_RANGE* p_hndl_range) {
  bta_gatts_co_update_handle_range(is_add,
                                   (tBTA_GATTS_HNDL_RANGE*)p_hndl_range);
}
                                    tGATTS_HNDL_RANGE* p_hndl_range) {}

/*******************************************************************************
 *
@@ -101,9 +97,7 @@ static void bta_gatts_nv_save_cback(bool is_add,
static bool bta_gatts_nv_srv_chg_cback(tGATTS_SRV_CHG_CMD cmd,
                                       tGATTS_SRV_CHG_REQ* p_req,
                                       tGATTS_SRV_CHG_RSP* p_rsp) {
  return bta_gatts_co_srv_chg((tGATTS_SRV_CHG_CMD)cmd,
                              (tGATTS_SRV_CHG_REQ*)p_req,
                              (tGATTS_SRV_CHG_RSP*)p_rsp);
  return false;
}

/*******************************************************************************
@@ -116,9 +110,6 @@ static bool bta_gatts_nv_srv_chg_cback(tGATTS_SRV_CHG_CMD cmd,
 *
 ******************************************************************************/
void bta_gatts_enable(tBTA_GATTS_CB* p_cb) {
  uint8_t index = 0;
  tBTA_GATTS_HNDL_RANGE handle_range;

  if (p_cb->enabled) {
    VLOG(1) << "GATTS already enabled.";
  } else {
@@ -126,14 +117,6 @@ void bta_gatts_enable(tBTA_GATTS_CB* p_cb) {

    p_cb->enabled = true;

    while (bta_gatts_co_load_handle_range(index, &handle_range)) {
      GATTS_AddHandleRange((tGATTS_HNDL_RANGE*)&handle_range);
      memset(&handle_range, 0, sizeof(tGATTS_HNDL_RANGE));
      index++;
    }

    VLOG(1) << __func__ << ": num of handle range added:" << +index;

    if (!GATTS_NVRegister(&bta_gatts_nv_cback)) {
      LOG(ERROR) << "BTA GATTS NV register failed.";
    }

system/bta/include/bta_gatts_co.h

deleted100644 → 0
+0 −82
Original line number Diff line number Diff line
/******************************************************************************
 *
 *  Copyright 2010-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 interface file for BTA GATT server call-out functions.
 *
 ******************************************************************************/
#ifndef BTA_GATTS_CO_H
#define BTA_GATTS_CO_H

#include "bta/include/bta_gatt_api.h"

/*******************************************************************************
 *
 * 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.
 *
 ******************************************************************************/
extern void bta_gatts_co_update_handle_range(
    bool is_add, tBTA_GATTS_HNDL_RANGE* 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
 *
 ******************************************************************************/
extern bool bta_gatts_co_srv_chg(tGATTS_SRV_CHG_CMD cmd,
                                 tGATTS_SRV_CHG_REQ* p_req,
                                 tGATTS_SRV_CHG_RSP* p_rsp);

/*******************************************************************************
 *
 * 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.
 *
 ******************************************************************************/
extern bool bta_gatts_co_load_handle_range(uint8_t index,
                                           tBTA_GATTS_HNDL_RANGE* p_handle);

#endif /* BTA_GATTS_CO_H */
+1 −63
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include <string.h>
#include "bt_common.h"
#include "bta_gatts_co.h"
#include "btif_util.h"
#include "osi/include/osi.h"
#include "stack/include/gatt_api.h"

/*****************************************************************************
 *  Local type definitions
@@ -82,65 +82,3 @@ void btif_gatts_add_bonded_dev_from_nv(const RawAddress& bda) {
    }
  }
}

/*****************************************************************************
 *  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(
    UNUSED_ATTR bool is_add, UNUSED_ATTR tBTA_GATTS_HNDL_RANGE* 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
 *
 ******************************************************************************/
bool bta_gatts_co_srv_chg(UNUSED_ATTR tGATTS_SRV_CHG_CMD cmd,
                          UNUSED_ATTR tGATTS_SRV_CHG_REQ* p_req,
                          UNUSED_ATTR tGATTS_SRV_CHG_RSP* p_rsp) {
  return false;
}

/*******************************************************************************
 *
 * 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(
    UNUSED_ATTR uint8_t index,
    UNUSED_ATTR tBTA_GATTS_HNDL_RANGE* p_handle_range) {
  return false;
}
+1 −0
Original line number Diff line number Diff line
@@ -105,4 +105,5 @@ void btif_dm_update_ble_remote_properties(const RawAddress& bd_addr,
                                          BD_NAME bd_name,
                                          tBT_DEVICE_TYPE dev_type);

bool check_cod_hid(const RawAddress& bd_addr);
#endif
+4 −0
Original line number Diff line number Diff line
@@ -394,6 +394,10 @@ bool check_cod_hid(const RawAddress* remote_bdaddr) {
  return (get_cod(remote_bdaddr) & COD_HID_MASK) == COD_HID_MAJOR;
}

bool check_cod_hid(const RawAddress& bd_addr) {
  return (get_cod(&bd_addr) & COD_HID_MASK) == COD_HID_MAJOR;
}

/*****************************************************************************
 *
 * Function        check_sdp_bl
Loading