mirror of
https://github.com/google/bumble.git
synced 2026-05-09 04:08:02 +00:00
address PR comments
This commit is contained in:
@@ -1211,9 +1211,7 @@ class Device(CompositeEventEmitter):
|
|||||||
|
|
||||||
if type(peer_address) is str:
|
if type(peer_address) is str:
|
||||||
try:
|
try:
|
||||||
peer_address = Address(peer_address)
|
peer_address = Address.from_string_for_transport(peer_address, transport)
|
||||||
if transport == BT_BR_EDR_TRANSPORT:
|
|
||||||
peer_address.address_type = Address.PUBLIC_DEVICE_ADDRESS
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# If the address is not parsable, assume it is a name instead
|
# If the address is not parsable, assume it is a name instead
|
||||||
logger.debug('looking for peer by name')
|
logger.debug('looking for peer by name')
|
||||||
|
|||||||
@@ -1666,6 +1666,14 @@ class Address:
|
|||||||
def address_type_name(address_type):
|
def address_type_name(address_type):
|
||||||
return name_or_number(Address.ADDRESS_TYPE_NAMES, address_type)
|
return name_or_number(Address.ADDRESS_TYPE_NAMES, address_type)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def from_string_for_transport(string, transport):
|
||||||
|
if transport == BT_BR_EDR_TRANSPORT:
|
||||||
|
address_type = Address.PUBLIC_DEVICE_ADDRESS
|
||||||
|
else:
|
||||||
|
address_type = Address.RANDOM_DEVICE_ADDRESS
|
||||||
|
return Address(string, address_type)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_address(data, offset):
|
def parse_address(data, offset):
|
||||||
# Fix the type to a default value. This is used for parsing type-less Classic addresses
|
# Fix the type to a default value. This is used for parsing type-less Classic addresses
|
||||||
|
|||||||
Reference in New Issue
Block a user