hvl_ccb.dev.sst_luminox.sst_luminox
digraph inheritanceacf8475538 { bgcolor=transparent; rankdir=TB; size=""; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AsyncCommunicationProtocol" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.AsyncCommunicationProtocol",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for asynchronous communication protocols"]; "CommunicationProtocol" -> "AsyncCommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AsyncCommunicationProtocolConfig" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.AsyncCommunicationProtocolConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base configuration data class for asynchronous communication protocols"]; "CCBError" [URL="../hvl_ccb.error.html#hvl_ccb.error.CCBError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "CommunicationProtocol" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.CommunicationProtocol",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Communication protocol abstract base class."]; "ConfigurationMixin" -> "CommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "CommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ConfigurationMixin" [URL="../hvl_ccb.configuration.html#hvl_ccb.configuration.ConfigurationMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin providing configuration to a class."]; "ABC" -> "ConfigurationMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Device" [URL="../hvl_ccb.dev.base.html#hvl_ccb.dev.base.Device",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for devices. Implement this class for a concrete device,"]; "ConfigurationMixin" -> "Device" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "Device" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DeviceError" [URL="../hvl_ccb.dev.base.html#hvl_ccb.dev.base.DeviceError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "CCBError" -> "DeviceError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Enum" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="An enumeration."]; "Enum" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Generic enumeration."]; "Luminox" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.Luminox",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Luminox oxygen sensor device class."]; "SingleCommDevice" -> "Luminox" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LuminoxConfig" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Configuration for the SST Luminox oxygen sensor."]; "LuminoxError" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="General Error for Luminox Device."]; "DeviceError" -> "LuminoxError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LuminoxMeasurementType" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxMeasurementType",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Measurement types for `LuminoxOutputMode.polling`."]; "ValueEnum" -> "LuminoxMeasurementType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LuminoxMeasurementTypeError" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxMeasurementTypeError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wrong measurement type for requested data"]; "LuminoxError" -> "LuminoxMeasurementTypeError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LuminoxOutputMode" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxOutputMode",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="output mode."]; "Enum" -> "LuminoxOutputMode" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LuminoxOutputModeError" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxOutputModeError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wrong output mode for requested data"]; "LuminoxError" -> "LuminoxOutputModeError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LuminoxSerialCommunication" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxSerialCommunication",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Specific communication protocol implementation for the SST Luminox oxygen sensor."]; "SerialCommunication" -> "LuminoxSerialCommunication" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LuminoxSerialCommunicationConfig" [URL="../hvl_ccb.dev.sst_luminox.sst_luminox.html#hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxSerialCommunicationConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="LuminoxSerialCommunicationConfig(terminator: bytes = b'\r\n', encoding: str = 'utf-8', encoding_error_handling: str = 'strict', wait_sec_read_text_nonempty: Union[int, float] = 0.5, default_n_attempts_read_text_nonempty: int = 10, port: Optional[str] = None, baudrate: int = 9600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, timeout: Union[int, float] = 3)"]; "SerialCommunicationConfig" -> "LuminoxSerialCommunicationConfig" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SerialCommunication" [URL="../hvl_ccb.comm.serial.html#hvl_ccb.comm.serial.SerialCommunication",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Implements the Communication Protocol for serial ports."]; "AsyncCommunicationProtocol" -> "SerialCommunication" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SerialCommunicationConfig" [URL="../hvl_ccb.comm.serial.html#hvl_ccb.comm.serial.SerialCommunicationConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Configuration dataclass for :class:`SerialCommunication`."]; "AsyncCommunicationProtocolConfig" -> "SerialCommunicationConfig" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SingleCommDevice" [URL="../hvl_ccb.dev.base.html#hvl_ccb.dev.base.SingleCommDevice",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for devices with a single communication protocol."]; "Device" -> "SingleCommDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "SingleCommDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "StrEnumBase" [URL="../hvl_ccb.utils.enum.html#hvl_ccb.utils.enum.StrEnumBase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="String representation-based equality and lookup."]; "Enum" -> "StrEnumBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ValueEnum" [URL="../hvl_ccb.utils.enum.html#hvl_ccb.utils.enum.ValueEnum",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Enum with string representation of values used as string representation, and with"]; "StrEnumBase" -> "ValueEnum" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Device class for a SST Luminox Oxygen sensor. This device can measure the oxygen concentration between 0 % and 25 %.
Furthermore, it measures the barometric pressure and internal temperature. The device supports two operating modes: in streaming mode the device measures all parameters every second, in polling mode the device measures only after a query.
Technical specification and documentation for the device can be found a the manufacturer’s page: https://www.sstsensing.com/product/luminox-optical-oxygen-sensors-2/
- class Luminox(com, dev_config=None)[source]
Bases:
SingleCommDevice
Luminox oxygen sensor device class.
- activate_output(mode: LuminoxOutputMode) None [source]
activate the selected output mode of the Luminox Sensor. :param mode: polling or streaming
- static config_cls()[source]
Return the default configdataclass class.
- Returns:
a reference to the default configdataclass class
- static default_com_cls()[source]
Get the class for the default communication protocol used with this device.
- Returns:
the type of the standard communication protocol for this device
- query_polling(measurement: str | LuminoxMeasurementType) dict[Union[str, hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxMeasurementType], Union[float, int, str]] | float | int | str [source]
Query a value or values of Luminox measurements in the polling mode, according to a given measurement type.
- Parameters:
measurement – type of measurement
- Returns:
value of requested measurement
- Raises:
ValueError – when a wrong key for LuminoxMeasurementType is provided
LuminoxOutputModeError – when polling mode is not activated
LuminoxMeasurementTypeError – when expected measurement value is not read
- read_streaming() dict[Union[str, hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxMeasurementType], Union[float, int, str]] [source]
Read values of Luminox in the streaming mode. Convert the single string into separate values.
- Returns:
dictionary with LuminoxMeasurementType.all_measurements_types() keys and accordingly type-parsed values.
- Raises:
LuminoxOutputModeError – when streaming mode is not activated
LuminoxMeasurementTypeError – when any of expected measurement values is not read
- class LuminoxConfig(wait_sec_post_activate: int | float = 0.5, wait_sec_trials_activate: int | float = 0.1, nr_trials_activate: int = 5)[source]
Bases:
object
Configuration for the SST Luminox oxygen sensor.
- force_value(fieldname, value)
Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters:
fieldname – name of the field
value – value to assign
- is_configdataclass = True
- classmethod keys() Sequence[str]
Returns a list of all configdataclass fields key-names.
- Returns:
a list of strings containing all keys.
- nr_trials_activate: int = 5
- classmethod optional_defaults() dict[str, object]
Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns:
a list of strings containing all optional keys.
- classmethod required_keys() Sequence[str]
Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns:
a list of strings containing all required keys.
- wait_sec_post_activate: int | float = 0.5
- wait_sec_trials_activate: int | float = 0.1
- exception LuminoxError[source]
Bases:
DeviceError
General Error for Luminox Device.
- class LuminoxMeasurementType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
ValueEnum
Measurement types for LuminoxOutputMode.polling.
The all_measurements type will read values for the actual measurement types as given in LuminoxOutputMode.all_measurements_types(); it parses multiple single values using regexp’s for other measurement types, therefore, no regexp is defined for this measurement type.
- all_measurements = 'A'
- classmethod all_measurements_types() tuple['LuminoxMeasurementType', ...] [source]
A tuple of LuminoxMeasurementType enum instances which are actual measurements, i.e. not date of manufacture or software revision.
- barometric_pressure = 'P'
- property command: str
- date_of_manufacture = '# 0'
- parse_read_measurement_value(read_txt: str) dict[Union[str, hvl_ccb.dev.sst_luminox.sst_luminox.LuminoxMeasurementType], Union[float, int, str]] | float | int | str [source]
- partial_pressure_o2 = 'O'
- percent_o2 = '%'
- sensor_status = 'e'
- serial_number = '# 1'
- software_revision = '# 2'
- temperature_sensor = 'T'
- LuminoxMeasurementTypeDict
A typing hint for a dictionary holding LuminoxMeasurementType values. Keys are allowed as strings because LuminoxMeasurementType is of a StrEnumBase type.
- exception LuminoxMeasurementTypeError[source]
Bases:
LuminoxError
Wrong measurement type for requested data
- LuminoxMeasurementTypeValue
A typing hint for all possible LuminoxMeasurementType values as read in either streaming mode or in a polling mode with LuminoxMeasurementType.all_measurements.
Beware: has to be manually kept in sync with LuminoxMeasurementType instances cast_type attribute values.
alias of
Union
[float
,int
,str
]
- exception LuminoxOutputModeError[source]
Bases:
LuminoxError
Wrong output mode for requested data
- class LuminoxSerialCommunication(configuration)[source]
Bases:
SerialCommunication
Specific communication protocol implementation for the SST Luminox oxygen sensor. Already predefines device-specific protocol parameters in config.
- class LuminoxSerialCommunicationConfig(terminator: bytes = b'\r\n', encoding: str = 'utf-8', encoding_error_handling: str = 'strict', wait_sec_read_text_nonempty: Union[int, float] = 0.5, default_n_attempts_read_text_nonempty: int = 10, port: Optional[str] = None, baudrate: int = 9600, parity: Union[str, hvl_ccb.comm.serial.SerialCommunicationParity] = <SerialCommunicationParity.NONE: 'N'>, stopbits: Union[int, hvl_ccb.comm.serial.SerialCommunicationStopbits] = <SerialCommunicationStopbits.ONE: 1>, bytesize: Union[int, hvl_ccb.comm.serial.SerialCommunicationBytesize] = <SerialCommunicationBytesize.EIGHTBITS: 8>, timeout: Union[int, float] = 3)[source]
Bases:
SerialCommunicationConfig
- baudrate: int = 9600
Baudrate for SST Luminox is 9600 baud
- bytesize: int | SerialCommunicationBytesize = 8
One byte is eight bits long
- force_value(fieldname, value)
Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters:
fieldname – name of the field
value – value to assign
- classmethod keys() Sequence[str]
Returns a list of all configdataclass fields key-names.
- Returns:
a list of strings containing all keys.
- classmethod optional_defaults() dict[str, object]
Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns:
a list of strings containing all optional keys.
- parity: str | SerialCommunicationParity = 'N'
SST Luminox does not use parity
- classmethod required_keys() Sequence[str]
Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns:
a list of strings containing all required keys.
- stopbits: int | SerialCommunicationStopbits = 1
SST Luminox does use one stop bit
- terminator: bytes = b'\r\n'
The terminator is CR LF
- timeout: int | float = 3
use 3 seconds timeout as default