25 lines
635 B
Python
25 lines
635 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from app.mqtt.parsers.nmea import parse_nmea_sentences
|
|
from app.mqtt.parsers.rtcm import summarize_rtcm_types
|
|
|
|
|
|
def parse_mixed_payload(payload: bytes) -> list[dict[str, Any]]:
|
|
events = parse_nmea_sentences(payload)
|
|
|
|
rtcm_types = summarize_rtcm_types(payload)
|
|
if rtcm_types:
|
|
events.append(
|
|
{
|
|
"event_type": "rtcm_summary",
|
|
"payload": {
|
|
"rtcm_message_count": sum(rtcm_types.values()),
|
|
"rtcm_types": rtcm_types,
|
|
},
|
|
}
|
|
)
|
|
|
|
return events
|