$search
00001 """autogenerated by genmsg_py from AudioData.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class AudioData(roslib.message.Message): 00007 _md5sum = "f43a8e1b362b75baa741461b46adc7e0" 00008 _type = "audio_common_msgs/AudioData" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """uint8[] data 00011 00012 """ 00013 __slots__ = ['data'] 00014 _slot_types = ['uint8[]'] 00015 00016 def __init__(self, *args, **kwds): 00017 """ 00018 Constructor. Any message fields that are implicitly/explicitly 00019 set to None will be assigned a default value. The recommend 00020 use is keyword arguments as this is more robust to future message 00021 changes. You cannot mix in-order arguments and keyword arguments. 00022 00023 The available fields are: 00024 data 00025 00026 @param args: complete set of field values, in .msg order 00027 @param kwds: use keyword arguments corresponding to message field names 00028 to set specific fields. 00029 """ 00030 if args or kwds: 00031 super(AudioData, self).__init__(*args, **kwds) 00032 #message fields cannot be None, assign default values for those that are 00033 if self.data is None: 00034 self.data = '' 00035 else: 00036 self.data = '' 00037 00038 def _get_types(self): 00039 """ 00040 internal API method 00041 """ 00042 return self._slot_types 00043 00044 def serialize(self, buff): 00045 """ 00046 serialize message into buffer 00047 @param buff: buffer 00048 @type buff: StringIO 00049 """ 00050 try: 00051 _x = self.data 00052 length = len(_x) 00053 # - if encoded as a list instead, serialize as bytes instead of string 00054 if type(_x) in [list, tuple]: 00055 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00056 else: 00057 buff.write(struct.pack('<I%ss'%length, length, _x)) 00058 except struct.error as se: self._check_types(se) 00059 except TypeError as te: self._check_types(te) 00060 00061 def deserialize(self, str): 00062 """ 00063 unpack serialized message in str into this message instance 00064 @param str: byte array of serialized message 00065 @type str: str 00066 """ 00067 try: 00068 end = 0 00069 start = end 00070 end += 4 00071 (length,) = _struct_I.unpack(str[start:end]) 00072 start = end 00073 end += length 00074 self.data = str[start:end] 00075 return self 00076 except struct.error as e: 00077 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00078 00079 00080 def serialize_numpy(self, buff, numpy): 00081 """ 00082 serialize message with numpy array types into buffer 00083 @param buff: buffer 00084 @type buff: StringIO 00085 @param numpy: numpy python module 00086 @type numpy module 00087 """ 00088 try: 00089 _x = self.data 00090 length = len(_x) 00091 # - if encoded as a list instead, serialize as bytes instead of string 00092 if type(_x) in [list, tuple]: 00093 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00094 else: 00095 buff.write(struct.pack('<I%ss'%length, length, _x)) 00096 except struct.error as se: self._check_types(se) 00097 except TypeError as te: self._check_types(te) 00098 00099 def deserialize_numpy(self, str, numpy): 00100 """ 00101 unpack serialized message in str into this message instance using numpy for array types 00102 @param str: byte array of serialized message 00103 @type str: str 00104 @param numpy: numpy python module 00105 @type numpy: module 00106 """ 00107 try: 00108 end = 0 00109 start = end 00110 end += 4 00111 (length,) = _struct_I.unpack(str[start:end]) 00112 start = end 00113 end += length 00114 self.data = str[start:end] 00115 return self 00116 except struct.error as e: 00117 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00118 00119 _struct_I = roslib.message.struct_I