00001 """autogenerated by genpy from zeroconf_msgs/DiscoveredService.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class DiscoveredService(genpy.Message):
00009 _md5sum = "3aabc6dd9875ef180c75536ad9a51d86"
00010 _type = "zeroconf_msgs/DiscoveredService"
00011 _has_header = False
00012 _full_text = """#
00013 # Provides all the properties required for definition of a discovered
00014 # zeroconf service. Note that it contains rather alot more information
00015 # than that which is used to publish a zeroconf service.
00016
00017 # Service Part
00018 string name
00019 string type
00020 string domain
00021 string description
00022
00023 # Resolved part
00024 string hostname
00025 string[] ipv4_addresses
00026 string[] ipv6_addresses
00027 int32 port
00028
00029 # These are detailed variables that you should not normally need
00030 # and can be safely ignored in most circumstances (currently used
00031 # by the avahi implementation).
00032
00033 uint32 cookie
00034 bool is_local
00035 bool our_own
00036 bool wide_area
00037 bool multicast
00038 bool cached
00039
00040
00041 """
00042 __slots__ = ['name','type','domain','description','hostname','ipv4_addresses','ipv6_addresses','port','cookie','is_local','our_own','wide_area','multicast','cached']
00043 _slot_types = ['string','string','string','string','string','string[]','string[]','int32','uint32','bool','bool','bool','bool','bool']
00044
00045 def __init__(self, *args, **kwds):
00046 """
00047 Constructor. Any message fields that are implicitly/explicitly
00048 set to None will be assigned a default value. The recommend
00049 use is keyword arguments as this is more robust to future message
00050 changes. You cannot mix in-order arguments and keyword arguments.
00051
00052 The available fields are:
00053 name,type,domain,description,hostname,ipv4_addresses,ipv6_addresses,port,cookie,is_local,our_own,wide_area,multicast,cached
00054
00055 :param args: complete set of field values, in .msg order
00056 :param kwds: use keyword arguments corresponding to message field names
00057 to set specific fields.
00058 """
00059 if args or kwds:
00060 super(DiscoveredService, self).__init__(*args, **kwds)
00061
00062 if self.name is None:
00063 self.name = ''
00064 if self.type is None:
00065 self.type = ''
00066 if self.domain is None:
00067 self.domain = ''
00068 if self.description is None:
00069 self.description = ''
00070 if self.hostname is None:
00071 self.hostname = ''
00072 if self.ipv4_addresses is None:
00073 self.ipv4_addresses = []
00074 if self.ipv6_addresses is None:
00075 self.ipv6_addresses = []
00076 if self.port is None:
00077 self.port = 0
00078 if self.cookie is None:
00079 self.cookie = 0
00080 if self.is_local is None:
00081 self.is_local = False
00082 if self.our_own is None:
00083 self.our_own = False
00084 if self.wide_area is None:
00085 self.wide_area = False
00086 if self.multicast is None:
00087 self.multicast = False
00088 if self.cached is None:
00089 self.cached = False
00090 else:
00091 self.name = ''
00092 self.type = ''
00093 self.domain = ''
00094 self.description = ''
00095 self.hostname = ''
00096 self.ipv4_addresses = []
00097 self.ipv6_addresses = []
00098 self.port = 0
00099 self.cookie = 0
00100 self.is_local = False
00101 self.our_own = False
00102 self.wide_area = False
00103 self.multicast = False
00104 self.cached = False
00105
00106 def _get_types(self):
00107 """
00108 internal API method
00109 """
00110 return self._slot_types
00111
00112 def serialize(self, buff):
00113 """
00114 serialize message into buffer
00115 :param buff: buffer, ``StringIO``
00116 """
00117 try:
00118 _x = self.name
00119 length = len(_x)
00120 if python3 or type(_x) == unicode:
00121 _x = _x.encode('utf-8')
00122 length = len(_x)
00123 buff.write(struct.pack('<I%ss'%length, length, _x))
00124 _x = self.type
00125 length = len(_x)
00126 if python3 or type(_x) == unicode:
00127 _x = _x.encode('utf-8')
00128 length = len(_x)
00129 buff.write(struct.pack('<I%ss'%length, length, _x))
00130 _x = self.domain
00131 length = len(_x)
00132 if python3 or type(_x) == unicode:
00133 _x = _x.encode('utf-8')
00134 length = len(_x)
00135 buff.write(struct.pack('<I%ss'%length, length, _x))
00136 _x = self.description
00137 length = len(_x)
00138 if python3 or type(_x) == unicode:
00139 _x = _x.encode('utf-8')
00140 length = len(_x)
00141 buff.write(struct.pack('<I%ss'%length, length, _x))
00142 _x = self.hostname
00143 length = len(_x)
00144 if python3 or type(_x) == unicode:
00145 _x = _x.encode('utf-8')
00146 length = len(_x)
00147 buff.write(struct.pack('<I%ss'%length, length, _x))
00148 length = len(self.ipv4_addresses)
00149 buff.write(_struct_I.pack(length))
00150 for val1 in self.ipv4_addresses:
00151 length = len(val1)
00152 if python3 or type(val1) == unicode:
00153 val1 = val1.encode('utf-8')
00154 length = len(val1)
00155 buff.write(struct.pack('<I%ss'%length, length, val1))
00156 length = len(self.ipv6_addresses)
00157 buff.write(_struct_I.pack(length))
00158 for val1 in self.ipv6_addresses:
00159 length = len(val1)
00160 if python3 or type(val1) == unicode:
00161 val1 = val1.encode('utf-8')
00162 length = len(val1)
00163 buff.write(struct.pack('<I%ss'%length, length, val1))
00164 _x = self
00165 buff.write(_struct_iI5B.pack(_x.port, _x.cookie, _x.is_local, _x.our_own, _x.wide_area, _x.multicast, _x.cached))
00166 except struct.error as se: self._check_types(se)
00167 except TypeError as te: self._check_types(te)
00168
00169 def deserialize(self, str):
00170 """
00171 unpack serialized message in str into this message instance
00172 :param str: byte array of serialized message, ``str``
00173 """
00174 try:
00175 end = 0
00176 start = end
00177 end += 4
00178 (length,) = _struct_I.unpack(str[start:end])
00179 start = end
00180 end += length
00181 if python3:
00182 self.name = str[start:end].decode('utf-8')
00183 else:
00184 self.name = str[start:end]
00185 start = end
00186 end += 4
00187 (length,) = _struct_I.unpack(str[start:end])
00188 start = end
00189 end += length
00190 if python3:
00191 self.type = str[start:end].decode('utf-8')
00192 else:
00193 self.type = str[start:end]
00194 start = end
00195 end += 4
00196 (length,) = _struct_I.unpack(str[start:end])
00197 start = end
00198 end += length
00199 if python3:
00200 self.domain = str[start:end].decode('utf-8')
00201 else:
00202 self.domain = str[start:end]
00203 start = end
00204 end += 4
00205 (length,) = _struct_I.unpack(str[start:end])
00206 start = end
00207 end += length
00208 if python3:
00209 self.description = str[start:end].decode('utf-8')
00210 else:
00211 self.description = str[start:end]
00212 start = end
00213 end += 4
00214 (length,) = _struct_I.unpack(str[start:end])
00215 start = end
00216 end += length
00217 if python3:
00218 self.hostname = str[start:end].decode('utf-8')
00219 else:
00220 self.hostname = str[start:end]
00221 start = end
00222 end += 4
00223 (length,) = _struct_I.unpack(str[start:end])
00224 self.ipv4_addresses = []
00225 for i in range(0, length):
00226 start = end
00227 end += 4
00228 (length,) = _struct_I.unpack(str[start:end])
00229 start = end
00230 end += length
00231 if python3:
00232 val1 = str[start:end].decode('utf-8')
00233 else:
00234 val1 = str[start:end]
00235 self.ipv4_addresses.append(val1)
00236 start = end
00237 end += 4
00238 (length,) = _struct_I.unpack(str[start:end])
00239 self.ipv6_addresses = []
00240 for i in range(0, length):
00241 start = end
00242 end += 4
00243 (length,) = _struct_I.unpack(str[start:end])
00244 start = end
00245 end += length
00246 if python3:
00247 val1 = str[start:end].decode('utf-8')
00248 else:
00249 val1 = str[start:end]
00250 self.ipv6_addresses.append(val1)
00251 _x = self
00252 start = end
00253 end += 13
00254 (_x.port, _x.cookie, _x.is_local, _x.our_own, _x.wide_area, _x.multicast, _x.cached,) = _struct_iI5B.unpack(str[start:end])
00255 self.is_local = bool(self.is_local)
00256 self.our_own = bool(self.our_own)
00257 self.wide_area = bool(self.wide_area)
00258 self.multicast = bool(self.multicast)
00259 self.cached = bool(self.cached)
00260 return self
00261 except struct.error as e:
00262 raise genpy.DeserializationError(e)
00263
00264
00265 def serialize_numpy(self, buff, numpy):
00266 """
00267 serialize message with numpy array types into buffer
00268 :param buff: buffer, ``StringIO``
00269 :param numpy: numpy python module
00270 """
00271 try:
00272 _x = self.name
00273 length = len(_x)
00274 if python3 or type(_x) == unicode:
00275 _x = _x.encode('utf-8')
00276 length = len(_x)
00277 buff.write(struct.pack('<I%ss'%length, length, _x))
00278 _x = self.type
00279 length = len(_x)
00280 if python3 or type(_x) == unicode:
00281 _x = _x.encode('utf-8')
00282 length = len(_x)
00283 buff.write(struct.pack('<I%ss'%length, length, _x))
00284 _x = self.domain
00285 length = len(_x)
00286 if python3 or type(_x) == unicode:
00287 _x = _x.encode('utf-8')
00288 length = len(_x)
00289 buff.write(struct.pack('<I%ss'%length, length, _x))
00290 _x = self.description
00291 length = len(_x)
00292 if python3 or type(_x) == unicode:
00293 _x = _x.encode('utf-8')
00294 length = len(_x)
00295 buff.write(struct.pack('<I%ss'%length, length, _x))
00296 _x = self.hostname
00297 length = len(_x)
00298 if python3 or type(_x) == unicode:
00299 _x = _x.encode('utf-8')
00300 length = len(_x)
00301 buff.write(struct.pack('<I%ss'%length, length, _x))
00302 length = len(self.ipv4_addresses)
00303 buff.write(_struct_I.pack(length))
00304 for val1 in self.ipv4_addresses:
00305 length = len(val1)
00306 if python3 or type(val1) == unicode:
00307 val1 = val1.encode('utf-8')
00308 length = len(val1)
00309 buff.write(struct.pack('<I%ss'%length, length, val1))
00310 length = len(self.ipv6_addresses)
00311 buff.write(_struct_I.pack(length))
00312 for val1 in self.ipv6_addresses:
00313 length = len(val1)
00314 if python3 or type(val1) == unicode:
00315 val1 = val1.encode('utf-8')
00316 length = len(val1)
00317 buff.write(struct.pack('<I%ss'%length, length, val1))
00318 _x = self
00319 buff.write(_struct_iI5B.pack(_x.port, _x.cookie, _x.is_local, _x.our_own, _x.wide_area, _x.multicast, _x.cached))
00320 except struct.error as se: self._check_types(se)
00321 except TypeError as te: self._check_types(te)
00322
00323 def deserialize_numpy(self, str, numpy):
00324 """
00325 unpack serialized message in str into this message instance using numpy for array types
00326 :param str: byte array of serialized message, ``str``
00327 :param numpy: numpy python module
00328 """
00329 try:
00330 end = 0
00331 start = end
00332 end += 4
00333 (length,) = _struct_I.unpack(str[start:end])
00334 start = end
00335 end += length
00336 if python3:
00337 self.name = str[start:end].decode('utf-8')
00338 else:
00339 self.name = str[start:end]
00340 start = end
00341 end += 4
00342 (length,) = _struct_I.unpack(str[start:end])
00343 start = end
00344 end += length
00345 if python3:
00346 self.type = str[start:end].decode('utf-8')
00347 else:
00348 self.type = str[start:end]
00349 start = end
00350 end += 4
00351 (length,) = _struct_I.unpack(str[start:end])
00352 start = end
00353 end += length
00354 if python3:
00355 self.domain = str[start:end].decode('utf-8')
00356 else:
00357 self.domain = 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.description = str[start:end].decode('utf-8')
00365 else:
00366 self.description = str[start:end]
00367 start = end
00368 end += 4
00369 (length,) = _struct_I.unpack(str[start:end])
00370 start = end
00371 end += length
00372 if python3:
00373 self.hostname = str[start:end].decode('utf-8')
00374 else:
00375 self.hostname = str[start:end]
00376 start = end
00377 end += 4
00378 (length,) = _struct_I.unpack(str[start:end])
00379 self.ipv4_addresses = []
00380 for i in range(0, length):
00381 start = end
00382 end += 4
00383 (length,) = _struct_I.unpack(str[start:end])
00384 start = end
00385 end += length
00386 if python3:
00387 val1 = str[start:end].decode('utf-8')
00388 else:
00389 val1 = str[start:end]
00390 self.ipv4_addresses.append(val1)
00391 start = end
00392 end += 4
00393 (length,) = _struct_I.unpack(str[start:end])
00394 self.ipv6_addresses = []
00395 for i in range(0, length):
00396 start = end
00397 end += 4
00398 (length,) = _struct_I.unpack(str[start:end])
00399 start = end
00400 end += length
00401 if python3:
00402 val1 = str[start:end].decode('utf-8')
00403 else:
00404 val1 = str[start:end]
00405 self.ipv6_addresses.append(val1)
00406 _x = self
00407 start = end
00408 end += 13
00409 (_x.port, _x.cookie, _x.is_local, _x.our_own, _x.wide_area, _x.multicast, _x.cached,) = _struct_iI5B.unpack(str[start:end])
00410 self.is_local = bool(self.is_local)
00411 self.our_own = bool(self.our_own)
00412 self.wide_area = bool(self.wide_area)
00413 self.multicast = bool(self.multicast)
00414 self.cached = bool(self.cached)
00415 return self
00416 except struct.error as e:
00417 raise genpy.DeserializationError(e)
00418
00419 _struct_I = genpy.struct_I
00420 _struct_iI5B = struct.Struct("<iI5B")