Skip to content

xwatch: pairs and banks raw data, decodes nothing yet - #351

Open
abdulsaheel wants to merge 5 commits into
mainfrom
feat/xwatch-adapter
Open

xwatch: pairs and banks raw data, decodes nothing yet#351
abdulsaheel wants to merge 5 commits into
mainfrom
feat/xwatch-adapter

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

pairs-only adapter for the unbranded XWatch board. no signals declared, no commands sent.

Summary by Sourcery

Add experimental XWatch pairing and raw-data collection while deferring protocol decoding and derived metrics.

New Features:

  • Add experimental XWatch support for pairing, listening to notifications, and archiving raw frames without decoding health signals.
  • Integrate XWatch pairing, manual sync, background sync, device identification, and user-facing status text.

Bug Fixes:

  • Ensure XWatch sessions reliably stop and disconnect across connection, hosting, and cleanup failures.

Enhancements:

  • Treat XWatch data as arrival-timestamped, non-derivable raw archives with no commands or historical offload requests.

Tests:

  • Add coverage confirming XWatch declares no signals, archives notifications verbatim, ignores empty frames, performs no writes, and emits no offload checkpoints.

@sourcery-ai

sourcery-ai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an experimental XWatch integration that discovers and pairs against the generic FFF0 GATT profile, listens for notify frames during bounded foreground/background sync sessions, archives raw bytes on arrival, and deliberately performs no commands, decoding, or signal derivation.

Entity relationship diagram for XWatch raw frame archival

erDiagram
    DEVICE {
        string id
        string adapter_id
        string remote_id
    }
    ARCHIVE_RECORD {
        string device_id
        string hex
        int packet_type
        int captured_at
        string reason
    }
    DEVICE ||--o{ ARCHIVE_RECORD : produces
Loading

File-Level Changes

Change Details Files
Registers the experimental XWatch GATT profile and exposes it as a paired, notify-only band without declaring health signals.
  • Adds the generic FFF0 service and FFF6 write/FFF7 notify characteristic identifiers.
  • Adds the XWatch registry entry, adapter signal mapping, and registry coverage.
  • Documents that the profile is unverified and intentionally performs no decoding or writes.
lib/ble/adapters/_registry.dart
lib/ble/adapters/xwatch.dart
Implements bounded raw-frame collection for paired XWatch devices and persists each notification as archival data.
  • Listens for notifications during a serialized 20-second secondary-link session.
  • Connects using the stored remote device identity, validates required characteristics, and tears down safely.
  • Archives non-empty frames verbatim with packet type and arrival timestamp, without counters or decoded timestamps.
  • Integrates background and manual profile sync paths.
lib/ble/xwatch_link.dart
lib/sync/background_sync.dart
lib/ui2/profile/devices.dart
Adds XWatch pairing and device-management presentation while keeping the feature explicitly raw-data-only.
  • Adds pairing-picker copy, device icon, profile entry, and manual sync feedback.
  • Keeps pairing without command/key initialization and preserves archived rows on unpair.
lib/ui2/pairing/device_picker.dart
lib/ui2/profile/devices.dart
Adds tests covering registry integration and the adapter's no-decode/no-write contract.
  • Verifies empty signal declarations and unframed registration.
  • Verifies notifications become raw SampleBatch payloads, empty frames are ignored, and no offload checkpoint is emitted.
  • Verifies the adapter never writes to the link and updates registry signal/id expectations.
test/adapters/xwatch_test.dart
test/adapter_signals_registry_test.dart
test/band_registry_test.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 8bd06c04-338a-4e75-af98-07725e44fe5a

📥 Commits

Reviewing files that changed from the base of the PR and between b98cae6 and 9e624af.

⛔ Files ignored due to path filters (3)
  • test/adapter_signals_registry_test.dart is excluded by !test/**
  • test/adapters/xwatch_test.dart is excluded by !test/**
  • test/band_registry_test.dart is excluded by !test/**
📒 Files selected for processing (6)
  • lib/ble/adapters/_registry.dart
  • lib/ble/adapters/xwatch.dart
  • lib/ble/xwatch_link.dart
  • lib/sync/background_sync.dart
  • lib/ui2/pairing/device_picker.dart
  • lib/ui2/profile/devices.dart

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the assumed XWatch characteristics or notification behavior are wrong, the sync can create bounded, incorrect raw archive records and consume a short BLE session. Reverting stops future connections, and the persisted rows can be removed or repaired separately.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@abdulsaheel

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@abdulsaheel

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@abdulsaheel

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@abdulsaheel

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@abdulsaheel

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@abdulsaheel

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@abdulsaheel have exceeded the limit for the number of chat messages per hour. Please wait 15 minutes and 33 seconds before sending another message.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@abdulsaheel

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@abdulsaheel

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

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.

1 participant