Files
chest_strap/code/l452_code/packet_parser_log.py
T

24 lines
670 B
Python

import packet_parser_helpers
import time
import matplotlib.pyplot as plt
log = open('5-23-2026-first-10-min.LOG','rb').read()
types = packet_parser_helpers.get_type_list(packet_parser_helpers.packet_definitions)
index = 493
while index < len(log):
size = int.from_bytes(log[index:index + 4], byteorder = 'little', signed = False)
print("INDEX: " + str(index) + " SIZE: " + str(size) + " FILESIZE: " + str(len(log)))
cons = log[index + 4 : index + 4 + size]
try:
packet_parser_helpers.read_and_process(types, cons, size)
#time.sleep(0.1)
except IndexError:
break
index += 4 + size
packet_parser_helpers.make_graphs()