Source code for sensirion_i2c_sfx6xxx.result_types

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2024 Sensirion AG, Switzerland
#
#     THIS FILE IS AUTOMATICALLY GENERATED!
#
# Generator:     sensirion-driver-generator 0.40.1
# Product:       sfx6xxx
# Model-Version: 2.3.1
#
"""
The signal classes specify transformations of the raw sensor signals into a meaningful units.
The generated signal types are used by the driver class and not intended for direct use.
"""

from sensirion_driver_support_types.signals import AbstractSignal


[docs]class SignalTemperature(AbstractSignal): """Measured temperature in degrees celsius. The raw value is scaled appropriately.""" def __init__(self, temperature_raw): self._temperature = temperature_raw / 200.0 @property def value(self): return self._temperature def __str__(self): return '{0:.2f}'.format(self.value)
[docs]class SignalFlow(AbstractSignal): """ This signal represents the measured flow. It is scaled with the corresponding scaling factor and offset """ def __init__(self, flow_raw, flow_scale_factor, flow_offset): scale_factor = float(flow_scale_factor) self._flow = float(flow_raw - flow_offset) / scale_factor @property def value(self): return self._flow def __str__(self): return '{0:.2f}'.format(self.value)
[docs]class SignalRawFlow(AbstractSignal): """This signal converts a user flow input from float into the twos-complement representation""" def __init__(self, flow, flow_scale_factor, flow_offset): self._raw_flow = int(flow * flow_scale_factor) + flow_offset @property def value(self): return self._raw_flow def __str__(self): return '{0}'.format(self.value)