Skip to content

Feat/improve connect and reconnect behaviour#2

Merged
smnmsr merged 5 commits into
mainfrom
feat/improve-connect-and-reconnect-behaviour
Sep 11, 2025
Merged

Feat/improve connect and reconnect behaviour#2
smnmsr merged 5 commits into
mainfrom
feat/improve-connect-and-reconnect-behaviour

Conversation

@smnmsr
Copy link
Copy Markdown
Owner

@smnmsr smnmsr commented Sep 11, 2025

Summary

Enhances nus-logger connectivity 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

  • Default advertisement UUID filtering (--adv-filter / --no-adv-filter).
  • Wildcard scanning (no --name required).
  • Faster reconnection via early address match termination.
  • Refactored connect flow with connect_discovered().
  • Wizard improvements for unnamed devices and filter toggling.
  • Expanded API: new kwargs for scan(), new connect_discovered().
  • README updates (flags, troubleshooting, filtering section).
  • Tests added for --filter-addr without --name.

Notes

  • Backwards compatible; defaults stricter but opt-out available.
  • Version bumped to 0.2.0.

- 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
@smnmsr smnmsr requested a review from Copilot September 11, 2025 12:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-filter flags
  • Wildcard scanning support allowing omission of the --name parameter
  • 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.

Comment thread src/nus_logger/nus_logger.py
Comment thread src/nus_logger/ble_nus.py
Comment thread src/nus_logger/ble_nus.py
@smnmsr smnmsr merged commit b585b1b into main Sep 11, 2025
8 checks passed
@smnmsr smnmsr deleted the feat/improve-connect-and-reconnect-behaviour branch September 11, 2025 12:30
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