diff options
author | Charlie Boutier <charliebout@google.com> | 2024-03-04 22:09:41 +0000 |
---|---|---|
committer | Slvr <30467496+SilverBzH@users.noreply.github.com> | 2024-03-18 09:20:55 -0700 |
commit | 7d0b4ef4e006d8a7d57a65358aa734b859d13885 (patch) | |
tree | 7ea6294b5347aa150ef5b8dbe3e9aacf5b565ada | |
parent | 313340f1c6abfa0062813cf3ff7b4c31f798240a (diff) | |
download | bumble-7d0b4ef4e006d8a7d57a65358aa734b859d13885.tar.gz |
pandora_server: Parse FLAGS into advertising data
Bug: 328089785
-rw-r--r-- | bumble/pandora/host.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bumble/pandora/host.py b/bumble/pandora/host.py index 3f48f46..f44e736 100644 --- a/bumble/pandora/host.py +++ b/bumble/pandora/host.py @@ -54,6 +54,8 @@ from pandora import host_pb2 from pandora.host_pb2 import ( NOT_CONNECTABLE, NOT_DISCOVERABLE, + DISCOVERABLE_LIMITED, + DISCOVERABLE_GENERAL, PRIMARY_1M, PRIMARY_CODED, SECONDARY_1M, @@ -69,6 +71,7 @@ from pandora.host_pb2 import ( ConnectResponse, DataTypes, DisconnectRequest, + DiscoverabilityMode, InquiryResponse, PrimaryPhy, ReadLocalAddressResponse, @@ -867,6 +870,16 @@ class HostService(HostServicer): ) ) + flag_map = { + NOT_DISCOVERABLE: 0x00, + DISCOVERABLE_LIMITED: AdvertisingData.LE_LIMITED_DISCOVERABLE_MODE_FLAG, + DISCOVERABLE_GENERAL: AdvertisingData.LE_GENERAL_DISCOVERABLE_MODE_FLAG, + } + + if dt.le_discoverability_mode: + flags = flag_map[dt.le_discoverability_mode] + ad_structures.append((AdvertisingData.FLAGS, flags.to_bytes(1, 'big'))) + return AdvertisingData(ad_structures) def pack_data_types(self, ad: AdvertisingData) -> DataTypes: |