Remove mutable ret pattern and test feature combinations

After adding test for feature combinations, I found a corner case where, when Transport is dropped and the process is terminated in a test, the `close` Python future is not awaited.
I don't know what other situations this issue may arise, so I have safe-guarded it via `block_on` instead of spawning a thread.
This commit is contained in:
Gabriel White-Vega
2023-10-18 15:39:37 -04:00
parent 1004f10384
commit 59d7717963
4 changed files with 27 additions and 18 deletions

View File

@@ -1000,16 +1000,15 @@ class Controller:
'''
See Bluetooth spec Vol 4, Part E - 7.8.10 LE Set Scan Parameters Command
'''
ret = HCI_SUCCESS
if not self.le_scan_enable:
self.le_scan_type = command.le_scan_type
self.le_scan_interval = command.le_scan_interval
self.le_scan_window = command.le_scan_window
self.le_scan_own_address_type = command.own_address_type
self.le_scanning_filter_policy = command.scanning_filter_policy
else:
ret = HCI_COMMAND_DISALLOWED_ERROR
return bytes([ret])
if self.le_scan_enable:
return bytes([HCI_COMMAND_DISALLOWED_ERROR])
self.le_scan_type = command.le_scan_type
self.le_scan_interval = command.le_scan_interval
self.le_scan_window = command.le_scan_window
self.le_scan_own_address_type = command.own_address_type
self.le_scanning_filter_policy = command.scanning_filter_policy
return bytes([HCI_SUCCESS])
def on_hci_le_set_scan_enable_command(self, command):
'''