"""
Autogenerated python message buffer code.
Source: clad/types/cameraParams.clad
Full command line: victor-clad/tools/message-buffers/emitters/Python_emitter.py -I coretech/vision/clad_src coretech/common/clad_src -o generated/cladPython clad/types/cameraParams.clad
"""

from __future__ import absolute_import
from __future__ import print_function

def _modify_path():
  import inspect, os, sys
  search_paths = [
    '../..',
    '../../../../victor-clad/tools/message-buffers/support/python',
  ]
  currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
  for search_path in search_paths:
    search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
    if search_path not in sys.path:
      sys.path.insert(0, search_path)
_modify_path()

import msgbuffers

Anki = msgbuffers.Namespace()
Anki.Vision = msgbuffers.Namespace()

class CameraParams(object):
  "Generated message-passing structure."

  __slots__ = (
    '_exposureTime_ms',   # int_32
    '_gain',              # float_32
    '_whiteBalanceGainR', # float_32
    '_whiteBalanceGainG', # float_32
    '_whiteBalanceGainB', # float_32
  )

  @property
  def exposureTime_ms(self):
    "int_32 exposureTime_ms struct property."
    return self._exposureTime_ms

  @exposureTime_ms.setter
  def exposureTime_ms(self, value):
    self._exposureTime_ms = msgbuffers.validate_integer(
      'CameraParams.exposureTime_ms', value, -2147483648, 2147483647)

  @property
  def gain(self):
    "float_32 gain struct property."
    return self._gain

  @gain.setter
  def gain(self, value):
    self._gain = msgbuffers.validate_float(
      'CameraParams.gain', value, 'f')

  @property
  def whiteBalanceGainR(self):
    "float_32 whiteBalanceGainR struct property."
    return self._whiteBalanceGainR

  @whiteBalanceGainR.setter
  def whiteBalanceGainR(self, value):
    self._whiteBalanceGainR = msgbuffers.validate_float(
      'CameraParams.whiteBalanceGainR', value, 'f')

  @property
  def whiteBalanceGainG(self):
    "float_32 whiteBalanceGainG struct property."
    return self._whiteBalanceGainG

  @whiteBalanceGainG.setter
  def whiteBalanceGainG(self, value):
    self._whiteBalanceGainG = msgbuffers.validate_float(
      'CameraParams.whiteBalanceGainG', value, 'f')

  @property
  def whiteBalanceGainB(self):
    "float_32 whiteBalanceGainB struct property."
    return self._whiteBalanceGainB

  @whiteBalanceGainB.setter
  def whiteBalanceGainB(self, value):
    self._whiteBalanceGainB = msgbuffers.validate_float(
      'CameraParams.whiteBalanceGainB', value, 'f')

  def __init__(self, exposureTime_ms=0, gain=0.0, whiteBalanceGainR=0.0, whiteBalanceGainG=0.0, whiteBalanceGainB=0.0):
    self.exposureTime_ms = exposureTime_ms
    self.gain = gain
    self.whiteBalanceGainR = whiteBalanceGainR
    self.whiteBalanceGainG = whiteBalanceGainG
    self.whiteBalanceGainB = whiteBalanceGainB

  @classmethod
  def unpack(cls, buffer):
    "Reads a new CameraParams from the given buffer."
    reader = msgbuffers.BinaryReader(buffer)
    value = cls.unpack_from(reader)
    if reader.tell() != len(reader):
      raise msgbuffers.ReadError(
        ('CameraParams.unpack received a buffer of length {length}, ' +
        'but only {position} bytes were read.').format(
        length=len(reader), position=reader.tell()))
    return value

  @classmethod
  def unpack_from(cls, reader):
    "Reads a new CameraParams from the given BinaryReader."
    _exposureTime_ms = reader.read('i')
    _gain = reader.read('f')
    _whiteBalanceGainR = reader.read('f')
    _whiteBalanceGainG = reader.read('f')
    _whiteBalanceGainB = reader.read('f')
    return cls(_exposureTime_ms, _gain, _whiteBalanceGainR, _whiteBalanceGainG, _whiteBalanceGainB)

  def pack(self):
    "Writes the current CameraParams, returning bytes."
    writer = msgbuffers.BinaryWriter()
    self.pack_to(writer)
    return writer.dumps()

  def pack_to(self, writer):
    "Writes the current CameraParams to the given BinaryWriter."
    writer.write(self._exposureTime_ms, 'i')
    writer.write(self._gain, 'f')
    writer.write(self._whiteBalanceGainR, 'f')
    writer.write(self._whiteBalanceGainG, 'f')
    writer.write(self._whiteBalanceGainB, 'f')

  def __eq__(self, other):
    if type(self) is type(other):
      return (self._exposureTime_ms == other._exposureTime_ms and
        self._gain == other._gain and
        self._whiteBalanceGainR == other._whiteBalanceGainR and
        self._whiteBalanceGainG == other._whiteBalanceGainG and
        self._whiteBalanceGainB == other._whiteBalanceGainB)
    else:
      return NotImplemented

  def __ne__(self, other):
    if type(self) is type(other):
      return not self.__eq__(other)
    else:
      return NotImplemented

  def __len__(self):
    return (msgbuffers.size(self._exposureTime_ms, 'i') +
      msgbuffers.size(self._gain, 'f') +
      msgbuffers.size(self._whiteBalanceGainR, 'f') +
      msgbuffers.size(self._whiteBalanceGainG, 'f') +
      msgbuffers.size(self._whiteBalanceGainB, 'f'))

  def __str__(self):
    return '{type}(exposureTime_ms={exposureTime_ms}, gain={gain}, whiteBalanceGainR={whiteBalanceGainR}, whiteBalanceGainG={whiteBalanceGainG}, whiteBalanceGainB={whiteBalanceGainB})'.format(
      type=type(self).__name__,
      exposureTime_ms=self._exposureTime_ms,
      gain=self._gain,
      whiteBalanceGainR=self._whiteBalanceGainR,
      whiteBalanceGainG=self._whiteBalanceGainG,
      whiteBalanceGainB=self._whiteBalanceGainB)

  def __repr__(self):
    return '{type}(exposureTime_ms={exposureTime_ms}, gain={gain}, whiteBalanceGainR={whiteBalanceGainR}, whiteBalanceGainG={whiteBalanceGainG}, whiteBalanceGainB={whiteBalanceGainB})'.format(
      type=type(self).__name__,
      exposureTime_ms=repr(self._exposureTime_ms),
      gain=repr(self._gain),
      whiteBalanceGainR=repr(self._whiteBalanceGainR),
      whiteBalanceGainG=repr(self._whiteBalanceGainG),
      whiteBalanceGainB=repr(self._whiteBalanceGainB))

Anki.Vision.CameraParams = CameraParams
del CameraParams


class ImageQuality(object):
  "Automatically-generated uint_8 enumeration."
  Unchecked = 0
  Good      = 1
  TooDark   = 2
  TooBright = 3

Anki.Vision.ImageQuality = ImageQuality
del ImageQuality


