_PublishedService.py
Go to the documentation of this file.
00001 """autogenerated by genpy from zeroconf_comms/PublishedService.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 PublishedService(genpy.Message):
00009   _md5sum = "a1b00555a59ffeb95091f591a6ba849a"
00010   _type = "zeroconf_comms/PublishedService"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """#
00013 # Provides all the properties required for publishing of a zeroconf service.
00014 
00015 string name
00016 string type
00017 string domain
00018 int32 port
00019 string description
00020 
00021 """
00022   __slots__ = ['name','type','domain','port','description']
00023   _slot_types = ['string','string','string','int32','string']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        name,type,domain,port,description
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(PublishedService, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.name is None:
00043         self.name = ''
00044       if self.type is None:
00045         self.type = ''
00046       if self.domain is None:
00047         self.domain = ''
00048       if self.port is None:
00049         self.port = 0
00050       if self.description is None:
00051         self.description = ''
00052     else:
00053       self.name = ''
00054       self.type = ''
00055       self.domain = ''
00056       self.port = 0
00057       self.description = ''
00058 
00059   def _get_types(self):
00060     """
00061     internal API method
00062     """
00063     return self._slot_types
00064 
00065   def serialize(self, buff):
00066     """
00067     serialize message into buffer
00068     :param buff: buffer, ``StringIO``
00069     """
00070     try:
00071       _x = self.name
00072       length = len(_x)
00073       if python3 or type(_x) == unicode:
00074         _x = _x.encode('utf-8')
00075         length = len(_x)
00076       buff.write(struct.pack('<I%ss'%length, length, _x))
00077       _x = self.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 = self.domain
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       buff.write(_struct_i.pack(self.port))
00090       _x = self.description
00091       length = len(_x)
00092       if python3 or type(_x) == unicode:
00093         _x = _x.encode('utf-8')
00094         length = len(_x)
00095       buff.write(struct.pack('<I%ss'%length, length, _x))
00096     except struct.error as se: self._check_types(se)
00097     except TypeError as te: self._check_types(te)
00098 
00099   def deserialize(self, str):
00100     """
00101     unpack serialized message in str into this message instance
00102     :param str: byte array of serialized message, ``str``
00103     """
00104     try:
00105       end = 0
00106       start = end
00107       end += 4
00108       (length,) = _struct_I.unpack(str[start:end])
00109       start = end
00110       end += length
00111       if python3:
00112         self.name = str[start:end].decode('utf-8')
00113       else:
00114         self.name = str[start:end]
00115       start = end
00116       end += 4
00117       (length,) = _struct_I.unpack(str[start:end])
00118       start = end
00119       end += length
00120       if python3:
00121         self.type = str[start:end].decode('utf-8')
00122       else:
00123         self.type = str[start:end]
00124       start = end
00125       end += 4
00126       (length,) = _struct_I.unpack(str[start:end])
00127       start = end
00128       end += length
00129       if python3:
00130         self.domain = str[start:end].decode('utf-8')
00131       else:
00132         self.domain = str[start:end]
00133       start = end
00134       end += 4
00135       (self.port,) = _struct_i.unpack(str[start:end])
00136       start = end
00137       end += 4
00138       (length,) = _struct_I.unpack(str[start:end])
00139       start = end
00140       end += length
00141       if python3:
00142         self.description = str[start:end].decode('utf-8')
00143       else:
00144         self.description = str[start:end]
00145       return self
00146     except struct.error as e:
00147       raise genpy.DeserializationError(e) #most likely buffer underfill
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       _x = self.name
00158       length = len(_x)
00159       if python3 or type(_x) == unicode:
00160         _x = _x.encode('utf-8')
00161         length = len(_x)
00162       buff.write(struct.pack('<I%ss'%length, length, _x))
00163       _x = self.type
00164       length = len(_x)
00165       if python3 or type(_x) == unicode:
00166         _x = _x.encode('utf-8')
00167         length = len(_x)
00168       buff.write(struct.pack('<I%ss'%length, length, _x))
00169       _x = self.domain
00170       length = len(_x)
00171       if python3 or type(_x) == unicode:
00172         _x = _x.encode('utf-8')
00173         length = len(_x)
00174       buff.write(struct.pack('<I%ss'%length, length, _x))
00175       buff.write(_struct_i.pack(self.port))
00176       _x = self.description
00177       length = len(_x)
00178       if python3 or type(_x) == unicode:
00179         _x = _x.encode('utf-8')
00180         length = len(_x)
00181       buff.write(struct.pack('<I%ss'%length, length, _x))
00182     except struct.error as se: self._check_types(se)
00183     except TypeError as te: self._check_types(te)
00184 
00185   def deserialize_numpy(self, str, numpy):
00186     """
00187     unpack serialized message in str into this message instance using numpy for array types
00188     :param str: byte array of serialized message, ``str``
00189     :param numpy: numpy python module
00190     """
00191     try:
00192       end = 0
00193       start = end
00194       end += 4
00195       (length,) = _struct_I.unpack(str[start:end])
00196       start = end
00197       end += length
00198       if python3:
00199         self.name = str[start:end].decode('utf-8')
00200       else:
00201         self.name = str[start:end]
00202       start = end
00203       end += 4
00204       (length,) = _struct_I.unpack(str[start:end])
00205       start = end
00206       end += length
00207       if python3:
00208         self.type = str[start:end].decode('utf-8')
00209       else:
00210         self.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         self.domain = str[start:end].decode('utf-8')
00218       else:
00219         self.domain = str[start:end]
00220       start = end
00221       end += 4
00222       (self.port,) = _struct_i.unpack(str[start:end])
00223       start = end
00224       end += 4
00225       (length,) = _struct_I.unpack(str[start:end])
00226       start = end
00227       end += length
00228       if python3:
00229         self.description = str[start:end].decode('utf-8')
00230       else:
00231         self.description = str[start:end]
00232       return self
00233     except struct.error as e:
00234       raise genpy.DeserializationError(e) #most likely buffer underfill
00235 
00236 _struct_I = genpy.struct_I
00237 _struct_i = struct.Struct("<i")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends


zeroconf_comms
Author(s): Daniel Stonier
autogenerated on Tue Nov 13 2012 23:48:04