"""autogenerated by genpy from qbo_arduqbo/TestRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct


class TestRequest(genpy.Message):
  _md5sum = "d41d8cd98f00b204e9800998ecf8427e"
  _type = "qbo_arduqbo/TestRequest"
  _has_header = False #flag to mark the presence of a Header object
  _full_text = """



















"""
  __slots__ = []
  _slot_types = []

  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:
       

    :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(TestRequest, self).__init__(*args, **kwds)

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

  def serialize(self, buff):
    """
    serialize message into buffer
    :param buff: buffer, ``StringIO``
    """
    try:
      pass
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))

  def deserialize(self, str):
    """
    unpack serialized message in str into this message instance
    :param str: byte array of serialized message, ``str``
    """
    try:
      end = 0
      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:
      pass
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))

  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
    """
    try:
      end = 0
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e) #most likely buffer underfill

_struct_I = genpy.struct_I
"""autogenerated by genpy from qbo_arduqbo/TestResponse.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct


class TestResponse(genpy.Message):
  _md5sum = "6f8d7da5192e662dd9f7974027b7e5ee"
  _type = "qbo_arduqbo/TestResponse"
  _has_header = False #flag to mark the presence of a Header object
  _full_text = """int8 SRFcount
int16[] SRFAddress
int16[] SRFNotFound
bool Gyroscope
bool Accelerometer
bool LCD
bool Qboard3
bool Qboard1
bool Qboard2
bool rightMotor
bool leftMotor


"""
  __slots__ = ['SRFcount','SRFAddress','SRFNotFound','Gyroscope','Accelerometer','LCD','Qboard3','Qboard1','Qboard2','rightMotor','leftMotor']
  _slot_types = ['int8','int16[]','int16[]','bool','bool','bool','bool','bool','bool','bool','bool']

  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:
       SRFcount,SRFAddress,SRFNotFound,Gyroscope,Accelerometer,LCD,Qboard3,Qboard1,Qboard2,rightMotor,leftMotor

    :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(TestResponse, self).__init__(*args, **kwds)
      #message fields cannot be None, assign default values for those that are
      if self.SRFcount is None:
        self.SRFcount = 0
      if self.SRFAddress is None:
        self.SRFAddress = []
      if self.SRFNotFound is None:
        self.SRFNotFound = []
      if self.Gyroscope is None:
        self.Gyroscope = False
      if self.Accelerometer is None:
        self.Accelerometer = False
      if self.LCD is None:
        self.LCD = False
      if self.Qboard3 is None:
        self.Qboard3 = False
      if self.Qboard1 is None:
        self.Qboard1 = False
      if self.Qboard2 is None:
        self.Qboard2 = False
      if self.rightMotor is None:
        self.rightMotor = False
      if self.leftMotor is None:
        self.leftMotor = False
    else:
      self.SRFcount = 0
      self.SRFAddress = []
      self.SRFNotFound = []
      self.Gyroscope = False
      self.Accelerometer = False
      self.LCD = False
      self.Qboard3 = False
      self.Qboard1 = False
      self.Qboard2 = False
      self.rightMotor = False
      self.leftMotor = False

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

  def serialize(self, buff):
    """
    serialize message into buffer
    :param buff: buffer, ``StringIO``
    """
    try:
      buff.write(_struct_b.pack(self.SRFcount))
      length = len(self.SRFAddress)
      buff.write(_struct_I.pack(length))
      pattern = '<%sh'%length
      buff.write(struct.pack(pattern, *self.SRFAddress))
      length = len(self.SRFNotFound)
      buff.write(_struct_I.pack(length))
      pattern = '<%sh'%length
      buff.write(struct.pack(pattern, *self.SRFNotFound))
      _x = self
      buff.write(_struct_8B.pack(_x.Gyroscope, _x.Accelerometer, _x.LCD, _x.Qboard3, _x.Qboard1, _x.Qboard2, _x.rightMotor, _x.leftMotor))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))

  def deserialize(self, str):
    """
    unpack serialized message in str into this message instance
    :param str: byte array of serialized message, ``str``
    """
    try:
      end = 0
      start = end
      end += 1
      (self.SRFcount,) = _struct_b.unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      pattern = '<%sh'%length
      start = end
      end += struct.calcsize(pattern)
      self.SRFAddress = struct.unpack(pattern, str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      pattern = '<%sh'%length
      start = end
      end += struct.calcsize(pattern)
      self.SRFNotFound = struct.unpack(pattern, str[start:end])
      _x = self
      start = end
      end += 8
      (_x.Gyroscope, _x.Accelerometer, _x.LCD, _x.Qboard3, _x.Qboard1, _x.Qboard2, _x.rightMotor, _x.leftMotor,) = _struct_8B.unpack(str[start:end])
      self.Gyroscope = bool(self.Gyroscope)
      self.Accelerometer = bool(self.Accelerometer)
      self.LCD = bool(self.LCD)
      self.Qboard3 = bool(self.Qboard3)
      self.Qboard1 = bool(self.Qboard1)
      self.Qboard2 = bool(self.Qboard2)
      self.rightMotor = bool(self.rightMotor)
      self.leftMotor = bool(self.leftMotor)
      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:
      buff.write(_struct_b.pack(self.SRFcount))
      length = len(self.SRFAddress)
      buff.write(_struct_I.pack(length))
      pattern = '<%sh'%length
      buff.write(self.SRFAddress.tostring())
      length = len(self.SRFNotFound)
      buff.write(_struct_I.pack(length))
      pattern = '<%sh'%length
      buff.write(self.SRFNotFound.tostring())
      _x = self
      buff.write(_struct_8B.pack(_x.Gyroscope, _x.Accelerometer, _x.LCD, _x.Qboard3, _x.Qboard1, _x.Qboard2, _x.rightMotor, _x.leftMotor))
    except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
    except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))

  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
    """
    try:
      end = 0
      start = end
      end += 1
      (self.SRFcount,) = _struct_b.unpack(str[start:end])
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      pattern = '<%sh'%length
      start = end
      end += struct.calcsize(pattern)
      self.SRFAddress = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length)
      start = end
      end += 4
      (length,) = _struct_I.unpack(str[start:end])
      pattern = '<%sh'%length
      start = end
      end += struct.calcsize(pattern)
      self.SRFNotFound = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length)
      _x = self
      start = end
      end += 8
      (_x.Gyroscope, _x.Accelerometer, _x.LCD, _x.Qboard3, _x.Qboard1, _x.Qboard2, _x.rightMotor, _x.leftMotor,) = _struct_8B.unpack(str[start:end])
      self.Gyroscope = bool(self.Gyroscope)
      self.Accelerometer = bool(self.Accelerometer)
      self.LCD = bool(self.LCD)
      self.Qboard3 = bool(self.Qboard3)
      self.Qboard1 = bool(self.Qboard1)
      self.Qboard2 = bool(self.Qboard2)
      self.rightMotor = bool(self.rightMotor)
      self.leftMotor = bool(self.leftMotor)
      return self
    except struct.error as e:
      raise genpy.DeserializationError(e) #most likely buffer underfill

_struct_I = genpy.struct_I
_struct_8B = struct.Struct("<8B")
_struct_b = struct.Struct("<b")
class Test(object):
  _type          = 'qbo_arduqbo/Test'
  _md5sum = '6f8d7da5192e662dd9f7974027b7e5ee'
  _request_class  = TestRequest
  _response_class = TestResponse
