00001 """autogenerated by genpy from gateway_comms/AdvertiseRequest.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import gateway_comms.msg
00008
00009 class AdvertiseRequest(genpy.Message):
00010 _md5sum = "85ef604243258e1594c5a7401f5e0339"
00011 _type = "gateway_comms/AdvertiseRequest"
00012 _has_header = False
00013 _full_text = """
00014 bool cancel
00015 Rule[] rules
00016
00017
00018 ================================================================================
00019 MSG: gateway_comms/Rule
00020 # Standard gateway connection rule
00021
00022 # type of connection (from gateway_comms.msg.Connection)
00023 string type
00024
00025 # this is the topic/service name or the action base name (a regex is supported)
00026 string name
00027
00028 # (optional) an optional node name can be provided. if node name is not provided
00029 # then all nodes are matched (also supports regex)
00030 string node
00031
00032 """
00033 __slots__ = ['cancel','rules']
00034 _slot_types = ['bool','gateway_comms/Rule[]']
00035
00036 def __init__(self, *args, **kwds):
00037 """
00038 Constructor. Any message fields that are implicitly/explicitly
00039 set to None will be assigned a default value. The recommend
00040 use is keyword arguments as this is more robust to future message
00041 changes. You cannot mix in-order arguments and keyword arguments.
00042
00043 The available fields are:
00044 cancel,rules
00045
00046 :param args: complete set of field values, in .msg order
00047 :param kwds: use keyword arguments corresponding to message field names
00048 to set specific fields.
00049 """
00050 if args or kwds:
00051 super(AdvertiseRequest, self).__init__(*args, **kwds)
00052
00053 if self.cancel is None:
00054 self.cancel = False
00055 if self.rules is None:
00056 self.rules = []
00057 else:
00058 self.cancel = False
00059 self.rules = []
00060
00061 def _get_types(self):
00062 """
00063 internal API method
00064 """
00065 return self._slot_types
00066
00067 def serialize(self, buff):
00068 """
00069 serialize message into buffer
00070 :param buff: buffer, ``StringIO``
00071 """
00072 try:
00073 buff.write(_struct_B.pack(self.cancel))
00074 length = len(self.rules)
00075 buff.write(_struct_I.pack(length))
00076 for val1 in self.rules:
00077 _x = val1.type
00078 length = len(_x)
00079 if python3 or type(_x) == unicode:
00080 _x = _x.encode('utf-8')
00081 length = len(_x)
00082 buff.write(struct.pack('<I%ss'%length, length, _x))
00083 _x = val1.name
00084 length = len(_x)
00085 if python3 or type(_x) == unicode:
00086 _x = _x.encode('utf-8')
00087 length = len(_x)
00088 buff.write(struct.pack('<I%ss'%length, length, _x))
00089 _x = val1.node
00090 length = len(_x)
00091 if python3 or type(_x) == unicode:
00092 _x = _x.encode('utf-8')
00093 length = len(_x)
00094 buff.write(struct.pack('<I%ss'%length, length, _x))
00095 except struct.error as se: self._check_types(se)
00096 except TypeError as te: self._check_types(te)
00097
00098 def deserialize(self, str):
00099 """
00100 unpack serialized message in str into this message instance
00101 :param str: byte array of serialized message, ``str``
00102 """
00103 try:
00104 if self.rules is None:
00105 self.rules = None
00106 end = 0
00107 start = end
00108 end += 1
00109 (self.cancel,) = _struct_B.unpack(str[start:end])
00110 self.cancel = bool(self.cancel)
00111 start = end
00112 end += 4
00113 (length,) = _struct_I.unpack(str[start:end])
00114 self.rules = []
00115 for i in range(0, length):
00116 val1 = gateway_comms.msg.Rule()
00117 start = end
00118 end += 4
00119 (length,) = _struct_I.unpack(str[start:end])
00120 start = end
00121 end += length
00122 if python3:
00123 val1.type = str[start:end].decode('utf-8')
00124 else:
00125 val1.type = str[start:end]
00126 start = end
00127 end += 4
00128 (length,) = _struct_I.unpack(str[start:end])
00129 start = end
00130 end += length
00131 if python3:
00132 val1.name = str[start:end].decode('utf-8')
00133 else:
00134 val1.name = str[start:end]
00135 start = end
00136 end += 4
00137 (length,) = _struct_I.unpack(str[start:end])
00138 start = end
00139 end += length
00140 if python3:
00141 val1.node = str[start:end].decode('utf-8')
00142 else:
00143 val1.node = str[start:end]
00144 self.rules.append(val1)
00145 return self
00146 except struct.error as e:
00147 raise genpy.DeserializationError(e)
00148
00149
00150 def serialize_numpy(self, buff, numpy):
00151 """
00152 serialize message with numpy array types into buffer
00153 :param buff: buffer, ``StringIO``
00154 :param numpy: numpy python module
00155 """
00156 try:
00157 buff.write(_struct_B.pack(self.cancel))
00158 length = len(self.rules)
00159 buff.write(_struct_I.pack(length))
00160 for val1 in self.rules:
00161 _x = val1.type
00162 length = len(_x)
00163 if python3 or type(_x) == unicode:
00164 _x = _x.encode('utf-8')
00165 length = len(_x)
00166 buff.write(struct.pack('<I%ss'%length, length, _x))
00167 _x = val1.name
00168 length = len(_x)
00169 if python3 or type(_x) == unicode:
00170 _x = _x.encode('utf-8')
00171 length = len(_x)
00172 buff.write(struct.pack('<I%ss'%length, length, _x))
00173 _x = val1.node
00174 length = len(_x)
00175 if python3 or type(_x) == unicode:
00176 _x = _x.encode('utf-8')
00177 length = len(_x)
00178 buff.write(struct.pack('<I%ss'%length, length, _x))
00179 except struct.error as se: self._check_types(se)
00180 except TypeError as te: self._check_types(te)
00181
00182 def deserialize_numpy(self, str, numpy):
00183 """
00184 unpack serialized message in str into this message instance using numpy for array types
00185 :param str: byte array of serialized message, ``str``
00186 :param numpy: numpy python module
00187 """
00188 try:
00189 if self.rules is None:
00190 self.rules = None
00191 end = 0
00192 start = end
00193 end += 1
00194 (self.cancel,) = _struct_B.unpack(str[start:end])
00195 self.cancel = bool(self.cancel)
00196 start = end
00197 end += 4
00198 (length,) = _struct_I.unpack(str[start:end])
00199 self.rules = []
00200 for i in range(0, length):
00201 val1 = gateway_comms.msg.Rule()
00202 start = end
00203 end += 4
00204 (length,) = _struct_I.unpack(str[start:end])
00205 start = end
00206 end += length
00207 if python3:
00208 val1.type = str[start:end].decode('utf-8')
00209 else:
00210 val1.type = str[start:end]
00211 start = end
00212 end += 4
00213 (length,) = _struct_I.unpack(str[start:end])
00214 start = end
00215 end += length
00216 if python3:
00217 val1.name = str[start:end].decode('utf-8')
00218 else:
00219 val1.name = str[start:end]
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 start = end
00224 end += length
00225 if python3:
00226 val1.node = str[start:end].decode('utf-8')
00227 else:
00228 val1.node = str[start:end]
00229 self.rules.append(val1)
00230 return self
00231 except struct.error as e:
00232 raise genpy.DeserializationError(e)
00233
00234 _struct_I = genpy.struct_I
00235 _struct_B = struct.Struct("<B")
00236 """autogenerated by genpy from gateway_comms/AdvertiseResponse.msg. Do not edit."""
00237 import sys
00238 python3 = True if sys.hexversion > 0x03000000 else False
00239 import genpy
00240 import struct
00241
00242 import gateway_comms.msg
00243
00244 class AdvertiseResponse(genpy.Message):
00245 _md5sum = "c389af2721ca403446acba93862aff4f"
00246 _type = "gateway_comms/AdvertiseResponse"
00247 _has_header = False
00248 _full_text = """
00249
00250
00251 int8 result
00252 string error_message
00253
00254 Rule[] watchlist
00255
00256
00257 ================================================================================
00258 MSG: gateway_comms/Rule
00259 # Standard gateway connection rule
00260
00261 # type of connection (from gateway_comms.msg.Connection)
00262 string type
00263
00264 # this is the topic/service name or the action base name (a regex is supported)
00265 string name
00266
00267 # (optional) an optional node name can be provided. if node name is not provided
00268 # then all nodes are matched (also supports regex)
00269 string node
00270
00271 """
00272 __slots__ = ['result','error_message','watchlist']
00273 _slot_types = ['int8','string','gateway_comms/Rule[]']
00274
00275 def __init__(self, *args, **kwds):
00276 """
00277 Constructor. Any message fields that are implicitly/explicitly
00278 set to None will be assigned a default value. The recommend
00279 use is keyword arguments as this is more robust to future message
00280 changes. You cannot mix in-order arguments and keyword arguments.
00281
00282 The available fields are:
00283 result,error_message,watchlist
00284
00285 :param args: complete set of field values, in .msg order
00286 :param kwds: use keyword arguments corresponding to message field names
00287 to set specific fields.
00288 """
00289 if args or kwds:
00290 super(AdvertiseResponse, self).__init__(*args, **kwds)
00291
00292 if self.result is None:
00293 self.result = 0
00294 if self.error_message is None:
00295 self.error_message = ''
00296 if self.watchlist is None:
00297 self.watchlist = []
00298 else:
00299 self.result = 0
00300 self.error_message = ''
00301 self.watchlist = []
00302
00303 def _get_types(self):
00304 """
00305 internal API method
00306 """
00307 return self._slot_types
00308
00309 def serialize(self, buff):
00310 """
00311 serialize message into buffer
00312 :param buff: buffer, ``StringIO``
00313 """
00314 try:
00315 buff.write(_struct_b.pack(self.result))
00316 _x = self.error_message
00317 length = len(_x)
00318 if python3 or type(_x) == unicode:
00319 _x = _x.encode('utf-8')
00320 length = len(_x)
00321 buff.write(struct.pack('<I%ss'%length, length, _x))
00322 length = len(self.watchlist)
00323 buff.write(_struct_I.pack(length))
00324 for val1 in self.watchlist:
00325 _x = val1.type
00326 length = len(_x)
00327 if python3 or type(_x) == unicode:
00328 _x = _x.encode('utf-8')
00329 length = len(_x)
00330 buff.write(struct.pack('<I%ss'%length, length, _x))
00331 _x = val1.name
00332 length = len(_x)
00333 if python3 or type(_x) == unicode:
00334 _x = _x.encode('utf-8')
00335 length = len(_x)
00336 buff.write(struct.pack('<I%ss'%length, length, _x))
00337 _x = val1.node
00338 length = len(_x)
00339 if python3 or type(_x) == unicode:
00340 _x = _x.encode('utf-8')
00341 length = len(_x)
00342 buff.write(struct.pack('<I%ss'%length, length, _x))
00343 except struct.error as se: self._check_types(se)
00344 except TypeError as te: self._check_types(te)
00345
00346 def deserialize(self, str):
00347 """
00348 unpack serialized message in str into this message instance
00349 :param str: byte array of serialized message, ``str``
00350 """
00351 try:
00352 if self.watchlist is None:
00353 self.watchlist = None
00354 end = 0
00355 start = end
00356 end += 1
00357 (self.result,) = _struct_b.unpack(str[start:end])
00358 start = end
00359 end += 4
00360 (length,) = _struct_I.unpack(str[start:end])
00361 start = end
00362 end += length
00363 if python3:
00364 self.error_message = str[start:end].decode('utf-8')
00365 else:
00366 self.error_message = str[start:end]
00367 start = end
00368 end += 4
00369 (length,) = _struct_I.unpack(str[start:end])
00370 self.watchlist = []
00371 for i in range(0, length):
00372 val1 = gateway_comms.msg.Rule()
00373 start = end
00374 end += 4
00375 (length,) = _struct_I.unpack(str[start:end])
00376 start = end
00377 end += length
00378 if python3:
00379 val1.type = str[start:end].decode('utf-8')
00380 else:
00381 val1.type = str[start:end]
00382 start = end
00383 end += 4
00384 (length,) = _struct_I.unpack(str[start:end])
00385 start = end
00386 end += length
00387 if python3:
00388 val1.name = str[start:end].decode('utf-8')
00389 else:
00390 val1.name = str[start:end]
00391 start = end
00392 end += 4
00393 (length,) = _struct_I.unpack(str[start:end])
00394 start = end
00395 end += length
00396 if python3:
00397 val1.node = str[start:end].decode('utf-8')
00398 else:
00399 val1.node = str[start:end]
00400 self.watchlist.append(val1)
00401 return self
00402 except struct.error as e:
00403 raise genpy.DeserializationError(e)
00404
00405
00406 def serialize_numpy(self, buff, numpy):
00407 """
00408 serialize message with numpy array types into buffer
00409 :param buff: buffer, ``StringIO``
00410 :param numpy: numpy python module
00411 """
00412 try:
00413 buff.write(_struct_b.pack(self.result))
00414 _x = self.error_message
00415 length = len(_x)
00416 if python3 or type(_x) == unicode:
00417 _x = _x.encode('utf-8')
00418 length = len(_x)
00419 buff.write(struct.pack('<I%ss'%length, length, _x))
00420 length = len(self.watchlist)
00421 buff.write(_struct_I.pack(length))
00422 for val1 in self.watchlist:
00423 _x = val1.type
00424 length = len(_x)
00425 if python3 or type(_x) == unicode:
00426 _x = _x.encode('utf-8')
00427 length = len(_x)
00428 buff.write(struct.pack('<I%ss'%length, length, _x))
00429 _x = val1.name
00430 length = len(_x)
00431 if python3 or type(_x) == unicode:
00432 _x = _x.encode('utf-8')
00433 length = len(_x)
00434 buff.write(struct.pack('<I%ss'%length, length, _x))
00435 _x = val1.node
00436 length = len(_x)
00437 if python3 or type(_x) == unicode:
00438 _x = _x.encode('utf-8')
00439 length = len(_x)
00440 buff.write(struct.pack('<I%ss'%length, length, _x))
00441 except struct.error as se: self._check_types(se)
00442 except TypeError as te: self._check_types(te)
00443
00444 def deserialize_numpy(self, str, numpy):
00445 """
00446 unpack serialized message in str into this message instance using numpy for array types
00447 :param str: byte array of serialized message, ``str``
00448 :param numpy: numpy python module
00449 """
00450 try:
00451 if self.watchlist is None:
00452 self.watchlist = None
00453 end = 0
00454 start = end
00455 end += 1
00456 (self.result,) = _struct_b.unpack(str[start:end])
00457 start = end
00458 end += 4
00459 (length,) = _struct_I.unpack(str[start:end])
00460 start = end
00461 end += length
00462 if python3:
00463 self.error_message = str[start:end].decode('utf-8')
00464 else:
00465 self.error_message = str[start:end]
00466 start = end
00467 end += 4
00468 (length,) = _struct_I.unpack(str[start:end])
00469 self.watchlist = []
00470 for i in range(0, length):
00471 val1 = gateway_comms.msg.Rule()
00472 start = end
00473 end += 4
00474 (length,) = _struct_I.unpack(str[start:end])
00475 start = end
00476 end += length
00477 if python3:
00478 val1.type = str[start:end].decode('utf-8')
00479 else:
00480 val1.type = str[start:end]
00481 start = end
00482 end += 4
00483 (length,) = _struct_I.unpack(str[start:end])
00484 start = end
00485 end += length
00486 if python3:
00487 val1.name = str[start:end].decode('utf-8')
00488 else:
00489 val1.name = str[start:end]
00490 start = end
00491 end += 4
00492 (length,) = _struct_I.unpack(str[start:end])
00493 start = end
00494 end += length
00495 if python3:
00496 val1.node = str[start:end].decode('utf-8')
00497 else:
00498 val1.node = str[start:end]
00499 self.watchlist.append(val1)
00500 return self
00501 except struct.error as e:
00502 raise genpy.DeserializationError(e)
00503
00504 _struct_I = genpy.struct_I
00505 _struct_b = struct.Struct("<b")
00506 class Advertise(object):
00507 _type = 'gateway_comms/Advertise'
00508 _md5sum = '394a2b6787bc0694573ae81a1842f14b'
00509 _request_class = AdvertiseRequest
00510 _response_class = AdvertiseResponse