mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2026-04-18 04:53:31 +00:00
upd the interface to read/write multiple private/public packets.
{VirtualStrip}.bass/mid/treble implemented reading from public packet NBS=1
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from functools import partial
|
||||
|
||||
from .enums import NBS
|
||||
from .util import cache_bool, cache_string
|
||||
|
||||
|
||||
@@ -13,7 +14,7 @@ def channel_bool_prop(param):
|
||||
return (
|
||||
not int.from_bytes(
|
||||
getattr(
|
||||
self.public_packet,
|
||||
self.public_packets[NBS.zero],
|
||||
f'{"strip" if "strip" in type(self).__name__.lower() else "bus"}state',
|
||||
)[self.index],
|
||||
'little',
|
||||
@@ -34,7 +35,7 @@ def channel_label_prop():
|
||||
@partial(cache_string, param='label')
|
||||
def fget(self) -> str:
|
||||
return getattr(
|
||||
self.public_packet,
|
||||
self.public_packets[NBS.zero],
|
||||
f'{"strip" if "strip" in type(self).__name__.lower() else "bus"}labels',
|
||||
)[self.index]
|
||||
|
||||
@@ -52,7 +53,9 @@ def strip_output_prop(param):
|
||||
cmd = self._cmd(param)
|
||||
self.logger.debug(f'getter: {cmd}')
|
||||
return (
|
||||
not int.from_bytes(self.public_packet.stripstate[self.index], 'little')
|
||||
not int.from_bytes(
|
||||
self.public_packets[NBS.zero].stripstate[self.index], 'little'
|
||||
)
|
||||
& getattr(self._modes, f'_bus{param.lower()}')
|
||||
== 0
|
||||
)
|
||||
@@ -71,7 +74,12 @@ def bus_mode_prop(param):
|
||||
cmd = self._cmd(param)
|
||||
self.logger.debug(f'getter: {cmd}')
|
||||
return [
|
||||
(int.from_bytes(self.public_packet.busstate[self.index], 'little') & val)
|
||||
(
|
||||
int.from_bytes(
|
||||
self.public_packets[NBS.zero].busstate[self.index], 'little'
|
||||
)
|
||||
& val
|
||||
)
|
||||
>> 4
|
||||
for val in self._modes.modevals
|
||||
] == self.modestates[param]
|
||||
|
||||
Reference in New Issue
Block a user