renamed commandhandler to iohandler
the name commandhandler might be misleading, as it has nothing to do with SECoP commands Change-Id: I31bbe1cefd49927fc591619dc7f41f332cca2c14 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/22084 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
588f3d7af7
commit
7c7c1cc5af
@ -28,7 +28,7 @@ from secop.datatypes import *
|
||||
from secop.modules import Module, Readable, Writable, Drivable, Communicator, Attached
|
||||
from secop.params import Parameter, Command, Override
|
||||
from secop.metaclass import Done
|
||||
from secop.commandhandler import CmdHandler, CmdHandlerBase
|
||||
from secop.iohandler import IOHandler, IOHandlerBase
|
||||
from secop.stringio import StringIO, HasIodev
|
||||
|
||||
|
||||
|
6
secop/commandhandler.py → secop/iohandler.py
Executable file → Normal file
6
secop/commandhandler.py → secop/iohandler.py
Executable file → Normal file
@ -18,7 +18,7 @@
|
||||
# Module authors:
|
||||
# Markus Zolliker <markus.zolliker@psi.ch>
|
||||
# *****************************************************************************
|
||||
"""command handler
|
||||
"""IO handler
|
||||
|
||||
Utility class for cases, where multiple parameters are treated with a common command.
|
||||
The support for LakeShore and similar protocols is already included.
|
||||
@ -177,7 +177,7 @@ class Change:
|
||||
return self._reply
|
||||
|
||||
|
||||
class CmdHandlerBase:
|
||||
class IOHandlerBase:
|
||||
"""generic command handler"""
|
||||
|
||||
def __init__(self, group):
|
||||
@ -302,7 +302,7 @@ class CmdHandlerBase:
|
||||
setattr(module, k, v)
|
||||
|
||||
|
||||
class CmdHandler(CmdHandlerBase):
|
||||
class IOHandler(IOHandlerBase):
|
||||
"""more evolved command handler
|
||||
|
||||
This command handler works for a syntax, where the reply of a query command has
|
@ -27,12 +27,12 @@ from secop.metaclass import Done
|
||||
from secop.datatypes import FloatRange, IntRange, EnumType, BoolType
|
||||
from secop.stringio import HasIodev
|
||||
from secop.poller import Poller, REGULAR
|
||||
import secop.commandhandler
|
||||
import secop.iohandler
|
||||
|
||||
Status = Drivable.Status
|
||||
|
||||
|
||||
class CmdHandler(secop.commandhandler.CmdHandler):
|
||||
class IOHandler(secop.iohandler.IOHandler):
|
||||
CMDARGS = ['channel']
|
||||
CMDSEPARATOR = ';'
|
||||
|
||||
@ -43,10 +43,10 @@ class CmdHandler(secop.commandhandler.CmdHandler):
|
||||
super().__init__(name, querycmd, replyfmt, changecmd)
|
||||
|
||||
|
||||
rdgrng = CmdHandler('rdgrng', 'RDGRNG?%(channel)d', '%d,%d,%d,%d,%d')
|
||||
inset = CmdHandler('inset', 'INSET?%(channel)d', '%d,%d,%d,%d,%d')
|
||||
filterhdl = CmdHandler('filter', 'FILTER?%(channel)d', '%d,%d,%d')
|
||||
scan = CmdHandler('scan', 'SCAN?', '%d,%d')
|
||||
rdgrng = IOHandler('rdgrng', 'RDGRNG?%(channel)d', '%d,%d,%d,%d,%d')
|
||||
inset = IOHandler('inset', 'INSET?%(channel)d', '%d,%d,%d,%d,%d')
|
||||
filterhdl = IOHandler('filter', 'FILTER?%(channel)d', '%d,%d,%d')
|
||||
scan = IOHandler('scan', 'SCAN?', '%d,%d')
|
||||
|
||||
|
||||
STATUS_TEXT = {0: ''}
|
||||
|
@ -41,7 +41,7 @@ from secop.datatypes import EnumType, FloatRange, IntRange, StringType,\
|
||||
from secop.lib.enum import Enum
|
||||
from secop.errors import HardwareError
|
||||
from secop.poller import Poller
|
||||
import secop.commandhandler
|
||||
import secop.iohandler
|
||||
from secop.stringio import HasIodev
|
||||
from secop.metaclass import Done
|
||||
|
||||
@ -51,7 +51,7 @@ except ImportError:
|
||||
import secop_psi.ppmssim as ppmshw
|
||||
|
||||
|
||||
class CmdHandler(secop.commandhandler.CmdHandler):
|
||||
class IOHandler(secop.iohandler.IOHandler):
|
||||
CMDARGS = ['no']
|
||||
CMDSEPARATOR = None # no command chaining
|
||||
READ_BEFORE_WRITE = False
|
||||
@ -213,7 +213,7 @@ class UserChannel(Channel):
|
||||
|
||||
|
||||
class DriverChannel(Channel):
|
||||
drvout = CmdHandler('drvout', 'DRVOUT? %(no)d', '%d,%g,%g')
|
||||
drvout = IOHandler('drvout', 'DRVOUT? %(no)d', '%d,%g,%g')
|
||||
|
||||
parameters = {
|
||||
'current':
|
||||
@ -237,7 +237,7 @@ class DriverChannel(Channel):
|
||||
|
||||
|
||||
class BridgeChannel(Channel):
|
||||
bridge = CmdHandler('bridge', 'BRIDGE? %(no)d', '%d,%g,%g,%d,%d,%g')
|
||||
bridge = IOHandler('bridge', 'BRIDGE? %(no)d', '%d,%g,%g,%d,%d,%g')
|
||||
# pylint: disable=invalid-name
|
||||
ReadingMode = Enum('ReadingMode', standard=0, fast=1, highres=2)
|
||||
parameters = {
|
||||
@ -284,7 +284,7 @@ class BridgeChannel(Channel):
|
||||
class Level(PpmsMixin, Readable):
|
||||
"""helium level"""
|
||||
|
||||
level = CmdHandler('level', 'LEVEL?', '%g,%d')
|
||||
level = IOHandler('level', 'LEVEL?', '%g,%d')
|
||||
|
||||
parameters = {
|
||||
'value': Override(datatype=FloatRange(unit='%'), handler=level),
|
||||
@ -316,7 +316,7 @@ class Chamber(PpmsMixin, Drivable):
|
||||
value is an Enum, which is redundant with the status text
|
||||
"""
|
||||
|
||||
chamber = CmdHandler('chamber', 'CHAMBER?', '%d')
|
||||
chamber = IOHandler('chamber', 'CHAMBER?', '%d')
|
||||
Status = Drivable.Status
|
||||
# pylint: disable=invalid-name
|
||||
Operation = Enum(
|
||||
@ -390,7 +390,7 @@ class Chamber(PpmsMixin, Drivable):
|
||||
class Temp(PpmsMixin, Drivable):
|
||||
"""temperature"""
|
||||
|
||||
temp = CmdHandler('temp', 'TEMP?', '%g,%g,%d')
|
||||
temp = IOHandler('temp', 'TEMP?', '%g,%g,%d')
|
||||
Status = Enum(Drivable.Status,
|
||||
RAMPING = 370,
|
||||
STABILIZING = 380,
|
||||
@ -537,7 +537,7 @@ class Temp(PpmsMixin, Drivable):
|
||||
class Field(PpmsMixin, Drivable):
|
||||
"""magnetic field"""
|
||||
|
||||
field = CmdHandler('field', 'FIELD?', '%g,%g,%d,%d')
|
||||
field = IOHandler('field', 'FIELD?', '%g,%g,%d,%d')
|
||||
Status = Enum(Drivable.Status,
|
||||
PREPARED = 150,
|
||||
PREPARING = 340,
|
||||
@ -657,7 +657,7 @@ class Field(PpmsMixin, Drivable):
|
||||
class Position(PpmsMixin, Drivable):
|
||||
"""rotator position"""
|
||||
|
||||
move = CmdHandler('move', 'MOVE?', '%g,%g,%g')
|
||||
move = IOHandler('move', 'MOVE?', '%g,%g,%g')
|
||||
Status = Drivable.Status
|
||||
parameters = {
|
||||
'value':
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from secop.commandhandler import CmdParser, CmdHandler
|
||||
from secop.iohandler import CmdParser, IOHandler
|
||||
from secop.modules import Module, Parameter
|
||||
from secop.datatypes import FloatRange, StringType, IntRange, Property
|
||||
from secop.errors import ProgrammingError
|
||||
@ -91,8 +91,8 @@ class ServerStub:
|
||||
self.dispatcher = DispatcherStub(updates)
|
||||
|
||||
|
||||
def test_CmdHandler():
|
||||
class Hdl(CmdHandler):
|
||||
def test_IOHandler():
|
||||
class Hdl(IOHandler):
|
||||
CMDARGS = ['channel', 'loop']
|
||||
CMDSEPARATOR ='|'
|
||||
|
Loading…
x
Reference in New Issue
Block a user