forked from auracaster/bumble_mirror
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):
|
if connection := self.connections.get(connection_handle):
|
||||||
return connection
|
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():
|
for connection in self.connections.values():
|
||||||
if connection.peer_address.get_bytes() == bd_addr.get_bytes():
|
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:
|
if transport is None or connection.transport == transport:
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user