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

Commit 2ebf9c16 authored by Chris Manton's avatar Chris Manton
Browse files

le_impl: Add explict callback for connected status

Bug: 204433265
Tag: #refactor
Test: gd/cert/run

Change-Id: Iba998dbc7eb95349882b5dc923b16f1ab6eb46b4
parent 8218f481
Loading
Loading
Loading
Loading
+25 −12
Original line number Original line Diff line number Diff line
@@ -413,6 +413,16 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
        address_with_type.ToPeerAddressType(), address_with_type.GetAddress());
        address_with_type.ToPeerAddressType(), address_with_type.GetAddress());
  }
  }


  void on_extended_create_connection(CommandStatusView status) {
    ASSERT(status.IsValid());
    ASSERT(status.GetCommandOpCode() == OpCode::LE_EXTENDED_CREATE_CONNECTION);
  }

  void on_create_connection(CommandStatusView status) {
    ASSERT(status.IsValid());
    ASSERT(status.GetCommandOpCode() == OpCode::LE_CREATE_CONNECTION);
  }

  void create_le_connection(AddressWithType address_with_type, bool add_to_connect_list, bool is_direct) {
  void create_le_connection(AddressWithType address_with_type, bool add_to_connect_list, bool is_direct) {
    if (le_client_callbacks_ == nullptr) {
    if (le_client_callbacks_ == nullptr) {
      LOG_ERROR("No callbacks to call");
      LOG_ERROR("No callbacks to call");
@@ -528,20 +538,23 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
              address_with_type.GetAddress(),
              address_with_type.GetAddress(),
              initiating_phys,
              initiating_phys,
              parameters),
              parameters),
          handler_->BindOnce([](CommandStatusView status) {
          handler_->BindOnce(&le_impl::on_extended_create_connection, common::Unretained(this)));
            ASSERT(status.IsValid());
            ASSERT(status.GetCommandOpCode() == OpCode::LE_EXTENDED_CREATE_CONNECTION);
          }));
    } else {
    } else {
      le_acl_connection_interface_->EnqueueCommand(
      le_acl_connection_interface_->EnqueueCommand(
          LeCreateConnectionBuilder::Create(le_scan_interval, le_scan_window, initiator_filter_policy,
          LeCreateConnectionBuilder::Create(
                                            address_with_type.GetAddressType(), address_with_type.GetAddress(),
              le_scan_interval,
                                            own_address_type, conn_interval_min, conn_interval_max, conn_latency,
              le_scan_window,
                                            supervision_timeout, kMinimumCeLength, kMaximumCeLength),
              initiator_filter_policy,
          handler_->BindOnce([](CommandStatusView status) {
              address_with_type.GetAddressType(),
            ASSERT(status.IsValid());
              address_with_type.GetAddress(),
            ASSERT(status.GetCommandOpCode() == OpCode::LE_CREATE_CONNECTION);
              own_address_type,
          }));
              conn_interval_min,
              conn_interval_max,
              conn_latency,
              supervision_timeout,
              kMinimumCeLength,
              kMaximumCeLength),
          handler_->BindOnce(&le_impl::on_create_connection, common::Unretained(this)));
    }
    }
  }
  }