mirror of
https://github.com/google/bumble.git
synced 2026-04-18 00:45:32 +00:00
Merge pull request #511 from AlanRosenthal/random
console.py: Use Address.generate_static_address
This commit is contained in:
@@ -63,6 +63,7 @@ from bumble.transport import open_transport_or_link
|
|||||||
from bumble.gatt import Characteristic, Service, CharacteristicDeclaration, Descriptor
|
from bumble.gatt import Characteristic, Service, CharacteristicDeclaration, Descriptor
|
||||||
from bumble.gatt_client import CharacteristicProxy
|
from bumble.gatt_client import CharacteristicProxy
|
||||||
from bumble.hci import (
|
from bumble.hci import (
|
||||||
|
Address,
|
||||||
HCI_Constant,
|
HCI_Constant,
|
||||||
HCI_LE_1M_PHY,
|
HCI_LE_1M_PHY,
|
||||||
HCI_LE_2M_PHY,
|
HCI_LE_2M_PHY,
|
||||||
@@ -289,11 +290,7 @@ class ConsoleApp:
|
|||||||
device_config, hci_source, hci_sink
|
device_config, hci_source, hci_sink
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
random_address = (
|
random_address = Address.generate_static_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}"
|
|
||||||
self.append_to_log(f"Setting random address: {random_address}")
|
self.append_to_log(f"Setting random address: {random_address}")
|
||||||
self.device = Device.with_hci(
|
self.device = Device.with_hci(
|
||||||
'Bumble', random_address, hci_source, hci_sink
|
'Bumble', random_address, hci_source, hci_sink
|
||||||
|
|||||||
Reference in New Issue
Block a user