mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
minor fix
This commit is contained in:
@@ -3953,6 +3953,9 @@ class Device(utils.CompositeEventEmitter):
|
||||
return result.return_parameters.rssi
|
||||
|
||||
async def get_connection_phy(self, connection: Connection) -> ConnectionPHY:
|
||||
if not self.host.supports_command(hci.HCI_LE_READ_PHY_COMMAND):
|
||||
return ConnectionPHY(hci.Phy.LE_1M, hci.Phy.LE_1M)
|
||||
|
||||
result = await self.send_command(
|
||||
hci.HCI_LE_Read_PHY_Command(connection_handle=connection.handle),
|
||||
check_result=True,
|
||||
|
||||
@@ -5825,12 +5825,18 @@ class HCI_LE_Advertising_Report_Event(HCI_LE_Meta_Event):
|
||||
return HCI_LE_Advertising_Report_Event.event_type_name(self.event_type)
|
||||
|
||||
def to_string(self, indentation='', _=None):
|
||||
def data_to_str(data):
|
||||
try:
|
||||
return data.hex() + ': ' + str(AdvertisingData.from_bytes(data))
|
||||
except Exception:
|
||||
return data.hex()
|
||||
|
||||
return super().to_string(
|
||||
indentation,
|
||||
{
|
||||
'event_type': HCI_LE_Advertising_Report_Event.event_type_name,
|
||||
'address_type': Address.address_type_name,
|
||||
'data': lambda x: str(AdvertisingData.from_bytes(x)),
|
||||
'data': data_to_str,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -6055,12 +6061,18 @@ class HCI_LE_Extended_Advertising_Report_Event(HCI_LE_Meta_Event):
|
||||
|
||||
def to_string(self, indentation='', _=None):
|
||||
# pylint: disable=line-too-long
|
||||
def data_to_str(data):
|
||||
try:
|
||||
return data.hex() + ': ' + str(AdvertisingData.from_bytes(data))
|
||||
except Exception:
|
||||
return data.hex()
|
||||
|
||||
return super().to_string(
|
||||
indentation,
|
||||
{
|
||||
'event_type': HCI_LE_Extended_Advertising_Report_Event.event_type_string,
|
||||
'address_type': Address.address_type_name,
|
||||
'data': lambda x: str(AdvertisingData.from_bytes(x)),
|
||||
'data': data_to_str,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class Advertiser(private val bluetoothAdapter: BluetoothAdapter) : AdvertiseCall
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
fun stop() {
|
||||
Log.info("stopping advertiser")
|
||||
bluetoothAdapter.bluetoothLeAdvertiser.stopAdvertising(this)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user