specify interface_classes property explicitly on SECoP base classes
The mechanism to calculate the interface_classes automatically gets more complicated whith the introduction if acquisition classes. Instead of making the mechanism more complex its simpler to give them explictly on the classes which correspond to the predefined SECoP interface classes. Change-Id: I9be7d9e54e3603b979ca2a823ec47b2075937ece
This commit is contained in:
@@ -37,10 +37,6 @@ from frappy.params import Accessible, Command, Parameter, Limit, PREDEFINED_ACCE
|
||||
from frappy.properties import HasProperties, Property
|
||||
from frappy.logging import RemoteLogHandler
|
||||
|
||||
# TODO: resolve cirular import
|
||||
# from .interfaces import SECoP_BASE_CLASSES
|
||||
# WORKAROUND:
|
||||
SECoP_BASE_CLASSES = ['Readable', 'Writable', 'Drivable', 'Communicator']
|
||||
PREDEF_ORDER = list(PREDEFINED_ACCESSIBLES)
|
||||
|
||||
Done = UniqueObject('Done')
|
||||
@@ -310,8 +306,8 @@ class Module(HasAccessibles):
|
||||
default='user', extname='visibility')
|
||||
implementation = Property('internal name of the implementation class of the module', StringType(),
|
||||
extname='implementation')
|
||||
interface_classes = Property('offical highest interface-class of the module', ArrayOf(StringType()),
|
||||
extname='interface_classes')
|
||||
interface_classes = Property('offical interface-classes of the module', ArrayOf(StringType()),
|
||||
extname='interface_classes', default=[])
|
||||
features = Property('list of features', ArrayOf(StringType()), extname='features')
|
||||
pollinterval = Property('poll interval for parameters handled by doPoll', FloatRange(0.1, 120), default=5)
|
||||
slowinterval = Property('poll interval for other parameters', FloatRange(0.1, 120), default=15)
|
||||
@@ -375,10 +371,6 @@ class Module(HasAccessibles):
|
||||
myclassname = f'{mycls.__module__}.{mycls.__name__}'
|
||||
self.implementation = myclassname
|
||||
|
||||
# list of only the 'highest' secop module class
|
||||
self.interface_classes = [
|
||||
b.__name__ for b in mycls.__mro__ if b.__name__ in SECoP_BASE_CLASSES][:1]
|
||||
|
||||
# handle Features
|
||||
self.features = [b.__name__ for b in mycls.__mro__ if Feature in b.__bases__]
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ from .modulebase import Module
|
||||
|
||||
class Readable(Module):
|
||||
"""basic readable module"""
|
||||
interface_classes = ['Readable']
|
||||
# pylint: disable=invalid-name
|
||||
Status = Enum('Status',
|
||||
IDLE=StatusType.IDLE,
|
||||
@@ -55,6 +56,7 @@ class Readable(Module):
|
||||
|
||||
class Writable(Readable):
|
||||
"""basic writable module"""
|
||||
interface_classes = ['Writable']
|
||||
target = Parameter('target value of the module',
|
||||
default=0, readonly=False, datatype=FloatRange(unit='$'))
|
||||
|
||||
@@ -74,7 +76,7 @@ class Writable(Readable):
|
||||
|
||||
class Drivable(Writable):
|
||||
"""basic drivable module"""
|
||||
|
||||
interface_classes = ['Drivable']
|
||||
status = Parameter(datatype=StatusType(Readable, 'BUSY')) # extend Readable.status
|
||||
|
||||
def isBusy(self, status=None):
|
||||
@@ -98,6 +100,7 @@ class Drivable(Writable):
|
||||
|
||||
class Communicator(HasComlog, Module):
|
||||
"""basic abstract communication module"""
|
||||
interface_classes = ['Communicator']
|
||||
|
||||
@Command(StringType(), result=StringType())
|
||||
def communicate(self, command):
|
||||
@@ -109,9 +112,6 @@ class Communicator(HasComlog, Module):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
SECoP_BASE_CLASSES = {Readable, Writable, Drivable, Communicator}
|
||||
|
||||
|
||||
class Attached(Property):
|
||||
"""a special property, defining an attached module
|
||||
|
||||
|
||||
Reference in New Issue
Block a user