Repository navigation
Conversation
Firmware that cannot start a log (docked or on USB power, no SD card or a bad one, logging turned off in its configuration) is to NACK START_LOGGING_ONLY_COMMAND, including in the middle of a stream, the NACK coming between two data packets with its own link CRC (C5, or C5 56). Shimmer.processPacket() had no NACK branch: it threw the NACK away a byte at a time with the packet before it, and 2 s later the driver's ACK timer took the device for logging. Ported from the driver's processPacket() (Shimmer-Java-Android-API #345, DEV-1431, on top of #293's NACK handling): a data packet followed by a NACK waits for the NACK's CRC and checks it, as a bare ACK's is; exactly the packet, the NACK and its CRC are consumed; a packet whose CRC fails is dropped without losing the NACK; a 0xFE whose CRC does not match is not a NACK; and the command in flight is failed by the driver's processNackFromCommand(), which leaves a refused log start not logging and calls eventLogStartRefused (a toast here, by default). With no command in flight a NACK is ignored. An idle refusal needs nothing here: it goes through the driver's own parser. Needs a driver release that has #293 and #345: processNackFromCommand() and NACK_COMMAND_PROCESSED are not in 0.11.12_beta, so this does not build against the current pin. Test: AAPI_00009_StreamingLogStartRefusedTest, a port of the driver's API_00037, every scenario at every read size from 1 to 48 bytes. Run locally against a build of #345's driver: the library's unit tests 39/39, and assembleDebug builds the library and every example. Against master's Shimmer.java 6 of the 7 new tests fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
The Android half of DEV-1431: a log start the device refuses in the middle of a stream.
Draft, and it won't build in CI yet. It calls the driver's
processNackFromCommand()and usesNACK_COMMAND_PROCESSED, which arrive with ShimmerResearch/Shimmer-Java-Android-API#293 and ShimmerResearch/Shimmer-Java-Android-API#345. The pinned driver, 0.11.12_beta, has neither. Once a Java API release carries both, rebase this onto (or fold it into) that release'sdriver_<version>bump PR. CI then runs it for real.The problem
Firmware that cannot start a log (docked or on USB power, no SD card or a bad one, logging turned off in its configuration) is to NACK
START_LOGGING_ONLY_COMMAND(ShimmerResearch/log-and-stream-common#228). Its rule doesn't look at streaming, so a 0x92 sent mid-stream is refused too, and the NACK comes between two data packets, followed by its own link CRC when the link has one (C5, or C5 56).Shimmer.javahas its own streaming parser (see AGENTS.md), so the driver's fix in #345 doesn't reach it.processPacket()had no NACK branch. It threw the NACK away a byte at a time along with the packet in front of it, and 2 s later the driver's ACK timer took the device for logging, a false success.An idle refusal needs nothing here: when not streaming,
Shimmeruses the driver's parser, and #345 handles it there.The change
processPacket()gets the branch the driver's parser has in #345:processNackFromCommand(). A refused log start is left not logging, andeventLogStartRefused()is called, which by default showsLOG_START_REFUSED_MESSAGEas a toast;Tests
AAPI_00009_StreamingLogStartRefusedTestports the driver'sAPI_00037_StreamingLogStartRefusedTest, with every scenario replayed at every read size from 1 to 48 bytes:Run locally against a build of #345's driver (
-PdriverVersionpointed at it in the local Maven repository): the library's unit tests pass, 39/39, andassembleDebugbuilds the library and every example. Againstmaster'sShimmer.java, 6 of the 7 new tests fail.Not run on a phone, and not against firmware that NACKs.
DEV-1431
🤖 Generated with Claude Code