Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discovered devices improvements #1047

Merged
merged 4 commits into from
Oct 3, 2022
Merged

Discovered devices improvements #1047

merged 4 commits into from
Oct 3, 2022

Commits on Sep 30, 2022

  1. backends/scanner: improve BLEDevice creation performance

    This changes all scanner backends so that they only create a BLEDevice
    object once per scan. For example, in several backends, a new BLEDevice
    was created for each discovered device each time the discovered_devices
    property was called, which could be significant if many (~100) devices
    were discovered.
    
    This also caches the last advertisement data along with the BLEDevice
    which is expected to be used as an alternative to BLEDevice.metadata
    in the future.
    dlech committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    f8f77fe View commit details
    Browse the repository at this point in the history
  2. backends/scanner: Add rssi to AdvertisementData

    This adds an `rssi` attribute to the AdvertisementData type.
    
    This is done so we can eventually deprecate the `rssi` on the BLEDevice
    object (#1025).
    
    While we are touching this, also change AdvertisementData to a named
    tuple so we don't have to initialize all of the values ourselves.
    dlech committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    51f29a0 View commit details
    Browse the repository at this point in the history
  3. backends/scanner: refactor common adv data code

    This reduces code duplication and helps ensure that all backends work
    the same.
    dlech committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    54f68c5 View commit details
    Browse the repository at this point in the history
  4. scanner: add discovered_devices_and_advertisement_data property

    This adds a new discovered_devices_and_advertisement_data property
    to BleakScanner that can be used to get the last advertisement data in
    addition to the BLEDevice of the devices discovered during the scan
    session.
    
    A new argument is added to the BleakScanner.discover() class method to
    allow this method to return the new property as well.
    dlech committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    4d8087f View commit details
    Browse the repository at this point in the history