Use EventWatcher and send_command(check_result=True) in all similar patterns

This commit is contained in:
Josh Wu
2025-11-06 18:19:02 +08:00
parent d112901a17
commit 4bee8d5287
2 changed files with 118 additions and 180 deletions

View File

@@ -184,6 +184,7 @@ class Controller:
advertising_interval: int = 2000
advertising_data: Optional[bytes] = None
advertising_timer_handle: Optional[asyncio.Handle] = None
classic_scan_enable: int = 0
_random_address: 'Address' = Address('00:00:00:00:00:00')
@@ -1630,6 +1631,15 @@ class Controller:
'''
return bytes([HCI_SUCCESS])
def on_hci_write_scan_enable_command(
self, command: hci.HCI_Write_Scan_Enable_Command
) -> Optional[bytes]:
'''
See Bluetooth spec Vol 4, Part E - 7.3.18 Write Scan Enable Command
'''
self.classic_scan_enable = command.scan_enable
return bytes([HCI_SUCCESS])
def on_hci_le_read_remote_features_command(
self, command: hci.HCI_LE_Read_Remote_Features_Command
) -> Optional[bytes]: