forked from auracaster/bumble_mirror
Remove the word 'complete' from function name
This commit is contained in:
@@ -1782,15 +1782,22 @@ class Connection(utils.CompositeEventEmitter):
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Parameters:
|
class Parameters:
|
||||||
connection_interval: float # Connection interval, in milliseconds. [LE only]
|
"""
|
||||||
peripheral_latency: int # Peripheral latency, in number of intervals. [LE only]
|
LE connection parameters.
|
||||||
supervision_timeout: float # Supervision timeout, in milliseconds.
|
|
||||||
subrate_factor: int = (
|
Attributes:
|
||||||
1 # See Bluetooth spec Vol 6, Part B - 4.5.1 Connection events
|
connection_interval: Connection interval, in milliseconds.
|
||||||
)
|
peripheral_latency: Peripheral latency, in number of intervals.
|
||||||
continuation_number: int = (
|
supervision_timeout: Supervision timeout, in milliseconds.
|
||||||
0 # See Bluetooth spec Vol 6, Part B - 4.5.1 Connection events
|
subrate_factor: See Bluetooth spec Vol 6, Part B - 4.5.1 Connection events
|
||||||
)
|
continuation_number: See Bluetooth spec Vol 6, Part B - 4.5.1 Connection events
|
||||||
|
"""
|
||||||
|
|
||||||
|
connection_interval: float
|
||||||
|
peripheral_latency: int
|
||||||
|
supervision_timeout: float
|
||||||
|
subrate_factor: int = 1
|
||||||
|
continuation_number: int = 0
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -5413,13 +5420,10 @@ class Device(utils.CompositeEventEmitter):
|
|||||||
self.emit(self.EVENT_CONNECTION, connection)
|
self.emit(self.EVENT_CONNECTION, connection)
|
||||||
|
|
||||||
@host_event_handler
|
@host_event_handler
|
||||||
def on_connection_complete(
|
def on_classic_connection(
|
||||||
self,
|
self,
|
||||||
connection_handle: int,
|
connection_handle: int,
|
||||||
peer_address: hci.Address,
|
peer_address: hci.Address,
|
||||||
connection_interval: int,
|
|
||||||
peripheral_latency: int,
|
|
||||||
supervision_timeout: int,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
connection_role = self.connection_roles.pop(peer_address, hci.Role.PERIPHERAL)
|
connection_role = self.connection_roles.pop(peer_address, hci.Role.PERIPHERAL)
|
||||||
|
|
||||||
@@ -5442,18 +5446,14 @@ class Device(utils.CompositeEventEmitter):
|
|||||||
peer_address=peer_address,
|
peer_address=peer_address,
|
||||||
peer_resolvable_address=None,
|
peer_resolvable_address=None,
|
||||||
role=connection_role,
|
role=connection_role,
|
||||||
parameters=Connection.Parameters(
|
parameters=Connection.Parameters(0.0, 0, 0.0),
|
||||||
connection_interval * 1.25,
|
|
||||||
peripheral_latency,
|
|
||||||
supervision_timeout * 10.0,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
self.connections[connection_handle] = connection
|
self.connections[connection_handle] = connection
|
||||||
|
|
||||||
self.emit(self.EVENT_CONNECTION, connection)
|
self.emit(self.EVENT_CONNECTION, connection)
|
||||||
|
|
||||||
@host_event_handler
|
@host_event_handler
|
||||||
def on_le_connection_complete(
|
def on_le_connection(
|
||||||
self,
|
self,
|
||||||
connection_handle: int,
|
connection_handle: int,
|
||||||
peer_address: hci.Address,
|
peer_address: hci.Address,
|
||||||
|
|||||||
@@ -992,7 +992,7 @@ class Host(utils.EventEmitter):
|
|||||||
|
|
||||||
# Notify the client
|
# Notify the client
|
||||||
self.emit(
|
self.emit(
|
||||||
'le_connection_complete',
|
'le_connection',
|
||||||
event.connection_handle,
|
event.connection_handle,
|
||||||
event.peer_address,
|
event.peer_address,
|
||||||
getattr(event, 'local_resolvable_private_address', None),
|
getattr(event, 'local_resolvable_private_address', None),
|
||||||
@@ -1051,12 +1051,9 @@ class Host(utils.EventEmitter):
|
|||||||
|
|
||||||
# Notify the client
|
# Notify the client
|
||||||
self.emit(
|
self.emit(
|
||||||
'connection_complete',
|
'classic_connection',
|
||||||
event.connection_handle,
|
event.connection_handle,
|
||||||
event.bd_addr,
|
event.bd_addr,
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.debug(f'### BR/EDR CONNECTION FAILED: {event.status}')
|
logger.debug(f'### BR/EDR CONNECTION FAILED: {event.status}')
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ async def test_legacy_advertising_disconnection(auto_restart):
|
|||||||
await device.power_on()
|
await device.power_on()
|
||||||
peer_address = Address('F0:F1:F2:F3:F4:F5')
|
peer_address = Address('F0:F1:F2:F3:F4:F5')
|
||||||
await device.start_advertising(auto_restart=auto_restart)
|
await device.start_advertising(auto_restart=auto_restart)
|
||||||
device.on_le_connection_complete(
|
device.on_le_connection(
|
||||||
0x0001,
|
0x0001,
|
||||||
peer_address,
|
peer_address,
|
||||||
None,
|
None,
|
||||||
@@ -348,7 +348,7 @@ async def test_extended_advertising_connection(own_address_type):
|
|||||||
advertising_set = await device.create_advertising_set(
|
advertising_set = await device.create_advertising_set(
|
||||||
advertising_parameters=AdvertisingParameters(own_address_type=own_address_type)
|
advertising_parameters=AdvertisingParameters(own_address_type=own_address_type)
|
||||||
)
|
)
|
||||||
device.on_le_connection_complete(
|
device.on_le_connection(
|
||||||
0x0001,
|
0x0001,
|
||||||
peer_address,
|
peer_address,
|
||||||
None,
|
None,
|
||||||
@@ -393,7 +393,7 @@ async def test_extended_advertising_connection_out_of_order(own_address_type):
|
|||||||
0x0001,
|
0x0001,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
device.on_le_connection_complete(
|
device.on_le_connection(
|
||||||
0x0001,
|
0x0001,
|
||||||
Address('F0:F1:F2:F3:F4:F5'),
|
Address('F0:F1:F2:F3:F4:F5'),
|
||||||
None,
|
None,
|
||||||
|
|||||||
Reference in New Issue
Block a user