Package master_discovery_fkie :: Package srv :: Module _DiscoverMasters
[frames] | no frames]

Source Code for Module master_discovery_fkie.srv._DiscoverMasters

  1  """autogenerated by genpy from master_discovery_fkie/DiscoverMastersRequest.msg. Do not edit.""" 
  2  import sys 
  3  python3 = True if sys.hexversion > 0x03000000 else False 
  4  import genpy 
  5  import struct 
  6   
  7   
8 -class DiscoverMastersRequest(genpy.Message):
9 _md5sum = "d41d8cd98f00b204e9800998ecf8427e" 10 _type = "master_discovery_fkie/DiscoverMastersRequest" 11 _has_header = False #flag to mark the presence of a Header object 12 _full_text = """ 13 """ 14 __slots__ = [] 15 _slot_types = [] 16
17 - def __init__(self, *args, **kwds):
18 """ 19 Constructor. Any message fields that are implicitly/explicitly 20 set to None will be assigned a default value. The recommend 21 use is keyword arguments as this is more robust to future message 22 changes. You cannot mix in-order arguments and keyword arguments. 23 24 The available fields are: 25 26 27 :param args: complete set of field values, in .msg order 28 :param kwds: use keyword arguments corresponding to message field names 29 to set specific fields. 30 """ 31 if args or kwds: 32 super(DiscoverMastersRequest, self).__init__(*args, **kwds)
33
34 - def _get_types(self):
35 """ 36 internal API method 37 """ 38 return self._slot_types
39
40 - def serialize(self, buff):
41 """ 42 serialize message into buffer 43 :param buff: buffer, ``StringIO`` 44 """ 45 try: 46 pass 47 except struct.error as se: self._check_types(se) 48 except TypeError as te: self._check_types(te)
49
50 - def deserialize(self, str):
51 """ 52 unpack serialized message in str into this message instance 53 :param str: byte array of serialized message, ``str`` 54 """ 55 try: 56 end = 0 57 return self 58 except struct.error as e: 59 raise genpy.DeserializationError(e) #most likely buffer underfill
60 61
62 - def serialize_numpy(self, buff, numpy):
63 """ 64 serialize message with numpy array types into buffer 65 :param buff: buffer, ``StringIO`` 66 :param numpy: numpy python module 67 """ 68 try: 69 pass 70 except struct.error as se: self._check_types(se) 71 except TypeError as te: self._check_types(te)
72
73 - def deserialize_numpy(self, str, numpy):
74 """ 75 unpack serialized message in str into this message instance using numpy for array types 76 :param str: byte array of serialized message, ``str`` 77 :param numpy: numpy python module 78 """ 79 try: 80 end = 0 81 return self 82 except struct.error as e: 83 raise genpy.DeserializationError(e) #most likely buffer underfill
84 85 _struct_I = genpy.struct_I 86 """autogenerated by genpy from master_discovery_fkie/DiscoverMastersResponse.msg. Do not edit.""" 87 import sys 88 python3 = True if sys.hexversion > 0x03000000 else False 89 import genpy 90 import struct 91 92 import master_discovery_fkie.msg 93
94 -class DiscoverMastersResponse(genpy.Message):
95 _md5sum = "bc7525cc24dd3b880f044a2cdfb95aad" 96 _type = "master_discovery_fkie/DiscoverMastersResponse" 97 _has_header = False #flag to mark the presence of a Header object 98 _full_text = """master_discovery_fkie/ROSMaster[] masters 99 100 101 ================================================================================ 102 MSG: master_discovery_fkie/ROSMaster 103 string name 104 # ROS Master URI 105 string uri 106 # The timestamp of the state of the remoter ROS master 107 float64 timestamp 108 # The timestamp of the state of the remoter ROS master, without the changes maked while a synchronization. 109 float64 timestamp_local 110 bool online 111 string discoverer_name 112 string monitoruri 113 """ 114 __slots__ = ['masters'] 115 _slot_types = ['master_discovery_fkie/ROSMaster[]'] 116
117 - def __init__(self, *args, **kwds):
118 """ 119 Constructor. Any message fields that are implicitly/explicitly 120 set to None will be assigned a default value. The recommend 121 use is keyword arguments as this is more robust to future message 122 changes. You cannot mix in-order arguments and keyword arguments. 123 124 The available fields are: 125 masters 126 127 :param args: complete set of field values, in .msg order 128 :param kwds: use keyword arguments corresponding to message field names 129 to set specific fields. 130 """ 131 if args or kwds: 132 super(DiscoverMastersResponse, self).__init__(*args, **kwds) 133 #message fields cannot be None, assign default values for those that are 134 if self.masters is None: 135 self.masters = [] 136 else: 137 self.masters = []
138
139 - def _get_types(self):
140 """ 141 internal API method 142 """ 143 return self._slot_types
144
145 - def serialize(self, buff):
146 """ 147 serialize message into buffer 148 :param buff: buffer, ``StringIO`` 149 """ 150 try: 151 length = len(self.masters) 152 buff.write(_struct_I.pack(length)) 153 for val1 in self.masters: 154 _x = val1.name 155 length = len(_x) 156 if python3 or type(_x) == unicode: 157 _x = _x.encode('utf-8') 158 length = len(_x) 159 buff.write(struct.pack('<I%ss'%length, length, _x)) 160 _x = val1.uri 161 length = len(_x) 162 if python3 or type(_x) == unicode: 163 _x = _x.encode('utf-8') 164 length = len(_x) 165 buff.write(struct.pack('<I%ss'%length, length, _x)) 166 _x = val1 167 buff.write(_struct_2dB.pack(_x.timestamp, _x.timestamp_local, _x.online)) 168 _x = val1.discoverer_name 169 length = len(_x) 170 if python3 or type(_x) == unicode: 171 _x = _x.encode('utf-8') 172 length = len(_x) 173 buff.write(struct.pack('<I%ss'%length, length, _x)) 174 _x = val1.monitoruri 175 length = len(_x) 176 if python3 or type(_x) == unicode: 177 _x = _x.encode('utf-8') 178 length = len(_x) 179 buff.write(struct.pack('<I%ss'%length, length, _x)) 180 except struct.error as se: self._check_types(se) 181 except TypeError as te: self._check_types(te)
182
183 - def deserialize(self, str):
184 """ 185 unpack serialized message in str into this message instance 186 :param str: byte array of serialized message, ``str`` 187 """ 188 try: 189 if self.masters is None: 190 self.masters = None 191 end = 0 192 start = end 193 end += 4 194 (length,) = _struct_I.unpack(str[start:end]) 195 self.masters = [] 196 for i in range(0, length): 197 val1 = master_discovery_fkie.msg.ROSMaster() 198 start = end 199 end += 4 200 (length,) = _struct_I.unpack(str[start:end]) 201 start = end 202 end += length 203 if python3: 204 val1.name = str[start:end].decode('utf-8') 205 else: 206 val1.name = str[start:end] 207 start = end 208 end += 4 209 (length,) = _struct_I.unpack(str[start:end]) 210 start = end 211 end += length 212 if python3: 213 val1.uri = str[start:end].decode('utf-8') 214 else: 215 val1.uri = str[start:end] 216 _x = val1 217 start = end 218 end += 17 219 (_x.timestamp, _x.timestamp_local, _x.online,) = _struct_2dB.unpack(str[start:end]) 220 val1.online = bool(val1.online) 221 start = end 222 end += 4 223 (length,) = _struct_I.unpack(str[start:end]) 224 start = end 225 end += length 226 if python3: 227 val1.discoverer_name = str[start:end].decode('utf-8') 228 else: 229 val1.discoverer_name = str[start:end] 230 start = end 231 end += 4 232 (length,) = _struct_I.unpack(str[start:end]) 233 start = end 234 end += length 235 if python3: 236 val1.monitoruri = str[start:end].decode('utf-8') 237 else: 238 val1.monitoruri = str[start:end] 239 self.masters.append(val1) 240 return self 241 except struct.error as e: 242 raise genpy.DeserializationError(e) #most likely buffer underfill
243 244
245 - def serialize_numpy(self, buff, numpy):
246 """ 247 serialize message with numpy array types into buffer 248 :param buff: buffer, ``StringIO`` 249 :param numpy: numpy python module 250 """ 251 try: 252 length = len(self.masters) 253 buff.write(_struct_I.pack(length)) 254 for val1 in self.masters: 255 _x = val1.name 256 length = len(_x) 257 if python3 or type(_x) == unicode: 258 _x = _x.encode('utf-8') 259 length = len(_x) 260 buff.write(struct.pack('<I%ss'%length, length, _x)) 261 _x = val1.uri 262 length = len(_x) 263 if python3 or type(_x) == unicode: 264 _x = _x.encode('utf-8') 265 length = len(_x) 266 buff.write(struct.pack('<I%ss'%length, length, _x)) 267 _x = val1 268 buff.write(_struct_2dB.pack(_x.timestamp, _x.timestamp_local, _x.online)) 269 _x = val1.discoverer_name 270 length = len(_x) 271 if python3 or type(_x) == unicode: 272 _x = _x.encode('utf-8') 273 length = len(_x) 274 buff.write(struct.pack('<I%ss'%length, length, _x)) 275 _x = val1.monitoruri 276 length = len(_x) 277 if python3 or type(_x) == unicode: 278 _x = _x.encode('utf-8') 279 length = len(_x) 280 buff.write(struct.pack('<I%ss'%length, length, _x)) 281 except struct.error as se: self._check_types(se) 282 except TypeError as te: self._check_types(te)
283
284 - def deserialize_numpy(self, str, numpy):
285 """ 286 unpack serialized message in str into this message instance using numpy for array types 287 :param str: byte array of serialized message, ``str`` 288 :param numpy: numpy python module 289 """ 290 try: 291 if self.masters is None: 292 self.masters = None 293 end = 0 294 start = end 295 end += 4 296 (length,) = _struct_I.unpack(str[start:end]) 297 self.masters = [] 298 for i in range(0, length): 299 val1 = master_discovery_fkie.msg.ROSMaster() 300 start = end 301 end += 4 302 (length,) = _struct_I.unpack(str[start:end]) 303 start = end 304 end += length 305 if python3: 306 val1.name = str[start:end].decode('utf-8') 307 else: 308 val1.name = str[start:end] 309 start = end 310 end += 4 311 (length,) = _struct_I.unpack(str[start:end]) 312 start = end 313 end += length 314 if python3: 315 val1.uri = str[start:end].decode('utf-8') 316 else: 317 val1.uri = str[start:end] 318 _x = val1 319 start = end 320 end += 17 321 (_x.timestamp, _x.timestamp_local, _x.online,) = _struct_2dB.unpack(str[start:end]) 322 val1.online = bool(val1.online) 323 start = end 324 end += 4 325 (length,) = _struct_I.unpack(str[start:end]) 326 start = end 327 end += length 328 if python3: 329 val1.discoverer_name = str[start:end].decode('utf-8') 330 else: 331 val1.discoverer_name = str[start:end] 332 start = end 333 end += 4 334 (length,) = _struct_I.unpack(str[start:end]) 335 start = end 336 end += length 337 if python3: 338 val1.monitoruri = str[start:end].decode('utf-8') 339 else: 340 val1.monitoruri = str[start:end] 341 self.masters.append(val1) 342 return self 343 except struct.error as e: 344 raise genpy.DeserializationError(e) #most likely buffer underfill
345 346 _struct_I = genpy.struct_I 347 _struct_2dB = struct.Struct("<2dB")
348 -class DiscoverMasters(object):
349 _type = 'master_discovery_fkie/DiscoverMasters' 350 _md5sum = 'bc7525cc24dd3b880f044a2cdfb95aad' 351 _request_class = DiscoverMastersRequest 352 _response_class = DiscoverMastersResponse
353