00001 """autogenerated by genpy from roomba_500_series/Song.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 roomba_500_series.msg
00008 import std_msgs.msg
00009
00010 class Song(genpy.Message):
00011 _md5sum = "2a8e64bdbdd926225694c88b701e505f"
00012 _type = "roomba_500_series/Song"
00013 _has_header = True
00014 _full_text = """Header header
00015 uint8 song_number
00016 Note[] notes
00017
00018 ================================================================================
00019 MSG: std_msgs/Header
00020 # Standard metadata for higher-level stamped data types.
00021 # This is generally used to communicate timestamped data
00022 # in a particular coordinate frame.
00023 #
00024 # sequence ID: consecutively increasing ID
00025 uint32 seq
00026 #Two-integer timestamp that is expressed as:
00027 # * stamp.secs: seconds (stamp_secs) since epoch
00028 # * stamp.nsecs: nanoseconds since stamp_secs
00029 # time-handling sugar is provided by the client library
00030 time stamp
00031 #Frame this data is associated with
00032 # 0: no frame
00033 # 1: global frame
00034 string frame_id
00035
00036 ================================================================================
00037 MSG: roomba_500_series/Note
00038 uint8 note
00039 uint8 length
00040
00041 """
00042 __slots__ = ['header','song_number','notes']
00043 _slot_types = ['std_msgs/Header','uint8','roomba_500_series/Note[]']
00044
00045 def __init__(self, *args, **kwds):
00046 """
00047 Constructor. Any message fields that are implicitly/explicitly
00048 set to None will be assigned a default value. The recommend
00049 use is keyword arguments as this is more robust to future message
00050 changes. You cannot mix in-order arguments and keyword arguments.
00051
00052 The available fields are:
00053 header,song_number,notes
00054
00055 :param args: complete set of field values, in .msg order
00056 :param kwds: use keyword arguments corresponding to message field names
00057 to set specific fields.
00058 """
00059 if args or kwds:
00060 super(Song, self).__init__(*args, **kwds)
00061
00062 if self.header is None:
00063 self.header = std_msgs.msg.Header()
00064 if self.song_number is None:
00065 self.song_number = 0
00066 if self.notes is None:
00067 self.notes = []
00068 else:
00069 self.header = std_msgs.msg.Header()
00070 self.song_number = 0
00071 self.notes = []
00072
00073 def _get_types(self):
00074 """
00075 internal API method
00076 """
00077 return self._slot_types
00078
00079 def serialize(self, buff):
00080 """
00081 serialize message into buffer
00082 :param buff: buffer, ``StringIO``
00083 """
00084 try:
00085 _x = self
00086 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00087 _x = self.header.frame_id
00088 length = len(_x)
00089 if python3 or type(_x) == unicode:
00090 _x = _x.encode('utf-8')
00091 length = len(_x)
00092 buff.write(struct.pack('<I%ss'%length, length, _x))
00093 buff.write(_struct_B.pack(self.song_number))
00094 length = len(self.notes)
00095 buff.write(_struct_I.pack(length))
00096 for val1 in self.notes:
00097 _x = val1
00098 buff.write(_struct_2B.pack(_x.note, _x.length))
00099 except struct.error as se: self._check_types(se)
00100 except TypeError as te: self._check_types(te)
00101
00102 def deserialize(self, str):
00103 """
00104 unpack serialized message in str into this message instance
00105 :param str: byte array of serialized message, ``str``
00106 """
00107 try:
00108 if self.header is None:
00109 self.header = std_msgs.msg.Header()
00110 if self.notes is None:
00111 self.notes = None
00112 end = 0
00113 _x = self
00114 start = end
00115 end += 12
00116 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00117 start = end
00118 end += 4
00119 (length,) = _struct_I.unpack(str[start:end])
00120 start = end
00121 end += length
00122 if python3:
00123 self.header.frame_id = str[start:end].decode('utf-8')
00124 else:
00125 self.header.frame_id = str[start:end]
00126 start = end
00127 end += 1
00128 (self.song_number,) = _struct_B.unpack(str[start:end])
00129 start = end
00130 end += 4
00131 (length,) = _struct_I.unpack(str[start:end])
00132 self.notes = []
00133 for i in range(0, length):
00134 val1 = roomba_500_series.msg.Note()
00135 _x = val1
00136 start = end
00137 end += 2
00138 (_x.note, _x.length,) = _struct_2B.unpack(str[start:end])
00139 self.notes.append(val1)
00140 return self
00141 except struct.error as e:
00142 raise genpy.DeserializationError(e)
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
00153 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00154 _x = self.header.frame_id
00155 length = len(_x)
00156 if python3 or type(_x) == unicode:
00157 _x = _x.encode('utf-8')
00158 length = len(_x)
00159 buff.write(struct.pack('<I%ss'%length, length, _x))
00160 buff.write(_struct_B.pack(self.song_number))
00161 length = len(self.notes)
00162 buff.write(_struct_I.pack(length))
00163 for val1 in self.notes:
00164 _x = val1
00165 buff.write(_struct_2B.pack(_x.note, _x.length))
00166 except struct.error as se: self._check_types(se)
00167 except TypeError as te: self._check_types(te)
00168
00169 def deserialize_numpy(self, str, numpy):
00170 """
00171 unpack serialized message in str into this message instance using numpy for array types
00172 :param str: byte array of serialized message, ``str``
00173 :param numpy: numpy python module
00174 """
00175 try:
00176 if self.header is None:
00177 self.header = std_msgs.msg.Header()
00178 if self.notes is None:
00179 self.notes = None
00180 end = 0
00181 _x = self
00182 start = end
00183 end += 12
00184 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00185 start = end
00186 end += 4
00187 (length,) = _struct_I.unpack(str[start:end])
00188 start = end
00189 end += length
00190 if python3:
00191 self.header.frame_id = str[start:end].decode('utf-8')
00192 else:
00193 self.header.frame_id = str[start:end]
00194 start = end
00195 end += 1
00196 (self.song_number,) = _struct_B.unpack(str[start:end])
00197 start = end
00198 end += 4
00199 (length,) = _struct_I.unpack(str[start:end])
00200 self.notes = []
00201 for i in range(0, length):
00202 val1 = roomba_500_series.msg.Note()
00203 _x = val1
00204 start = end
00205 end += 2
00206 (_x.note, _x.length,) = _struct_2B.unpack(str[start:end])
00207 self.notes.append(val1)
00208 return self
00209 except struct.error as e:
00210 raise genpy.DeserializationError(e)
00211
00212 _struct_I = genpy.struct_I
00213 _struct_3I = struct.Struct("<3I")
00214 _struct_B = struct.Struct("<B")
00215 _struct_2B = struct.Struct("<2B")