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