feat(decode): the monitor log line from the file's footer (group F)
Blastware prints one Monitor Log line per event: the footer's start and stop, then words for the footer's flag word [18:20] -- 69,983 / 69,983 DL2 lines, character for character (2026-11-08): 0x0001 Event Recorded 0x0010 Timer Stop 0x0002 Keyboard Exit 0x0020 Modem Exit 0x0004 Remote Exit 0x0200 Battery Low Exit 0x0008 Selfcheck Passed 0x0800 Memory Full Exit One line sets Modem and Timer and prints Modem, so the higher bit wins (the order of the others is inferred). Footer [20:22] is the event record's trigger source again (69,983 / 69,983); [22:24] is zero; [24:26] is not a common CRC-16 or sum. Event.monitor_log: MonitorLogLine(start, stop, flags, description), read only when the file's record chain is whole, which proves the footer. The checker compares it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
This commit is contained in:
1 parent
4402753e70
commit
b6309027b3
13 files changed
+595
-4
No files matched your search
@@ -658,3 +658,56 @@ def test_a_check_keeps_the_units_status_code():
|
||||
# Tran is a Check at 8.1 Hz and 3.3, inside every passing range).
|
||||
got = read_blastware_file(_FIX / f"{_US}/K440HJCN.AS0W").sensor_check_results
|
||||
assert [got[ch].status for ch in ("Tran", "Vert", "Long", "MicL")] == [11, 2, 0, 0]
|
||||
|
||||
|
||||
# ── Group F: the monitor log ────────────────────────────────────────────────
|
||||
# Blastware prints one Monitor Log line per event: the footer's start and stop,
|
||||
# and words from the footer's flag word [18:20]. 69,983 / 69,983 DL2 lines,
|
||||
# character for character (2026-11-08). Expected lines are Blastware's own,
|
||||
# from each file's _XML.XML report.
|
||||
|
||||
_ML = "monitor-log-11-08-26"
|
||||
|
||||
|
||||
def _log_line(ml):
|
||||
return f'{ml.start:%Y-%m-%d %H:%M:%S} - {ml.stop:%Y-%m-%d %H:%M:%S} "{ml.description}"'
|
||||
|
||||
|
||||
@pytest.mark.parametrize("rel,line", [
|
||||
(f"{_US}/I145L6UJ.3Y0W", '2025-08-08 18:23:55 - 2025-08-08 18:24:01 "Event Recorded "'),
|
||||
(f"{_US}/O117I1NK.R70W", '2019-07-31 06:59:31 - 2019-07-31 06:59:33 "Event Recorded "'),
|
||||
(f"{_US}/T193HLJ3.X80H", '2018-09-20 20:07:55 - 2018-09-21 13:20:01 "Event Recorded Modem Exit"'),
|
||||
(f"{_ML}/T189INWA.060H", '2020-10-05 16:04:53 - 2020-10-05 16:06:09 "Event Recorded Keyboard Exit"'),
|
||||
(f"{_ML}/K559HCQ7.IU0H", '2018-04-02 17:06:30 - 2018-04-02 17:07:47 "Event Recorded Remote Exit"'),
|
||||
(f"{_ML}/T192JWEL.0Y0H", '2023-02-17 21:58:09 - 2023-02-17 22:00:00 "Event Recorded Timer Stop"'),
|
||||
(f"{_ML}/T189JZY7.L60H", '2023-04-27 20:00:41 - 2023-04-27 20:01:42 "Event Recorded Battery Low Exit"'),
|
||||
])
|
||||
def test_the_monitor_log_is_the_footers(rel, line):
|
||||
assert _log_line(read_blastware_file(_FIX / rel).monitor_log) == line
|
||||
|
||||
|
||||
from minimateplus.event_file_io import monitor_log_description # noqa: E402
|
||||
|
||||
|
||||
@pytest.mark.parametrize("flags,words", [
|
||||
(0x0001, "Event Recorded "),
|
||||
(0x0003, "Event Recorded Keyboard Exit"),
|
||||
(0x0005, "Event Recorded Remote Exit"),
|
||||
(0x0009, "Event Recorded Selfcheck Passed"),
|
||||
(0x0011, "Event Recorded Timer Stop"),
|
||||
(0x0021, "Event Recorded Modem Exit"),
|
||||
(0x0201, "Event Recorded Battery Low Exit"),
|
||||
(0x0801, "Event Recorded Memory Full Exit"),
|
||||
# One DL2 line sets Modem and Timer; Blastware prints Modem: the higher
|
||||
# bit wins (one file, so the order of the others is inferred).
|
||||
(0x0031, "Event Recorded Modem Exit"),
|
||||
])
|
||||
def test_the_monitor_log_words(flags, words):
|
||||
assert monitor_log_description(flags) == words
|
||||
|
||||
|
||||
def test_without_a_whole_record_chain_there_is_no_monitor_log():
|
||||
raw = bytearray((_FIX / f"{_US}/I145L6UJ.3Y0W").read_bytes())
|
||||
i = raw.find(b"\x00\xd4\x3c")
|
||||
raw[i + 1] = 0xd3 # one byte short: the footer is not proven
|
||||
assert decode_blastware_bytes(bytes(raw), name=None).monitor_log is None
|
||||
Reference in new issue
Block a user