from typing import TYPE_CHECKING
if TYPE_CHECKING:
from cantools.database.can.formats.dbc_specifics import DbcSpecifics
[docs]
class EnvironmentVariable:
"""A CAN environment variable.
"""
def __init__(self,
name: str,
env_type: int,
minimum: int | float,
maximum: int | float,
unit: str,
initial_value: int | float,
env_id: int,
access_type: str,
access_node: str,
comment: str | None,
dbc_specifics: "DbcSpecifics") -> None:
self._name = name
self._env_type = env_type
self._minimum = minimum
self._maximum = maximum
self._unit = unit
self._initial_value = initial_value
self._env_id = env_id
self._access_type = access_type
self._access_node = access_node
self._comment = comment
self._dbc = dbc_specifics
@property
def name(self) -> str:
"""The environment variable name as a string.
"""
return self._name
@name.setter
def name(self, value: str) -> None:
self._name = value
@property
def env_type(self) -> int:
"""The environment variable type value.
"""
return self._env_type
@env_type.setter
def env_type(self, value: int) -> None:
self._env_type = value
@property
def minimum(self) -> int | float:
"""The minimum value of the environment variable.
"""
return self._minimum
@minimum.setter
def minimum(self, value: int | float) -> None:
self._minimum = value
@property
def maximum(self) -> int | float:
"""The maximum value of the environment variable.
"""
return self._maximum
@maximum.setter
def maximum(self, value: int | float) -> None:
self._maximum = value
@property
def unit(self) -> str:
""" The units in which the environment variable is expressed as a string.
"""
return self._unit
@unit.setter
def unit(self, value: str) -> None:
self._unit = value
@property
def initial_value(self) -> int | float:
"""The initial value of the environment variable.
"""
return self._initial_value
@initial_value.setter
def initial_value(self, value: int | float) -> None:
self._initial_value = value
@property
def env_id(self) -> int:
"""The id value of the environment variable.
"""
return self._env_id
@env_id.setter
def env_id(self, value: int) -> None:
self._env_id = value
@property
def access_type(self) -> str:
"""The environment variable access type as a string.
"""
return self._access_type
@access_type.setter
def access_type(self, value: str) -> None:
self._access_type = value
@property
def access_node(self) -> str:
"""The environment variable access node as a string.
"""
return self._access_node
@access_node.setter
def access_node(self, value: str) -> None:
self._access_node = value
@property
def comment(self) -> str | None:
"""The environment variable comment, or ``None`` if unavailable.
"""
return self._comment
@comment.setter
def comment(self, value: str | None) -> None:
self._comment = value
@property
def dbc(self) -> "DbcSpecifics":
"""An object containing dbc specific properties like e.g. attributes.
"""
return self._dbc
@dbc.setter
def dbc(self, value: "DbcSpecifics") -> None:
self._dbc = value
def __repr__(self) -> str:
return "environment_variable('{}', {}, {}, {}, '{}', {}, {}, '{}', '{}', {})".format(
self._name,
self._env_type,
self._minimum,
self._maximum,
self._unit,
self._initial_value,
self._env_id,
self._access_type,
self._access_node,
"'" + self._comment + "'" if self._comment is not None else None)