From e09c91df8eb0cb8044cdb3d48c914d4132ff57fd Mon Sep 17 00:00:00 2001 From: Alan Rosenthal <1288897+AlanRosenthal@users.noreply.github.com> Date: Wed, 10 Jul 2024 18:46:28 +0000 Subject: [PATCH] console.py: Use Address.generate_static_address --- apps/console.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/console.py b/apps/console.py index 5d046366..9dc173c1 100644 --- a/apps/console.py +++ b/apps/console.py @@ -63,6 +63,7 @@ from bumble.transport import open_transport_or_link from bumble.gatt import Characteristic, Service, CharacteristicDeclaration, Descriptor from bumble.gatt_client import CharacteristicProxy from bumble.hci import ( + Address, HCI_Constant, HCI_LE_1M_PHY, HCI_LE_2M_PHY, @@ -289,11 +290,7 @@ class ConsoleApp: device_config, hci_source, hci_sink ) else: - random_address = ( - f"{random.randint(192,255):02X}" # address is static random - ) - for random_byte in random.sample(range(255), 5): - random_address += f":{random_byte:02X}" + random_address = Address.generate_static_address() self.append_to_log(f"Setting random address: {random_address}") self.device = Device.with_hci( 'Bumble', random_address, hci_source, hci_sink