00001 """autogenerated by genpy from ros_rt_wmp_msgs/WMPMessage.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 WMPMessage(genpy.Message):
00010 _md5sum = "fa7fd663ecc1e6348e06454a200ecbe3"
00011 _type = "ros_rt_wmp_msgs/WMPMessage"
00012 _has_header = False
00013 _full_text = """WMPHeader header
00014 uint8[] data
00015
00016
00017 ================================================================================
00018 MSG: ros_rt_wmp_msgs/WMPHeader
00019 uint8 source
00020 uint8[] dest
00021 uint8 priority
00022 uint8 deadline
00023 string sub_topic
00024
00025
00026 """
00027 __slots__ = ['header','data']
00028 _slot_types = ['ros_rt_wmp_msgs/WMPHeader','uint8[]']
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 header,data
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(WMPMessage, self).__init__(*args, **kwds)
00046
00047 if self.header is None:
00048 self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00049 if self.data is None:
00050 self.data = ''
00051 else:
00052 self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00053 self.data = ''
00054
00055 def _get_types(self):
00056 """
00057 internal API method
00058 """
00059 return self._slot_types
00060
00061 def serialize(self, buff):
00062 """
00063 serialize message into buffer
00064 :param buff: buffer, ``StringIO``
00065 """
00066 try:
00067 buff.write(_struct_B.pack(self.header.source))
00068 _x = self.header.dest
00069 length = len(_x)
00070
00071 if type(_x) in [list, tuple]:
00072 buff.write(struct.pack('<I%sB'%length, length, *_x))
00073 else:
00074 buff.write(struct.pack('<I%ss'%length, length, _x))
00075 _x = self
00076 buff.write(_struct_2B.pack(_x.header.priority, _x.header.deadline))
00077 _x = self.header.sub_topic
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.data
00084 length = len(_x)
00085
00086 if type(_x) in [list, tuple]:
00087 buff.write(struct.pack('<I%sB'%length, length, *_x))
00088 else:
00089 buff.write(struct.pack('<I%ss'%length, length, _x))
00090 except struct.error as se: self._check_types(se)
00091 except TypeError as te: self._check_types(te)
00092
00093 def deserialize(self, str):
00094 """
00095 unpack serialized message in str into this message instance
00096 :param str: byte array of serialized message, ``str``
00097 """
00098 try:
00099 if self.header is None:
00100 self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00101 end = 0
00102 start = end
00103 end += 1
00104 (self.header.source,) = _struct_B.unpack(str[start:end])
00105 start = end
00106 end += 4
00107 (length,) = _struct_I.unpack(str[start:end])
00108 start = end
00109 end += length
00110 if python3:
00111 self.header.dest = str[start:end].decode('utf-8')
00112 else:
00113 self.header.dest = str[start:end]
00114 _x = self
00115 start = end
00116 end += 2
00117 (_x.header.priority, _x.header.deadline,) = _struct_2B.unpack(str[start:end])
00118 start = end
00119 end += 4
00120 (length,) = _struct_I.unpack(str[start:end])
00121 start = end
00122 end += length
00123 if python3:
00124 self.header.sub_topic = str[start:end].decode('utf-8')
00125 else:
00126 self.header.sub_topic = str[start:end]
00127 start = end
00128 end += 4
00129 (length,) = _struct_I.unpack(str[start:end])
00130 start = end
00131 end += length
00132 if python3:
00133 self.data = str[start:end].decode('utf-8')
00134 else:
00135 self.data = str[start:end]
00136 return self
00137 except struct.error as e:
00138 raise genpy.DeserializationError(e)
00139
00140
00141 def serialize_numpy(self, buff, numpy):
00142 """
00143 serialize message with numpy array types into buffer
00144 :param buff: buffer, ``StringIO``
00145 :param numpy: numpy python module
00146 """
00147 try:
00148 buff.write(_struct_B.pack(self.header.source))
00149 _x = self.header.dest
00150 length = len(_x)
00151
00152 if type(_x) in [list, tuple]:
00153 buff.write(struct.pack('<I%sB'%length, length, *_x))
00154 else:
00155 buff.write(struct.pack('<I%ss'%length, length, _x))
00156 _x = self
00157 buff.write(_struct_2B.pack(_x.header.priority, _x.header.deadline))
00158 _x = self.header.sub_topic
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.data
00165 length = len(_x)
00166
00167 if type(_x) in [list, tuple]:
00168 buff.write(struct.pack('<I%sB'%length, length, *_x))
00169 else:
00170 buff.write(struct.pack('<I%ss'%length, length, _x))
00171 except struct.error as se: self._check_types(se)
00172 except TypeError as te: self._check_types(te)
00173
00174 def deserialize_numpy(self, str, numpy):
00175 """
00176 unpack serialized message in str into this message instance using numpy for array types
00177 :param str: byte array of serialized message, ``str``
00178 :param numpy: numpy python module
00179 """
00180 try:
00181 if self.header is None:
00182 self.header = ros_rt_wmp_msgs.msg.WMPHeader()
00183 end = 0
00184 start = end
00185 end += 1
00186 (self.header.source,) = _struct_B.unpack(str[start:end])
00187 start = end
00188 end += 4
00189 (length,) = _struct_I.unpack(str[start:end])
00190 start = end
00191 end += length
00192 if python3:
00193 self.header.dest = str[start:end].decode('utf-8')
00194 else:
00195 self.header.dest = str[start:end]
00196 _x = self
00197 start = end
00198 end += 2
00199 (_x.header.priority, _x.header.deadline,) = _struct_2B.unpack(str[start:end])
00200 start = end
00201 end += 4
00202 (length,) = _struct_I.unpack(str[start:end])
00203 start = end
00204 end += length
00205 if python3:
00206 self.header.sub_topic = str[start:end].decode('utf-8')
00207 else:
00208 self.header.sub_topic = str[start:end]
00209 start = end
00210 end += 4
00211 (length,) = _struct_I.unpack(str[start:end])
00212 start = end
00213 end += length
00214 if python3:
00215 self.data = str[start:end].decode('utf-8')
00216 else:
00217 self.data = str[start:end]
00218 return self
00219 except struct.error as e:
00220 raise genpy.DeserializationError(e)
00221
00222 _struct_I = genpy.struct_I
00223 _struct_B = struct.Struct("<B")
00224 _struct_2B = struct.Struct("<2B")