_WMPTest.py
Go to the documentation of this file.
00001 """autogenerated by genpy from ros_rt_wmp_msgs/WMPTest.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 ros_rt_wmp_msgs.msg
00008 
00009 class WMPTest(genpy.Message):
00010   _md5sum = "8b537da7043fb94b678a9fe8aacd2ff8"
00011   _type = "ros_rt_wmp_msgs/WMPTest"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """WMPHeader header
00014 int8 hola
00015 ================================================================================
00016 MSG: ros_rt_wmp_msgs/WMPHeader
00017 uint8 source
00018 uint8[] dest
00019 uint8 priority
00020 uint8 deadline
00021 string sub_topic
00022 
00023 
00024 """
00025   __slots__ = ['header','hola']
00026   _slot_types = ['ros_rt_wmp_msgs/WMPHeader','int8']
00027 
00028   def __init__(self, *args, **kwds):
00029     """
00030     Constructor. Any message fields that are implicitly/explicitly
00031     set to None will be assigned a default value. The recommend
00032     use is keyword arguments as this is more robust to future message
00033     changes.  You cannot mix in-order arguments and keyword arguments.
00034 
00035     The available fields are:
00036        header,hola
00037 
00038     :param args: complete set of field values, in .msg order
00039     :param kwds: use keyword arguments corresponding to message field names
00040     to set specific fields.
00041     """
00042     if args or kwds:
00043       super(WMPTest, self).__init__(*args, **kwds)
00044       #message fields cannot be None, assign default values for those that are
00045       if self.header is None:
00046         self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00047       if self.hola is None:
00048         self.hola = 0
00049     else:
00050       self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00051       self.hola = 0
00052 
00053   def _get_types(self):
00054     """
00055     internal API method
00056     """
00057     return self._slot_types
00058 
00059   def serialize(self, buff):
00060     """
00061     serialize message into buffer
00062     :param buff: buffer, ``StringIO``
00063     """
00064     try:
00065       buff.write(_struct_B.pack(self.header.source))
00066       _x = self.header.dest
00067       length = len(_x)
00068       # - if encoded as a list instead, serialize as bytes instead of string
00069       if type(_x) in [list, tuple]:
00070         buff.write(struct.pack('<I%sB'%length, length, *_x))
00071       else:
00072         buff.write(struct.pack('<I%ss'%length, length, _x))
00073       _x = self
00074       buff.write(_struct_2B.pack(_x.header.priority, _x.header.deadline))
00075       _x = self.header.sub_topic
00076       length = len(_x)
00077       if python3 or type(_x) == unicode:
00078         _x = _x.encode('utf-8')
00079         length = len(_x)
00080       buff.write(struct.pack('<I%ss'%length, length, _x))
00081       buff.write(_struct_b.pack(self.hola))
00082     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00083     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00084 
00085   def deserialize(self, str):
00086     """
00087     unpack serialized message in str into this message instance
00088     :param str: byte array of serialized message, ``str``
00089     """
00090     try:
00091       if self.header is None:
00092         self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00093       end = 0
00094       start = end
00095       end += 1
00096       (self.header.source,) = _struct_B.unpack(str[start:end])
00097       start = end
00098       end += 4
00099       (length,) = _struct_I.unpack(str[start:end])
00100       start = end
00101       end += length
00102       self.header.dest = str[start:end]
00103       _x = self
00104       start = end
00105       end += 2
00106       (_x.header.priority, _x.header.deadline,) = _struct_2B.unpack(str[start:end])
00107       start = end
00108       end += 4
00109       (length,) = _struct_I.unpack(str[start:end])
00110       start = end
00111       end += length
00112       if python3:
00113         self.header.sub_topic = str[start:end].decode('utf-8')
00114       else:
00115         self.header.sub_topic = str[start:end]
00116       start = end
00117       end += 1
00118       (self.hola,) = _struct_b.unpack(str[start:end])
00119       return self
00120     except struct.error as e:
00121       raise genpy.DeserializationError(e) #most likely buffer underfill
00122 
00123 
00124   def serialize_numpy(self, buff, numpy):
00125     """
00126     serialize message with numpy array types into buffer
00127     :param buff: buffer, ``StringIO``
00128     :param numpy: numpy python module
00129     """
00130     try:
00131       buff.write(_struct_B.pack(self.header.source))
00132       _x = self.header.dest
00133       length = len(_x)
00134       # - if encoded as a list instead, serialize as bytes instead of string
00135       if type(_x) in [list, tuple]:
00136         buff.write(struct.pack('<I%sB'%length, length, *_x))
00137       else:
00138         buff.write(struct.pack('<I%ss'%length, length, _x))
00139       _x = self
00140       buff.write(_struct_2B.pack(_x.header.priority, _x.header.deadline))
00141       _x = self.header.sub_topic
00142       length = len(_x)
00143       if python3 or type(_x) == unicode:
00144         _x = _x.encode('utf-8')
00145         length = len(_x)
00146       buff.write(struct.pack('<I%ss'%length, length, _x))
00147       buff.write(_struct_b.pack(self.hola))
00148     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00149     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00150 
00151   def deserialize_numpy(self, str, numpy):
00152     """
00153     unpack serialized message in str into this message instance using numpy for array types
00154     :param str: byte array of serialized message, ``str``
00155     :param numpy: numpy python module
00156     """
00157     try:
00158       if self.header is None:
00159         self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00160       end = 0
00161       start = end
00162       end += 1
00163       (self.header.source,) = _struct_B.unpack(str[start:end])
00164       start = end
00165       end += 4
00166       (length,) = _struct_I.unpack(str[start:end])
00167       start = end
00168       end += length
00169       self.header.dest = str[start:end]
00170       _x = self
00171       start = end
00172       end += 2
00173       (_x.header.priority, _x.header.deadline,) = _struct_2B.unpack(str[start:end])
00174       start = end
00175       end += 4
00176       (length,) = _struct_I.unpack(str[start:end])
00177       start = end
00178       end += length
00179       if python3:
00180         self.header.sub_topic = str[start:end].decode('utf-8')
00181       else:
00182         self.header.sub_topic = str[start:end]
00183       start = end
00184       end += 1
00185       (self.hola,) = _struct_b.unpack(str[start:end])
00186       return self
00187     except struct.error as e:
00188       raise genpy.DeserializationError(e) #most likely buffer underfill
00189 
00190 _struct_I = genpy.struct_I
00191 _struct_B = struct.Struct("<B")
00192 _struct_b = struct.Struct("<b")
00193 _struct_2B = struct.Struct("<2B")


ros_rt_wmp_msgs
Author(s): Pablo Urcola
autogenerated on Mon Oct 6 2014 08:26:58