fixes for proxy modules
- for the case when the remote module name does not match, 'read', 'change' and 'do' does not work - a proxy to an IO class has enablePoll == False, but it needs a triggerPoll for modules relying on it to work - a proxy on a communicator module has a status even when the remote does not - this needs 2 fixes Change-Id: Icd44da4c2984f27ce7147dec633739f9176012ec Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/33168 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
9d9d31693b
commit
af28511403
@ -614,6 +614,10 @@ class Module(HasAccessibles):
|
||||
# enablePoll == False: we still need the poll thread for writing values from writeDict
|
||||
if hasattr(self, 'io'):
|
||||
self.io.polledModules.append(self)
|
||||
if not self.io.triggerPoll:
|
||||
# when self.io.enablePoll is False, triggerPoll is not
|
||||
# created for self.io in the else clause below
|
||||
self.triggerPoll = threading.Event()
|
||||
else:
|
||||
self.triggerPoll = threading.Event()
|
||||
self.polledModules.append(self)
|
||||
|
@ -71,7 +71,7 @@ class ProxyModule(HasIO, Module):
|
||||
pname, pobj = params.popitem()
|
||||
props = remoteparams.get(pname, None)
|
||||
if props is None:
|
||||
if pobj.export:
|
||||
if pobj.export and pname != 'status':
|
||||
self.log.warning('remote parameter %s:%s does not exist', self.module, pname)
|
||||
continue
|
||||
dt = props['datatype']
|
||||
@ -108,17 +108,19 @@ class ProxyModule(HasIO, Module):
|
||||
# for now, the error message must be enough
|
||||
|
||||
def nodeStateChange(self, online, state):
|
||||
disconnected = Readable.Status.ERROR, 'disconnected'
|
||||
if online:
|
||||
if not self._consistency_check_done:
|
||||
self._check_descriptive_data()
|
||||
self._consistency_check_done = True
|
||||
if self.status == disconnected:
|
||||
self.status = Readable.Status.IDLE, 'connected'
|
||||
else:
|
||||
newstatus = Readable.Status.ERROR, 'disconnected'
|
||||
readerror = CommunicationFailedError('disconnected')
|
||||
if self.status != newstatus:
|
||||
if self.status != disconnected:
|
||||
for pname in set(self.parameters) - set(('module', 'status')):
|
||||
self.announceUpdate(pname, None, readerror)
|
||||
self.announceUpdate('status', newstatus)
|
||||
self.status = disconnected
|
||||
|
||||
def checkProperties(self):
|
||||
pass # skip
|
||||
@ -193,7 +195,7 @@ def proxy_class(remote_class, name=None):
|
||||
attrs[aname] = pobj
|
||||
|
||||
def rfunc(self, pname=aname):
|
||||
value, _, readerror = self._secnode.getParameter(self.name, pname, True)
|
||||
value, _, readerror = self._secnode.getParameter(self.module, pname, True)
|
||||
if readerror:
|
||||
raise readerror
|
||||
return value
|
||||
@ -203,7 +205,7 @@ def proxy_class(remote_class, name=None):
|
||||
if not pobj.readonly:
|
||||
|
||||
def wfunc(self, value, pname=aname):
|
||||
value, _, readerror = self._secnode.setParameter(self.name, pname, value)
|
||||
value, _, readerror = self._secnode.setParameter(self.module, pname, value)
|
||||
if readerror:
|
||||
raise readerror
|
||||
return value
|
||||
@ -214,7 +216,7 @@ def proxy_class(remote_class, name=None):
|
||||
cobj = aobj.copy()
|
||||
|
||||
def cfunc(self, arg=None, cname=aname):
|
||||
return self._secnode.execCommand(self.name, cname, arg)[0]
|
||||
return self._secnode.execCommand(self.module, cname, arg)[0]
|
||||
|
||||
attrs[aname] = cobj(cfunc)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user