1 """autogenerated by genpy from network_monitor_udp/UdpSink.msg. Do not edit."""
2 import sys
3 python3 = True if sys.hexversion > 0x03000000 else False
4 import genpy
5 import struct
6
7
9 _md5sum = "a56e2a33942a368e87b357cc9e894ec5"
10 _type = "network_monitor_udp/UdpSink"
11 _has_header = False
12 _full_text = """### data send from sink to source
13 uint8[4] magic
14 float64 send_time
15 float64 echo_time
16 int32 seqnum
17 int32 source_id
18
19
20 """
21 __slots__ = ['magic','send_time','echo_time','seqnum','source_id']
22 _slot_types = ['uint8[4]','float64','float64','int32','int32']
23
25 """
26 Constructor. Any message fields that are implicitly/explicitly
27 set to None will be assigned a default value. The recommend
28 use is keyword arguments as this is more robust to future message
29 changes. You cannot mix in-order arguments and keyword arguments.
30
31 The available fields are:
32 magic,send_time,echo_time,seqnum,source_id
33
34 :param args: complete set of field values, in .msg order
35 :param kwds: use keyword arguments corresponding to message field names
36 to set specific fields.
37 """
38 if args or kwds:
39 super(UdpSink, self).__init__(*args, **kwds)
40
41 if self.magic is None:
42 self.magic = chr(0)*4
43 if self.send_time is None:
44 self.send_time = 0.
45 if self.echo_time is None:
46 self.echo_time = 0.
47 if self.seqnum is None:
48 self.seqnum = 0
49 if self.source_id is None:
50 self.source_id = 0
51 else:
52 self.magic = chr(0)*4
53 self.send_time = 0.
54 self.echo_time = 0.
55 self.seqnum = 0
56 self.source_id = 0
57
59 """
60 internal API method
61 """
62 return self._slot_types
63
65 """
66 serialize message into buffer
67 :param buff: buffer, ``StringIO``
68 """
69 try:
70 _x = self.magic
71
72 if type(_x) in [list, tuple]:
73 buff.write(_struct_4B.pack(*_x))
74 else:
75 buff.write(_struct_4s.pack(_x))
76 _x = self
77 buff.write(_struct_2d2i.pack(_x.send_time, _x.echo_time, _x.seqnum, _x.source_id))
78 except struct.error as se: self._check_types(se)
79 except TypeError as te: self._check_types(te)
80
82 """
83 unpack serialized message in str into this message instance
84 :param str: byte array of serialized message, ``str``
85 """
86 try:
87 end = 0
88 start = end
89 end += 4
90 self.magic = str[start:end]
91 _x = self
92 start = end
93 end += 24
94 (_x.send_time, _x.echo_time, _x.seqnum, _x.source_id,) = _struct_2d2i.unpack(str[start:end])
95 return self
96 except struct.error as e:
97 raise genpy.DeserializationError(e)
98
99
101 """
102 serialize message with numpy array types into buffer
103 :param buff: buffer, ``StringIO``
104 :param numpy: numpy python module
105 """
106 try:
107 _x = self.magic
108
109 if type(_x) in [list, tuple]:
110 buff.write(_struct_4B.pack(*_x))
111 else:
112 buff.write(_struct_4s.pack(_x))
113 _x = self
114 buff.write(_struct_2d2i.pack(_x.send_time, _x.echo_time, _x.seqnum, _x.source_id))
115 except struct.error as se: self._check_types(se)
116 except TypeError as te: self._check_types(te)
117
119 """
120 unpack serialized message in str into this message instance using numpy for array types
121 :param str: byte array of serialized message, ``str``
122 :param numpy: numpy python module
123 """
124 try:
125 end = 0
126 start = end
127 end += 4
128 self.magic = str[start:end]
129 _x = self
130 start = end
131 end += 24
132 (_x.send_time, _x.echo_time, _x.seqnum, _x.source_id,) = _struct_2d2i.unpack(str[start:end])
133 return self
134 except struct.error as e:
135 raise genpy.DeserializationError(e)
136
137 _struct_I = genpy.struct_I
138 _struct_2d2i = struct.Struct("<2d2i")
139 _struct_4B = struct.Struct("<4B")
140 _struct_4s = struct.Struct("<4s")
141