_AddService.py
Go to the documentation of this file.
00001 """autogenerated by genpy from zeroconf_comms/AddServiceRequest.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 zeroconf_comms.msg
00008 
00009 class AddServiceRequest(genpy.Message):
00010   _md5sum = "7028a4a43349f6cca86209ddd39f607a"
00011   _type = "zeroconf_comms/AddServiceRequest"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """zeroconf_comms/PublishedService service
00014 
00015 ================================================================================
00016 MSG: zeroconf_comms/PublishedService
00017 #
00018 # Provides all the properties required for publishing of a zeroconf service.
00019 
00020 string name
00021 string type
00022 string domain
00023 int32 port
00024 string description
00025 
00026 """
00027   __slots__ = ['service']
00028   _slot_types = ['zeroconf_comms/PublishedService']
00029 
00030   def __init__(self, *args, **kwds):
00031     """
00032     Constructor. Any message fields that are implicitly/explicitly
00033     set to None will be assigned a default value. The recommend
00034     use is keyword arguments as this is more robust to future message
00035     changes.  You cannot mix in-order arguments and keyword arguments.
00036 
00037     The available fields are:
00038        service
00039 
00040     :param args: complete set of field values, in .msg order
00041     :param kwds: use keyword arguments corresponding to message field names
00042     to set specific fields.
00043     """
00044     if args or kwds:
00045       super(AddServiceRequest, self).__init__(*args, **kwds)
00046       #message fields cannot be None, assign default values for those that are
00047       if self.service is None:
00048         self.service = zeroconf_comms.msg.PublishedService()
00049     else:
00050       self.service = zeroconf_comms.msg.PublishedService()
00051 
00052   def _get_types(self):
00053     """
00054     internal API method
00055     """
00056     return self._slot_types
00057 
00058   def serialize(self, buff):
00059     """
00060     serialize message into buffer
00061     :param buff: buffer, ``StringIO``
00062     """
00063     try:
00064       _x = self.service.name
00065       length = len(_x)
00066       if python3 or type(_x) == unicode:
00067         _x = _x.encode('utf-8')
00068         length = len(_x)
00069       buff.write(struct.pack('<I%ss'%length, length, _x))
00070       _x = self.service.type
00071       length = len(_x)
00072       if python3 or type(_x) == unicode:
00073         _x = _x.encode('utf-8')
00074         length = len(_x)
00075       buff.write(struct.pack('<I%ss'%length, length, _x))
00076       _x = self.service.domain
00077       length = len(_x)
00078       if python3 or type(_x) == unicode:
00079         _x = _x.encode('utf-8')
00080         length = len(_x)
00081       buff.write(struct.pack('<I%ss'%length, length, _x))
00082       buff.write(_struct_i.pack(self.service.port))
00083       _x = self.service.description
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     except struct.error as se: self._check_types(se)
00090     except TypeError as te: self._check_types(te)
00091 
00092   def deserialize(self, str):
00093     """
00094     unpack serialized message in str into this message instance
00095     :param str: byte array of serialized message, ``str``
00096     """
00097     try:
00098       if self.service is None:
00099         self.service = zeroconf_comms.msg.PublishedService()
00100       end = 0
00101       start = end
00102       end += 4
00103       (length,) = _struct_I.unpack(str[start:end])
00104       start = end
00105       end += length
00106       if python3:
00107         self.service.name = str[start:end].decode('utf-8')
00108       else:
00109         self.service.name = str[start:end]
00110       start = end
00111       end += 4
00112       (length,) = _struct_I.unpack(str[start:end])
00113       start = end
00114       end += length
00115       if python3:
00116         self.service.type = str[start:end].decode('utf-8')
00117       else:
00118         self.service.type = str[start:end]
00119       start = end
00120       end += 4
00121       (length,) = _struct_I.unpack(str[start:end])
00122       start = end
00123       end += length
00124       if python3:
00125         self.service.domain = str[start:end].decode('utf-8')
00126       else:
00127         self.service.domain = str[start:end]
00128       start = end
00129       end += 4
00130       (self.service.port,) = _struct_i.unpack(str[start:end])
00131       start = end
00132       end += 4
00133       (length,) = _struct_I.unpack(str[start:end])
00134       start = end
00135       end += length
00136       if python3:
00137         self.service.description = str[start:end].decode('utf-8')
00138       else:
00139         self.service.description = str[start:end]
00140       return self
00141     except struct.error as e:
00142       raise genpy.DeserializationError(e) #most likely buffer underfill
00143 
00144 
00145   def serialize_numpy(self, buff, numpy):
00146     """
00147     serialize message with numpy array types into buffer
00148     :param buff: buffer, ``StringIO``
00149     :param numpy: numpy python module
00150     """
00151     try:
00152       _x = self.service.name
00153       length = len(_x)
00154       if python3 or type(_x) == unicode:
00155         _x = _x.encode('utf-8')
00156         length = len(_x)
00157       buff.write(struct.pack('<I%ss'%length, length, _x))
00158       _x = self.service.type
00159       length = len(_x)
00160       if python3 or type(_x) == unicode:
00161         _x = _x.encode('utf-8')
00162         length = len(_x)
00163       buff.write(struct.pack('<I%ss'%length, length, _x))
00164       _x = self.service.domain
00165       length = len(_x)
00166       if python3 or type(_x) == unicode:
00167         _x = _x.encode('utf-8')
00168         length = len(_x)
00169       buff.write(struct.pack('<I%ss'%length, length, _x))
00170       buff.write(_struct_i.pack(self.service.port))
00171       _x = self.service.description
00172       length = len(_x)
00173       if python3 or type(_x) == unicode:
00174         _x = _x.encode('utf-8')
00175         length = len(_x)
00176       buff.write(struct.pack('<I%ss'%length, length, _x))
00177     except struct.error as se: self._check_types(se)
00178     except TypeError as te: self._check_types(te)
00179 
00180   def deserialize_numpy(self, str, numpy):
00181     """
00182     unpack serialized message in str into this message instance using numpy for array types
00183     :param str: byte array of serialized message, ``str``
00184     :param numpy: numpy python module
00185     """
00186     try:
00187       if self.service is None:
00188         self.service = zeroconf_comms.msg.PublishedService()
00189       end = 0
00190       start = end
00191       end += 4
00192       (length,) = _struct_I.unpack(str[start:end])
00193       start = end
00194       end += length
00195       if python3:
00196         self.service.name = str[start:end].decode('utf-8')
00197       else:
00198         self.service.name = str[start:end]
00199       start = end
00200       end += 4
00201       (length,) = _struct_I.unpack(str[start:end])
00202       start = end
00203       end += length
00204       if python3:
00205         self.service.type = str[start:end].decode('utf-8')
00206       else:
00207         self.service.type = str[start:end]
00208       start = end
00209       end += 4
00210       (length,) = _struct_I.unpack(str[start:end])
00211       start = end
00212       end += length
00213       if python3:
00214         self.service.domain = str[start:end].decode('utf-8')
00215       else:
00216         self.service.domain = str[start:end]
00217       start = end
00218       end += 4
00219       (self.service.port,) = _struct_i.unpack(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         self.service.description = str[start:end].decode('utf-8')
00227       else:
00228         self.service.description = str[start:end]
00229       return self
00230     except struct.error as e:
00231       raise genpy.DeserializationError(e) #most likely buffer underfill
00232 
00233 _struct_I = genpy.struct_I
00234 _struct_i = struct.Struct("<i")
00235 """autogenerated by genpy from zeroconf_comms/AddServiceResponse.msg. Do not edit."""
00236 import sys
00237 python3 = True if sys.hexversion > 0x03000000 else False
00238 import genpy
00239 import struct
00240 
00241 
00242 class AddServiceResponse(genpy.Message):
00243   _md5sum = "eb13ac1f1354ccecb7941ee8fa2192e8"
00244   _type = "zeroconf_comms/AddServiceResponse"
00245   _has_header = False #flag to mark the presence of a Header object
00246   _full_text = """bool result
00247 
00248 """
00249   __slots__ = ['result']
00250   _slot_types = ['bool']
00251 
00252   def __init__(self, *args, **kwds):
00253     """
00254     Constructor. Any message fields that are implicitly/explicitly
00255     set to None will be assigned a default value. The recommend
00256     use is keyword arguments as this is more robust to future message
00257     changes.  You cannot mix in-order arguments and keyword arguments.
00258 
00259     The available fields are:
00260        result
00261 
00262     :param args: complete set of field values, in .msg order
00263     :param kwds: use keyword arguments corresponding to message field names
00264     to set specific fields.
00265     """
00266     if args or kwds:
00267       super(AddServiceResponse, self).__init__(*args, **kwds)
00268       #message fields cannot be None, assign default values for those that are
00269       if self.result is None:
00270         self.result = False
00271     else:
00272       self.result = False
00273 
00274   def _get_types(self):
00275     """
00276     internal API method
00277     """
00278     return self._slot_types
00279 
00280   def serialize(self, buff):
00281     """
00282     serialize message into buffer
00283     :param buff: buffer, ``StringIO``
00284     """
00285     try:
00286       buff.write(_struct_B.pack(self.result))
00287     except struct.error as se: self._check_types(se)
00288     except TypeError as te: self._check_types(te)
00289 
00290   def deserialize(self, str):
00291     """
00292     unpack serialized message in str into this message instance
00293     :param str: byte array of serialized message, ``str``
00294     """
00295     try:
00296       end = 0
00297       start = end
00298       end += 1
00299       (self.result,) = _struct_B.unpack(str[start:end])
00300       self.result = bool(self.result)
00301       return self
00302     except struct.error as e:
00303       raise genpy.DeserializationError(e) #most likely buffer underfill
00304 
00305 
00306   def serialize_numpy(self, buff, numpy):
00307     """
00308     serialize message with numpy array types into buffer
00309     :param buff: buffer, ``StringIO``
00310     :param numpy: numpy python module
00311     """
00312     try:
00313       buff.write(_struct_B.pack(self.result))
00314     except struct.error as se: self._check_types(se)
00315     except TypeError as te: self._check_types(te)
00316 
00317   def deserialize_numpy(self, str, numpy):
00318     """
00319     unpack serialized message in str into this message instance using numpy for array types
00320     :param str: byte array of serialized message, ``str``
00321     :param numpy: numpy python module
00322     """
00323     try:
00324       end = 0
00325       start = end
00326       end += 1
00327       (self.result,) = _struct_B.unpack(str[start:end])
00328       self.result = bool(self.result)
00329       return self
00330     except struct.error as e:
00331       raise genpy.DeserializationError(e) #most likely buffer underfill
00332 
00333 _struct_I = genpy.struct_I
00334 _struct_B = struct.Struct("<B")
00335 class AddService(object):
00336   _type          = 'zeroconf_comms/AddService'
00337   _md5sum = '2ae0e420b2f58ab49b813cd81e42d4b3'
00338   _request_class  = AddServiceRequest
00339   _response_class = AddServiceResponse
 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