-
Notifications
You must be signed in to change notification settings - Fork 90
Optimize scan filtering #890
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
kable-core/src/androidMain/kotlin/BluetoothLeScannerAndroidScanner.kt:164
- Combining multiple native filters into a single ScanFilter may inadvertently merge distinct filtering criteria. Please review if this merging accurately reflects the intended native filtering behavior.
native = listOf(nativeFilters.values.toList().toNativeScanFilter()),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Closes #889
Optimizes scan filtering when non-native filter(s) are combined with native filter(s), by favoring native scan filtering and moving non-native supported filters to flow filtering.
Take the following example:
This PR will optimize the scan by establishing a native filter for the
Filter.Service
andFilter.ServiceData
and having theFilter.Name.Prefix
filtering occur via flow operator.This optimization is only possible when a single
match
is specified (i.e. filters will not beOR
'd). This is because when there are multiple filtermatch
declarations, then it would be difficult to reliably determine which native filter was applied to know what "overlayed" filters should occur at the flow operator level. To illustrate this limitation, take the following example:Then, during a scan there isn't a clear way to filter at the flow operator:
As such, for these situations (more than one
match
with non-native filters): all filters will occur at the flow operator level.