mirror of
https://github.com/google/bumble.git
synced 2026-05-06 03:38:01 +00:00
device: add option to check for the address type when using find_connection_by_bd_addr
This commit is contained in:
@@ -777,9 +777,11 @@ class Device(CompositeEventEmitter):
|
||||
if connection := self.connections.get(connection_handle):
|
||||
return connection
|
||||
|
||||
def find_connection_by_bd_addr(self, bd_addr, transport=None):
|
||||
def find_connection_by_bd_addr(self, bd_addr, transport=None, check_address_type=False):
|
||||
for connection in self.connections.values():
|
||||
if connection.peer_address.get_bytes() == bd_addr.get_bytes():
|
||||
if check_address_type and connection.peer_address.address_type != bd_addr.address_type:
|
||||
continue
|
||||
if transport is None or connection.transport == transport:
|
||||
return connection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user