15def main(filenames, frame_type, print_headers):
18 if frame_type ==
'wibeth':
19 frame_size = fddetdataformats.WIBEthFrame.sizeof()
20 elif frame_type ==
'tdeeth':
21 frame_size = fddetdataformats.TDEEthFrame.sizeof()
22 elif frame_type ==
'daphne':
23 frame_size = fddetdataformats.DAPHNEFrame.sizeof()
25 for filename
in filenames:
26 with open(filename,
'rb')
as ff:
31 frame = ff.read(frame_size)
36 if frame_type ==
'wibeth':
37 wf = fddetdataformats.WIBEthFrame(frame)
38 timestamp = wf.get_timestamp()
39 if first_timestamp == -1
or timestamp < first_timestamp:
40 first_timestamp = timestamp
41 if last_timestamp == -1
or timestamp > last_timestamp:
42 last_timestamp = timestamp
46 print(
'\n\t==== WIBETH HEADER ====')
47 print_header(wf,prefix=
'\t\t')
48 if frame_type ==
'tdeeth':
49 tf = fddetdataformats.TDEEthFrame(frame)
50 timestamp = tf.get_timestamp()
52 if first_timestamp == -1
or timestamp < first_timestamp:
53 first_timestamp = timestamp
54 if last_timestamp == -1
or timestamp > last_timestamp:
55 last_timestamp = timestamp
59 print(
'\n\t==== TDE ETH HEADER PRINT NOT SUPPORTED ====')
60 if frame_type ==
'daphne':
61 df = fddetdataformats.DAPHNEFrame(frame)
62 timestamp = df.get_timestamp()
64 if first_timestamp == -1
or timestamp < first_timestamp:
65 first_timestamp = timestamp
66 if last_timestamp == -1
or timestamp > last_timestamp:
67 last_timestamp = timestamp
71 print(
'\n\t==== DAPHNE HEADER PRINT NOT SUPPORTED ====')
74 print(f
'\n==== FILE {filename} SUMMARY ====')
75 print(f
'{frame_counter} frames, first timestamp {first_timestamp}, last timestamp {last_timestamp}')
78 print(f
'Processed all requested frames')