Go to the documentation of this file.00001 """autogenerated by genpy from iri_perception_msgs/voiceRecognitionAnswer.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 voiceRecognitionAnswer(genpy.Message):
00009 _md5sum = "8af98cfda9adf4e1ce1333303c85eeb9"
00010 _type = "iri_perception_msgs/voiceRecognitionAnswer"
00011 _has_header = False
00012 _full_text = """uint32 code
00013 string answer
00014 """
00015 __slots__ = ['code','answer']
00016 _slot_types = ['uint32','string']
00017
00018 def __init__(self, *args, **kwds):
00019 """
00020 Constructor. Any message fields that are implicitly/explicitly
00021 set to None will be assigned a default value. The recommend
00022 use is keyword arguments as this is more robust to future message
00023 changes. You cannot mix in-order arguments and keyword arguments.
00024
00025 The available fields are:
00026 code,answer
00027
00028 :param args: complete set of field values, in .msg order
00029 :param kwds: use keyword arguments corresponding to message field names
00030 to set specific fields.
00031 """
00032 if args or kwds:
00033 super(voiceRecognitionAnswer, self).__init__(*args, **kwds)
00034
00035 if self.code is None:
00036 self.code = 0
00037 if self.answer is None:
00038 self.answer = ''
00039 else:
00040 self.code = 0
00041 self.answer = ''
00042
00043 def _get_types(self):
00044 """
00045 internal API method
00046 """
00047 return self._slot_types
00048
00049 def serialize(self, buff):
00050 """
00051 serialize message into buffer
00052 :param buff: buffer, ``StringIO``
00053 """
00054 try:
00055 buff.write(_struct_I.pack(self.code))
00056 _x = self.answer
00057 length = len(_x)
00058 if python3 or type(_x) == unicode:
00059 _x = _x.encode('utf-8')
00060 length = len(_x)
00061 buff.write(struct.pack('<I%ss'%length, length, _x))
00062 except struct.error as se: self._check_types(se)
00063 except TypeError as te: self._check_types(te)
00064
00065 def deserialize(self, str):
00066 """
00067 unpack serialized message in str into this message instance
00068 :param str: byte array of serialized message, ``str``
00069 """
00070 try:
00071 end = 0
00072 start = end
00073 end += 4
00074 (self.code,) = _struct_I.unpack(str[start:end])
00075 start = end
00076 end += 4
00077 (length,) = _struct_I.unpack(str[start:end])
00078 start = end
00079 end += length
00080 if python3:
00081 self.answer = str[start:end].decode('utf-8')
00082 else:
00083 self.answer = str[start:end]
00084 return self
00085 except struct.error as e:
00086 raise genpy.DeserializationError(e)
00087
00088
00089 def serialize_numpy(self, buff, numpy):
00090 """
00091 serialize message with numpy array types into buffer
00092 :param buff: buffer, ``StringIO``
00093 :param numpy: numpy python module
00094 """
00095 try:
00096 buff.write(_struct_I.pack(self.code))
00097 _x = self.answer
00098 length = len(_x)
00099 if python3 or type(_x) == unicode:
00100 _x = _x.encode('utf-8')
00101 length = len(_x)
00102 buff.write(struct.pack('<I%ss'%length, length, _x))
00103 except struct.error as se: self._check_types(se)
00104 except TypeError as te: self._check_types(te)
00105
00106 def deserialize_numpy(self, str, numpy):
00107 """
00108 unpack serialized message in str into this message instance using numpy for array types
00109 :param str: byte array of serialized message, ``str``
00110 :param numpy: numpy python module
00111 """
00112 try:
00113 end = 0
00114 start = end
00115 end += 4
00116 (self.code,) = _struct_I.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.answer = str[start:end].decode('utf-8')
00124 else:
00125 self.answer = str[start:end]
00126 return self
00127 except struct.error as e:
00128 raise genpy.DeserializationError(e)
00129
00130 _struct_I = genpy.struct_I