2022-02-25 14:37:23 +00:00
|
|
|
from .errors import VMCMDErrors
|
|
|
|
|
|
|
|
def strip_output_prop(param):
|
2022-02-25 17:02:27 +00:00
|
|
|
""" A strip output prop. """
|
2022-02-25 14:37:23 +00:00
|
|
|
def fget(self):
|
2022-02-26 23:57:19 +00:00
|
|
|
data = self._remote.public_packet
|
2022-02-25 14:37:23 +00:00
|
|
|
return not int.from_bytes(data.stripstate[self.index], 'little') & getattr(self._modes, f'_bus{param.lower()}') == 0
|
|
|
|
def fset(self, val):
|
|
|
|
if not isinstance(val, bool) and val not in (0, 1):
|
|
|
|
raise VMCMDErrors(f'{param} is a boolean parameter')
|
|
|
|
self.setter(param, 1 if val else 0)
|
2022-02-25 17:02:27 +00:00
|
|
|
return property(fget, fset)
|