forked from auracaster/bumble_mirror
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e1baf0344 |
+1
-1
@@ -902,7 +902,7 @@ class LogHandler(logging.Handler):
|
||||
def __init__(self, app):
|
||||
super().__init__()
|
||||
self.app = app
|
||||
self.setFormatter("[%(asctime)s][%(pathname)s:%(lineno)d][%(levelname)s] %(message)s")
|
||||
self.setFormatter(logging.Formatter('[%(asctime)s][%(levelname)s] %(message)s'))
|
||||
|
||||
def emit(self, record):
|
||||
message = self.format(record)
|
||||
|
||||
+1
-5
@@ -1211,15 +1211,11 @@ class Device(CompositeEventEmitter):
|
||||
|
||||
if type(peer_address) is str:
|
||||
try:
|
||||
peer_address = Address.from_string_for_transport(peer_address, transport)
|
||||
peer_address = Address(peer_address)
|
||||
except ValueError:
|
||||
# If the address is not parsable, assume it is a name instead
|
||||
logger.debug('looking for peer by name')
|
||||
peer_address = await self.find_peer_by_name(peer_address, transport) # TODO: timeout
|
||||
else:
|
||||
# All BR/EDR addresses should be public addresses
|
||||
if transport == BT_BR_EDR_TRANSPORT and peer_address.address_type != Address.PUBLIC_DEVICE_ADDRESS:
|
||||
raise ValueError('BR/EDR addresses must be PUBLIC')
|
||||
|
||||
def on_connection(connection):
|
||||
if transport == BT_LE_TRANSPORT or (
|
||||
|
||||
@@ -1666,14 +1666,6 @@ class Address:
|
||||
def address_type_name(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
|
||||
def parse_address(data, offset):
|
||||
# Fix the type to a default value. This is used for parsing type-less Classic addresses
|
||||
@@ -1714,9 +1706,6 @@ class Address:
|
||||
|
||||
self.address_type = address_type
|
||||
|
||||
def clone(self):
|
||||
return Address(self.address_bytes, self.address_type)
|
||||
|
||||
@property
|
||||
def is_public(self):
|
||||
return self.address_type == self.PUBLIC_DEVICE_ADDRESS or self.address_type == self.PUBLIC_IDENTITY_ADDRESS
|
||||
|
||||
Reference in New Issue
Block a user