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

connectToAdvertisingDevice: Check for recently discovered device when BLE scan already running #875

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maBarabas
Copy link

Prevents error reported in #872 as long as the device was scanned within the last _scanRegistryCacheValidityPeriod (25 seconds) from where connectToAdvertisingDevice is called. In practice, this is as good as always for usecases where a device is selected from a scan list and immediately connected.

@@ -85,7 +85,17 @@ class DeviceConnectorImpl implements DeviceConnector {
Map<Uuid, List<Uuid>>? servicesWithCharacteristicsToDiscover,
Duration? connectionTimeout,
}) {
if (_deviceScanner.currentScan != null) {
if (_deviceIsDiscoveredRecently(
Copy link
Collaborator

@Taym95 Taym95 Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't you just stop the scan and connect with connectToAdvertisingDevice ? why do we need this in library?

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.

None yet

2 participants