mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2024-11-15 17:40:57 +00:00
info_response property added to base clase.
This commit is contained in:
parent
78cd0b489a
commit
0606c8d107
@ -2,6 +2,9 @@ import xair_api
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
kind_id = "XR18"
|
||||||
|
ip = "<ip address>"
|
||||||
|
|
||||||
with xair_api.connect(kind_id, ip=ip) as mixer:
|
with xair_api.connect(kind_id, ip=ip) as mixer:
|
||||||
mixer.strip[8].config.name = "sm7b"
|
mixer.strip[8].config.name = "sm7b"
|
||||||
mixer.strip[8].config.on = True
|
mixer.strip[8].config.on = True
|
||||||
@ -11,7 +14,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
kind_id = "MR18"
|
|
||||||
ip = "<ip address>"
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -19,8 +19,8 @@ class X32KindMap(KindMap):
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class MR18KindMap(KindMap):
|
class XR18KindMap(KindMap):
|
||||||
# note ch 17-18 defined as aux rtn
|
# note ch 17-18 defined as aux return
|
||||||
id_: str
|
id_: str
|
||||||
num_dca: int = 4
|
num_dca: int = 4
|
||||||
num_strip: int = 16
|
num_strip: int = 16
|
||||||
@ -48,8 +48,8 @@ class XR12KindMap(KindMap):
|
|||||||
|
|
||||||
_kinds = {
|
_kinds = {
|
||||||
"X32": X32KindMap(id_="X32"),
|
"X32": X32KindMap(id_="X32"),
|
||||||
"XR18": MR18KindMap(id_="XR18"),
|
"MR18": XR18KindMap(id_="MR18"),
|
||||||
"MR18": MR18KindMap(id_="MR18"),
|
"XR18": XR18KindMap(id_="XR18"),
|
||||||
"XR16": XR16KindMap(id_="XR16"),
|
"XR16": XR16KindMap(id_="XR16"),
|
||||||
"XR12": XR12KindMap(id_="XR12"),
|
"XR12": XR12KindMap(id_="XR12"),
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class XAirRemote(abc.ABC):
|
|||||||
_WAIT_TIME = 0.025
|
_WAIT_TIME = 0.025
|
||||||
_REFRESH_TIMEOUT = 5
|
_REFRESH_TIMEOUT = 5
|
||||||
|
|
||||||
info_response = []
|
_info_response = []
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
dispatcher = Dispatcher()
|
dispatcher = Dispatcher()
|
||||||
@ -85,21 +85,24 @@ class XAirRemote(abc.ABC):
|
|||||||
f"Successfully connected to {self.info_response[2]} at {self.info_response[0]}."
|
f"Successfully connected to {self.info_response[2]} at {self.info_response[0]}."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def info_response(self):
|
||||||
|
return self._info_response
|
||||||
|
|
||||||
def run_server(self):
|
def run_server(self):
|
||||||
self.server.serve_forever()
|
self.server.serve_forever()
|
||||||
|
|
||||||
def msg_handler(self, addr, *data):
|
def msg_handler(self, addr, *data):
|
||||||
self.logger.debug(f"received: {addr} {data if data else ''}")
|
self.logger.debug(f"received: {addr} {data if data else ''}")
|
||||||
self.info_response = data[:]
|
self._info_response = data[:]
|
||||||
|
|
||||||
def send(self, addr: str, param: Optional[str] = None):
|
def send(self, addr: str, param: Optional[str] = None):
|
||||||
self.logger.debug(f"sending: {addr} {param if param else ''}")
|
self.logger.debug(f"sending: {addr} {param if param else ''}")
|
||||||
self.server.send_message(addr, param)
|
self.server.send_message(addr, param)
|
||||||
time.sleep(self._WAIT_TIME)
|
time.sleep(self._WAIT_TIME)
|
||||||
|
|
||||||
def _query(self, address):
|
def query(self, address):
|
||||||
self.send(address)
|
self.send(address)
|
||||||
time.sleep(self._WAIT_TIME)
|
|
||||||
return self.info_response
|
return self.info_response
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, exc_tr):
|
def __exit__(self, exc_type, exc_value, exc_tr):
|
||||||
@ -128,8 +131,8 @@ def _make_remote(kind: KindMap) -> XAirRemote:
|
|||||||
self.dca = tuple(DCA(self, i) for i in range(kind.num_dca))
|
self.dca = tuple(DCA(self, i) for i in range(kind.num_dca))
|
||||||
self.fx = tuple(FX(self, i) for i in range(kind.num_fx))
|
self.fx = tuple(FX(self, i) for i in range(kind.num_fx))
|
||||||
self.fxreturn = tuple(adapter.FxRtn.make(self, i) for i in range(kind.num_fx))
|
self.fxreturn = tuple(adapter.FxRtn.make(self, i) for i in range(kind.num_fx))
|
||||||
self.config = Config.make(self)
|
|
||||||
self.auxin = tuple(adapter.AuxRtn.make(self, i) for i in range(kind.num_auxrtn))
|
self.auxin = tuple(adapter.AuxRtn.make(self, i) for i in range(kind.num_auxrtn))
|
||||||
|
self.config = Config.make(self)
|
||||||
|
|
||||||
def init_xair(self, *args, **kwargs):
|
def init_xair(self, *args, **kwargs):
|
||||||
defaultkwargs = {"ip": None, "port": 10024}
|
defaultkwargs = {"ip": None, "port": 10024}
|
||||||
@ -143,8 +146,8 @@ def _make_remote(kind: KindMap) -> XAirRemote:
|
|||||||
self.fx = tuple(FX(self, i) for i in range(kind.num_fx))
|
self.fx = tuple(FX(self, i) for i in range(kind.num_fx))
|
||||||
self.fxsend = tuple(FXSend.make(self, i) for i in range(kind.num_fx))
|
self.fxsend = tuple(FXSend.make(self, i) for i in range(kind.num_fx))
|
||||||
self.fxreturn = tuple(FxRtn.make(self, i) for i in range(kind.num_fx))
|
self.fxreturn = tuple(FxRtn.make(self, i) for i in range(kind.num_fx))
|
||||||
self.config = Config.make(self)
|
|
||||||
self.auxreturn = AuxRtn.make(self)
|
self.auxreturn = AuxRtn.make(self)
|
||||||
|
self.config = Config.make(self)
|
||||||
|
|
||||||
if kind.id_ == "X32":
|
if kind.id_ == "X32":
|
||||||
return type(
|
return type(
|
||||||
|
Loading…
Reference in New Issue
Block a user