fix: fix token position in params and enhance event iteration logic for MiniMateClient

This commit is contained in:
Brian Harrison
2026-04-03 17:30:47 -04:00
parent 3effa1aab5
commit 4fb1bbfe35
3 changed files with 52 additions and 16 deletions

View File

@@ -223,21 +223,27 @@ def token_params(token: int = 0) -> bytes:
Build the 10-byte params block that carries a single token byte.
Used for SUBs 1E (EVENT_HEADER) and 1F (EVENT_ADVANCE).
The token goes at params[6], which maps to payload[12].
The token goes at params[7], which maps to payload[13].
Confirmed from BOTH 3-31-26 and 4-3-26 BW TX captures:
raw params bytes: 00 00 00 00 00 00 00 fe 00 00
token is at index 7 (not 6 — that was wrong).
Confirmed from 3-31-26 capture:
- token=0x00: first-event read / browse mode (no download marking)
- token=0xfe: download mode (causes 1F to skip partial bins and
advance to the next full record)
The device echoes the token at data[8] of the S3 response (payload[13]),
distinct from the next-event key at data[11:15] (payload[16:20]).
Args:
token: single byte to place at params[6] / payload[12].
token: single byte to place at params[7] / payload[13].
Returns:
10-byte params block with token at position [6].
10-byte params block with token at position [7].
"""
p = bytearray(10)
p[6] = token
p[7] = token
return bytes(p)