Skip to content

Commit 2e50718

Browse files
committed
add constructor to EntInfoHeader
1 parent a71e77b commit 2e50718

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

cqc/entInfoHeader.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,32 @@ class EntInfoHeader(Header):
5151
HDR_LENGTH = ENT_INFO_LENGTH
5252
packaging_format = "!LHHLHHLQQHBB"
5353

54+
def __init__(self, headerBytes=None):
55+
"""
56+
Initialize using values received from a packet, if available.
57+
"""
58+
super().__init__(headerBytes)
59+
if headerBytes is None:
60+
self.node_A = 0
61+
self.port_A = 0
62+
self.app_id_A = 0
63+
64+
self.node_B = 0
65+
self.port_B = 0
66+
self.app_id_B = 0
67+
68+
self.id_AB = 0
69+
70+
self.timestamp = 0
71+
self.ToG = 0
72+
self.goodness = 0
73+
self.DF = 0
74+
self.is_set = False
75+
else:
76+
self.unpack(headerBytes)
77+
self.is_set = True
78+
79+
5480
def _setVals(self, node_A=0, port_A=0, app_id_A=0, node_B=0, port_B=0, app_id_B=0, id_AB=0, timestamp=0, ToG=0,
5581
goodness=0, DF=0):
5682
"""

0 commit comments

Comments
 (0)