# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from mettler_toledo_quantos_q2_msgs/QuantosCommand.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct


class QuantosCommand(genpy.Message):
  _md5sum = "aa63230c95b3f1f7695d287e88ee9006"
  _type = "mettler_toledo_quantos_q2_msgs/QuantosCommand"
  _has_header = False  # flag to mark the presence of a Header object
  _full_text = """# Available commands to use the MT Quantos System
int32 STARTDOSE = 0
int32 STOPDOSE = 1
int32 GETDOORPOS = 2
int32 GETSAMPLEPOS = 3
int32 GETHEAD = 4
int32 GETSAMPLE = 5
int32 MOVEPIN = 6
int32 MOVEDOOR = 7
int32 SETSAMPLEPOS = 8
int32 SETTAPBEFORE = 9
int32 SETTAPDURING = 10
int32 SETTAPINT = 11
int32 SETTAPDURATION = 12
int32 SETTARGET = 13
int32 SETTOL = 14
int32 SETTOLMODE = 15
int32 SETSAMPLEID = 16
int32 SETPANOFF = 17
int32 SETALGO = 18
int32 SETAS = 19
int32 DISPENSESOLID = 20

int32 quantos_command
string quantos_ID
bool quantos_bool
float32 quantos_float
int32 quantos_int
"""
  # Pseudo-constants
  STARTDOSE = 0
  STOPDOSE = 1
  GETDOORPOS = 2
  GETSAMPLEPOS = 3
  GETHEAD = 4
  GETSAMPLE = 5
  MOVEPIN = 6
  MOVEDOOR = 7
  SETSAMPLEPOS = 8
  SETTAPBEFORE = 9
  SETTAPDURING = 10
  SETTAPINT = 11
  SETTAPDURATION = 12
  SETTARGET = 13
  SETTOL = 14
  SETTOLMODE = 15
  SETSAMPLEID = 16
  SETPANOFF = 17
  SETALGO = 18
  SETAS = 19
  DISPENSESOLID = 20

  __slots__ = ['quantos_command','quantos_ID','quantos_bool','quantos_float','quantos_int']
  _slot_types = ['int32','string','bool','float32','int32']

  def __init__(self, *args, **kwds):
    """
    Constructor. Any message fields that are implicitly/explicitly
    set to None will be assigned a default value. The recommend
    use is keyword arguments as this is more robust to future message
    changes.  You cannot mix in-order arguments and keyword arguments.

    The available fields are:
       quantos_command,quantos_ID,quantos_bool,quantos_float,quantos_int

    :param args: complete set of field values, in .msg order
    :param kwds: use keyword arguments corresponding to message field names
    to set specific fields.
    """
    if args or kwds:
      super(QuantosCommand, self).__init__(*args, **kwds)
      # message fields cannot be None, assign default values for those that are
      if self.quantos_command is None:
        self.quantos_command = 0
      if self.quantos_ID is None:
        self.quantos_ID = ''
      if self.quantos_bool is None:
        self.quantos_bool = False
      if self.quantos_float is None:
        self.quantos_float = 0.
      if self.quantos_int is None:
        self.quantos_int = 0
    else:
      self.quantos_command = 0
      self.quantos_ID = ''
      self.quantos_bool = False
      self.quantos_float = 0.
      self.quantos_int = 0

  def _get_types(self):
    """
    internal API method
    """
    return self._slot_types

  def serialize(self, buff):
    """
    serialize message into buffer
    :param buff: buffer, ``StringIO``
    """
    try:
      _x = self.quantos_command
      buff.write(_get_struct_i().pack(_x))
      _x = self.quantos_ID
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
      _x = self
      buff.write(_get_struct_Bfi().pack(_x.quantos_bool, _x.quantos_float, _x.quantos_int))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))

  def deserialize(self, str):
    """
    unpack serialized message in str into this message instance
    :param str: byte array of serialized message, ``str``
    """
    if python3:
      codecs.lookup_error("rosmsg").msg_type = self._type
    try:
      end = 0
      start = end
      end += 4
      (self.quantos_command,) = _get_struct_i().unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.quantos_ID = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.quantos_ID = str[start:end]
      _x = self
      start = end
      end += 9
      (_x.quantos_bool, _x.quantos_float, _x.quantos_int,) = _get_struct_Bfi().unpack(str[start:end])
      self.quantos_bool = bool(self.quantos_bool)
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e)  # most likely buffer underfill


  def serialize_numpy(self, buff, numpy):
    """
    serialize message with numpy array types into buffer
    :param buff: buffer, ``StringIO``
    :param numpy: numpy python module
    """
    try:
      _x = self.quantos_command
      buff.write(_get_struct_i().pack(_x))
      _x = self.quantos_ID
      length = len(_x)
      if python3 or type(_x) == unicode:
        _x = _x.encode('utf-8')
        length = len(_x)
      buff.write(struct.Struct('<I%ss'%length).pack(length, _x))
      _x = self
      buff.write(_get_struct_Bfi().pack(_x.quantos_bool, _x.quantos_float, _x.quantos_int))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))

  def deserialize_numpy(self, str, numpy):
    """
    unpack serialized message in str into this message instance using numpy for array types
    :param str: byte array of serialized message, ``str``
    :param numpy: numpy python module
    """
    if python3:
      codecs.lookup_error("rosmsg").msg_type = self._type
    try:
      end = 0
      start = end
      end += 4
      (self.quantos_command,) = _get_struct_i().unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      start = end
      end += length
      if python3:
        self.quantos_ID = str[start:end].decode('utf-8', 'rosmsg')
      else:
        self.quantos_ID = str[start:end]
      _x = self
      start = end
      end += 9
      (_x.quantos_bool, _x.quantos_float, _x.quantos_int,) = _get_struct_Bfi().unpack(str[start:end])
      self.quantos_bool = bool(self.quantos_bool)
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e)  # most likely buffer underfill

_struct_I = genpy.struct_I
def _get_struct_I():
    global _struct_I
    return _struct_I
_struct_Bfi = None
def _get_struct_Bfi():
    global _struct_Bfi
    if _struct_Bfi is None:
        _struct_Bfi = struct.Struct("<Bfi")
    return _struct_Bfi
_struct_i = None
def _get_struct_i():
    global _struct_i
    if _struct_i is None:
        _struct_i = struct.Struct("<i")
    return _struct_i
