00001 """autogenerated by genmsg_py from UdpMonitor.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006
00007 class UdpMonitor(roslib.message.Message):
00008 _md5sum = "61e78eeecffb9257ae40ca291408f8cc"
00009 _type = "network_monitor_udp/UdpMonitor"
00010 _has_header = True
00011 _full_text = """Header header
00012
00013 # Summary of the client settings
00014 string server_host
00015 uint32 server_port
00016 string source_interface
00017 float32 packet_rate
00018 uint32 packet_size
00019
00020 # Proportion of packets that have latencies within a bin. The first bin
00021 # starts at zero, bins end at the value in latency_bin_values.
00022 # len(latency_bin_values) = len(latency_bin_limits) + 1
00023 float32[] latency_bin_limits
00024 float32[] latency_bin_values
00025
00026 # Average latency in seconds and loss rate (between 0 and 1) for packets
00027 # that fall within one of the bins.
00028 float32 average_latency_fresh
00029 float32 loss_fresh
00030
00031 # Average latency in seconds for all
00032 # received packets, including very old ones.
00033 float32 average_latency_all
00034
00035 ================================================================================
00036 MSG: std_msgs/Header
00037 # Standard metadata for higher-level stamped data types.
00038 # This is generally used to communicate timestamped data
00039 # in a particular coordinate frame.
00040 #
00041 # sequence ID: consecutively increasing ID
00042 uint32 seq
00043 #Two-integer timestamp that is expressed as:
00044 # * stamp.secs: seconds (stamp_secs) since epoch
00045 # * stamp.nsecs: nanoseconds since stamp_secs
00046 # time-handling sugar is provided by the client library
00047 time stamp
00048 #Frame this data is associated with
00049 # 0: no frame
00050 # 1: global frame
00051 string frame_id
00052
00053 """
00054 __slots__ = ['header','server_host','server_port','source_interface','packet_rate','packet_size','latency_bin_limits','latency_bin_values','average_latency_fresh','loss_fresh','average_latency_all']
00055 _slot_types = ['Header','string','uint32','string','float32','uint32','float32[]','float32[]','float32','float32','float32']
00056
00057 def __init__(self, *args, **kwds):
00058 """
00059 Constructor. Any message fields that are implicitly/explicitly
00060 set to None will be assigned a default value. The recommend
00061 use is keyword arguments as this is more robust to future message
00062 changes. You cannot mix in-order arguments and keyword arguments.
00063
00064 The available fields are:
00065 header,server_host,server_port,source_interface,packet_rate,packet_size,latency_bin_limits,latency_bin_values,average_latency_fresh,loss_fresh,average_latency_all
00066
00067 @param args: complete set of field values, in .msg order
00068 @param kwds: use keyword arguments corresponding to message field names
00069 to set specific fields.
00070 """
00071 if args or kwds:
00072 super(UdpMonitor, self).__init__(*args, **kwds)
00073
00074 if self.header is None:
00075 self.header = std_msgs.msg._Header.Header()
00076 if self.server_host is None:
00077 self.server_host = ''
00078 if self.server_port is None:
00079 self.server_port = 0
00080 if self.source_interface is None:
00081 self.source_interface = ''
00082 if self.packet_rate is None:
00083 self.packet_rate = 0.
00084 if self.packet_size is None:
00085 self.packet_size = 0
00086 if self.latency_bin_limits is None:
00087 self.latency_bin_limits = []
00088 if self.latency_bin_values is None:
00089 self.latency_bin_values = []
00090 if self.average_latency_fresh is None:
00091 self.average_latency_fresh = 0.
00092 if self.loss_fresh is None:
00093 self.loss_fresh = 0.
00094 if self.average_latency_all is None:
00095 self.average_latency_all = 0.
00096 else:
00097 self.header = std_msgs.msg._Header.Header()
00098 self.server_host = ''
00099 self.server_port = 0
00100 self.source_interface = ''
00101 self.packet_rate = 0.
00102 self.packet_size = 0
00103 self.latency_bin_limits = []
00104 self.latency_bin_values = []
00105 self.average_latency_fresh = 0.
00106 self.loss_fresh = 0.
00107 self.average_latency_all = 0.
00108
00109 def _get_types(self):
00110 """
00111 internal API method
00112 """
00113 return self._slot_types
00114
00115 def serialize(self, buff):
00116 """
00117 serialize message into buffer
00118 @param buff: buffer
00119 @type buff: StringIO
00120 """
00121 try:
00122 _x = self
00123 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00124 _x = self.header.frame_id
00125 length = len(_x)
00126 buff.write(struct.pack('<I%ss'%length, length, _x))
00127 _x = self.server_host
00128 length = len(_x)
00129 buff.write(struct.pack('<I%ss'%length, length, _x))
00130 buff.write(_struct_I.pack(self.server_port))
00131 _x = self.source_interface
00132 length = len(_x)
00133 buff.write(struct.pack('<I%ss'%length, length, _x))
00134 _x = self
00135 buff.write(_struct_fI.pack(_x.packet_rate, _x.packet_size))
00136 length = len(self.latency_bin_limits)
00137 buff.write(_struct_I.pack(length))
00138 pattern = '<%sf'%length
00139 buff.write(struct.pack(pattern, *self.latency_bin_limits))
00140 length = len(self.latency_bin_values)
00141 buff.write(_struct_I.pack(length))
00142 pattern = '<%sf'%length
00143 buff.write(struct.pack(pattern, *self.latency_bin_values))
00144 _x = self
00145 buff.write(_struct_3f.pack(_x.average_latency_fresh, _x.loss_fresh, _x.average_latency_all))
00146 except struct.error, se: self._check_types(se)
00147 except TypeError, te: self._check_types(te)
00148
00149 def deserialize(self, str):
00150 """
00151 unpack serialized message in str into this message instance
00152 @param str: byte array of serialized message
00153 @type str: str
00154 """
00155 try:
00156 if self.header is None:
00157 self.header = std_msgs.msg._Header.Header()
00158 end = 0
00159 _x = self
00160 start = end
00161 end += 12
00162 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00163 start = end
00164 end += 4
00165 (length,) = _struct_I.unpack(str[start:end])
00166 start = end
00167 end += length
00168 self.header.frame_id = str[start:end]
00169 start = end
00170 end += 4
00171 (length,) = _struct_I.unpack(str[start:end])
00172 start = end
00173 end += length
00174 self.server_host = str[start:end]
00175 start = end
00176 end += 4
00177 (self.server_port,) = _struct_I.unpack(str[start:end])
00178 start = end
00179 end += 4
00180 (length,) = _struct_I.unpack(str[start:end])
00181 start = end
00182 end += length
00183 self.source_interface = str[start:end]
00184 _x = self
00185 start = end
00186 end += 8
00187 (_x.packet_rate, _x.packet_size,) = _struct_fI.unpack(str[start:end])
00188 start = end
00189 end += 4
00190 (length,) = _struct_I.unpack(str[start:end])
00191 pattern = '<%sf'%length
00192 start = end
00193 end += struct.calcsize(pattern)
00194 self.latency_bin_limits = struct.unpack(pattern, str[start:end])
00195 start = end
00196 end += 4
00197 (length,) = _struct_I.unpack(str[start:end])
00198 pattern = '<%sf'%length
00199 start = end
00200 end += struct.calcsize(pattern)
00201 self.latency_bin_values = struct.unpack(pattern, str[start:end])
00202 _x = self
00203 start = end
00204 end += 12
00205 (_x.average_latency_fresh, _x.loss_fresh, _x.average_latency_all,) = _struct_3f.unpack(str[start:end])
00206 return self
00207 except struct.error, e:
00208 raise roslib.message.DeserializationError(e)
00209
00210
00211 def serialize_numpy(self, buff, numpy):
00212 """
00213 serialize message with numpy array types into buffer
00214 @param buff: buffer
00215 @type buff: StringIO
00216 @param numpy: numpy python module
00217 @type numpy module
00218 """
00219 try:
00220 _x = self
00221 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00222 _x = self.header.frame_id
00223 length = len(_x)
00224 buff.write(struct.pack('<I%ss'%length, length, _x))
00225 _x = self.server_host
00226 length = len(_x)
00227 buff.write(struct.pack('<I%ss'%length, length, _x))
00228 buff.write(_struct_I.pack(self.server_port))
00229 _x = self.source_interface
00230 length = len(_x)
00231 buff.write(struct.pack('<I%ss'%length, length, _x))
00232 _x = self
00233 buff.write(_struct_fI.pack(_x.packet_rate, _x.packet_size))
00234 length = len(self.latency_bin_limits)
00235 buff.write(_struct_I.pack(length))
00236 pattern = '<%sf'%length
00237 buff.write(self.latency_bin_limits.tostring())
00238 length = len(self.latency_bin_values)
00239 buff.write(_struct_I.pack(length))
00240 pattern = '<%sf'%length
00241 buff.write(self.latency_bin_values.tostring())
00242 _x = self
00243 buff.write(_struct_3f.pack(_x.average_latency_fresh, _x.loss_fresh, _x.average_latency_all))
00244 except struct.error, se: self._check_types(se)
00245 except TypeError, te: self._check_types(te)
00246
00247 def deserialize_numpy(self, str, numpy):
00248 """
00249 unpack serialized message in str into this message instance using numpy for array types
00250 @param str: byte array of serialized message
00251 @type str: str
00252 @param numpy: numpy python module
00253 @type numpy: module
00254 """
00255 try:
00256 if self.header is None:
00257 self.header = std_msgs.msg._Header.Header()
00258 end = 0
00259 _x = self
00260 start = end
00261 end += 12
00262 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00263 start = end
00264 end += 4
00265 (length,) = _struct_I.unpack(str[start:end])
00266 start = end
00267 end += length
00268 self.header.frame_id = str[start:end]
00269 start = end
00270 end += 4
00271 (length,) = _struct_I.unpack(str[start:end])
00272 start = end
00273 end += length
00274 self.server_host = str[start:end]
00275 start = end
00276 end += 4
00277 (self.server_port,) = _struct_I.unpack(str[start:end])
00278 start = end
00279 end += 4
00280 (length,) = _struct_I.unpack(str[start:end])
00281 start = end
00282 end += length
00283 self.source_interface = str[start:end]
00284 _x = self
00285 start = end
00286 end += 8
00287 (_x.packet_rate, _x.packet_size,) = _struct_fI.unpack(str[start:end])
00288 start = end
00289 end += 4
00290 (length,) = _struct_I.unpack(str[start:end])
00291 pattern = '<%sf'%length
00292 start = end
00293 end += struct.calcsize(pattern)
00294 self.latency_bin_limits = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00295 start = end
00296 end += 4
00297 (length,) = _struct_I.unpack(str[start:end])
00298 pattern = '<%sf'%length
00299 start = end
00300 end += struct.calcsize(pattern)
00301 self.latency_bin_values = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00302 _x = self
00303 start = end
00304 end += 12
00305 (_x.average_latency_fresh, _x.loss_fresh, _x.average_latency_all,) = _struct_3f.unpack(str[start:end])
00306 return self
00307 except struct.error, e:
00308 raise roslib.message.DeserializationError(e)
00309
00310 _struct_I = roslib.message.struct_I
00311 _struct_fI = struct.Struct("<fI")
00312 _struct_3I = struct.Struct("<3I")
00313 _struct_3f = struct.Struct("<3f")