# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.4.0
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.

"""
SoapySDR API.

SoapySDR is an open-source generalized API and runtime library for interfacing
with Software Defined Radio devices. With SoapySDR, you can instantiate,
configure, and stream with an SDR device in a variety of environments.
Refer to https://github.com/pothosware/SoapySDR/wiki

This Python interface closely maps to the C/C++ one.
See https://pothosware.github.io/SoapySDR/doxygen/latest/index.html for details.

"""


import os

if os.name == 'nt' and hasattr(os, 'add_dll_directory'):
    root_dir = __file__
    for i in range(5): #limit search depth
        root_dir = os.path.dirname(root_dir)
        bin_dir = os.path.join(root_dir, 'bin')
        if os.path.exists(bin_dir):
            try: os.add_dll_directory(bin_dir)
            except Exception as ex:
                print('add_dll_directory(%s): %s'%(bin_dir, ex))
            break



from sys import version_info as _swig_python_version_info
# Import the low-level C/C++ module
if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
    from . import _SoapySDR
else:
    import _SoapySDR

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "this":
            set(self, name, value)
        elif name == "thisown":
            self.this.own(value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


import weakref



COMPILE_ABI_VERSION = "0.8"
PYTHONLIB_ABI_VERSION = _SoapySDR.SOAPY_SDR_ABI_VERSION
CORELIB_ABI_VERSION = _SoapySDR.getABIVersion()

if not (COMPILE_ABI_VERSION == PYTHONLIB_ABI_VERSION == CORELIB_ABI_VERSION):
    raise Exception("""Failed ABI check.
Import script:    {0}
Python module:    {1}
SoapySDR library: {2}""".format(COMPILE_ABI_VERSION, PYTHONLIB_ABI_VERSION, CORELIB_ABI_VERSION))

class SwigPyIterator(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr
    __swig_destroy__ = _SoapySDR.delete_SwigPyIterator

    def value(self):
        return _SoapySDR.SwigPyIterator_value(self)

    def incr(self, n=1):
        return _SoapySDR.SwigPyIterator_incr(self, n)

    def decr(self, n=1):
        return _SoapySDR.SwigPyIterator_decr(self, n)

    def distance(self, x):
        return _SoapySDR.SwigPyIterator_distance(self, x)

    def equal(self, x):
        return _SoapySDR.SwigPyIterator_equal(self, x)

    def copy(self):
        return _SoapySDR.SwigPyIterator_copy(self)

    def next(self):
        return _SoapySDR.SwigPyIterator_next(self)

    def __next__(self):
        return _SoapySDR.SwigPyIterator___next__(self)

    def previous(self):
        return _SoapySDR.SwigPyIterator_previous(self)

    def advance(self, n):
        return _SoapySDR.SwigPyIterator_advance(self, n)

    def __eq__(self, x):
        return _SoapySDR.SwigPyIterator___eq__(self, x)

    def __ne__(self, x):
        return _SoapySDR.SwigPyIterator___ne__(self, x)

    def __iadd__(self, n):
        return _SoapySDR.SwigPyIterator___iadd__(self, n)

    def __isub__(self, n):
        return _SoapySDR.SwigPyIterator___isub__(self, n)

    def __add__(self, n):
        return _SoapySDR.SwigPyIterator___add__(self, n)

    def __sub__(self, *args):
        return _SoapySDR.SwigPyIterator___sub__(self, *args)
    def __iter__(self):
        return self

# Register SwigPyIterator in _SoapySDR:
_SoapySDR.SwigPyIterator_swigregister(SwigPyIterator)

def KwargsFromString(markup):
    return _SoapySDR.KwargsFromString(markup)

def KwargsToString(args):
    return _SoapySDR.KwargsToString(args)
class Range(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _SoapySDR.Range_swiginit(self, _SoapySDR.new_Range(*args))

    def minimum(self):
        return _SoapySDR.Range_minimum(self)

    def maximum(self):
        return _SoapySDR.Range_maximum(self)

    def step(self):
        return _SoapySDR.Range_step(self)

    def __str__(self):
        fields = [self.minimum(), self.maximum()]
        if self.step() != 0.0: fields.append(self.step())
        return ', '.join(['%g'%f for f in fields])

    __swig_destroy__ = _SoapySDR.delete_Range

# Register Range in _SoapySDR:
_SoapySDR.Range_swigregister(Range)
class ArgInfo(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _SoapySDR.ArgInfo_swiginit(self, _SoapySDR.new_ArgInfo())
    key = property(_SoapySDR.ArgInfo_key_get, _SoapySDR.ArgInfo_key_set)
    value = property(_SoapySDR.ArgInfo_value_get, _SoapySDR.ArgInfo_value_set)
    name = property(_SoapySDR.ArgInfo_name_get, _SoapySDR.ArgInfo_name_set)
    description = property(_SoapySDR.ArgInfo_description_get, _SoapySDR.ArgInfo_description_set)
    units = property(_SoapySDR.ArgInfo_units_get, _SoapySDR.ArgInfo_units_set)
    BOOL = _SoapySDR.ArgInfo_BOOL
    INT = _SoapySDR.ArgInfo_INT
    FLOAT = _SoapySDR.ArgInfo_FLOAT
    STRING = _SoapySDR.ArgInfo_STRING
    type = property(_SoapySDR.ArgInfo_type_get, _SoapySDR.ArgInfo_type_set)
    range = property(_SoapySDR.ArgInfo_range_get, _SoapySDR.ArgInfo_range_set)
    options = property(_SoapySDR.ArgInfo_options_get, _SoapySDR.ArgInfo_options_set)
    optionNames = property(_SoapySDR.ArgInfo_optionNames_get, _SoapySDR.ArgInfo_optionNames_set)
    __swig_destroy__ = _SoapySDR.delete_ArgInfo

# Register ArgInfo in _SoapySDR:
_SoapySDR.ArgInfo_swigregister(ArgInfo)

def SettingToString(*args):
    return _SoapySDR.SettingToString(*args)
class SoapySDRKwargs(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _SoapySDR.SoapySDRKwargs_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _SoapySDR.SoapySDRKwargs___nonzero__(self)

    def __bool__(self):
        return _SoapySDR.SoapySDRKwargs___bool__(self)

    def __len__(self):
        return _SoapySDR.SoapySDRKwargs___len__(self)
    def __iter__(self):
        return self.key_iterator()
    def iterkeys(self):
        return self.key_iterator()
    def itervalues(self):
        return self.value_iterator()
    def iteritems(self):
        return self.iterator()

    def __getitem__(self, key):
        return _SoapySDR.SoapySDRKwargs___getitem__(self, key)

    def __delitem__(self, key):
        return _SoapySDR.SoapySDRKwargs___delitem__(self, key)

    def has_key(self, key):
        return _SoapySDR.SoapySDRKwargs_has_key(self, key)

    def keys(self):
        return _SoapySDR.SoapySDRKwargs_keys(self)

    def values(self):
        return _SoapySDR.SoapySDRKwargs_values(self)

    def items(self):
        return _SoapySDR.SoapySDRKwargs_items(self)

    def __contains__(self, key):
        return _SoapySDR.SoapySDRKwargs___contains__(self, key)

    def key_iterator(self):
        return _SoapySDR.SoapySDRKwargs_key_iterator(self)

    def value_iterator(self):
        return _SoapySDR.SoapySDRKwargs_value_iterator(self)

    def __setitem__(self, *args):
        return _SoapySDR.SoapySDRKwargs___setitem__(self, *args)

    def asdict(self):
        return _SoapySDR.SoapySDRKwargs_asdict(self)

    def __init__(self, *args):
        _SoapySDR.SoapySDRKwargs_swiginit(self, _SoapySDR.new_SoapySDRKwargs(*args))

    def empty(self):
        return _SoapySDR.SoapySDRKwargs_empty(self)

    def size(self):
        return _SoapySDR.SoapySDRKwargs_size(self)

    def swap(self, v):
        return _SoapySDR.SoapySDRKwargs_swap(self, v)

    def begin(self):
        return _SoapySDR.SoapySDRKwargs_begin(self)

    def end(self):
        return _SoapySDR.SoapySDRKwargs_end(self)

    def rbegin(self):
        return _SoapySDR.SoapySDRKwargs_rbegin(self)

    def rend(self):
        return _SoapySDR.SoapySDRKwargs_rend(self)

    def clear(self):
        return _SoapySDR.SoapySDRKwargs_clear(self)

    def get_allocator(self):
        return _SoapySDR.SoapySDRKwargs_get_allocator(self)

    def count(self, x):
        return _SoapySDR.SoapySDRKwargs_count(self, x)

    def erase(self, *args):
        return _SoapySDR.SoapySDRKwargs_erase(self, *args)

    def find(self, x):
        return _SoapySDR.SoapySDRKwargs_find(self, x)

    def lower_bound(self, x):
        return _SoapySDR.SoapySDRKwargs_lower_bound(self, x)

    def upper_bound(self, x):
        return _SoapySDR.SoapySDRKwargs_upper_bound(self, x)

    def __str__(self):
        out = list()
        for k, v in self.iteritems():
            out.append("%s=%s"%(k, v))
        return '{'+(', '.join(out))+'}'

    __swig_destroy__ = _SoapySDR.delete_SoapySDRKwargs

# Register SoapySDRKwargs in _SoapySDR:
_SoapySDR.SoapySDRKwargs_swigregister(SoapySDRKwargs)
class SoapySDRKwargsList(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _SoapySDR.SoapySDRKwargsList_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _SoapySDR.SoapySDRKwargsList___nonzero__(self)

    def __bool__(self):
        return _SoapySDR.SoapySDRKwargsList___bool__(self)

    def __len__(self):
        return _SoapySDR.SoapySDRKwargsList___len__(self)

    def __getslice__(self, i, j):
        return _SoapySDR.SoapySDRKwargsList___getslice__(self, i, j)

    def __setslice__(self, *args):
        return _SoapySDR.SoapySDRKwargsList___setslice__(self, *args)

    def __delslice__(self, i, j):
        return _SoapySDR.SoapySDRKwargsList___delslice__(self, i, j)

    def __delitem__(self, *args):
        return _SoapySDR.SoapySDRKwargsList___delitem__(self, *args)

    def __getitem__(self, *args):
        return _SoapySDR.SoapySDRKwargsList___getitem__(self, *args)

    def __setitem__(self, *args):
        return _SoapySDR.SoapySDRKwargsList___setitem__(self, *args)

    def pop(self):
        return _SoapySDR.SoapySDRKwargsList_pop(self)

    def append(self, x):
        return _SoapySDR.SoapySDRKwargsList_append(self, x)

    def empty(self):
        return _SoapySDR.SoapySDRKwargsList_empty(self)

    def size(self):
        return _SoapySDR.SoapySDRKwargsList_size(self)

    def swap(self, v):
        return _SoapySDR.SoapySDRKwargsList_swap(self, v)

    def begin(self):
        return _SoapySDR.SoapySDRKwargsList_begin(self)

    def end(self):
        return _SoapySDR.SoapySDRKwargsList_end(self)

    def rbegin(self):
        return _SoapySDR.SoapySDRKwargsList_rbegin(self)

    def rend(self):
        return _SoapySDR.SoapySDRKwargsList_rend(self)

    def clear(self):
        return _SoapySDR.SoapySDRKwargsList_clear(self)

    def get_allocator(self):
        return _SoapySDR.SoapySDRKwargsList_get_allocator(self)

    def pop_back(self):
        return _SoapySDR.SoapySDRKwargsList_pop_back(self)

    def erase(self, *args):
        return _SoapySDR.SoapySDRKwargsList_erase(self, *args)

    def __init__(self, *args):
        _SoapySDR.SoapySDRKwargsList_swiginit(self, _SoapySDR.new_SoapySDRKwargsList(*args))

    def push_back(self, x):
        return _SoapySDR.SoapySDRKwargsList_push_back(self, x)

    def front(self):
        return _SoapySDR.SoapySDRKwargsList_front(self)

    def back(self):
        return _SoapySDR.SoapySDRKwargsList_back(self)

    def assign(self, n, x):
        return _SoapySDR.SoapySDRKwargsList_assign(self, n, x)

    def resize(self, *args):
        return _SoapySDR.SoapySDRKwargsList_resize(self, *args)

    def insert(self, *args):
        return _SoapySDR.SoapySDRKwargsList_insert(self, *args)

    def reserve(self, n):
        return _SoapySDR.SoapySDRKwargsList_reserve(self, n)

    def capacity(self):
        return _SoapySDR.SoapySDRKwargsList_capacity(self)
    __swig_destroy__ = _SoapySDR.delete_SoapySDRKwargsList

# Register SoapySDRKwargsList in _SoapySDR:
_SoapySDR.SoapySDRKwargsList_swigregister(SoapySDRKwargsList)
class SoapySDRArgInfoList(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _SoapySDR.SoapySDRArgInfoList_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _SoapySDR.SoapySDRArgInfoList___nonzero__(self)

    def __bool__(self):
        return _SoapySDR.SoapySDRArgInfoList___bool__(self)

    def __len__(self):
        return _SoapySDR.SoapySDRArgInfoList___len__(self)

    def __getslice__(self, i, j):
        return _SoapySDR.SoapySDRArgInfoList___getslice__(self, i, j)

    def __setslice__(self, *args):
        return _SoapySDR.SoapySDRArgInfoList___setslice__(self, *args)

    def __delslice__(self, i, j):
        return _SoapySDR.SoapySDRArgInfoList___delslice__(self, i, j)

    def __delitem__(self, *args):
        return _SoapySDR.SoapySDRArgInfoList___delitem__(self, *args)

    def __getitem__(self, *args):
        return _SoapySDR.SoapySDRArgInfoList___getitem__(self, *args)

    def __setitem__(self, *args):
        return _SoapySDR.SoapySDRArgInfoList___setitem__(self, *args)

    def pop(self):
        return _SoapySDR.SoapySDRArgInfoList_pop(self)

    def append(self, x):
        return _SoapySDR.SoapySDRArgInfoList_append(self, x)

    def empty(self):
        return _SoapySDR.SoapySDRArgInfoList_empty(self)

    def size(self):
        return _SoapySDR.SoapySDRArgInfoList_size(self)

    def swap(self, v):
        return _SoapySDR.SoapySDRArgInfoList_swap(self, v)

    def begin(self):
        return _SoapySDR.SoapySDRArgInfoList_begin(self)

    def end(self):
        return _SoapySDR.SoapySDRArgInfoList_end(self)

    def rbegin(self):
        return _SoapySDR.SoapySDRArgInfoList_rbegin(self)

    def rend(self):
        return _SoapySDR.SoapySDRArgInfoList_rend(self)

    def clear(self):
        return _SoapySDR.SoapySDRArgInfoList_clear(self)

    def get_allocator(self):
        return _SoapySDR.SoapySDRArgInfoList_get_allocator(self)

    def pop_back(self):
        return _SoapySDR.SoapySDRArgInfoList_pop_back(self)

    def erase(self, *args):
        return _SoapySDR.SoapySDRArgInfoList_erase(self, *args)

    def __init__(self, *args):
        _SoapySDR.SoapySDRArgInfoList_swiginit(self, _SoapySDR.new_SoapySDRArgInfoList(*args))

    def push_back(self, x):
        return _SoapySDR.SoapySDRArgInfoList_push_back(self, x)

    def front(self):
        return _SoapySDR.SoapySDRArgInfoList_front(self)

    def back(self):
        return _SoapySDR.SoapySDRArgInfoList_back(self)

    def assign(self, n, x):
        return _SoapySDR.SoapySDRArgInfoList_assign(self, n, x)

    def resize(self, *args):
        return _SoapySDR.SoapySDRArgInfoList_resize(self, *args)

    def insert(self, *args):
        return _SoapySDR.SoapySDRArgInfoList_insert(self, *args)

    def reserve(self, n):
        return _SoapySDR.SoapySDRArgInfoList_reserve(self, n)

    def capacity(self):
        return _SoapySDR.SoapySDRArgInfoList_capacity(self)
    __swig_destroy__ = _SoapySDR.delete_SoapySDRArgInfoList

# Register SoapySDRArgInfoList in _SoapySDR:
_SoapySDR.SoapySDRArgInfoList_swigregister(SoapySDRArgInfoList)
class SoapySDRStringList(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _SoapySDR.SoapySDRStringList_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _SoapySDR.SoapySDRStringList___nonzero__(self)

    def __bool__(self):
        return _SoapySDR.SoapySDRStringList___bool__(self)

    def __len__(self):
        return _SoapySDR.SoapySDRStringList___len__(self)

    def __getslice__(self, i, j):
        return _SoapySDR.SoapySDRStringList___getslice__(self, i, j)

    def __setslice__(self, *args):
        return _SoapySDR.SoapySDRStringList___setslice__(self, *args)

    def __delslice__(self, i, j):
        return _SoapySDR.SoapySDRStringList___delslice__(self, i, j)

    def __delitem__(self, *args):
        return _SoapySDR.SoapySDRStringList___delitem__(self, *args)

    def __getitem__(self, *args):
        return _SoapySDR.SoapySDRStringList___getitem__(self, *args)

    def __setitem__(self, *args):
        return _SoapySDR.SoapySDRStringList___setitem__(self, *args)

    def pop(self):
        return _SoapySDR.SoapySDRStringList_pop(self)

    def append(self, x):
        return _SoapySDR.SoapySDRStringList_append(self, x)

    def empty(self):
        return _SoapySDR.SoapySDRStringList_empty(self)

    def size(self):
        return _SoapySDR.SoapySDRStringList_size(self)

    def swap(self, v):
        return _SoapySDR.SoapySDRStringList_swap(self, v)

    def begin(self):
        return _SoapySDR.SoapySDRStringList_begin(self)

    def end(self):
        return _SoapySDR.SoapySDRStringList_end(self)

    def rbegin(self):
        return _SoapySDR.SoapySDRStringList_rbegin(self)

    def rend(self):
        return _SoapySDR.SoapySDRStringList_rend(self)

    def clear(self):
        return _SoapySDR.SoapySDRStringList_clear(self)

    def get_allocator(self):
        return _SoapySDR.SoapySDRStringList_get_allocator(self)

    def pop_back(self):
        return _SoapySDR.SoapySDRStringList_pop_back(self)

    def erase(self, *args):
        return _SoapySDR.SoapySDRStringList_erase(self, *args)

    def __init__(self, *args):
        _SoapySDR.SoapySDRStringList_swiginit(self, _SoapySDR.new_SoapySDRStringList(*args))

    def push_back(self, x):
        return _SoapySDR.SoapySDRStringList_push_back(self, x)

    def front(self):
        return _SoapySDR.SoapySDRStringList_front(self)

    def back(self):
        return _SoapySDR.SoapySDRStringList_back(self)

    def assign(self, n, x):
        return _SoapySDR.SoapySDRStringList_assign(self, n, x)

    def resize(self, *args):
        return _SoapySDR.SoapySDRStringList_resize(self, *args)

    def insert(self, *args):
        return _SoapySDR.SoapySDRStringList_insert(self, *args)

    def reserve(self, n):
        return _SoapySDR.SoapySDRStringList_reserve(self, n)

    def capacity(self):
        return _SoapySDR.SoapySDRStringList_capacity(self)
    __swig_destroy__ = _SoapySDR.delete_SoapySDRStringList

# Register SoapySDRStringList in _SoapySDR:
_SoapySDR.SoapySDRStringList_swigregister(SoapySDRStringList)
class SoapySDRRangeList(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _SoapySDR.SoapySDRRangeList_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _SoapySDR.SoapySDRRangeList___nonzero__(self)

    def __bool__(self):
        return _SoapySDR.SoapySDRRangeList___bool__(self)

    def __len__(self):
        return _SoapySDR.SoapySDRRangeList___len__(self)

    def __getslice__(self, i, j):
        return _SoapySDR.SoapySDRRangeList___getslice__(self, i, j)

    def __setslice__(self, *args):
        return _SoapySDR.SoapySDRRangeList___setslice__(self, *args)

    def __delslice__(self, i, j):
        return _SoapySDR.SoapySDRRangeList___delslice__(self, i, j)

    def __delitem__(self, *args):
        return _SoapySDR.SoapySDRRangeList___delitem__(self, *args)

    def __getitem__(self, *args):
        return _SoapySDR.SoapySDRRangeList___getitem__(self, *args)

    def __setitem__(self, *args):
        return _SoapySDR.SoapySDRRangeList___setitem__(self, *args)

    def pop(self):
        return _SoapySDR.SoapySDRRangeList_pop(self)

    def append(self, x):
        return _SoapySDR.SoapySDRRangeList_append(self, x)

    def empty(self):
        return _SoapySDR.SoapySDRRangeList_empty(self)

    def size(self):
        return _SoapySDR.SoapySDRRangeList_size(self)

    def swap(self, v):
        return _SoapySDR.SoapySDRRangeList_swap(self, v)

    def begin(self):
        return _SoapySDR.SoapySDRRangeList_begin(self)

    def end(self):
        return _SoapySDR.SoapySDRRangeList_end(self)

    def rbegin(self):
        return _SoapySDR.SoapySDRRangeList_rbegin(self)

    def rend(self):
        return _SoapySDR.SoapySDRRangeList_rend(self)

    def clear(self):
        return _SoapySDR.SoapySDRRangeList_clear(self)

    def get_allocator(self):
        return _SoapySDR.SoapySDRRangeList_get_allocator(self)

    def pop_back(self):
        return _SoapySDR.SoapySDRRangeList_pop_back(self)

    def erase(self, *args):
        return _SoapySDR.SoapySDRRangeList_erase(self, *args)

    def __init__(self, *args):
        _SoapySDR.SoapySDRRangeList_swiginit(self, _SoapySDR.new_SoapySDRRangeList(*args))

    def push_back(self, x):
        return _SoapySDR.SoapySDRRangeList_push_back(self, x)

    def front(self):
        return _SoapySDR.SoapySDRRangeList_front(self)

    def back(self):
        return _SoapySDR.SoapySDRRangeList_back(self)

    def assign(self, n, x):
        return _SoapySDR.SoapySDRRangeList_assign(self, n, x)

    def resize(self, *args):
        return _SoapySDR.SoapySDRRangeList_resize(self, *args)

    def insert(self, *args):
        return _SoapySDR.SoapySDRRangeList_insert(self, *args)

    def reserve(self, n):
        return _SoapySDR.SoapySDRRangeList_reserve(self, n)

    def capacity(self):
        return _SoapySDR.SoapySDRRangeList_capacity(self)
    __swig_destroy__ = _SoapySDR.delete_SoapySDRRangeList

# Register SoapySDRRangeList in _SoapySDR:
_SoapySDR.SoapySDRRangeList_swigregister(SoapySDRRangeList)
class SoapySDRSizeList(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _SoapySDR.SoapySDRSizeList_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _SoapySDR.SoapySDRSizeList___nonzero__(self)

    def __bool__(self):
        return _SoapySDR.SoapySDRSizeList___bool__(self)

    def __len__(self):
        return _SoapySDR.SoapySDRSizeList___len__(self)

    def __getslice__(self, i, j):
        return _SoapySDR.SoapySDRSizeList___getslice__(self, i, j)

    def __setslice__(self, *args):
        return _SoapySDR.SoapySDRSizeList___setslice__(self, *args)

    def __delslice__(self, i, j):
        return _SoapySDR.SoapySDRSizeList___delslice__(self, i, j)

    def __delitem__(self, *args):
        return _SoapySDR.SoapySDRSizeList___delitem__(self, *args)

    def __getitem__(self, *args):
        return _SoapySDR.SoapySDRSizeList___getitem__(self, *args)

    def __setitem__(self, *args):
        return _SoapySDR.SoapySDRSizeList___setitem__(self, *args)

    def pop(self):
        return _SoapySDR.SoapySDRSizeList_pop(self)

    def append(self, x):
        return _SoapySDR.SoapySDRSizeList_append(self, x)

    def empty(self):
        return _SoapySDR.SoapySDRSizeList_empty(self)

    def size(self):
        return _SoapySDR.SoapySDRSizeList_size(self)

    def swap(self, v):
        return _SoapySDR.SoapySDRSizeList_swap(self, v)

    def begin(self):
        return _SoapySDR.SoapySDRSizeList_begin(self)

    def end(self):
        return _SoapySDR.SoapySDRSizeList_end(self)

    def rbegin(self):
        return _SoapySDR.SoapySDRSizeList_rbegin(self)

    def rend(self):
        return _SoapySDR.SoapySDRSizeList_rend(self)

    def clear(self):
        return _SoapySDR.SoapySDRSizeList_clear(self)

    def get_allocator(self):
        return _SoapySDR.SoapySDRSizeList_get_allocator(self)

    def pop_back(self):
        return _SoapySDR.SoapySDRSizeList_pop_back(self)

    def erase(self, *args):
        return _SoapySDR.SoapySDRSizeList_erase(self, *args)

    def __init__(self, *args):
        _SoapySDR.SoapySDRSizeList_swiginit(self, _SoapySDR.new_SoapySDRSizeList(*args))

    def push_back(self, x):
        return _SoapySDR.SoapySDRSizeList_push_back(self, x)

    def front(self):
        return _SoapySDR.SoapySDRSizeList_front(self)

    def back(self):
        return _SoapySDR.SoapySDRSizeList_back(self)

    def assign(self, n, x):
        return _SoapySDR.SoapySDRSizeList_assign(self, n, x)

    def resize(self, *args):
        return _SoapySDR.SoapySDRSizeList_resize(self, *args)

    def insert(self, *args):
        return _SoapySDR.SoapySDRSizeList_insert(self, *args)

    def reserve(self, n):
        return _SoapySDR.SoapySDRSizeList_reserve(self, n)

    def capacity(self):
        return _SoapySDR.SoapySDRSizeList_capacity(self)
    __swig_destroy__ = _SoapySDR.delete_SoapySDRSizeList

# Register SoapySDRSizeList in _SoapySDR:
_SoapySDR.SoapySDRSizeList_swigregister(SoapySDRSizeList)
class SoapySDRDoubleList(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _SoapySDR.SoapySDRDoubleList_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _SoapySDR.SoapySDRDoubleList___nonzero__(self)

    def __bool__(self):
        return _SoapySDR.SoapySDRDoubleList___bool__(self)

    def __len__(self):
        return _SoapySDR.SoapySDRDoubleList___len__(self)

    def __getslice__(self, i, j):
        return _SoapySDR.SoapySDRDoubleList___getslice__(self, i, j)

    def __setslice__(self, *args):
        return _SoapySDR.SoapySDRDoubleList___setslice__(self, *args)

    def __delslice__(self, i, j):
        return _SoapySDR.SoapySDRDoubleList___delslice__(self, i, j)

    def __delitem__(self, *args):
        return _SoapySDR.SoapySDRDoubleList___delitem__(self, *args)

    def __getitem__(self, *args):
        return _SoapySDR.SoapySDRDoubleList___getitem__(self, *args)

    def __setitem__(self, *args):
        return _SoapySDR.SoapySDRDoubleList___setitem__(self, *args)

    def pop(self):
        return _SoapySDR.SoapySDRDoubleList_pop(self)

    def append(self, x):
        return _SoapySDR.SoapySDRDoubleList_append(self, x)

    def empty(self):
        return _SoapySDR.SoapySDRDoubleList_empty(self)

    def size(self):
        return _SoapySDR.SoapySDRDoubleList_size(self)

    def swap(self, v):
        return _SoapySDR.SoapySDRDoubleList_swap(self, v)

    def begin(self):
        return _SoapySDR.SoapySDRDoubleList_begin(self)

    def end(self):
        return _SoapySDR.SoapySDRDoubleList_end(self)

    def rbegin(self):
        return _SoapySDR.SoapySDRDoubleList_rbegin(self)

    def rend(self):
        return _SoapySDR.SoapySDRDoubleList_rend(self)

    def clear(self):
        return _SoapySDR.SoapySDRDoubleList_clear(self)

    def get_allocator(self):
        return _SoapySDR.SoapySDRDoubleList_get_allocator(self)

    def pop_back(self):
        return _SoapySDR.SoapySDRDoubleList_pop_back(self)

    def erase(self, *args):
        return _SoapySDR.SoapySDRDoubleList_erase(self, *args)

    def __init__(self, *args):
        _SoapySDR.SoapySDRDoubleList_swiginit(self, _SoapySDR.new_SoapySDRDoubleList(*args))

    def push_back(self, x):
        return _SoapySDR.SoapySDRDoubleList_push_back(self, x)

    def front(self):
        return _SoapySDR.SoapySDRDoubleList_front(self)

    def back(self):
        return _SoapySDR.SoapySDRDoubleList_back(self)

    def assign(self, n, x):
        return _SoapySDR.SoapySDRDoubleList_assign(self, n, x)

    def resize(self, *args):
        return _SoapySDR.SoapySDRDoubleList_resize(self, *args)

    def insert(self, *args):
        return _SoapySDR.SoapySDRDoubleList_insert(self, *args)

    def reserve(self, n):
        return _SoapySDR.SoapySDRDoubleList_reserve(self, n)

    def capacity(self):
        return _SoapySDR.SoapySDRDoubleList_capacity(self)
    __swig_destroy__ = _SoapySDR.delete_SoapySDRDoubleList

# Register SoapySDRDoubleList in _SoapySDR:
_SoapySDR.SoapySDRDoubleList_swigregister(SoapySDRDoubleList)
class SoapySDRDeviceList(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _SoapySDR.SoapySDRDeviceList_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _SoapySDR.SoapySDRDeviceList___nonzero__(self)

    def __bool__(self):
        return _SoapySDR.SoapySDRDeviceList___bool__(self)

    def __len__(self):
        return _SoapySDR.SoapySDRDeviceList___len__(self)

    def __getslice__(self, i, j):
        return _SoapySDR.SoapySDRDeviceList___getslice__(self, i, j)

    def __setslice__(self, *args):
        return _SoapySDR.SoapySDRDeviceList___setslice__(self, *args)

    def __delslice__(self, i, j):
        return _SoapySDR.SoapySDRDeviceList___delslice__(self, i, j)

    def __delitem__(self, *args):
        return _SoapySDR.SoapySDRDeviceList___delitem__(self, *args)

    def __getitem__(self, *args):
        return _SoapySDR.SoapySDRDeviceList___getitem__(self, *args)

    def __setitem__(self, *args):
        return _SoapySDR.SoapySDRDeviceList___setitem__(self, *args)

    def pop(self):
        return _SoapySDR.SoapySDRDeviceList_pop(self)

    def append(self, x):
        return _SoapySDR.SoapySDRDeviceList_append(self, x)

    def empty(self):
        return _SoapySDR.SoapySDRDeviceList_empty(self)

    def size(self):
        return _SoapySDR.SoapySDRDeviceList_size(self)

    def swap(self, v):
        return _SoapySDR.SoapySDRDeviceList_swap(self, v)

    def begin(self):
        return _SoapySDR.SoapySDRDeviceList_begin(self)

    def end(self):
        return _SoapySDR.SoapySDRDeviceList_end(self)

    def rbegin(self):
        return _SoapySDR.SoapySDRDeviceList_rbegin(self)

    def rend(self):
        return _SoapySDR.SoapySDRDeviceList_rend(self)

    def clear(self):
        return _SoapySDR.SoapySDRDeviceList_clear(self)

    def get_allocator(self):
        return _SoapySDR.SoapySDRDeviceList_get_allocator(self)

    def pop_back(self):
        return _SoapySDR.SoapySDRDeviceList_pop_back(self)

    def erase(self, *args):
        return _SoapySDR.SoapySDRDeviceList_erase(self, *args)

    def __init__(self, *args):
        _SoapySDR.SoapySDRDeviceList_swiginit(self, _SoapySDR.new_SoapySDRDeviceList(*args))

    def push_back(self, x):
        return _SoapySDR.SoapySDRDeviceList_push_back(self, x)

    def front(self):
        return _SoapySDR.SoapySDRDeviceList_front(self)

    def back(self):
        return _SoapySDR.SoapySDRDeviceList_back(self)

    def assign(self, n, x):
        return _SoapySDR.SoapySDRDeviceList_assign(self, n, x)

    def resize(self, *args):
        return _SoapySDR.SoapySDRDeviceList_resize(self, *args)

    def insert(self, *args):
        return _SoapySDR.SoapySDRDeviceList_insert(self, *args)

    def reserve(self, n):
        return _SoapySDR.SoapySDRDeviceList_reserve(self, n)

    def capacity(self):
        return _SoapySDR.SoapySDRDeviceList_capacity(self)
    __swig_destroy__ = _SoapySDR.delete_SoapySDRDeviceList

# Register SoapySDRDeviceList in _SoapySDR:
_SoapySDR.SoapySDRDeviceList_swigregister(SoapySDRDeviceList)
class StreamResult(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _SoapySDR.StreamResult_swiginit(self, _SoapySDR.new_StreamResult())
    ret = property(_SoapySDR.StreamResult_ret_get, _SoapySDR.StreamResult_ret_set)
    flags = property(_SoapySDR.StreamResult_flags_get, _SoapySDR.StreamResult_flags_set)
    timeNs = property(_SoapySDR.StreamResult_timeNs_get, _SoapySDR.StreamResult_timeNs_set)
    chanMask = property(_SoapySDR.StreamResult_chanMask_get, _SoapySDR.StreamResult_chanMask_set)

    def __str__(self):
        return "ret=%s, flags=%s, timeNs=%s"%(self.ret, self.flags, self.timeNs)

    __swig_destroy__ = _SoapySDR.delete_StreamResult

# Register StreamResult in _SoapySDR:
_SoapySDR.StreamResult_swigregister(StreamResult)
SOAPY_SDR_TX = _SoapySDR.SOAPY_SDR_TX
SOAPY_SDR_RX = _SoapySDR.SOAPY_SDR_RX
SOAPY_SDR_END_BURST = _SoapySDR.SOAPY_SDR_END_BURST
SOAPY_SDR_HAS_TIME = _SoapySDR.SOAPY_SDR_HAS_TIME
SOAPY_SDR_END_ABRUPT = _SoapySDR.SOAPY_SDR_END_ABRUPT
SOAPY_SDR_ONE_PACKET = _SoapySDR.SOAPY_SDR_ONE_PACKET
SOAPY_SDR_MORE_FRAGMENTS = _SoapySDR.SOAPY_SDR_MORE_FRAGMENTS
SOAPY_SDR_WAIT_TRIGGER = _SoapySDR.SOAPY_SDR_WAIT_TRIGGER
SOAPY_SDR_TRUE = _SoapySDR.SOAPY_SDR_TRUE
SOAPY_SDR_FALSE = _SoapySDR.SOAPY_SDR_FALSE
class SoapySDRRange(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    minimum = property(_SoapySDR.SoapySDRRange_minimum_get, _SoapySDR.SoapySDRRange_minimum_set)
    maximum = property(_SoapySDR.SoapySDRRange_maximum_get, _SoapySDR.SoapySDRRange_maximum_set)
    step = property(_SoapySDR.SoapySDRRange_step_get, _SoapySDR.SoapySDRRange_step_set)

    def __init__(self):
        _SoapySDR.SoapySDRRange_swiginit(self, _SoapySDR.new_SoapySDRRange())
    __swig_destroy__ = _SoapySDR.delete_SoapySDRRange

# Register SoapySDRRange in _SoapySDR:
_SoapySDR.SoapySDRRange_swigregister(SoapySDRRange)

def SoapySDRKwargs_fromString(markup):
    return _SoapySDR.SoapySDRKwargs_fromString(markup)

def SoapySDRKwargs_toString(args):
    return _SoapySDR.SoapySDRKwargs_toString(args)
SOAPY_SDR_ARG_INFO_BOOL = _SoapySDR.SOAPY_SDR_ARG_INFO_BOOL
SOAPY_SDR_ARG_INFO_INT = _SoapySDR.SOAPY_SDR_ARG_INFO_INT
SOAPY_SDR_ARG_INFO_FLOAT = _SoapySDR.SOAPY_SDR_ARG_INFO_FLOAT
SOAPY_SDR_ARG_INFO_STRING = _SoapySDR.SOAPY_SDR_ARG_INFO_STRING
class SoapySDRArgInfo(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    key = property(_SoapySDR.SoapySDRArgInfo_key_get, _SoapySDR.SoapySDRArgInfo_key_set)
    value = property(_SoapySDR.SoapySDRArgInfo_value_get, _SoapySDR.SoapySDRArgInfo_value_set)
    name = property(_SoapySDR.SoapySDRArgInfo_name_get, _SoapySDR.SoapySDRArgInfo_name_set)
    description = property(_SoapySDR.SoapySDRArgInfo_description_get, _SoapySDR.SoapySDRArgInfo_description_set)
    units = property(_SoapySDR.SoapySDRArgInfo_units_get, _SoapySDR.SoapySDRArgInfo_units_set)
    type = property(_SoapySDR.SoapySDRArgInfo_type_get, _SoapySDR.SoapySDRArgInfo_type_set)
    range = property(_SoapySDR.SoapySDRArgInfo_range_get, _SoapySDR.SoapySDRArgInfo_range_set)
    numOptions = property(_SoapySDR.SoapySDRArgInfo_numOptions_get, _SoapySDR.SoapySDRArgInfo_numOptions_set)
    options = property(_SoapySDR.SoapySDRArgInfo_options_get, _SoapySDR.SoapySDRArgInfo_options_set)
    optionNames = property(_SoapySDR.SoapySDRArgInfo_optionNames_get, _SoapySDR.SoapySDRArgInfo_optionNames_set)

    def __init__(self):
        _SoapySDR.SoapySDRArgInfo_swiginit(self, _SoapySDR.new_SoapySDRArgInfo())
    __swig_destroy__ = _SoapySDR.delete_SoapySDRArgInfo

# Register SoapySDRArgInfo in _SoapySDR:
_SoapySDR.SoapySDRArgInfo_swigregister(SoapySDRArgInfo)

def SoapySDR_free(ptr):
    return _SoapySDR.SoapySDR_free(ptr)

def SoapySDRStrings_clear(elems, length):
    return _SoapySDR.SoapySDRStrings_clear(elems, length)

def SoapySDRKwargs_set(args, key, val):
    return _SoapySDR.SoapySDRKwargs_set(args, key, val)

def SoapySDRKwargs_get(args, key):
    return _SoapySDR.SoapySDRKwargs_get(args, key)

def SoapySDRArgInfo_clear(info):
    return _SoapySDR.SoapySDRArgInfo_clear(info)

def SoapySDR_errToStr(errorCode):
    return _SoapySDR.SoapySDR_errToStr(errorCode)
SOAPY_SDR_TIMEOUT = _SoapySDR.SOAPY_SDR_TIMEOUT
SOAPY_SDR_STREAM_ERROR = _SoapySDR.SOAPY_SDR_STREAM_ERROR
SOAPY_SDR_CORRUPTION = _SoapySDR.SOAPY_SDR_CORRUPTION
SOAPY_SDR_OVERFLOW = _SoapySDR.SOAPY_SDR_OVERFLOW
SOAPY_SDR_NOT_SUPPORTED = _SoapySDR.SOAPY_SDR_NOT_SUPPORTED
SOAPY_SDR_TIME_ERROR = _SoapySDR.SOAPY_SDR_TIME_ERROR
SOAPY_SDR_UNDERFLOW = _SoapySDR.SOAPY_SDR_UNDERFLOW
SOAPY_SDR_API_VERSION = _SoapySDR.SOAPY_SDR_API_VERSION
SOAPY_SDR_ABI_VERSION = _SoapySDR.SOAPY_SDR_ABI_VERSION

def SoapySDR_getAPIVersion():
    return _SoapySDR.SoapySDR_getAPIVersion()

def SoapySDR_getABIVersion():
    return _SoapySDR.SoapySDR_getABIVersion()

def SoapySDR_getLibVersion():
    return _SoapySDR.SoapySDR_getLibVersion()
SOAPY_SDR_CF64 = _SoapySDR.SOAPY_SDR_CF64
SOAPY_SDR_CF32 = _SoapySDR.SOAPY_SDR_CF32
SOAPY_SDR_CS32 = _SoapySDR.SOAPY_SDR_CS32
SOAPY_SDR_CU32 = _SoapySDR.SOAPY_SDR_CU32
SOAPY_SDR_CS16 = _SoapySDR.SOAPY_SDR_CS16
SOAPY_SDR_CU16 = _SoapySDR.SOAPY_SDR_CU16
SOAPY_SDR_CS12 = _SoapySDR.SOAPY_SDR_CS12
SOAPY_SDR_CU12 = _SoapySDR.SOAPY_SDR_CU12
SOAPY_SDR_CS8 = _SoapySDR.SOAPY_SDR_CS8
SOAPY_SDR_CU8 = _SoapySDR.SOAPY_SDR_CU8
SOAPY_SDR_CS4 = _SoapySDR.SOAPY_SDR_CS4
SOAPY_SDR_CU4 = _SoapySDR.SOAPY_SDR_CU4
SOAPY_SDR_F64 = _SoapySDR.SOAPY_SDR_F64
SOAPY_SDR_F32 = _SoapySDR.SOAPY_SDR_F32
SOAPY_SDR_S32 = _SoapySDR.SOAPY_SDR_S32
SOAPY_SDR_U32 = _SoapySDR.SOAPY_SDR_U32
SOAPY_SDR_S16 = _SoapySDR.SOAPY_SDR_S16
SOAPY_SDR_U16 = _SoapySDR.SOAPY_SDR_U16
SOAPY_SDR_S8 = _SoapySDR.SOAPY_SDR_S8
SOAPY_SDR_U8 = _SoapySDR.SOAPY_SDR_U8

def SoapySDR_formatToSize(format):
    return _SoapySDR.SoapySDR_formatToSize(format)
SOAPY_SDR_FATAL = _SoapySDR.SOAPY_SDR_FATAL
SOAPY_SDR_CRITICAL = _SoapySDR.SOAPY_SDR_CRITICAL
SOAPY_SDR_ERROR = _SoapySDR.SOAPY_SDR_ERROR
SOAPY_SDR_WARNING = _SoapySDR.SOAPY_SDR_WARNING
SOAPY_SDR_NOTICE = _SoapySDR.SOAPY_SDR_NOTICE
SOAPY_SDR_INFO = _SoapySDR.SOAPY_SDR_INFO
SOAPY_SDR_DEBUG = _SoapySDR.SOAPY_SDR_DEBUG
SOAPY_SDR_TRACE = _SoapySDR.SOAPY_SDR_TRACE
SOAPY_SDR_SSI = _SoapySDR.SOAPY_SDR_SSI

def SoapySDR_log(logLevel, message):
    return _SoapySDR.SoapySDR_log(logLevel, message)

def SoapySDR_setLogLevel(logLevel):
    return _SoapySDR.SoapySDR_setLogLevel(logLevel)

def log(logLevel, message):
    return _SoapySDR.log(logLevel, message)

def setLogLevel(logLevel):
    return _SoapySDR.setLogLevel(logLevel)
class _SoapySDR_pythonLogHandlerBase(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        if self.__class__ == _SoapySDR_pythonLogHandlerBase:
            _self = None
        else:
            _self = self
        _SoapySDR._SoapySDR_pythonLogHandlerBase_swiginit(self, _SoapySDR.new__SoapySDR_pythonLogHandlerBase(_self, ))
    __swig_destroy__ = _SoapySDR.delete__SoapySDR_pythonLogHandlerBase

    def handle(self, arg0, arg1):
        return _SoapySDR._SoapySDR_pythonLogHandlerBase_handle(self, arg0, arg1)
    def __disown__(self):
        self.this.disown()
        _SoapySDR.disown__SoapySDR_pythonLogHandlerBase(self)
        return weakref.proxy(self)

# Register _SoapySDR_pythonLogHandlerBase in _SoapySDR:
_SoapySDR._SoapySDR_pythonLogHandlerBase_swigregister(_SoapySDR_pythonLogHandlerBase)

_SoapySDR_globalLogHandlers = [None]

class _SoapySDR_pythonLogHandler(_SoapySDR_pythonLogHandlerBase):
    def __init__(self, handler):
        self.handler = handler
        getattr(_SoapySDR_pythonLogHandlerBase, '__init__')(self)

    def handle(self, *args): self.handler(*args)

def registerLogHandler(handler):
    """Register a new system log handler.

    Platforms should call this to replace the default stdio handler.

    :param handler: is a callback function that's called each time an event is
    to be logged by the SoapySDR module.  It is passed the log level and the
    the log message.  The callback shouldn't return anything, but may throw
    exceptions which can be handled in turn in the Python client code.
    Alternately, setting handler to None restores the default.

    :type handler: Callable[[int, str], None] or None

    :returns: None
    """
    if handler is None:
        _SoapySDR_globalLogHandlers[0] = None
    else:
        _SoapySDR_globalLogHandlers[0] = _SoapySDR_pythonLogHandler(handler)


def errToStr(errorCode):
    return _SoapySDR.errToStr(errorCode)

def getAPIVersion():
    return _SoapySDR.getAPIVersion()

def getABIVersion():
    return _SoapySDR.getABIVersion()

def getLibVersion():
    return _SoapySDR.getLibVersion()

def getRootPath():
    return _SoapySDR.getRootPath()

def listSearchPaths():
    return _SoapySDR.listSearchPaths()

def listModules(*args):
    return _SoapySDR.listModules(*args)

def loadModule(path):
    return _SoapySDR.loadModule(path)

def getLoaderResult(path):
    return _SoapySDR.getLoaderResult(path)

def getModuleVersion(path):
    return _SoapySDR.getModuleVersion(path)

def unloadModule(path):
    return _SoapySDR.unloadModule(path)

def loadModules():
    return _SoapySDR.loadModules()

def unloadModules():
    return _SoapySDR.unloadModules()
class ModuleManager(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, load=True):
        _SoapySDR.ModuleManager_swiginit(self, _SoapySDR.new_ModuleManager(load))
    __swig_destroy__ = _SoapySDR.delete_ModuleManager

# Register ModuleManager in _SoapySDR:
_SoapySDR.ModuleManager_swigregister(ModuleManager)
class ModuleVersion(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, version):
        _SoapySDR.ModuleVersion_swiginit(self, _SoapySDR.new_ModuleVersion(version))
    __swig_destroy__ = _SoapySDR.delete_ModuleVersion

# Register ModuleVersion in _SoapySDR:
_SoapySDR.ModuleVersion_swigregister(ModuleVersion)

def formatToSize(format):
    return _SoapySDR.formatToSize(format)

def ticksToTimeNs(ticks, rate):
    return _SoapySDR.ticksToTimeNs(ticks, rate)

def timeNsToTicks(timeNs, rate):
    return _SoapySDR.timeNsToTicks(timeNs, rate)
class Device(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined")
    __repr__ = _swig_repr
    __swig_destroy__ = _SoapySDR.delete_Device

    @staticmethod
    def enumerate(*args):
        return _SoapySDR.Device_enumerate(*args)

    @staticmethod
    def make(*args):
        return _SoapySDR.Device_make(*args)

    @staticmethod
    def unmake(*args):
        return _SoapySDR.Device_unmake(*args)

    def getDriverKey(self):
        return _SoapySDR.Device_getDriverKey(self)

    def getHardwareKey(self):
        return _SoapySDR.Device_getHardwareKey(self)

    def getHardwareInfo(self):
        return _SoapySDR.Device_getHardwareInfo(self)

    def setFrontendMapping(self, direction, mapping):
        return _SoapySDR.Device_setFrontendMapping(self, direction, mapping)

    def getFrontendMapping(self, direction):
        return _SoapySDR.Device_getFrontendMapping(self, direction)

    def getNumChannels(self, direction):
        return _SoapySDR.Device_getNumChannels(self, direction)

    def getChannelInfo(self, direction, channel):
        return _SoapySDR.Device_getChannelInfo(self, direction, channel)

    def getFullDuplex(self, direction, channel):
        return _SoapySDR.Device_getFullDuplex(self, direction, channel)

    def getStreamFormats(self, direction, channel):
        return _SoapySDR.Device_getStreamFormats(self, direction, channel)

    def getNativeStreamFormat(self, direction, channel, fullScale):
        return _SoapySDR.Device_getNativeStreamFormat(self, direction, channel, fullScale)

    def getStreamArgsInfo(self, direction, channel):
        return _SoapySDR.Device_getStreamArgsInfo(self, direction, channel)

    def setupStream(self, *args):
        return _SoapySDR.Device_setupStream(self, *args)

    def closeStream(self, stream):
        return _SoapySDR.Device_closeStream(self, stream)

    def getStreamMTU(self, stream):
        return _SoapySDR.Device_getStreamMTU(self, stream)

    def activateStream(self, stream, flags=0, timeNs=0, numElems=0):
        return _SoapySDR.Device_activateStream(self, stream, flags, timeNs, numElems)

    def deactivateStream(self, stream, flags=0, timeNs=0):
        return _SoapySDR.Device_deactivateStream(self, stream, flags, timeNs)

    def readStream(self, stream, buffs, numElems, flags, timeNs, timeoutUs=100000):
        return _SoapySDR.Device_readStream(self, stream, buffs, numElems, flags, timeNs, timeoutUs)

    def writeStream(self, stream, buffs, numElems, flags, timeNs=0, timeoutUs=100000):
        return _SoapySDR.Device_writeStream(self, stream, buffs, numElems, flags, timeNs, timeoutUs)

    def readStreamStatus(self, stream, chanMask, flags, timeNs, timeoutUs=100000):
        return _SoapySDR.Device_readStreamStatus(self, stream, chanMask, flags, timeNs, timeoutUs)

    def getNumDirectAccessBuffers(self, stream):
        return _SoapySDR.Device_getNumDirectAccessBuffers(self, stream)

    def getDirectAccessBufferAddrs(self, stream, handle, buffs):
        return _SoapySDR.Device_getDirectAccessBufferAddrs(self, stream, handle, buffs)

    def acquireReadBuffer(self, stream, handle, buffs, flags, timeNs, timeoutUs=100000):
        return _SoapySDR.Device_acquireReadBuffer(self, stream, handle, buffs, flags, timeNs, timeoutUs)

    def releaseReadBuffer(self, stream, handle):
        return _SoapySDR.Device_releaseReadBuffer(self, stream, handle)

    def acquireWriteBuffer(self, stream, handle, buffs, timeoutUs=100000):
        return _SoapySDR.Device_acquireWriteBuffer(self, stream, handle, buffs, timeoutUs)

    def releaseWriteBuffer(self, stream, handle, numElems, flags, timeNs=0):
        return _SoapySDR.Device_releaseWriteBuffer(self, stream, handle, numElems, flags, timeNs)

    def listAntennas(self, direction, channel):
        return _SoapySDR.Device_listAntennas(self, direction, channel)

    def setAntenna(self, direction, channel, name):
        return _SoapySDR.Device_setAntenna(self, direction, channel, name)

    def getAntenna(self, direction, channel):
        return _SoapySDR.Device_getAntenna(self, direction, channel)

    def hasDCOffsetMode(self, direction, channel):
        return _SoapySDR.Device_hasDCOffsetMode(self, direction, channel)

    def setDCOffsetMode(self, direction, channel, automatic):
        return _SoapySDR.Device_setDCOffsetMode(self, direction, channel, automatic)

    def getDCOffsetMode(self, direction, channel):
        return _SoapySDR.Device_getDCOffsetMode(self, direction, channel)

    def hasDCOffset(self, direction, channel):
        return _SoapySDR.Device_hasDCOffset(self, direction, channel)

    def setDCOffset(self, direction, channel, offset):
        return _SoapySDR.Device_setDCOffset(self, direction, channel, offset)

    def getDCOffset(self, direction, channel):
        return _SoapySDR.Device_getDCOffset(self, direction, channel)

    def hasIQBalance(self, direction, channel):
        return _SoapySDR.Device_hasIQBalance(self, direction, channel)

    def setIQBalance(self, direction, channel, balance):
        return _SoapySDR.Device_setIQBalance(self, direction, channel, balance)

    def getIQBalance(self, direction, channel):
        return _SoapySDR.Device_getIQBalance(self, direction, channel)

    def hasIQBalanceMode(self, direction, channel):
        return _SoapySDR.Device_hasIQBalanceMode(self, direction, channel)

    def setIQBalanceMode(self, direction, channel, automatic):
        return _SoapySDR.Device_setIQBalanceMode(self, direction, channel, automatic)

    def getIQBalanceMode(self, direction, channel):
        return _SoapySDR.Device_getIQBalanceMode(self, direction, channel)

    def hasFrequencyCorrection(self, direction, channel):
        return _SoapySDR.Device_hasFrequencyCorrection(self, direction, channel)

    def setFrequencyCorrection(self, direction, channel, value):
        return _SoapySDR.Device_setFrequencyCorrection(self, direction, channel, value)

    def getFrequencyCorrection(self, direction, channel):
        return _SoapySDR.Device_getFrequencyCorrection(self, direction, channel)

    def listGains(self, direction, channel):
        return _SoapySDR.Device_listGains(self, direction, channel)

    def hasGainMode(self, direction, channel):
        return _SoapySDR.Device_hasGainMode(self, direction, channel)

    def setGainMode(self, direction, channel, automatic):
        return _SoapySDR.Device_setGainMode(self, direction, channel, automatic)

    def getGainMode(self, direction, channel):
        return _SoapySDR.Device_getGainMode(self, direction, channel)

    def setGain(self, *args):
        return _SoapySDR.Device_setGain(self, *args)

    def getGain(self, *args):
        return _SoapySDR.Device_getGain(self, *args)

    def getGainRange(self, *args):
        return _SoapySDR.Device_getGainRange(self, *args)

    def setFrequency(self, *args):
        return _SoapySDR.Device_setFrequency(self, *args)

    def getFrequency(self, *args):
        return _SoapySDR.Device_getFrequency(self, *args)

    def listFrequencies(self, direction, channel):
        return _SoapySDR.Device_listFrequencies(self, direction, channel)

    def getFrequencyRange(self, *args):
        return _SoapySDR.Device_getFrequencyRange(self, *args)

    def getFrequencyArgsInfo(self, direction, channel):
        return _SoapySDR.Device_getFrequencyArgsInfo(self, direction, channel)

    def setSampleRate(self, direction, channel, rate):
        return _SoapySDR.Device_setSampleRate(self, direction, channel, rate)

    def getSampleRate(self, direction, channel):
        return _SoapySDR.Device_getSampleRate(self, direction, channel)

    def listSampleRates(self, direction, channel):
        return _SoapySDR.Device_listSampleRates(self, direction, channel)

    def getSampleRateRange(self, direction, channel):
        return _SoapySDR.Device_getSampleRateRange(self, direction, channel)

    def setBandwidth(self, direction, channel, bw):
        return _SoapySDR.Device_setBandwidth(self, direction, channel, bw)

    def getBandwidth(self, direction, channel):
        return _SoapySDR.Device_getBandwidth(self, direction, channel)

    def listBandwidths(self, direction, channel):
        return _SoapySDR.Device_listBandwidths(self, direction, channel)

    def getBandwidthRange(self, direction, channel):
        return _SoapySDR.Device_getBandwidthRange(self, direction, channel)

    def setMasterClockRate(self, rate):
        return _SoapySDR.Device_setMasterClockRate(self, rate)

    def getMasterClockRate(self):
        return _SoapySDR.Device_getMasterClockRate(self)

    def getMasterClockRates(self):
        return _SoapySDR.Device_getMasterClockRates(self)

    def setReferenceClockRate(self, rate):
        return _SoapySDR.Device_setReferenceClockRate(self, rate)

    def getReferenceClockRate(self):
        return _SoapySDR.Device_getReferenceClockRate(self)

    def getReferenceClockRates(self):
        return _SoapySDR.Device_getReferenceClockRates(self)

    def listClockSources(self):
        return _SoapySDR.Device_listClockSources(self)

    def setClockSource(self, source):
        return _SoapySDR.Device_setClockSource(self, source)

    def getClockSource(self):
        return _SoapySDR.Device_getClockSource(self)

    def listTimeSources(self):
        return _SoapySDR.Device_listTimeSources(self)

    def setTimeSource(self, source):
        return _SoapySDR.Device_setTimeSource(self, source)

    def getTimeSource(self):
        return _SoapySDR.Device_getTimeSource(self)

    def hasHardwareTime(self, *args):
        return _SoapySDR.Device_hasHardwareTime(self, *args)

    def getHardwareTime(self, *args):
        return _SoapySDR.Device_getHardwareTime(self, *args)

    def setHardwareTime(self, *args):
        return _SoapySDR.Device_setHardwareTime(self, *args)

    def setCommandTime(self, *args):
        return _SoapySDR.Device_setCommandTime(self, *args)

    def listSensors(self, *args):
        return _SoapySDR.Device_listSensors(self, *args)

    def getSensorInfo(self, *args):
        return _SoapySDR.Device_getSensorInfo(self, *args)

    def readSensor(self, *args):
        return _SoapySDR.Device_readSensor(self, *args)

    def listRegisterInterfaces(self):
        return _SoapySDR.Device_listRegisterInterfaces(self)

    def writeRegister(self, *args):
        return _SoapySDR.Device_writeRegister(self, *args)

    def readRegister(self, *args):
        return _SoapySDR.Device_readRegister(self, *args)

    def writeRegisters(self, name, addr, value):
        return _SoapySDR.Device_writeRegisters(self, name, addr, value)

    def readRegisters(self, name, addr, length):
        return _SoapySDR.Device_readRegisters(self, name, addr, length)

    def getSettingInfo(self, *args):
        return _SoapySDR.Device_getSettingInfo(self, *args)

    def readSetting(self, *args):
        return _SoapySDR.Device_readSetting(self, *args)

    def listGPIOBanks(self):
        return _SoapySDR.Device_listGPIOBanks(self)

    def writeGPIO(self, *args):
        return _SoapySDR.Device_writeGPIO(self, *args)

    def readGPIO(self, bank):
        return _SoapySDR.Device_readGPIO(self, bank)

    def writeGPIODir(self, *args):
        return _SoapySDR.Device_writeGPIODir(self, *args)

    def readGPIODir(self, bank):
        return _SoapySDR.Device_readGPIODir(self, bank)

    def writeI2C(self, addr, data):
        return _SoapySDR.Device_writeI2C(self, addr, data)

    def readI2C(self, addr, numBytes):
        return _SoapySDR.Device_readI2C(self, addr, numBytes)

    def transactSPI(self, addr, data, numBits):
        return _SoapySDR.Device_transactSPI(self, addr, data, numBits)

    def listUARTs(self):
        return _SoapySDR.Device_listUARTs(self)

    def writeUART(self, which, data):
        return _SoapySDR.Device_writeUART(self, which, data)

    def readUART(self, which, timeoutUs=100000):
        return _SoapySDR.Device_readUART(self, which, timeoutUs)

    def getNativeDeviceHandle(self):
        return _SoapySDR.Device_getNativeDeviceHandle(self)

    def writeSetting(self, *args):
        return _SoapySDR.Device_writeSetting(self, *args)

    def readSensorBool(self, *args):
        return _SoapySDR.Device_readSensorBool(self, *args)

    def readSensorInt(self, *args):
        return _SoapySDR.Device_readSensorInt(self, *args)

    def readSensorFloat(self, *args):
        return _SoapySDR.Device_readSensorFloat(self, *args)

    def readSettingBool(self, *args):
        return _SoapySDR.Device_readSettingBool(self, *args)

    def readSettingInt(self, *args):
        return _SoapySDR.Device_readSettingInt(self, *args)

    def readSettingFloat(self, *args):
        return _SoapySDR.Device_readSettingFloat(self, *args)

    def readStream__(self, stream, buffs, numElems, flags, timeoutUs):
        return _SoapySDR.Device_readStream__(self, stream, buffs, numElems, flags, timeoutUs)

    def writeStream__(self, stream, buffs, numElems, flags, timeNs, timeoutUs):
        return _SoapySDR.Device_writeStream__(self, stream, buffs, numElems, flags, timeNs, timeoutUs)

    def readStreamStatus__(self, stream, timeoutUs):
        return _SoapySDR.Device_readStreamStatus__(self, stream, timeoutUs)

            #manually unmake and flag for future calls and the deleter
    def close(self):
        try: getattr(self, '__closed__')
        except AttributeError: Device.unmake(self)
        setattr(self, '__closed__', True)

    def __del__(self): self.close()

    def __str__(self):
        return "%s:%s"%(self.getDriverKey(), self.getHardwareKey())

    def readStream(self, stream, buffs, numElems, flags = 0, timeoutUs = 100000):
        ptrs = [extractBuffPointer(b) for b in buffs]
        return self.readStream__(stream, ptrs, numElems, flags, timeoutUs)

    def writeStream(self, stream, buffs, numElems, flags = 0, timeNs = 0, timeoutUs = 100000):
        ptrs = [extractBuffPointer(b) for b in buffs]
        return self.writeStream__(stream, ptrs, numElems, flags, timeNs, timeoutUs)

    def readStreamStatus(self, stream, timeoutUs = 100000):
        return self.readStreamStatus__(stream, timeoutUs)


# Register Device in _SoapySDR:
_SoapySDR.Device_swigregister(Device)


__all__ = list()
for key in sorted(globals().keys()):
    if key.startswith('SOAPY_SDR_'):
        __all__.append(key)


class Device(Device):
    def __new__(cls, *args, **kwargs):
        return cls.make(*args, **kwargs)

def extractBuffPointer(buff):
    if hasattr(buff, '__array_interface__'): return buff.__array_interface__['data'][0]
    if hasattr(buff, 'buffer_info'): return buff.buffer_info()[0]
    if hasattr(buff, '__long__'): return long(buff)
    if hasattr(buff, '__int__'): return int(buff)
    raise Exception("Unrecognized data format: " + str(type(buff)))


