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 = "9cfd61778f9f82824e2604bc63ee8104"
00008 _type = "sound_play/SoundRequest"
00009 _has_header = False
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
00037 """
00038
00039 BACKINGUP = 1
00040 NEEDS_UNPLUGGING = 2
00041 NEEDS_PLUGGING = 3
00042 NEEDS_UNPLUGGING_BADLY = 4
00043 NEEDS_PLUGGING_BADLY = 5
00044 ALL = -1
00045 PLAY_FILE = -2
00046 SAY = -3
00047 PLAY_STOP = 0
00048 PLAY_ONCE = 1
00049 PLAY_START = 2
00050
00051 __slots__ = ['sound','command','arg']
00052 _slot_types = ['int8','int8','string']
00053
00054 def __init__(self, *args, **kwds):
00055 """
00056 Constructor. Any message fields that are implicitly/explicitly
00057 set to None will be assigned a default value. The recommend
00058 use is keyword arguments as this is more robust to future message
00059 changes. You cannot mix in-order arguments and keyword arguments.
00060
00061 The available fields are:
00062 sound,command,arg
00063
00064 @param args: complete set of field values, in .msg order
00065 @param kwds: use keyword arguments corresponding to message field names
00066 to set specific fields.
00067 """
00068 if args or kwds:
00069 super(SoundRequest, self).__init__(*args, **kwds)
00070
00071 if self.sound is None:
00072 self.sound = 0
00073 if self.command is None:
00074 self.command = 0
00075 if self.arg is None:
00076 self.arg = ''
00077 else:
00078 self.sound = 0
00079 self.command = 0
00080 self.arg = ''
00081
00082 def _get_types(self):
00083 """
00084 internal API method
00085 """
00086 return self._slot_types
00087
00088 def serialize(self, buff):
00089 """
00090 serialize message into buffer
00091 @param buff: buffer
00092 @type buff: StringIO
00093 """
00094 try:
00095 _x = self
00096 buff.write(_struct_2b.pack(_x.sound, _x.command))
00097 _x = self.arg
00098 length = len(_x)
00099 buff.write(struct.pack('<I%ss'%length, length, _x))
00100 except struct.error, se: self._check_types(se)
00101 except TypeError, te: self._check_types(te)
00102
00103 def deserialize(self, str):
00104 """
00105 unpack serialized message in str into this message instance
00106 @param str: byte array of serialized message
00107 @type str: str
00108 """
00109 try:
00110 end = 0
00111 _x = self
00112 start = end
00113 end += 2
00114 (_x.sound, _x.command,) = _struct_2b.unpack(str[start:end])
00115 start = end
00116 end += 4
00117 (length,) = _struct_I.unpack(str[start:end])
00118 start = end
00119 end += length
00120 self.arg = str[start:end]
00121 return self
00122 except struct.error, e:
00123 raise roslib.message.DeserializationError(e)
00124
00125
00126 def serialize_numpy(self, buff, numpy):
00127 """
00128 serialize message with numpy array types into buffer
00129 @param buff: buffer
00130 @type buff: StringIO
00131 @param numpy: numpy python module
00132 @type numpy module
00133 """
00134 try:
00135 _x = self
00136 buff.write(_struct_2b.pack(_x.sound, _x.command))
00137 _x = self.arg
00138 length = len(_x)
00139 buff.write(struct.pack('<I%ss'%length, length, _x))
00140 except struct.error, se: self._check_types(se)
00141 except TypeError, te: self._check_types(te)
00142
00143 def deserialize_numpy(self, str, numpy):
00144 """
00145 unpack serialized message in str into this message instance using numpy for array types
00146 @param str: byte array of serialized message
00147 @type str: str
00148 @param numpy: numpy python module
00149 @type numpy: module
00150 """
00151 try:
00152 end = 0
00153 _x = self
00154 start = end
00155 end += 2
00156 (_x.sound, _x.command,) = _struct_2b.unpack(str[start:end])
00157 start = end
00158 end += 4
00159 (length,) = _struct_I.unpack(str[start:end])
00160 start = end
00161 end += length
00162 self.arg = str[start:end]
00163 return self
00164 except struct.error, e:
00165 raise roslib.message.DeserializationError(e)
00166
00167 _struct_I = roslib.message.struct_I
00168 _struct_2b = struct.Struct("<2b")