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

Cache service resolution on connect when using BlueZ/Dbus backend when requested #923

Merged
merged 7 commits into from
Sep 5, 2022

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Aug 6, 2022

If the device was previously connected and we have the
the service collection already built, it can
be reused for the next connection if the device has not
since been removed from the bus when the dangerous_use_bleak_cache
flag is passed.

For devices that connect and disconnect frequently this
can make operations up to an magnitude faster once
the first connection has been made and the device
has not been removed from the bus since the last
connection.

In testing this significantly reduced the time it took to execute operations on Ble devices. The goal is to be able to quickly operate Bluetooth locks (and other similar devices)

@dlech
Copy link
Collaborator

dlech commented Aug 6, 2022

This will not work with devices that suffer from the issues described in #882. We need to wait for "ServicesResolved" after connect to ensure that BlueZ is not longer adding or removing service/characteristic/descriptor d-bus objects.

I suppose we could make this opt-in for devices that are known to be well behaved (meaning they don't trigger the BlueZ bugs).

@bdraco bdraco force-pushed the bluez_service_cache branch 2 times, most recently from aa82962 to 5e87ff9 Compare August 6, 2022 20:09
@bdraco bdraco changed the title Cache service resolution on connect when using BlueZ/Dbus backend Cache service resolution on connect when using BlueZ/Dbus backend when requested Aug 6, 2022
@bdraco bdraco force-pushed the bluez_service_cache branch 3 times, most recently from 3c5c4fc to f8e524c Compare August 6, 2022 20:12
@bdraco
Copy link
Contributor Author

bdraco commented Aug 6, 2022

I reworked it to be opt-in and renamed it to be dangerous_use_bleak_cache

…hen requested

If the device was previously connected and we have the
the service collection already built, it can
be reused for the next connection if the device has not
since been removed from the bus when the dangerous_use_bleak_cache
flag is passed.

For devices that connect and disconnect frequently this
can make operations up to an magnitude faster once
the first connection has been made and the device
has not been removed from the bus since the last
connection.
CHANGELOG.rst Outdated Show resolved Hide resolved
@dlech dlech merged commit d255663 into hbldh:develop Sep 5, 2022
@bdraco
Copy link
Contributor Author

bdraco commented Sep 5, 2022

Thanks

@dlech dlech mentioned this pull request Sep 12, 2022
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.

2 participants