fix(protocol): improve terminator frame detection in write_blastware_file.

fix: rename .n00 to just blastware file (.n00 was false positive)
This commit is contained in:
2026-04-23 01:33:44 -04:00
parent 8cb8b86192
commit 3eeafd24aa
6 changed files with 70 additions and 59 deletions
+4 -4
View File
@@ -61,7 +61,7 @@ from minimateplus import MiniMateClient
from minimateplus.protocol import ProtocolError
from minimateplus.models import CallHomeConfig, ComplianceConfig, DeviceInfo, Event, PeakValues, ProjectInfo, Timestamp
from minimateplus.transport import TcpTransport, DEFAULT_TCP_PORT
from minimateplus.blastware_file import write_n00, blastware_filename
from minimateplus.blastware_file import write_blastware_file, blastware_filename
from sfm.cache import SFMCache, get_cache
from sfm.database import SeismoDb
@@ -874,7 +874,7 @@ def device_event_blastware_file(
to be populated from compliance config)
Performs: POLL startup → get_events(full_waveform=False, stop_after_index=index)
→ write_n00() → FileResponse.
→ write_blastware_file() → FileResponse.
"""
log.info(
"GET /device/event/%d/blastware_file port=%s host=%s",
@@ -890,7 +890,7 @@ def device_event_blastware_file(
# 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
# sufficient for byte-perfect write_n00 output.
# sufficient for byte-perfect write_blastware_file output.
events = client.get_events(full_waveform=False, stop_after_index=index)
matching = [ev for ev in events if ev.index == index]
return matching[0] if matching else None, info
@@ -928,7 +928,7 @@ def device_event_blastware_file(
# Write to /tmp so FastAPI can stream it back
out_path = Path("/tmp") / filename
write_n00(ev, a5_frames, out_path)
write_blastware_file(ev, a5_frames, out_path)
log.info(
"blastware_file: wrote %s (%d A5 frames, serial=%s)",
out_path, len(a5_frames), serial,