forked from auracaster/bumble_mirror
fix tests
This commit is contained in:
@@ -583,13 +583,15 @@ class Controller:
|
||||
'''
|
||||
See Bluetooth spec Vol 2, Part E - 7.4.1 Read Local Version Information Command
|
||||
'''
|
||||
return struct.pack('<BBHBHH',
|
||||
return struct.pack(
|
||||
'<BBHBHH',
|
||||
HCI_SUCCESS,
|
||||
self.hci_version,
|
||||
self.hci_revision,
|
||||
self.lmp_version,
|
||||
self.manufacturer_name,
|
||||
self.lmp_subversion)
|
||||
self.lmp_subversion
|
||||
)
|
||||
|
||||
def on_hci_read_local_supported_commands_command(self, command):
|
||||
'''
|
||||
@@ -876,12 +878,26 @@ class Controller:
|
||||
'''
|
||||
See Bluetooth spec Vol 2, Part E - 7.8.46 LE Read Maximum Data Length Command
|
||||
'''
|
||||
return struct.pack('<BHHHH',
|
||||
return struct.pack(
|
||||
'<BHHHH',
|
||||
HCI_SUCCESS,
|
||||
self.supported_max_tx_octets,
|
||||
self.supported_max_tx_time,
|
||||
self.supported_max_rx_octets,
|
||||
self.supported_max_rx_time)
|
||||
self.supported_max_rx_time
|
||||
)
|
||||
|
||||
def on_hci_le_read_phy_command(self, command):
|
||||
'''
|
||||
See Bluetooth spec Vol 2, Part E - 7.8.47 LE Read PHY command
|
||||
'''
|
||||
return struct.pack(
|
||||
'<BHBB',
|
||||
HCI_SUCCESS,
|
||||
command.connection_handle,
|
||||
HCI_LE_1M_PHY,
|
||||
HCI_LE_1M_PHY
|
||||
)
|
||||
|
||||
def on_hci_le_set_default_phy_command(self, command):
|
||||
'''
|
||||
@@ -893,3 +909,4 @@ class Controller:
|
||||
'rx_phys': command.rx_phys
|
||||
}
|
||||
return bytes([HCI_SUCCESS])
|
||||
|
||||
|
||||
@@ -271,8 +271,8 @@ class Peer:
|
||||
|
||||
async def request_mtu(self, mtu):
|
||||
mtu = await self.gatt_client.request_mtu(mtu)
|
||||
self.connection.att_mtu = mtu
|
||||
self.connection.emit('connection_att_mtu_update')
|
||||
return mtu
|
||||
|
||||
async def discover_service(self, uuid):
|
||||
return await self.gatt_client.discover_service(uuid)
|
||||
@@ -1052,7 +1052,7 @@ class Device(CompositeEventEmitter):
|
||||
lap = HCI_GENERAL_INQUIRY_LAP,
|
||||
inquiry_length = DEVICE_DEFAULT_INQUIRY_LENGTH,
|
||||
num_responses = 0 # Unlimited number of responses.
|
||||
), check_result=True)
|
||||
))
|
||||
if response.status != HCI_Command_Status_Event.PENDING:
|
||||
self.discovering = False
|
||||
raise HCI_StatusError(response)
|
||||
@@ -1644,6 +1644,23 @@ class Device(CompositeEventEmitter):
|
||||
if connection_handle in self.connections:
|
||||
logger.warn('new connection reuses the same handle as a previous connection')
|
||||
|
||||
if transport == BT_BR_EDR_TRANSPORT:
|
||||
# Create a new connection
|
||||
connection = Connection(
|
||||
self,
|
||||
connection_handle,
|
||||
transport,
|
||||
peer_address,
|
||||
peer_resolvable_address,
|
||||
role,
|
||||
connection_parameters,
|
||||
phy=None
|
||||
)
|
||||
self.connections[connection_handle] = connection
|
||||
|
||||
# Emit an event to notify listeners of the new connection
|
||||
self.emit('connection', connection)
|
||||
else:
|
||||
# Resolve the peer address if we can
|
||||
if self.address_resolver:
|
||||
if peer_address.is_resolvable:
|
||||
|
||||
Reference in New Issue
Block a user