forked from valschmidt/kmall
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkmall_tester.py
executable file
·167 lines (138 loc) · 5.64 KB
/
kmall_tester.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/usr/bin/env python
import os
import kmall
# 2019 Thunder Bay - With Water Column
#file = 'data/0019_20190511_204630_ASVBEN.kmall'
#file = '~/Desktop/SharedFolder_ASV_III/0019_20190511_204630_ASVBEN.kmall'
#2019 Pre-Samoa MAC Test Near Portsmouth
#file = '0006_20190529_161633_ASVBEN.kmall'
#Val's Test File
#file = 'data/0007_20190513_154724_ASVBEN.kmall'
#SCL read fails on this file:
#file = 'data/0012_20190529_182623_ASVBEN.kmall'
#file = '/home/monster-kitty/Desktop/kmall/test_log_1.kmall'
path = 'data'
for item in os.listdir(path):
print('File: ', item)
file = path + '/' + item
k = kmall.kmall(file)
k.OpenFiletoRead()
k.index_file()
#print(k.msgoffset, len(k.msgoffset))
#print(k.msgsize, len(k.msgsize))
#print(k.msgtype, len(k.msgtype))
#pingCount = k.check_ping_count()
#print(pingCount)
# Get the file byte count offset for each IIP datagram.
IIPOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#IIP'"]
print("Num IIP Offsets: ", len(IIPOffsets))
for offset in IIPOffsets:
k.FID.seek(offset, 0)
dg_IIP = k.read_EMdgmIIP()
#print(dg_IIP)
# Get the file byte count offset for each IOP datagram.
IOPOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#IOP'"]
print("Num IOP Offsets: ", len(IOPOffsets))
for offset in IOPOffsets:
k.FID.seek(offset, 0)
dg_IOP = k.read_EMdgmIOP()
#print(dg_IOP)
# Get the file byte count offset for each IBE datagram.
IBEOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#IBE'"]
print("Num IBE Offsets: ", len(IBEOffsets))
for offset in IBEOffsets:
k.FID.seek(offset, 0)
dg_IBE = k.read_EMdgmIB()
#print(dg_IBE)
# Get the file byte count offset for each IBR datagram.
IBROffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#IBR'"]
print("Num IBR Offsets: ", len(IBROffsets))
for offset in IBROffsets:
k.FID.seek(offset, 0)
dg_IBR = k.read_EMdgmIB()
#print(dg_IBR)
# Get the file byte count offset for each IBS datagram.
IBSOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#IBS'"]
print("Num IBS Offsets: ", len(IBSOffsets))
for offset in IBSOffsets:
k.FID.seek(offset, 0)
dg_IBS = k.read_EMdgmIB()
#print(dg_IBS)
# Get the file byte count offset for each MRZ datagram.
MRZOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#MRZ'"]
print("Num MRZ Offsets: ", len(MRZOffsets))
for offset in MRZOffsets:
k.FID.seek(offset, 0)
dg_MRZ = k.read_EMdgmMRZ()
#print(dg_MRZ)
# Get the file byte count offset for each MWC datagram.
MWCOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#MWC'"]
print("Num MWC Offsets: ", len(MWCOffsets))
for offset in MWCOffsets:
k.FID.seek(offset, 0)
dg_MWC = k.read_EMdgmMWC()
#print(dg_MWC)
# Get the file byte count offset for each SPO datagram.
SPOOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#SPO'"]
print("Num SPO Offsets: ", len(SPOOffsets))
for offset in SPOOffsets:
k.FID.seek(offset, 0)
dg_SPO = k.read_EMdgmSPO()
#print(dg_SPO)
# Get the file byte count offset for each SKM datagram.
SKMOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#SKM'"]
print("Num SKM Offsets: ", len(SKMOffsets))
for offset in SKMOffsets:
k.FID.seek(offset, 0)
dg_SKM = k.read_EMdgmSKM()
#print(dg_SKM)
# Get the file byte count offset for each SVP datagram.
SVPOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#SVP'"]
print("Num SVP Offsets: ", len(SVPOffsets))
for offset in SVPOffsets:
k.FID.seek(offset, 0)
dg_SVP = k.read_EMdgmSVP()
#print(dg_SVP)
# Get the file byte count offset for each SVT datagram.
SVTOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#SVT'"]
print("Num SVT Offsets: ", len(SVTOffsets))
for offset in SVTOffsets:
k.FID.seek(offset, 0)
dg_SVT = k.read_EMdgmSVT()
#print(dg_SVT)
# Get the file byte count offset for each SCL datagram.
SCLOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#SCL'"]
print("Num SCL Offsets: ", len(SCLOffsets))
for offset in SCLOffsets:
k.FID.seek(offset, 0)
dg_SCL = k.read_EMdgmSCL()
#print(dg_SCL)
# Get the file byte count offset for each SDE datagram.
SDEOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#SDE'"]
print("Num SDE Offsets: ", len(SDEOffsets))
for offset in SDEOffsets:
k.FID.seek(offset, 0)
dg_SDE = k.read_EMdgmSDE()
#print(dg_SCL)
# Get the file byte count offset for each SHI datagram.
SHIOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#SHI'"]
print("Num SHI Offsets: ", len(SHIOffsets))
for offset in SDEOffsets:
k.FID.seek(offset, 0)
dg_SHI = k.read_EMdgmSHI()
#print(dg_SHI)
# Get the file byte count offset for each CPO datagram.
CPOOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#CPO'"]
print("Num CPO Offsets: ", len(CPOOffsets))
for offset in CPOOffsets:
k.FID.seek(offset, 0)
dg_CPO = k.read_EMdgmCPO()
#print(dg_CPO)
# Get the file byte count offset for each CHE datagram.
CHEOffsets = [x for x, y in zip(k.msgoffset, k.msgtype) if y == "b'#CHE'"]
print("Num CHE Offsets: ", len(CHEOffsets))
for offset in CHEOffsets:
k.FID.seek(offset, 0)
dg_CHE = k.read_EMdgmCHE()
#print(dg_CHE)
k.closeFile()