ringconn: sm3 handshake + framing, no field decode - #48
Conversation
Reviewer's GuideIntroduces a publicly exported, hardware-independent RingConn Gen 2/2 Air/3 wire-format implementation: SM3-based authentication, framing and bulk-history record slicing, plus outbound commands, with comprehensive synthetic byte fixtures while intentionally leaving record fields undecoded and real-device behavior unverified. Sequence diagram for the RingConn authentication and history sync flowsequenceDiagram
participant Host
participant RingConn
Host->>RingConn: ringConnCmdStatus()
RingConn-->>Host: parseRingConnFrame(status challenge)
Host->>Host: ringConnMacFromSystemId(systemId)
Host->>Host: ringConnAuthResponse(mac, challenge)
Host->>RingConn: ringConnCmdAuthResponse(response)
Host->>RingConn: ringConnCmdSyncOpen(cursor, channel)
RingConn-->>Host: parseRingConnFrame(sync-open reply)
Host->>RingConn: ringConnCmdFetch()
RingConn-->>Host: parseRingConnFrame(notification)
alt bulk page
Host->>Host: parseRingConnBulkPage(frame)
Host->>RingConn: ringConnCmdAckPpg() or ringConnCmdAckActivity()
else burst ends
Host->>Host: ringConnEndsBurst(respid)
end
Flow diagram for RingConn reply framing and bulk-page slicingflowchart LR
N[BLE notification bytes] --> P["parseRingConnFrame(value)"]
P --> V{xorValid}
V -->|valid| T["ringConnIsBulk(respid)"]
V -->|invalid| R[Caller decides whether to drop or archive]
T -->|yes| B["parseRingConnBulkPage(frame)"]
T -->|no| E["ringConnEndsBurst(respid)"]
B --> S[remaining count plus fixed-size raw records]
E --> D[End current fetch burst]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reachedNext included review available in 22 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: Team Run ID: 📒 Files selected for processing (3)
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 |
adds the RingConn (Gen 2 / Gen 2 Air / Gen 3) wire format as pure functions — SM3 auth handshake (keyed off the ring's own BLE MAC, no vendor secret), frame parsing, bulk-page slicing for both history channels.
structural only: reply tags, page lengths, record slicing. nothing inside a record is decoded — those layouts aren't verified against real hardware yet.
Summary by Sourcery
Add a pure-function RingConn protocol layer for authentication, framing, synchronization, and structural history-page parsing without decoding record contents.
New Features:
Enhancements:
Tests: