# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
    def swig_import_helper():
        from os.path import dirname
        import imp
        fp = None
        try:
            fp, pathname, description = imp.find_module('_pyupm_scam', [dirname(__file__)])
        except ImportError:
            import _pyupm_scam
            return _pyupm_scam
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_scam', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_scam = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_scam
del version_info
try:
    _swig_property = property
except NameError:
    pass  # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
    if (name == "thisown"):
        return self.this.own(value)
    if (name == "this"):
        if type(value).__name__ == 'SwigPyObject':
            self.__dict__[name] = value
            return
    method = class_type.__swig_setmethods__.get(name, None)
    if method:
        return method(self, value)
    if (not static):
        if _newclass:
            object.__setattr__(self, name, value)
        else:
            self.__dict__[name] = value
    else:
        raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
    return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
    if (name == "thisown"):
        return self.this.own()
    method = class_type.__swig_getmethods__.get(name, None)
    if method:
        return method(self)
    if (not static):
        return object.__getattr__(self, name)
    else:
        raise AttributeError(name)
def _swig_getattr(self, class_type, name):
    return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
    _object = object
    _newclass = 1
except AttributeError:
    class _object:
        pass
    _newclass = 0
def getVersion():
    return _pyupm_scam.getVersion()
getVersion = _pyupm_scam.getVersion
_pyupm_scam.SCAM_DEFAULT_UART_swigconstant(_pyupm_scam)
SCAM_DEFAULT_UART = _pyupm_scam.SCAM_DEFAULT_UART
_pyupm_scam.SCAM_DEFAULT_CAMERA_ADDR_swigconstant(_pyupm_scam)
SCAM_DEFAULT_CAMERA_ADDR = _pyupm_scam.SCAM_DEFAULT_CAMERA_ADDR
[docs]class SCAM(_object):
    """
    API for the Serial Camera.
    ID: scam
    Name: Serial Camera
    Other Names: Grove Serial Camera
    Category: other
    Manufacturer: seeed
    Connection: uart
    Link:http://www.seeedstudio.com/wiki/Grove_-_Serial_Camera_Kit  The
    driver was tested with the Serial Camera. There is no protocol
    documentation currently available, so this module was developed based
    completely on the Seeed Studio* Arduino* sketch.
    It is connected via a UART at 115,200 baud.
    C++ includes: scam.hpp 
    """
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, SCAM, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, SCAM, name)
    __repr__ = _swig_repr
    MAX_PKT_LEN = _pyupm_scam.SCAM_MAX_PKT_LEN
    FORMAT_VGA = _pyupm_scam.SCAM_FORMAT_VGA
    FORMAT_CIF = _pyupm_scam.SCAM_FORMAT_CIF
    FORMAT_OCIF = _pyupm_scam.SCAM_FORMAT_OCIF
    def __init__(self, uart, camAddr=0):
        """
        SCAM(int uart, uint8_t
        camAddr=SCAM_DEFAULT_CAMERA_ADDR)
        Serial Camera constructor
        Parameters:
        -----------
        uart:  Default UART to use (0 or 1)
        camAddr:  3-bit address identifier of the camera; default is 0 
        """
        this = _pyupm_scam.new_SCAM(uart, camAddr)
        try:
            self.this.append(this)
        except Exception:
            self.this = this
    __swig_destroy__ = _pyupm_scam.delete_SCAM
    __del__ = lambda self: None
[docs]    def dataAvailable(self, millis):
        """
        bool
        dataAvailable(unsigned int millis)
        Checks to see if there is data available for reading
        Parameters:
        -----------
        millis:  Number of milliseconds to wait; 0 means no waiting.
        True if there is data available for reading 
        """
        return _pyupm_scam.SCAM_dataAvailable(self, millis) 
[docs]    def readData(self, buffer, len):
        """
        int readData(uint8_t
        *buffer, int len)
        Reads any available data into a user-supplied buffer. Note: the call
        blocks until data is available to be read. Use dataAvailable() to
        determine whether there is data available beforehand, to avoid
        blocking.
        Parameters:
        -----------
        buffer:  Buffer to hold the data read
        len:  Length of the buffer
        Number of bytes read 
        """
        return _pyupm_scam.SCAM_readData(self, buffer, len) 
[docs]    def writeData(self, buffer, len):
        """
        int writeData(uint8_t
        *buffer, int len)
        Writes the data in the buffer to the device
        Parameters:
        -----------
        buffer:  Buffer to hold the data read
        len:  Length of the buffer
        Number of bytes written 
        """
        return _pyupm_scam.SCAM_writeData(self, buffer, len) 
[docs]    def setupTty(self, *args):
        """
        bool setupTty(speed_t
        baud=B115200)
        Sets up proper tty I/O modes and the baud rate. For this device, the
        default baud rate is 9,600 (B9600).
        Parameters:
        -----------
        baud:  Desired baud rate
        True if successful 
        """
        return _pyupm_scam.SCAM_setupTty(self, *args) 
[docs]    def init(self):
        """
        bool init()
        Initializes the camera 
        """
        return _pyupm_scam.SCAM_init(self) 
[docs]    def preCapture(self, *args):
        """
        bool
        preCapture(PIC_FORMATS_T fmt=FORMAT_VGA)
        Tells the camera to prepare for a capture
        Parameters:
        -----------
        fmt:  One of the PIC_FORMATS_T values 
        """
        return _pyupm_scam.SCAM_preCapture(self, *args) 
[docs]    def doCapture(self):
        """
        bool doCapture()
        Starts the capture
        True if successful 
        """
        return _pyupm_scam.SCAM_doCapture(self) 
[docs]    def storeImage(self, fname):
        """
        bool storeImage(const
        char *fname)
        Stores the captured image in a file
        Parameters:
        -----------
        fname:  Name of the file to write
        True if successful
        let the games begin... 
        """
        return _pyupm_scam.SCAM_storeImage(self, fname) 
[docs]    def getImageSize(self):
        """
        int getImageSize()
        Returns the picture length. Note: this is only valid after doCapture()
        has run successfully.
        Image length 
        """
        return _pyupm_scam.SCAM_getImageSize(self)  
SCAM_swigregister = _pyupm_scam.SCAM_swigregister
SCAM_swigregister(SCAM)
# This file is compatible with both classic and new-style classes.