1 """autogenerated by genpy from network_monitor_udp/LinktestFeedback.msg. Do not edit."""
2 import sys
3 python3 = True if sys.hexversion > 0x03000000 else False
4 import genpy
5 import struct
6
7 import genpy
8
10 _md5sum = "0692c53722c7e369a7f8108c019796f3"
11 _type = "network_monitor_udp/LinktestFeedback"
12 _has_header = False
13 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
14 # Feedback definition
15 float32 latency
16 float32 loss
17 float32 bandwidth
18 float32[] latency_histogram
19 time stamp
20
21
22 """
23 __slots__ = ['latency','loss','bandwidth','latency_histogram','stamp']
24 _slot_types = ['float32','float32','float32','float32[]','time']
25
27 """
28 Constructor. Any message fields that are implicitly/explicitly
29 set to None will be assigned a default value. The recommend
30 use is keyword arguments as this is more robust to future message
31 changes. You cannot mix in-order arguments and keyword arguments.
32
33 The available fields are:
34 latency,loss,bandwidth,latency_histogram,stamp
35
36 :param args: complete set of field values, in .msg order
37 :param kwds: use keyword arguments corresponding to message field names
38 to set specific fields.
39 """
40 if args or kwds:
41 super(LinktestFeedback, self).__init__(*args, **kwds)
42
43 if self.latency is None:
44 self.latency = 0.
45 if self.loss is None:
46 self.loss = 0.
47 if self.bandwidth is None:
48 self.bandwidth = 0.
49 if self.latency_histogram is None:
50 self.latency_histogram = []
51 if self.stamp is None:
52 self.stamp = genpy.Time()
53 else:
54 self.latency = 0.
55 self.loss = 0.
56 self.bandwidth = 0.
57 self.latency_histogram = []
58 self.stamp = genpy.Time()
59
61 """
62 internal API method
63 """
64 return self._slot_types
65
67 """
68 serialize message into buffer
69 :param buff: buffer, ``StringIO``
70 """
71 try:
72 _x = self
73 buff.write(_struct_3f.pack(_x.latency, _x.loss, _x.bandwidth))
74 length = len(self.latency_histogram)
75 buff.write(_struct_I.pack(length))
76 pattern = '<%sf'%length
77 buff.write(struct.pack(pattern, *self.latency_histogram))
78 _x = self
79 buff.write(_struct_2I.pack(_x.stamp.secs, _x.stamp.nsecs))
80 except struct.error as se: self._check_types(se)
81 except TypeError as te: self._check_types(te)
82
84 """
85 unpack serialized message in str into this message instance
86 :param str: byte array of serialized message, ``str``
87 """
88 try:
89 if self.stamp is None:
90 self.stamp = genpy.Time()
91 end = 0
92 _x = self
93 start = end
94 end += 12
95 (_x.latency, _x.loss, _x.bandwidth,) = _struct_3f.unpack(str[start:end])
96 start = end
97 end += 4
98 (length,) = _struct_I.unpack(str[start:end])
99 pattern = '<%sf'%length
100 start = end
101 end += struct.calcsize(pattern)
102 self.latency_histogram = struct.unpack(pattern, str[start:end])
103 _x = self
104 start = end
105 end += 8
106 (_x.stamp.secs, _x.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
107 self.stamp.canon()
108 return self
109 except struct.error as e:
110 raise genpy.DeserializationError(e)
111
112
114 """
115 serialize message with numpy array types into buffer
116 :param buff: buffer, ``StringIO``
117 :param numpy: numpy python module
118 """
119 try:
120 _x = self
121 buff.write(_struct_3f.pack(_x.latency, _x.loss, _x.bandwidth))
122 length = len(self.latency_histogram)
123 buff.write(_struct_I.pack(length))
124 pattern = '<%sf'%length
125 buff.write(self.latency_histogram.tostring())
126 _x = self
127 buff.write(_struct_2I.pack(_x.stamp.secs, _x.stamp.nsecs))
128 except struct.error as se: self._check_types(se)
129 except TypeError as te: self._check_types(te)
130
132 """
133 unpack serialized message in str into this message instance using numpy for array types
134 :param str: byte array of serialized message, ``str``
135 :param numpy: numpy python module
136 """
137 try:
138 if self.stamp is None:
139 self.stamp = genpy.Time()
140 end = 0
141 _x = self
142 start = end
143 end += 12
144 (_x.latency, _x.loss, _x.bandwidth,) = _struct_3f.unpack(str[start:end])
145 start = end
146 end += 4
147 (length,) = _struct_I.unpack(str[start:end])
148 pattern = '<%sf'%length
149 start = end
150 end += struct.calcsize(pattern)
151 self.latency_histogram = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
152 _x = self
153 start = end
154 end += 8
155 (_x.stamp.secs, _x.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
156 self.stamp.canon()
157 return self
158 except struct.error as e:
159 raise genpy.DeserializationError(e)
160
161 _struct_I = genpy.struct_I
162 _struct_3f = struct.Struct("<3f")
163 _struct_2I = struct.Struct("<2I")
164