Go to the documentation of this file.00001 """autogenerated by genpy from sound_play/SoundRequest.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class SoundRequest(genpy.Message):
00009 _md5sum = "f194e75f1c3bf7a3e1e8b16bc9ef7c2a"
00010 _type = "sound_play/SoundRequest"
00011 _has_header = False
00012 _full_text = """# IMPORTANT: You should never have to generate this message yourself.
00013 # Use the sound_play::SoundClient C++ helper or the
00014 # sound_play.libsoundplay.SoundClient Python helper.
00015
00016 # Sounds
00017 int8 BACKINGUP = 1
00018 int8 NEEDS_UNPLUGGING = 2
00019 int8 NEEDS_PLUGGING = 3
00020 int8 NEEDS_UNPLUGGING_BADLY = 4
00021 int8 NEEDS_PLUGGING_BADLY = 5
00022
00023 # Sound identifiers that have special meaning
00024 int8 ALL = -1 # Only legal with PLAY_STOP
00025 int8 PLAY_FILE = -2
00026 int8 SAY = -3
00027
00028 int8 sound # Selects which sound to play (see above)
00029
00030 # Commands
00031 int8 PLAY_STOP = 0 # Stop this sound from playing
00032 int8 PLAY_ONCE = 1 # Play the sound once
00033 int8 PLAY_START = 2 # Play the sound in a loop until a stop request occurs
00034
00035 int8 command # Indicates what to do with the sound
00036
00037 string arg # file name or text to say
00038 string arg2 # other arguments
00039
00040 """
00041
00042 BACKINGUP = 1
00043 NEEDS_UNPLUGGING = 2
00044 NEEDS_PLUGGING = 3
00045 NEEDS_UNPLUGGING_BADLY = 4
00046 NEEDS_PLUGGING_BADLY = 5
00047 ALL = -1
00048 PLAY_FILE = -2
00049 SAY = -3
00050 PLAY_STOP = 0
00051 PLAY_ONCE = 1
00052 PLAY_START = 2
00053
00054 __slots__ = ['sound','command','arg','arg2']
00055 _slot_types = ['int8','int8','string','string']
00056
00057 def __init__(self, *args, **kwds):
00058 """
00059 Constructor. Any message fields that are implicitly/explicitly
00060 set to None will be assigned a default value. The recommend
00061 use is keyword arguments as this is more robust to future message
00062 changes. You cannot mix in-order arguments and keyword arguments.
00063
00064 The available fields are:
00065 sound,command,arg,arg2
00066
00067 :param args: complete set of field values, in .msg order
00068 :param kwds: use keyword arguments corresponding to message field names
00069 to set specific fields.
00070 """
00071 if args or kwds:
00072 super(SoundRequest, self).__init__(*args, **kwds)
00073
00074 if self.sound is None:
00075 self.sound = 0
00076 if self.command is None:
00077 self.command = 0
00078 if self.arg is None:
00079 self.arg = ''
00080 if self.arg2 is None:
00081 self.arg2 = ''
00082 else:
00083 self.sound = 0
00084 self.command = 0
00085 self.arg = ''
00086 self.arg2 = ''
00087
00088 def _get_types(self):
00089 """
00090 internal API method
00091 """
00092 return self._slot_types
00093
00094 def serialize(self, buff):
00095 """
00096 serialize message into buffer
00097 :param buff: buffer, ``StringIO``
00098 """
00099 try:
00100 _x = self
00101 buff.write(_struct_2b.pack(_x.sound, _x.command))
00102 _x = self.arg
00103 length = len(_x)
00104 if python3 or type(_x) == unicode:
00105 _x = _x.encode('utf-8')
00106 length = len(_x)
00107 buff.write(struct.pack('<I%ss'%length, length, _x))
00108 _x = self.arg2
00109 length = len(_x)
00110 if python3 or type(_x) == unicode:
00111 _x = _x.encode('utf-8')
00112 length = len(_x)
00113 buff.write(struct.pack('<I%ss'%length, length, _x))
00114 except struct.error as se: self._check_types(se)
00115 except TypeError as te: self._check_types(te)
00116
00117 def deserialize(self, str):
00118 """
00119 unpack serialized message in str into this message instance
00120 :param str: byte array of serialized message, ``str``
00121 """
00122 try:
00123 end = 0
00124 _x = self
00125 start = end
00126 end += 2
00127 (_x.sound, _x.command,) = _struct_2b.unpack(str[start:end])
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 if python3:
00134 self.arg = str[start:end].decode('utf-8')
00135 else:
00136 self.arg = str[start:end]
00137 start = end
00138 end += 4
00139 (length,) = _struct_I.unpack(str[start:end])
00140 start = end
00141 end += length
00142 if python3:
00143 self.arg2 = str[start:end].decode('utf-8')
00144 else:
00145 self.arg2 = str[start:end]
00146 return self
00147 except struct.error as e:
00148 raise genpy.DeserializationError(e)
00149
00150
00151 def serialize_numpy(self, buff, numpy):
00152 """
00153 serialize message with numpy array types into buffer
00154 :param buff: buffer, ``StringIO``
00155 :param numpy: numpy python module
00156 """
00157 try:
00158 _x = self
00159 buff.write(_struct_2b.pack(_x.sound, _x.command))
00160 _x = self.arg
00161 length = len(_x)
00162 if python3 or type(_x) == unicode:
00163 _x = _x.encode('utf-8')
00164 length = len(_x)
00165 buff.write(struct.pack('<I%ss'%length, length, _x))
00166 _x = self.arg2
00167 length = len(_x)
00168 if python3 or type(_x) == unicode:
00169 _x = _x.encode('utf-8')
00170 length = len(_x)
00171 buff.write(struct.pack('<I%ss'%length, length, _x))
00172 except struct.error as se: self._check_types(se)
00173 except TypeError as te: self._check_types(te)
00174
00175 def deserialize_numpy(self, str, numpy):
00176 """
00177 unpack serialized message in str into this message instance using numpy for array types
00178 :param str: byte array of serialized message, ``str``
00179 :param numpy: numpy python module
00180 """
00181 try:
00182 end = 0
00183 _x = self
00184 start = end
00185 end += 2
00186 (_x.sound, _x.command,) = _struct_2b.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.arg = str[start:end].decode('utf-8')
00194 else:
00195 self.arg = str[start:end]
00196 start = end
00197 end += 4
00198 (length,) = _struct_I.unpack(str[start:end])
00199 start = end
00200 end += length
00201 if python3:
00202 self.arg2 = str[start:end].decode('utf-8')
00203 else:
00204 self.arg2 = str[start:end]
00205 return self
00206 except struct.error as e:
00207 raise genpy.DeserializationError(e)
00208
00209 _struct_I = genpy.struct_I
00210 _struct_2b = struct.Struct("<2b")