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