Skip to content

update fork - #1

Closed
vChavezB wants to merge 121 commits into
bumble_update_developfrom
develop
Closed

update fork#1
vChavezB wants to merge 121 commits into
bumble_update_developfrom
develop

Conversation

@vChavezB

@vChavezB vChavezB commented Aug 2, 2025

Copy link
Copy Markdown
Owner

Pull Request Guidelines for Bleak

Before you submit a pull request, check that it meets these guidelines:

  1. If the pull request adds functionality, the docs should be updated.
  2. Modify the CHANGELOG.rst, describing your changes as is specified by the
    guidelines in that document.
  3. The pull request should work for Python 3.9+ on the following platforms:
    • Windows 10, version 16299 (Fall Creators Update) and greater
    • Linux distributions with BlueZ >= 5.55
    • OS X / macOS >= 10.13
  4. Squash all your commits on your PR branch, if the commits are not solving
    different problems and you are committing them in the same PR. In that case,
    consider making several PRs instead.
  5. Feel free to add your name as a contributor to the AUTHORS.rst file!

dlech and others added 30 commits November 3, 2024 17:52
Ignore Flake E231. It disagrees with Black formatting.
Also fix the type hints while we are touching it (hbldh#1730).

Co-authored-by: David Lechner <david@pybricks.com>
Log to stderr instead of stdout by default
Unless there is a know breaking change that actually affects us, having
upper bounds on dependencies in libraries can actually be problematic
for people using the library who may need newer versions to satisfy
other dependencies.
There are known bugs in older versions of the winrt libraries. Drop
bleak_winrt and use winrt >= 3.1 on all Python versions now.

There were some major breaking API name changes, so there is quite a bit
of churn in the code as well as some improvements to type hints.
Fix a leak where service interfaces were not being removed from the
service map in the BlueZ manager. This could cause a KeyError on later
connections when calling get_services().

Fixes: hbldh#1435
The try/except blocks in the `BluezDBusClient` connect menthod were
cleaning up a few things on failure, but not everything. So we need one
more level of cleanup that calls _cleanup_all().

Since this is getting too indented, switch to using an AsyncExitStack
to handle the cleanup.
It is convenient to create a separate virtual environment for the docs.
However, docs builds can fail because it would otherwise recurse into
this directory.
Also reformat to return early on already paired devices for less indentation.
Avoid a deadlock when event doesn't come by allowing it to timeout.
choose all characters up to the last 21. This is needed, since the hci device can have
an index >= 10 and hence the number of characters of the prefix is not fixed. Instead,
the suffix length is fixed as it comes from

https://github.com/bluez/bluez/blob/313de9af36cbbd02d69ba12b8819e28f6a89bbd5/src/gatt-client.c#L2011
https://github.com/bluez/bluez/blob/313de9af36cbbd02d69ba12b8819e28f6a89bbd5/src/gatt-client.c#L1835
Add a new callback that can help discriminate between characteristic value changes due to a notification and ones due to a read response. CoreBluetooth uses the same delegate callback for both and doesn't have any info available in the parameters to know what is the difference between the two.

To work around this allow the user to provide a discriminator function that can inspect the value to determine if it was from a notification. This way, if a notification happens while we are waiting for a read response, we don't accidentally send the notification value as the read response value.
Some device need to pair _before_ connecting, otherwise getting services
doesn't work correctly. This adds a `pair` parameter to the BleakClient
constructor that allows this to happen during the connection process.
This is handled in the pyproject.toml file now.
dlech and others added 28 commits May 23, 2025 11:38
bleak/backends/bluezdbus/manager.py:713: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
bleak/backends/bluezdbus/manager.py:713: note: Consider using "Sequence" instead, which is covariant
We want to deprecate this, so it shouldn't be part of the public API.
It still works thanks to kwargs.
Apparently, can_pair is False if a device is already paired, so we need
to reverse the order of the checks in order to avoid raising an exception
when trying to pair a device that is already paired.
Recent versions of Python only print the int value of IntEnum. Printing
the name is more user-friendly.
Seems to be a bug in the WinRT API where the value returned by the
pairing status result is not updated unless we request a device info
update first.
This should remove the need for the protection_level kwarg.

Not sure if the retry is actually needed since on the device used for
testing, it connects at the ENCRYPTION level on the first try.
Now that the default behavior is to try to use the highest protection
level, there should no longer be a need to manually set the protection
level.
Currently, the bot only adds labels. We want it to also comment so that
notifications are sent to issue subscribers.
Bumps [requests](https://github.com/psf/requests) from 2.32.0 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.0...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Enable extended advertising scanning by default by setting the
`AllowExtendedAdvertisements` property, which defaults to false.

https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.advertisement.bluetoothleadvertisementwatcher.allowextendedadvertisements

Signed-off-by: Jordan Yates <jordan@embeint.com>
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.19 to 2.5.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@1.26.19...2.5.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.5.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Add some docs and update the sample code to advise users to use a longer
timeout when pairing during connect for devices that require user
interaction.
Devices with resolvable private addresses will change their address
after pairing. So for the address property to return the "correct"
value, we need to update the device's address after pairing.

Fixes: hbldh#1737
Replace use of address with backend-specific key for the seen_devices
dictionary.

As we found out, in the BlueZ backend, the address may not match the
D-Bus path in the case of private resolvable addresses. So to avoid
problems with converting the address to a D-Bus path, we need to use
the D-Bus path as the key in the seen_devices dictionary.

For good measure, we also use the macOS UUID for the device even when
using the use_bdaddr hack to get the actual address.

Other backends continue to use the address as the key, as there doesn't
appear to be any better alternative.
Way overdue to use a real major version number. 😅
Use tomllib instead of tomli when building the docs since they require Python 3.11 to build already.

This required some trickery to make isort happy since the docs have a different minimum Python version than the rest of the code.
- unnecessary cast
- accessing attributes of None
The BLEDevice() constructor technically isn't considered part of the
public API, so a breaking change was made removing `rssi` and `**kwargs`.
However, there are users that implement their own backends, so effectively
this should be considered public and the breaking change reverted.

It looks like all users are passing `rssi` as a keyword argument, so
just restoring `**kwargs` should be sufficient.

Signed-off-by: David Lechner <david@pybricks.com>
There were some imports that were moved to `bleak.args.bluez` in v1.0
without a proper deprecation period. Restore these imports and add the
proper deprecation warnings.
This will let us see which tests are actually being run, which is useful
since some tests are skipped on some platforms.
When reading characteristics and descriptors, we can pass the objects
directly instead of their handles. This is more efficient because it
saves a dictionary lookup to get the object from the handle. No point
in doing that lookup if we already have the object.
@vChavezB
vChavezB deleted the branch bumble_update_develop August 2, 2025 12:04
@vChavezB vChavezB closed this Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.