gbg/extended scanning (#47)

Squashed:
* add extended report class
* more HCI commands
* add AdvertisingType
* add phy options
* fix tests
This commit is contained in:
Gilles Boccon-Gibod
2022-10-19 10:06:00 -07:00
committed by GitHub
parent 4d96b821bc
commit eb8556ccf6
16 changed files with 1972 additions and 523 deletions
+4 -4
View File
@@ -29,15 +29,15 @@ from bumble.transport import open_transport_or_link
# -----------------------------------------------------------------------------
class ScannerListener(Device.Listener):
def on_advertisement(self, address, ad_data, rssi, connectable):
address_type_string = ('P', 'R', 'PI', 'RI')[address.address_type]
address_color = 'yellow' if connectable else 'red'
def on_advertisement(self, advertisement):
address_type_string = ('P', 'R', 'PI', 'RI')[advertisement.address.address_type]
address_color = 'yellow' if advertisement.is_connectable else 'red'
if address_type_string.startswith('P'):
type_color = 'green'
else:
type_color = 'cyan'
print(f'>>> {color(address, address_color)} [{color(address_type_string, type_color)}]: RSSI={rssi}, {ad_data}')
print(f'>>> {color(advertisement.address, address_color)} [{color(address_type_string, type_color)}]: RSSI={advertisement.rssi}, {advertisement.data}')
# -----------------------------------------------------------------------------