Skip to content

Commit

Permalink
refactor: adapt instrument aux to dt interface (#85)
Browse files Browse the repository at this point in the history
* feat: adapt instrument auxiliary to double threaded interface
* - adapt version_ongoing
  • Loading branch information
BKaDamien authored Jul 11, 2022
1 parent 44ff7ff commit b2fa3c7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
4 changes: 4 additions & 0 deletions docs/whats_new/version_ongoing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ adapt the record auxiliary to fit with the brand new double threaded auxiliary i
Acroname Auxiliary adaption
^^^^^^^^^^^^^^^^^^^^^^^^^^^
adapt the acroname auxiliary to fit with the brand new double threaded auxiliary interface

Instrument Auxiliary adaption
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
adapt the instrument auxiliary to fit with the brand new double threaded auxiliary interface
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@
import queue
import re
import time
from typing import List, Tuple, Union
from typing import Any, List, Optional, Tuple, Union

from pykiso import CChannel, SimpleAuxiliaryInterface
from pykiso import CChannel
from pykiso.interfaces.dt_auxiliary import (
DTAuxiliaryInterface,
close_connector,
)

from .lib_scpi_commands import LibSCPI

log = logging.getLogger(__name__)


class InstrumentControlAuxiliary(SimpleAuxiliaryInterface):
class InstrumentControlAuxiliary(DTAuxiliaryInterface):
"""Auxiliary used to communicate via a VISA connector using the SCPI
protocol.
"""
Expand All @@ -54,7 +58,9 @@ def __init__(
:param output_channel: output channel to use on the instrument
currently in use (if more than one)
"""
super().__init__(**kwargs)
super().__init__(
is_proxy_capable=False, tx_task_on=False, rx_task_on=False, **kwargs
)
self.channel = com
self.instrument = instrument
self.write_termination = write_termination
Expand Down Expand Up @@ -232,14 +238,23 @@ def _create_auxiliary_instance(self) -> bool:
return False
return True

@close_connector
def _delete_auxiliary_instance(self) -> bool:
"""Close the connector.
"""Close the connector communication.
:return: always True
:return: True if the connectors is closed otherwise False
"""
log.info("Delete auxiliary instance")
try:
self.channel.close()
except Exception:
log.exception("Unable to close the instrument.")
log.info("Auxiliary instance deleted")
return True

def _run_command(self, cmd_message: Any, cmd_data: Optional[bytes]) -> None:
"""Not used.
Simply respect the interface.
"""

def _receive_message(self, timeout_in_s: float) -> None:
"""Not used.
Simply respect the interface.
"""

0 comments on commit b2fa3c7

Please sign in to comment.