Skip to content
Snippets Groups Projects
Commit 13d34a4c authored by Kien Le's avatar Kien Le
Browse files

Add check for masspos when detecting data type

parent 7bdc11ed
No related branches found
No related tags found
1 merge request!191Read log files generated by users
...@@ -37,13 +37,19 @@ def detect_log_file_packet_format(packet: List[str]) -> LogFileFormat: ...@@ -37,13 +37,19 @@ def detect_log_file_packet_format(packet: List[str]) -> LogFileFormat:
# at the start of a packet, we know the log file is from SOHStationViewer. # at the start of a packet, we know the log file is from SOHStationViewer.
if packet_start.startswith('Events:'): if packet_start.startswith('Events:'):
return 'sohstationviewer' return 'sohstationviewer'
# Unlike logpeek, we are writing the mass position in its own packet. So,
# a packet that starts with mass position data would be an SOHStationViewer
# packet.
if packet_start.startswith('LPMP'):
return 'sohstationviewer'
# Logpeek write its events' info right after an SH packet. # Logpeek write its events' info right after an SH packet.
packet_end = packet[-1] packet_end = packet[-1]
packet_end_with_event_info = (packet_end.startswith('DAS') or packet_end_with_event_info = (packet_end.startswith('DAS') or
packet_end.startswith('WARNING')) packet_end.startswith('WARNING'))
if (packet_start.startswith('State of Health') and packet_end_with_mass_pos = packet_end.startswith('LPMP')
packet_end_with_event_info): packet_end_special = packet_end_with_event_info or packet_end_with_mass_pos
if packet_start.startswith('State of Health') and packet_end_special:
return 'logpeek' return 'logpeek'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment