_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(se)
00083     except TypeError as te: self._check_types(te)
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       if python3:
00103         self.header.dest = str[start:end].decode('utf-8')
00104       else:
00105         self.header.dest = str[start:end]
00106       _x = self
00107       start = end
00108       end += 2
00109       (_x.header.priority, _x.header.deadline,) = _struct_2B.unpack(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.header.sub_topic = str[start:end].decode('utf-8')
00117       else:
00118         self.header.sub_topic = str[start:end]
00119       start = end
00120       end += 1
00121       (self.hola,) = _struct_b.unpack(str[start:end])
00122       return self
00123     except struct.error as e:
00124       raise genpy.DeserializationError(e) #most likely buffer underfill
00125 
00126 
00127   def serialize_numpy(self, buff, numpy):
00128     """
00129     serialize message with numpy array types into buffer
00130     :param buff: buffer, ``StringIO``
00131     :param numpy: numpy python module
00132     """
00133     try:
00134       buff.write(_struct_B.pack(self.header.source))
00135       _x = self.header.dest
00136       length = len(_x)
00137       # - if encoded as a list instead, serialize as bytes instead of string
00138       if type(_x) in [list, tuple]:
00139         buff.write(struct.pack('<I%sB'%length, length, *_x))
00140       else:
00141         buff.write(struct.pack('<I%ss'%length, length, _x))
00142       _x = self
00143       buff.write(_struct_2B.pack(_x.header.priority, _x.header.deadline))
00144       _x = self.header.sub_topic
00145       length = len(_x)
00146       if python3 or type(_x) == unicode:
00147         _x = _x.encode('utf-8')
00148         length = len(_x)
00149       buff.write(struct.pack('<I%ss'%length, length, _x))
00150       buff.write(_struct_b.pack(self.hola))
00151     except struct.error as se: self._check_types(se)
00152     except TypeError as te: self._check_types(te)
00153 
00154   def deserialize_numpy(self, str, numpy):
00155     """
00156     unpack serialized message in str into this message instance using numpy for array types
00157     :param str: byte array of serialized message, ``str``
00158     :param numpy: numpy python module
00159     """
00160     try:
00161       if self.header is None:
00162         self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00163       end = 0
00164       start = end
00165       end += 1
00166       (self.header.source,) = _struct_B.unpack(str[start:end])
00167       start = end
00168       end += 4
00169       (length,) = _struct_I.unpack(str[start:end])
00170       start = end
00171       end += length
00172       if python3:
00173         self.header.dest = str[start:end].decode('utf-8')
00174       else:
00175         self.header.dest = str[start:end]
00176       _x = self
00177       start = end
00178       end += 2
00179       (_x.header.priority, _x.header.deadline,) = _struct_2B.unpack(str[start:end])
00180       start = end
00181       end += 4
00182       (length,) = _struct_I.unpack(str[start:end])
00183       start = end
00184       end += length
00185       if python3:
00186         self.header.sub_topic = str[start:end].decode('utf-8')
00187       else:
00188         self.header.sub_topic = str[start:end]
00189       start = end
00190       end += 1
00191       (self.hola,) = _struct_b.unpack(str[start:end])
00192       return self
00193     except struct.error as e:
00194       raise genpy.DeserializationError(e) #most likely buffer underfill
00195 
00196 _struct_I = genpy.struct_I
00197 _struct_B = struct.Struct("<B")
00198 _struct_b = struct.Struct("<b")
00199 _struct_2B = struct.Struct("<2B")


ros_rt_wmp_msgs
Author(s): Pablo Urcola
autogenerated on Fri Jan 3 2014 12:07:44