feat(protocol): fully decode Blastware filename encoding and update related documentation

This commit is contained in:
2026-04-22 23:43:31 -04:00
parent c47e3a3af0
commit 6dcca4da79
3 changed files with 76 additions and 60 deletions
+13 -6
View File
@@ -858,15 +858,22 @@ def device_event_blastware_file(
tcp_port: int = Query(DEFAULT_TCP_PORT, description=f"TCP port (default {DEFAULT_TCP_PORT})"),
) -> FileResponse:
"""
Download the full waveform for a single event (0-based index) and return it
as a Blastware-compatible binary file (.N00 for single-shot, .9T0 for continuous).
Download the waveform for a single event (0-based index) and return it
as a Blastware-compatible binary file with a correct Blastware filename.
Supply either *port* (serial) or *host* (TCP/modem).
The file is written to a temporary path under /tmp and streamed back as a
file download. Blastware can open it directly.
The file is written to /tmp and streamed back as a binary download.
Blastware can open it directly — filename encodes serial + timestamp.
Performs: POLL startup → get_events(full_waveform=True, stop_after_index=index)
Filename format: <prefix><serial3><stem><AB>0<W|H>
- prefix letter = chr(ord('B') + floor(serial_numeric / 1000))
- stem + AB = second-resolution timestamp since 1985-01-01 local
- W / H = Full Waveform / Full Histogram (defaults to W for
triggered events; histogram requires recording_mode
to be populated from compliance config)
Performs: POLL startup → get_events(full_waveform=False, stop_after_index=index)
→ write_n00() → FileResponse.
"""
log.info(
@@ -879,7 +886,7 @@ def device_event_blastware_file(
with _build_client(port, baud, host, tcp_port, timeout=120.0) as client:
info = client.connect()
# Use full_waveform=False (metadata-only, stop_after_metadata=True) —
# Blastware writes .N00 files from only the first ~8 A5 frames, NOT
# Blastware writes waveform files from only the first ~8 A5 frames, NOT
# the full bulk download. Using full_waveform=True produces a file
# ~8x larger than Blastware's because it includes all post-event
# silence chunks. The metadata-only a5_frames (with terminator) are