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

Commit 7d658d23 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Jakub Pawlowski
Browse files

gatt: Allow services to indicate eatt support

With this patch eatch client/server can decide if EATT support
should be enabled or not.
If eatt_support is set to true, and EATT is available, it will be used for services added.
If eatt_support is set to false, that means only ATT (CID 4) is used for services added.

Tag: #feature
Bug: 159786353
Sponsor: jpawlowski@
Test: compilation
Change-Id: I584172800ce32a4a11df465841d2bc49ab224939
parent 8ba16302
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3500,7 +3500,7 @@ static void bta_dm_gattc_register(void) {
                            else
                              bta_dm_search_cb.client_if = BTA_GATTS_INVALID_IF;

                          }));
                          }), false);
  }
}

+3 −3
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ void bta_gattc_start_if(uint8_t client_if) {

/** Register a GATT client application with BTA */
void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback,
                        BtaAppRegisterCallback cb) {
                        BtaAppRegisterCallback cb, bool eatt_suppport) {
  tGATT_STATUS status = GATT_NO_RESOURCES;
  uint8_t client_if = 0;
  VLOG(1) << __func__ << ": state:" << +bta_gattc_cb.state;
@@ -179,8 +179,8 @@ void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback,
  /* todo need to check duplicate uuid */
  for (uint8_t i = 0; i < BTA_GATTC_CL_MAX; i++) {
    if (!bta_gattc_cb.cl_rcb[i].in_use) {
      if ((bta_gattc_cb.cl_rcb[i].client_if =
               GATT_Register(app_uuid, &bta_gattc_cl_cback)) == 0) {
      if ((bta_gattc_cb.cl_rcb[i].client_if = GATT_Register(
               app_uuid, &bta_gattc_cl_cback, eatt_suppport)) == 0) {
        LOG(ERROR) << "Register with GATT stack failed.";
        status = GATT_ERROR;
      } else {
+2 −2
Original line number Diff line number Diff line
@@ -73,13 +73,13 @@ void BTA_GATTC_Disable(void) {
 * |cb| one time callback when registration is finished
 */
void BTA_GATTC_AppRegister(tBTA_GATTC_CBACK* p_client_cb,
                           BtaAppRegisterCallback cb) {
                           BtaAppRegisterCallback cb, bool eatt_support) {
  if (!bta_sys_is_register(BTA_ID_GATTC))
    bta_sys_register(BTA_ID_GATTC, &bta_gattc_reg);

  do_in_main_thread(
      FROM_HERE, base::Bind(&bta_gattc_register, Uuid::GetRandom(), p_client_cb,
                            std::move(cb)));
                            std::move(cb), eatt_support));
}

static void app_deregister_impl(tGATT_IF client_if) {
+1 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ extern bool bta_gattc_sm_execute(tBTA_GATTC_CLCB* p_clcb, uint16_t event,
extern void bta_gattc_disable();
extern void bta_gattc_register(const bluetooth::Uuid& app_uuid,
                               tBTA_GATTC_CBACK* p_data,
                               BtaAppRegisterCallback cb);
                               BtaAppRegisterCallback cb, bool eatt_support);
extern void bta_gattc_process_api_open(tBTA_GATTC_DATA* p_msg);
extern void bta_gattc_process_api_open_cancel(tBTA_GATTC_DATA* p_msg);
extern void bta_gattc_deregister(tBTA_GATTC_RCB* p_clreg);
+2 −1
Original line number Diff line number Diff line
@@ -212,7 +212,8 @@ void bta_gatts_register(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) {
      p_cb->rcb[first_unuse].p_cback = p_msg->api_reg.p_cback;
      p_cb->rcb[first_unuse].app_uuid = p_msg->api_reg.app_uuid;
      cb_data.reg_oper.server_if = p_cb->rcb[first_unuse].gatt_if =
          GATT_Register(p_msg->api_reg.app_uuid, &bta_gatts_cback);
          GATT_Register(p_msg->api_reg.app_uuid, &bta_gatts_cback,
                        p_msg->api_reg.eatt_support);
      if (!p_cb->rcb[first_unuse].gatt_if) {
        status = GATT_NO_RESOURCES;
      } else {
Loading