Source code for sensirion_i2c_sfm3505.result_types

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2025 Sensirion AG, Switzerland
#
#     THIS FILE IS AUTOMATICALLY GENERATED!
#
# Generator:     sensirion-driver-generator 1.3.4
# Product:       sfm3505
# Model-Version: 1.2.0
#
"""
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 SignalAirFlow(AbstractSignal): """ This signal represents the measured Air flow in slm (at 20°C and 1013.25hPa). It is scaled with the corresponding scaling factor and offset. """ def __init__(self, flow_bytes_raw): flow_raw = (flow_bytes_raw[0] << 16) | (flow_bytes_raw[1] << 8) | flow_bytes_raw[2] self._air_flow = (float(flow_raw) - 8388608) / 25600 @property def value(self): return self._air_flow def __str__(self): return '{0:.2f}'.format(self.value)
[docs]class SignalO2Flow(AbstractSignal): """ This signal represents the measured O2 flow in slm (at 20°C and 1013.25hPa). It is scaled with the corresponding scaling factor and offset. """ def __init__(self, flow_bytes_raw): flow_raw = (flow_bytes_raw[3] << 16) | (flow_bytes_raw[4] << 8) | flow_bytes_raw[5] self._o2_flow = (float(flow_raw) - 8388608) / 25600 @property def value(self): return self._o2_flow def __str__(self): return '{0:.2f}'.format(self.value)
[docs]class SignalO2FlowRaw(AbstractSignal): """ This raw signal represents the measured O2 flow as returned by the sensor. The result needs to be scaled to obtain slm. """ def __init__(self, flow_bytes_raw): self._o2_flow_raw = int((flow_bytes_raw[3] << 16) | (flow_bytes_raw[4] << 8) | flow_bytes_raw[5]) @property def value(self): return self._o2_flow_raw def __str__(self): return '{0}'.format(self.value)
[docs]class SignalAirFlowRaw(AbstractSignal): """ This raw signal represents the measured Air flow as returned by the sensor. The result needs to be scaled to obtain slm. """ def __init__(self, flow_bytes_raw): self._air_flow_raw = int((flow_bytes_raw[0] << 16) | (flow_bytes_raw[1] << 8) | flow_bytes_raw[2]) @property def value(self): return self._air_flow_raw def __str__(self): return '{0}'.format(self.value)