decode r11 frames (raw, meaning unconfirmed) - #36
Conversation
Reviewer's GuideIntroduces and publicly exports a raw decoder for live 0x2B/0x0B R11 frames, parsing the timestamp and two 50-sample signed int32-LE channels while intentionally leaving signal semantics unconfirmed. Synthetic tests pin the frame layout and basic validation behavior. Sequence diagram for decoding a raw R11 framesequenceDiagram
participant Caller
participant Decoder
participant ByteData
Caller->>Decoder: decodeR11Raw(hex)
Decoder->>Decoder: hexToBytes(hex)
alt invalid hex, short frame, or wrong header
Decoder-->>Caller: null
else valid 0x2B 0x0B frame
Decoder->>ByteData: getUint32(7, Endian.little)
Decoder->>ByteData: getInt32(36 + 4*i, Endian.little)
Decoder->>ByteData: getInt32(236 + 4*i, Endian.little)
Decoder-->>Caller: R11Raw(ts, channelA, channelB)
end
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reachedNext included review available in 55 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe PR adds an ChangesR11 decoding
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This adds a localized raw R11 frame decoder with input validation and synthetic parsing tests; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Linked Issues checkExplanation The PR implements the requested R11 container decoding from issue Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (3 skipped: 3 unsupported.) 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. Comment |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="lib/src/live.dart" line_range="551" />
<code_context>
+/// word-swapped-int32 reading first proposed — that reading put a spurious
+/// ~56,700 discontinuity at sample 49 that a plain LE read does not have).
+/// Both accelerometer and cardiac interpretations were checked and ruled out
+/// on real captures; an optical baseline or ambient-light channel remain
+/// plausible but unconfirmed. Effective sample rate is "near 50 Hz per
+/// channel", not confirmed to be exactly 50 Hz.
</code_context>
<issue_to_address>
**issue:** The `R11Raw` documentation states that cardiac interpretations were ruled out, presenting a definitive conclusion that contradicts the PR's stated unconfirmed scope and can cause API consumers to treat the raw channels as proven non-cardiac.
**Suggested fix:** Change this claim to say that a cardiac interpretation remains unconfirmed and that the decoder intentionally makes no signal-meaning determination.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: lib/src/live.dart:551
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
closes #25 (the r11 part — r10 was already fine, no change needed there)
adds
decodeR11Raw/R11Rawfor the live0x2B/0x0Bcontainer. per the issue author's ownfollow-up correction in the thread, the region at frame-abs [36:436] is 100 plain int32-LE
samples split into two 50-sample channels back to back — not the word-swapped-int32 reading
first proposed, which put a fake ~56,700 discontinuity at sample 49 that a plain LE read
doesn't have, and which produced a bogus 60/120/180/240 bpm spectral comb that led to a
premature "not cardiac" call. that call is retracted in the thread and this PR doesn't take a
position on what the signal is either — comments say so explicitly (not accel, not confirmed
cardiac, could be optical/ambient). no real captures checked into the repo so the test pins
the parse math against synthetic bytes.
Summary by Sourcery
Add raw decoding support for live R11 frames without assigning a confirmed meaning to their two-channel signal.
New Features:
Enhancements:
Tests:
Summary by CodeRabbit
New Features
Tests