Feat/improve connect and reconnect behaviour#2
Merged
Conversation
- Refactored connection handling to separate scanning and connecting processes. - Added warnings for multiple device matches during scanning. - Implemented filtering for preferred address substring. - Updated connection method to use a discovered device directly.
- Enhanced the `scan` method in `NUSClient` to accept an `early_addr_substring` parameter for early termination of scans. - Updated the `scan` method call in `NUSLoggerController` to reflect the new parameter. - Adjusted the initial scan in the CLI tool to set `early_addr_substring` to `None`.
- Introduced `--adv-filter` CLI argument to require advertised NUS service UUID. - Updated `NUSClient` and `LoggerSettings` to support advertisement filtering. - Enhanced scanning and connection methods to utilize the new filtering option. - Updated documentation to reflect changes in filtering behavior.
- Allow omission of --name argument, treating it as a wildcard to scan all NUS devices. - Update scan feedback messages to reflect wildcard behavior. - Modify error messages for no devices found to be more general. - Update test to verify default behavior of name argument when using --filter-addr.
- Updated version in pyproject.toml from 0.1.3 to 0.2.0 - Created CHANGELOG.md to document notable changes
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the nus-logger connectivity and scanning behavior for multi-device environments by introducing advertisement filtering, wildcard scanning, and improved reconnection logic.
Key changes include:
- Default advertisement UUID filtering with opt-out capability via
--adv-filter/--no-adv-filterflags - Wildcard scanning support allowing omission of the
--nameparameter - Faster reconnection through early address match termination and refactored connect flow
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/nus_logger/nus_logger.py | Main CLI argument parsing and connection flow refactor with new advertisement filtering options |
| src/nus_logger/ble_nus.py | Enhanced scan method with early termination and advertisement filtering, plus new connect_discovered method |
| src/nus_logger/logger_controller.py | Updated LoggerSettings and scan calls to support new filtering parameters |
| tests/test_basic.py | Added test for filter-addr without name requirement |
| pyproject.toml | Version bump to 0.2.0 |
| README.md | Documentation updates for new flags and troubleshooting guidance |
| CHANGELOG.md | New changelog documenting all changes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhances
nus-loggerconnectivity and scanning for multi-device environments. Introduces stricter advertisement filtering, wildcard scanning, and faster reconnection logic. Improves UX in the wizard and adds clearer API flows.Key Changes
--adv-filter / --no-adv-filter).--namerequired).connect_discovered().scan(), newconnect_discovered().--filter-addrwithout--name.Notes