Compare commits
2 Commits
c4a5da893c
...
501b5080e9
| Author | SHA1 | Date | |
|---|---|---|---|
| 501b5080e9 | |||
| 5948c833bd |
@@ -702,8 +702,8 @@ def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None:
|
|||||||
# Validated by checking unit strings "in.\0" at label-14 and "/s\0\0" at label-6.
|
# Validated by checking unit strings "in.\0" at label-14 and "/s\0\0" at label-6.
|
||||||
# "Tran2" at a later position won't match because its surrounding bytes differ.
|
# "Tran2" at a later position won't match because its surrounding bytes differ.
|
||||||
try:
|
try:
|
||||||
tran_pos = data.find(b"Tran", 1000)
|
tran_pos = data.find(b"Tran", 44)
|
||||||
log.warning("compliance_config: 'Tran' search from 1000 → pos=%d cfg_len=%d", tran_pos, len(data))
|
log.warning("compliance_config: 'Tran' search from 44 → pos=%d cfg_len=%d", tran_pos, len(data))
|
||||||
if tran_pos >= 0:
|
if tran_pos >= 0:
|
||||||
pre = data[max(0, tran_pos - 30) : tran_pos + 8]
|
pre = data[max(0, tran_pos - 30) : tran_pos + 8]
|
||||||
log.warning(
|
log.warning(
|
||||||
|
|||||||
@@ -323,6 +323,20 @@ def device_events(
|
|||||||
if ev.sample_rate is None:
|
if ev.sample_rate is None:
|
||||||
ev.sample_rate = info.compliance_config.sample_rate
|
ev.sample_rate = info.compliance_config.sample_rate
|
||||||
|
|
||||||
|
# Backfill event.project_info fields that the 210-byte waveform record doesn't carry.
|
||||||
|
# The waveform record only stores "Project:" — client/operator/sensor_location/notes
|
||||||
|
# live in the SUB 1A compliance config, not in the per-event record.
|
||||||
|
if info.compliance_config:
|
||||||
|
cc = info.compliance_config
|
||||||
|
for ev in events:
|
||||||
|
if ev.project_info is None:
|
||||||
|
ev.project_info = ProjectInfo()
|
||||||
|
pi = ev.project_info
|
||||||
|
if pi.client is None: pi.client = cc.client
|
||||||
|
if pi.operator is None: pi.operator = cc.operator
|
||||||
|
if pi.sensor_location is None: pi.sensor_location = cc.sensor_location
|
||||||
|
if pi.notes is None: pi.notes = cc.notes
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"device": _serialise_device_info(info),
|
"device": _serialise_device_info(info),
|
||||||
"event_count": len(events),
|
"event_count": len(events),
|
||||||
|
|||||||
Reference in New Issue
Block a user