# 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_t3311', [dirname(__file__)])
except ImportError:
import _pyupm_t3311
return _pyupm_t3311
if fp is not None:
try:
_mod = imp.load_module('_pyupm_t3311', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_t3311 = swig_import_helper()
del swig_import_helper
else:
import _pyupm_t3311
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_t3311.getVersion()
getVersion = _pyupm_t3311.getVersion
def new_floatp():
return _pyupm_t3311.new_floatp()
new_floatp = _pyupm_t3311.new_floatp
def copy_floatp(value):
return _pyupm_t3311.copy_floatp(value)
copy_floatp = _pyupm_t3311.copy_floatp
def delete_floatp(obj):
return _pyupm_t3311.delete_floatp(obj)
delete_floatp = _pyupm_t3311.delete_floatp
def floatp_assign(obj, value):
return _pyupm_t3311.floatp_assign(obj, value)
floatp_assign = _pyupm_t3311.floatp_assign
def floatp_value(obj):
return _pyupm_t3311.floatp_value(obj)
floatp_value = _pyupm_t3311.floatp_value
[docs]class T3311(_object):
"""
UPM API for the T3311 MODBUS Temperature and Humidity Sensor.
ID: t3311
Name: Temperature and Humidity Probe
Category: temp
Manufacturer: comet
Connection: uart
Link:http://www.cometsystem.com/products/reg-T3311 This module
implements support for the Comet System T3311 Temperature and Humidity
transmitter. It uses MODBUS over an RS232 serial port. You must have
libmodbus v3.1.2 (or greater) installed to compile and use this
driver.
This module was developed using libmodbus 3.1.2, and T3311 Firmware
revison 2.66 connected via a Prolific RS232 Serial to USB adaptor. You
cannot use the built in TTL UART pins for accessing this device you
must use a full serial RS232 interface connected via USB.
C++ includes: t3311.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, T3311, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, T3311, name)
__repr__ = _swig_repr
REG_TEMPERATURE = _pyupm_t3311.T3311_REG_TEMPERATURE
REG_HUMIDITY = _pyupm_t3311.T3311_REG_HUMIDITY
REG_COMPUTED = _pyupm_t3311.T3311_REG_COMPUTED
REG_DEW_POINT = _pyupm_t3311.T3311_REG_DEW_POINT
REG_ABS_HUMIDITY = _pyupm_t3311.T3311_REG_ABS_HUMIDITY
REG_SPECIFIC_HUMIDITY = _pyupm_t3311.T3311_REG_SPECIFIC_HUMIDITY
REG_MIXING_RATIO = _pyupm_t3311.T3311_REG_MIXING_RATIO
REG_SPECIFIC_ENTHALPY = _pyupm_t3311.T3311_REG_SPECIFIC_ENTHALPY
REG_SERIAL_HI = _pyupm_t3311.T3311_REG_SERIAL_HI
REG_SERIAL_LO = _pyupm_t3311.T3311_REG_SERIAL_LO
REG_UNIT_SETTINGS = _pyupm_t3311.T3311_REG_UNIT_SETTINGS
REG_FW_HI = _pyupm_t3311.T3311_REG_FW_HI
REG_FW_LO = _pyupm_t3311.T3311_REG_FW_LO
def __init__(self, *args):
"""
T3311(std::string device,
int address, int baud=9600, int bits=8, char parity='N', int
stopBits=2)
T3311 constructor
Parameters:
-----------
device: Path to the serial device
address: The MODBUS slave address
baud: The baudrate of the device. Default: 9600
bits: The number of bits per byte. Default: 8
parity: The parity of the connection, 'N' for None, 'E' for Even, 'O'
for Odd. Default: 'N'
stopBits: The number of stop bits. Default: 2
"""
this = _pyupm_t3311.new_T3311(*args)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_t3311.delete_T3311
__del__ = lambda self: None
[docs] def extendedDataAvailable(self):
"""
bool
extendedDataAvailable()
Indicate whether the attached sensor supports extended Computed Data
registers. Firmware versions at, or higher than 2.44 provide this
data.
true if Extended Data is available, false otherwise
"""
return _pyupm_t3311.T3311_extendedDataAvailable(self)
[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_t3311.T3311_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.
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_t3311.T3311_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_t3311.T3311_getHumidity(self)
[docs] def getComputedValue(self):
"""
float
getComputedValue()
Get the current computed value. update() must have been called prior
to calling this method. This value is configured via the configuration
of the sensor using the sensors configuration utility, and can
represent several different computed values. The default value from
the factory is the current Dew Point Temperature.
Since the actual value configured is unknown (and unknowable) to this
driver, the units represented depend on how you have configured the
device. This function simply returns the value without any conversion
or interpretation, other than the default scaling.
The last Computed Value
"""
return _pyupm_t3311.T3311_getComputedValue(self)
[docs] def getDewPointTemperature(self, fahrenheit=False):
"""
float
getDewPointTemperature(bool fahrenheit=false)
Get the current dew point temperature. update() must have been called
prior to calling this method. This information is only available if
the sensor supports Extended Data (ie: extendedDataAvailable() returns
true).
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 dew point temperature reading in Celsius or Fahrenheit
"""
return _pyupm_t3311.T3311_getDewPointTemperature(self, fahrenheit)
[docs] def getAbsoluteHumidity(self):
"""
float
getAbsoluteHumidity()
Get the current absolute humidity. update() must have been called
prior to calling this method. This information is only available if
the sensor supports Extended Data (ie: extendedDataAvailable() returns
true).
The last absolute humidity reading in g/m3 (grams per cubic meter).
"""
return _pyupm_t3311.T3311_getAbsoluteHumidity(self)
[docs] def getSpecificHumidity(self):
"""
float
getSpecificHumidity()
Get the current specific humidity. update() must have been called
prior to calling this method. This information is only available if
the sensor supports Extended Data (ie: extendedDataAvailable() returns
true).
The last specific humidity reading in g/kg (grams per kilogram).
"""
return _pyupm_t3311.T3311_getSpecificHumidity(self)
[docs] def getMixingRatio(self):
"""
float
getMixingRatio()
Get the current mixing ratio. update() must have been called prior to
calling this method. This information is only available if the sensor
supports Extended Data (ie: extendedDataAvailable() returns true).
The last mixing ratio reading in g/kg (grams per kilogram).
"""
return _pyupm_t3311.T3311_getMixingRatio(self)
[docs] def getSpecificEnthalpy(self):
"""
float
getSpecificEnthalpy()
Get the current specific enthalopy, a measure of energy density.
update() must have been called prior to calling this method. This
information is only available if the sensor supports Extended Data
(ie: extendedDataAvailable() returns true).
The last specific enthalopy reading in kJ/kg (kilojoules per
kilogram).
"""
return _pyupm_t3311.T3311_getSpecificEnthalpy(self)
[docs] def getSerialNumber(self):
"""
std::string
getSerialNumber()
Get the serial number of the sensor.
The serial number
"""
return _pyupm_t3311.T3311_getSerialNumber(self)
[docs] def getFirmwareMajor(self):
"""
int
getFirmwareMajor()
Get the firmware revision major number.
The firmware revsion major number.
"""
return _pyupm_t3311.T3311_getFirmwareMajor(self)
[docs] def getFirmwareMinor(self):
"""
int
getFirmwareMinor()
Get the firmware revision minor number.
The firmware revsion minor number.
"""
return _pyupm_t3311.T3311_getFirmwareMinor(self)
[docs] def setDebug(self, enable):
"""
void setDebug(bool
enable)
Enable or disable debugging output. This primarily enables and
disables libmodbus debugging output.
Parameters:
-----------
enable: true to enable debugging, false otherwise
"""
return _pyupm_t3311.T3311_setDebug(self, enable)
T3311_swigregister = _pyupm_t3311.T3311_swigregister
T3311_swigregister(T3311)
# This file is compatible with both classic and new-style classes.