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