Source code for pyupm_grovescam

# 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_grovescam', [dirname(__file__)])
        except ImportError:
            import _pyupm_grovescam
            return _pyupm_grovescam
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_grovescam', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_grovescam = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_grovescam
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_grovescam.getVersion()
getVersion = _pyupm_grovescam.getVersion

_pyupm_grovescam.GROVESCAM_DEFAULT_UART_swigconstant(_pyupm_grovescam)
GROVESCAM_DEFAULT_UART = _pyupm_grovescam.GROVESCAM_DEFAULT_UART

_pyupm_grovescam.GROVESCAM_DEFAULT_CAMERA_ADDR_swigconstant(_pyupm_grovescam)
GROVESCAM_DEFAULT_CAMERA_ADDR = _pyupm_grovescam.GROVESCAM_DEFAULT_CAMERA_ADDR
[docs]class GROVESCAM(_object): """ API for the Grove Serial Camera. Deprecated This class is being replaced by SCAM ID: grovescam Name: Serial Camera Module Category: other Manufacturer: seeed Connection: uart Link:http://www.seeedstudio.com/wiki/Grove_-_Serial_Camera_Kit The driver was tested with the Grove 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: grovescam.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, GROVESCAM, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, GROVESCAM, name) __repr__ = _swig_repr MAX_PKT_LEN = _pyupm_grovescam.GROVESCAM_MAX_PKT_LEN FORMAT_VGA = _pyupm_grovescam.GROVESCAM_FORMAT_VGA FORMAT_CIF = _pyupm_grovescam.GROVESCAM_FORMAT_CIF FORMAT_OCIF = _pyupm_grovescam.GROVESCAM_FORMAT_OCIF def __init__(self, uart, camAddr=0): """ GROVESCAM(int uart, uint8_t camAddr=GROVESCAM_DEFAULT_CAMERA_ADDR) Grove 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_grovescam.new_GROVESCAM(uart, camAddr) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_grovescam.delete_GROVESCAM __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_grovescam.GROVESCAM_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_grovescam.GROVESCAM_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_grovescam.GROVESCAM_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_grovescam.GROVESCAM_setupTty(self, *args)
[docs] def drainInput(self): """ void drainInput() Reads serial input and discards until no more characters are available """ return _pyupm_grovescam.GROVESCAM_drainInput(self)
[docs] def init(self): """ bool init() Initializes the camera """ return _pyupm_grovescam.GROVESCAM_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_grovescam.GROVESCAM_preCapture(self, *args)
[docs] def doCapture(self): """ bool doCapture() Starts the capture True if successful """ return _pyupm_grovescam.GROVESCAM_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_grovescam.GROVESCAM_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_grovescam.GROVESCAM_getImageSize(self)
GROVESCAM_swigregister = _pyupm_grovescam.GROVESCAM_swigregister GROVESCAM_swigregister(GROVESCAM) # This file is compatible with both classic and new-style classes.