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

Commit 1ee7faf5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "LeAclManager: Add CancelConnection"

parents 29fb4969 b689ff5c
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -43,13 +43,7 @@ class PyLeAclManagerAclConnection(IEventStream, Closable):
        self.our_acl_stream = acl_stream

        if remote_addr:
            remote_addr_bytes = bytes(remote_addr.address.address,
                                      'utf8') if type(remote_addr.address.address) is str else bytes(
                                          remote_addr.address.address)
            self.connection_event_stream = EventStream(
                self.device.hci_le_acl_manager.CreateConnection(
                    le_acl_manager_facade.LeConnectionMsg(
                        address_type=int(remote_addr.type), address=remote_addr_bytes)))
            self.connection_event_stream = EventStream(self.device.hci_le_acl_manager.CreateConnection(remote_addr))
        else:
            self.connection_event_stream = None

+4 −0
Original line number Diff line number Diff line
@@ -155,6 +155,10 @@ void AclManager::CancelConnect(Address address) {
  GetHandler()->Post(BindOnce(&classic_impl::cancel_connect, common::Unretained(pimpl_->classic_impl_), address));
}

void AclManager::CancelLeConnect(AddressWithType address_with_type) {
  GetHandler()->Post(BindOnce(&le_impl::cancel_connect, common::Unretained(pimpl_->le_impl_), address_with_type));
}

void AclManager::MasterLinkKey(KeyFlag key_flag) {
  GetHandler()->Post(BindOnce(&classic_impl::master_link_key, common::Unretained(pimpl_->classic_impl_), key_flag));
}
+2 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ class AclManager : public Module {
  // successfully cancelled and already connected
  virtual void CancelConnect(Address address);

  virtual void CancelLeConnect(AddressWithType address_with_type);

  virtual void MasterLinkKey(KeyFlag key_flag);
  virtual void SwitchRole(Address address, Role role);
  virtual uint16_t ReadDefaultLinkPolicySettings();
+6 −0
Original line number Diff line number Diff line
@@ -289,6 +289,12 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
    }
  }

  void cancel_connect(AddressWithType /* TODO: use this parameter for whitelist management */) {
    le_acl_connection_interface_->EnqueueCommand(
        LeCreateConnectionCancelBuilder::Create(),
        handler_->BindOnce(&check_command_complete<LeCreateConnectionCancelCompleteView>));
  }

  void set_privacy_policy_for_initiator_address(
      LeAddressManager::AddressPolicy address_policy,
      AddressWithType fixed_address,
+6 −6
Original line number Diff line number Diff line
@@ -117,9 +117,9 @@ class LeAclManagerTest(GdBaseTestClass):

            with EventStream(
                    self.dut.hci_le_acl_manager.CreateConnection(
                        le_acl_manager_facade.LeConnectionMsg(
                            address_type=int(hci_packets.AddressType.RANDOM_DEVICE_ADDRESS),
                            address=bytes('0C:05:04:03:02:01', 'utf8')))) as connection_event_stream:
                        common.BluetoothAddressWithType(
                            address=common.BluetoothAddress(address=bytes('0C:05:04:03:02:01', 'utf8')),
                            type=int(hci_packets.AddressType.RANDOM_DEVICE_ADDRESS)))) as connection_event_stream:

                # Cert gets ConnectionComplete with a handle and sends ACL data
                handle = 0xfff
@@ -338,9 +338,9 @@ class LeAclManagerTest(GdBaseTestClass):

            with EventStream(
                    self.dut.hci_le_acl_manager.CreateConnection(
                        le_acl_manager_facade.LeConnectionMsg(
                            address_type=int(hci_packets.AddressType.RANDOM_DEVICE_ADDRESS),
                            address=bytes('0C:05:04:03:02:01', 'utf8')))) as connection_event_stream:
                        common.BluetoothAddressWithType(
                            address=common.BluetoothAddress(address=bytes('0C:05:04:03:02:01', 'utf8')),
                            type=int(hci_packets.AddressType.RANDOM_DEVICE_ADDRESS)))) as connection_event_stream:

                # Cert gets ConnectionComplete with a handle and sends ACL data
                handle = 0xfff
Loading