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:
2025-10-29 14:32:33 +01:00
parent 174da915d2
commit 84ee2dd508
2 changed files with 6 additions and 14 deletions

View File

@@ -37,10 +37,6 @@ from frappy.params import Accessible, Command, Parameter, Limit, PREDEFINED_ACCE
from frappy.properties import HasProperties, Property from frappy.properties import HasProperties, Property
from frappy.logging import RemoteLogHandler 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) PREDEF_ORDER = list(PREDEFINED_ACCESSIBLES)
Done = UniqueObject('Done') Done = UniqueObject('Done')
@@ -310,8 +306,8 @@ class Module(HasAccessibles):
default='user', extname='visibility') default='user', extname='visibility')
implementation = Property('internal name of the implementation class of the module', StringType(), implementation = Property('internal name of the implementation class of the module', StringType(),
extname='implementation') extname='implementation')
interface_classes = Property('offical highest interface-class of the module', ArrayOf(StringType()), interface_classes = Property('offical interface-classes of the module', ArrayOf(StringType()),
extname='interface_classes') extname='interface_classes', default=[])
features = Property('list of features', ArrayOf(StringType()), extname='features') features = Property('list of features', ArrayOf(StringType()), extname='features')
pollinterval = Property('poll interval for parameters handled by doPoll', FloatRange(0.1, 120), default=5) 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) 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__}' myclassname = f'{mycls.__module__}.{mycls.__name__}'
self.implementation = myclassname 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 # handle Features
self.features = [b.__name__ for b in mycls.__mro__ if Feature in b.__bases__] self.features = [b.__name__ for b in mycls.__mro__ if Feature in b.__bases__]

View File

@@ -36,6 +36,7 @@ from .modulebase import Module
class Readable(Module): class Readable(Module):
"""basic readable module""" """basic readable module"""
interface_classes = ['Readable']
# pylint: disable=invalid-name # pylint: disable=invalid-name
Status = Enum('Status', Status = Enum('Status',
IDLE=StatusType.IDLE, IDLE=StatusType.IDLE,
@@ -55,6 +56,7 @@ class Readable(Module):
class Writable(Readable): class Writable(Readable):
"""basic writable module""" """basic writable module"""
interface_classes = ['Writable']
target = Parameter('target value of the module', target = Parameter('target value of the module',
default=0, readonly=False, datatype=FloatRange(unit='$')) default=0, readonly=False, datatype=FloatRange(unit='$'))
@@ -74,7 +76,7 @@ class Writable(Readable):
class Drivable(Writable): class Drivable(Writable):
"""basic drivable module""" """basic drivable module"""
interface_classes = ['Drivable']
status = Parameter(datatype=StatusType(Readable, 'BUSY')) # extend Readable.status status = Parameter(datatype=StatusType(Readable, 'BUSY')) # extend Readable.status
def isBusy(self, status=None): def isBusy(self, status=None):
@@ -98,6 +100,7 @@ class Drivable(Writable):
class Communicator(HasComlog, Module): class Communicator(HasComlog, Module):
"""basic abstract communication module""" """basic abstract communication module"""
interface_classes = ['Communicator']
@Command(StringType(), result=StringType()) @Command(StringType(), result=StringType())
def communicate(self, command): def communicate(self, command):
@@ -109,9 +112,6 @@ class Communicator(HasComlog, Module):
raise NotImplementedError() raise NotImplementedError()
SECoP_BASE_CLASSES = {Readable, Writable, Drivable, Communicator}
class Attached(Property): class Attached(Property):
"""a special property, defining an attached module """a special property, defining an attached module