Source code for pyupm_hdxxvxta

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

_pyupm_hdxxvxta.HDXXVXTA_DEFAULT_AREF_swigconstant(_pyupm_hdxxvxta)
HDXXVXTA_DEFAULT_AREF = _pyupm_hdxxvxta.HDXXVXTA_DEFAULT_AREF
[docs]class HDXXVXTA(_object): """ API for the Veris HDXXVXTA Humidity Transmitter. ID: hdxxvxta Name: Veris HDXXVXTA Temperature/humidity Transmitter Category: temp Manufacturer: veris Connection: analog Link:http://www.veris.com/Item/HD2NVSTA1.aspx The driver was developed using the HD2NVSTA1 humidity transmitter. The 'T' variant supports a temperature transmitter as well. Both signals are provided by the device as analog 0-5Vdc or 0-10Vdc outputs. The A1 variant supports a temperature range of -40C-50C, while the A2 variant supports a range of 0C-50C. Humidity ranges for all devices in this device family range from 0% to 100% (non- condensing). This driver used the 5Vdc outputs for obvious reasons. Your MCU must be configured for 5V operation. Using any other analog reference voltage will require the appropriate external circuitry (such as a voltage divider) in order to interface safely with your MCU. For devices which do not support temperature, use '-1' as the temperature pin number in the object constructor. If temperature measurement is disabled, getTemperature() will always return 0C/32F. C++ includes: hdxxvxta.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, HDXXVXTA, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, HDXXVXTA, name) __repr__ = _swig_repr RANGE_MINUS40_50 = _pyupm_hdxxvxta.HDXXVXTA_RANGE_MINUS40_50 RANGE_0_50 = _pyupm_hdxxvxta.HDXXVXTA_RANGE_0_50 def __init__(self, hPin, tPin, aref=5.0): """ HDXXVXTA(int hPin, int tPin, float aref=HDXXVXTA_DEFAULT_AREF) HDXXVXTA object constructor Parameters: ----------- hPin: Analog pin to use for the humidity measurement tPin: Analog pin to use for temperature. If your device does not support temperature, use -1 as the value so that temperature will not be queried and an analog pin won't be wasted. aref: The analog reference voltage, default 5.0 """ this = _pyupm_hdxxvxta.new_HDXXVXTA(hPin, tPin, aref) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_hdxxvxta.delete_HDXXVXTA __del__ = lambda self: None
[docs] def setRange(self, *args): """ void setRange(RANGE_T range=RANGE_MINUS40_50) Set the temperature range of the sensor. HD*A1 sensors support a range of -40C-50C, while HD*A2 devices support a temperature range of 0C- 50C. The constructor sets a default of RANGE_MINUS40_50. Parameters: ----------- range: One of the RANGE_T values, default is RANGE_MINUS40_50 """ return _pyupm_hdxxvxta.HDXXVXTA_setRange(self, *args)
[docs] def update(self): """ void update() Read current values from the sensor and update internal stored values. This method must be called prior to querying any values, such as temperature or humidity. """ return _pyupm_hdxxvxta.HDXXVXTA_update(self)
[docs] def getTemperature(self, fahrenheit=False): """ float getTemperature(bool fahrenheit=false) Get the current temperature. update() must have been called prior to calling this method. If temperature measurement was disabled (by passing -1 as the temperature pin in the constructor) then this function will always return 0C/32F. Parameters: ----------- fahrenheit: true to return the temperature in degrees fahrenheit, false to return the temperature in degrees celsius. The default is false (degrees Celsius). The last temperature reading in Celsius or Fahrenheit """ return _pyupm_hdxxvxta.HDXXVXTA_getTemperature(self, fahrenheit)
[docs] def getHumidity(self): """ float getHumidity() Get the current relative humidity. update() must have been called prior to calling this method. The last humidity reading """ return _pyupm_hdxxvxta.HDXXVXTA_getHumidity(self)
HDXXVXTA_swigregister = _pyupm_hdxxvxta.HDXXVXTA_swigregister HDXXVXTA_swigregister(HDXXVXTA) # This file is compatible with both classic and new-style classes.