mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2024-11-15 17:40:57 +00:00
move delay into {XAirRemote}.query()
update getters
This commit is contained in:
parent
cab3888946
commit
035c8d6507
@ -13,8 +13,7 @@ class IBus(abc.ABC):
|
|||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
self._remote.send(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
return self._remote.info_response
|
|
||||||
|
|
||||||
def setter(self, param: str, val: int):
|
def setter(self, param: str, val: int):
|
||||||
self._remote.send(f"{self.address}/{param}", val)
|
self._remote.send(f"{self.address}/{param}", val)
|
||||||
|
@ -13,8 +13,7 @@ class IConfig(abc.ABC):
|
|||||||
self._remote = remote
|
self._remote = remote
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
self._remote.send(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
return self._remote.info_response
|
|
||||||
|
|
||||||
def setter(self, param: str, val: int):
|
def setter(self, param: str, val: int):
|
||||||
self._remote.send(f"{self.address}/{param}", val)
|
self._remote.send(f"{self.address}/{param}", val)
|
||||||
|
@ -11,8 +11,7 @@ class IDCA(abc.ABC):
|
|||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
|
||||||
def getter(self, param: str) -> tuple:
|
def getter(self, param: str) -> tuple:
|
||||||
self._remote.send(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
return self._remote.info_response
|
|
||||||
|
|
||||||
def setter(self, param: str, val: int):
|
def setter(self, param: str, val: int):
|
||||||
self._remote.send(f"{self.address}/{param}", val)
|
self._remote.send(f"{self.address}/{param}", val)
|
||||||
|
@ -13,8 +13,7 @@ class IFX(abc.ABC):
|
|||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
self._remote.send(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
return self._remote.info_response
|
|
||||||
|
|
||||||
def setter(self, param: str, val: int):
|
def setter(self, param: str, val: int):
|
||||||
self._remote.send(f"{self.address}/{param}", val)
|
self._remote.send(f"{self.address}/{param}", val)
|
||||||
|
@ -15,8 +15,7 @@ class ILR(abc.ABC):
|
|||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
self._remote.send(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
return self._remote.info_response
|
|
||||||
|
|
||||||
def setter(self, param: str, val: int):
|
def setter(self, param: str, val: int):
|
||||||
self._remote.send(f"{self.address}/{param}", val)
|
self._remote.send(f"{self.address}/{param}", val)
|
||||||
|
@ -15,8 +15,7 @@ class IRtn(abc.ABC):
|
|||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
|
||||||
def getter(self, param: str):
|
def getter(self, param: str):
|
||||||
self._remote.send(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
return self._remote.info_response
|
|
||||||
|
|
||||||
def setter(self, param: str, val: int):
|
def setter(self, param: str, val: int):
|
||||||
self._remote.send(f"{self.address}/{param}", val)
|
self._remote.send(f"{self.address}/{param}", val)
|
||||||
|
@ -13,8 +13,7 @@ class IStrip(abc.ABC):
|
|||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
|
|
||||||
def getter(self, param: str) -> tuple:
|
def getter(self, param: str) -> tuple:
|
||||||
self._remote.send(f"{self.address}/{param}")
|
return self._remote.query(f"{self.address}/{param}")
|
||||||
return self._remote.info_response
|
|
||||||
|
|
||||||
def setter(self, param: str, val: int):
|
def setter(self, param: str, val: int):
|
||||||
self._remote.send(f"{self.address}/{param}", val)
|
self._remote.send(f"{self.address}/{param}", val)
|
||||||
|
@ -98,10 +98,10 @@ class XAirRemote(abc.ABC):
|
|||||||
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 is not None else ''}")
|
self.logger.debug(f"sending: {addr} {param if param is not None else ''}")
|
||||||
self.server.send_message(addr, param)
|
self.server.send_message(addr, param)
|
||||||
time.sleep(self._delay)
|
|
||||||
|
|
||||||
def query(self, address):
|
def query(self, address):
|
||||||
self.send(address)
|
self.send(address)
|
||||||
|
time.sleep(self._delay)
|
||||||
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):
|
||||||
|
Loading…
Reference in New Issue
Block a user