Repository navigation
DEV-971: fix five event-channel parser defects found in #348's review - #349
Conversation
Each was first reproduced by a test that failed on the unchanged code (API_00044_EventStreamReviewReproTest), then fixed: 1. Idle: event records right behind an in-stream reply were lost. After an unsolicited status push ([ACK][0x8A][0x71]), sent on a dock, an undock or a press that starts logging, clearSerialBuffer() wiped the records queued behind it (0 of 2 arrived). With the event channel on, the bytes after the reply are now left for the next pass. A record frame after a stray ACK no longer has link-CRC bytes cleared after it either: it carries its own CRC. 2. Streaming: an ACK nobody waited for, before a record frame, re-ran the ACK handling of the SET that went last. It is now taken only while an ACK is awaited. 3. Streaming with no link CRC: the packet before a 0x8A was taken as a packet even when the 0x8A was a data byte after a lost byte, so misframed bytes reached the app as a sample. It is now taken only once the frame after it passes its own CRC; otherwise the bytes are discarded as before. 4. readEventChannelStatus() could be queued behind a start of streaming not yet acknowledged, and its unwrapped reply, [ACK][0xBA][9], was then not taken between data packets and the command timed out. It is now refused while a start of streaming is queued, and a reply that still arrives between packets is taken. ShimmerDriver 219/219 and ShimmerDriverPC 154/154 pass; the Java 8 MATLAB jar builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed by reading the code at 3de20a7; I did not run the suites. The four fixes look correct. The gaps are in the tests. The fixes
Unchanged: behaviour with the event channel off; status, VBATT and DIR replies through the reworked idle handler. Android's Test gaps
Before it leaves draft: a bench run, since it hasn't run on hardware since the fix and CI doesn't run on this base. I also didn't confirm against the firmware that 0xB9 is answered, not NACKed, while streaming; a NACK would go through the existing path. |
…ehind a bare ACK's CRC From the review of #349: - The idle tests' radios now take each burst whole and let reads wait for their bytes, as a serial port does (WaitingTestRadio), so the IOThread can no longer race the test's writes. API_00043's idle tests use it too. - The status-push, frame-after-ACK and status-reply tests now run with no link CRC, a 1-byte and a 2-byte one. - The misframing test checks that the good packets after the damaged one still arrive; the status-reply test that the command is retired, the lock released, the timer cancelled and the packets either side parsed. The CRC runs reproduced one more defect, which is fixed here: with a link CRC on (the driver turns it on at connect where the firmware has it), the records sent in the same burst as the opt-in's ACK were lost, 0 of 2. The bare ACK's link CRC is left after the ACK is taken; the idle path read it as an unknown byte and cleared the whole serial buffer, records included. With the event channel on, the idle path now drops only the bytes it read. All 7 tests in API_00044 fail on #348's code and pass here. ShimmerDriver 219/219, ShimmerDriverPC 155/155; the Java 8 MATLAB jar builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. Every point checked out against the code, and the test gaps are closed in be9a917. Test gaps
All 7 tests in A fifth defect, found by the CRC runs and fixed here. With a link CRC on, the records sent in the same burst as the opt-in's ACK were lost: 0 of 2. The driver turns the link CRC on at connect where the firmware has it, and the bench run used a 1-byte CRC.
The other points
Results: ShimmerDriver 219/219, ShimmerDriverPC 155/155, and the Java 8 MATLAB jar builds. Still not run on a unit since the fixes, so it stays a draft until a bench run. 🤖 Generated with Claude Code |
|
Bench, 13 Nov 2026: a Shimmer3R on LogAndStream v1.1.26 over Bluetooth Classic, with the 1-byte link CRC the driver sets at connect. Code: be9a917. Run in two ways: a headless check with no one at the bench (changing nothing on the unit except the connection's opt-in), and the DEV-1473 Java Shimmer Capture for the button presses. Headless check
Button presses in Capture
The two Capture runs logged no unexpected headers, resyncs, bad CRCs, NACKs, exceptions or lost links. Not covered on hardware
🤖 Generated with Claude Code |
DEV-971. Follow-up to #348, which was merged before these landed: four parser defects in the Java event channel, found in its review. Each was first reproduced by a test that failed on #348's code (
API_00044_EventStreamReviewReproTest), then fixed. All changes are inShimmerBluetooth.java.[ACK][0x8A][0x71](sent on a dock, an undock, or a press that starts logging),clearSerialBuffer()wiped the records queued behind itprocessAckFromSetCommand(0x05)ran for a sampling-rate write long finished20 8A 01 07 05 08 3F 09 00reached the app as a samplereadEventChannelStatus()could be queued behind a start of streaming not yet acknowledged. Its reply,[ACK][0xBA][9], has no 0x8A wrapper, was not taken between data packets, and the command timed outTests
API_00044_EventStreamReviewReproTestAPI_00043_EventStreamTestbuild, as CI runs it)shadowJar -PmatlabJava8)Not run on a unit since the fix. The bench run before it, posted on #348, was clean, and none of these four conditions came up in it.
Not changed
These review findings were not reproduced by a test, so they are left as they were:
MSG_IDENTIFIER_*handler messages. A design choice for review.EventFile.getCompanionFile().🤖 Generated with Claude Code