Rebuild TK5 support on the Yucheng YCBT protocol and add SmartHealth-app Colmi rings#82
Merged
Merged
Conversation
…nd add SmartHealth-app Colmi rings
…ion and add the Colmi R99
…and fail fast when a measurement is refused
…promising them unconditionally
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
The TK5's manufacturer supplied the SmartHealth Android app, whose Yucheng YCBT SDK is the
authoritative protocol. Comparing it byte-by-byte against our driver showed TK5 history sync was
fundamentally broken. This rebuilds the driver on the real protocol — and because Colmi rings that ship
with SmartHealth (rather than QRing) speak the same protocol, adds them as a second family off the
shared stack.
What was broken on the TK5:
02 24/26/28) areGetCardInfo/GetSleepStatus/GetMeasurementFunction. The real flow is05 <key>query → header → data →terminal
05 80→ a mandatory ACK we never sent, so the ring never released the next data type.05 40…4E), so the ring wasnever told to record the metrics we then tried to read.
straddled a GATT boundary. There was no fragment reassembly at all.
setTime's weekday byte was hard-coded (the ring thought every day was Monday); the "user profile"was a frozen capture blob rather than the actual user.
New: a protocol-driven history state machine, GATT fragment reassembly, correct settings/monitor
commands, all 9 record types, device-push ACKs, and periodic re-sync. Capabilities are now decided by
the ring: the handshake reads its capability bitmap (
02 01) and we only offer sensors it actuallyclaims.
Colmi + SmartHealth: a ring's Bluetooth name doesn't say which app it shipped with, so the pairing
screen asks; the choice picks the driver, and a wrong pick fails in 20s with a one-tap "try the other
app" retry.
The
AE00handshake is deliberately not implemented — it's JieLi RCSP and gates only OTA/watchfaces. Confirmed on hardware: a JieLi ring (
chipScheme 4) answers every health command in plaintext.Related issues
Part of #50 (TK5 A840 — this PR is the TK5 driver rebuild; that unit's
TK5 A840name matches theTK5 <4 hex>pattern, but it hasn't been tested on that ring).Type of change
UI: the pairing screen's app-type picker + the wrong-app failure/retry path. Not breaking: every
persisted enum is append-only and jring / QRing-Colmi source files are byte-identical, so existing
users' rings and data are unaffected.
How was this tested?
PulseLoopTests) — 612 passing (461 before this PR)⌘Uin Xcode)R99 54DC)-seedDemo YES, no hardware)Confirmed on the R09: pairing and app-type selection, plaintext handshake with no
AE00auth on aJieLi chip, time sync (correct weekday), firmware + battery parse, the 9-query history sync with its
ACKs, live/spot HR, spot SpO₂, blood pressure + calibration, and workout HR/SpO₂.
The hardware session also caught two real bugs, now fixed: HRV was offered on a ring whose bitmap
denies it (it refuses the command outright), and the SpO₂ spot window (40 s) was shorter than the
ring's own sweep (38–41 s).
Not yet exercised on hardware: sleep (the multi-session timeline is decoded from the SDK and
unit-tested, but no YCBT ring has been worn overnight), and the TK5 itself — it shares this driver but
hasn't been re-tested, so it stays 🧪 Limited.
Privacy & data
Checklist
docs/YCBT-Protocol.md(wire spec), rewrittenhardware/tk5.md, and a SmartHealth section onhardware/colmi.md.