don't set a random address when it is 00:00:00:00:00:00

This commit is contained in:
Gilles Boccon-Gibod
2023-01-13 13:22:27 -08:00
parent 16e926a216
commit 422b05ad51
2 changed files with 10 additions and 6 deletions

View File

@@ -1113,8 +1113,11 @@ class Device(CompositeEventEmitter):
if self.le_enabled: if self.le_enabled:
# Set the controller address # Set the controller address
if self.random_address != Address.ANY_RANDOM:
await self.send_command( await self.send_command(
HCI_LE_Set_Random_Address_Command(random_address=self.random_address), HCI_LE_Set_Random_Address_Command(
random_address=self.random_address
),
check_result=True, check_result=True,
) )

View File

@@ -1807,6 +1807,7 @@ class Address:
# Predefined address values # Predefined address values
Address.NIL = Address(b"\xff\xff\xff\xff\xff\xff", Address.PUBLIC_DEVICE_ADDRESS) Address.NIL = Address(b"\xff\xff\xff\xff\xff\xff", Address.PUBLIC_DEVICE_ADDRESS)
Address.ANY = Address(b"\x00\x00\x00\x00\x00\x00", Address.PUBLIC_DEVICE_ADDRESS) Address.ANY = Address(b"\x00\x00\x00\x00\x00\x00", Address.PUBLIC_DEVICE_ADDRESS)
Address.ANY_RANDOM = Address(b"\x00\x00\x00\x00\x00\x00", Address.RANDOM_DEVICE_ADDRESS)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
class OwnAddressType: class OwnAddressType: