fix equipment_id handling
Change-Id: Ibeba9f0771dca8e7f9754f8b6431535885d654a0 Reviewed-on: https://forge.frm2.tum.de/review/17857 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Tested-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
parent
6c4cde4f2f
commit
153b4d79f7
@ -161,7 +161,6 @@ class Value(object):
|
|||||||
|
|
||||||
|
|
||||||
class Client(object):
|
class Client(object):
|
||||||
equipment_id = 'unknown'
|
|
||||||
secop_id = 'unknown'
|
secop_id = 'unknown'
|
||||||
describing_data = {}
|
describing_data = {}
|
||||||
stopflag = False
|
stopflag = False
|
||||||
@ -313,15 +312,13 @@ class Client(object):
|
|||||||
self.log.warning("deprecated specifier %r" % spec)
|
self.log.warning("deprecated specifier %r" % spec)
|
||||||
spec = '%s:value' % spec
|
spec = '%s:value' % spec
|
||||||
modname, pname = spec.split(':', 1)
|
modname, pname = spec.split(':', 1)
|
||||||
# previous = '<unset>'
|
|
||||||
# if modname in self._cache:
|
|
||||||
# if pname in self._cache:
|
|
||||||
# previous = self._cache[modname][pname]
|
|
||||||
if data:
|
if data:
|
||||||
self._cache.setdefault(modname, {})[pname] = Value(*data)
|
self._cache.setdefault(modname, {})[pname] = Value(*data)
|
||||||
else:
|
else:
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
'got malformed answer! (%s,%s)' % (spec, data))
|
'got malformed answer! (%s,%s)' % (spec, data))
|
||||||
|
|
||||||
# self.log.info('cache: %s:%s=%r (was: %s)', modname, pname, data, previous)
|
# self.log.info('cache: %s:%s=%r (was: %s)', modname, pname, data, previous)
|
||||||
if spec in self.callbacks:
|
if spec in self.callbacks:
|
||||||
for func in self.callbacks[spec]:
|
for func in self.callbacks[spec]:
|
||||||
@ -367,7 +364,7 @@ class Client(object):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def _issueDescribe(self):
|
def _issueDescribe(self):
|
||||||
_, self.equipment_id, describing_data = self._communicate('describe')
|
_, _, describing_data = self._communicate('describe')
|
||||||
try:
|
try:
|
||||||
describing_data = self._decode_substruct(
|
describing_data = self._decode_substruct(
|
||||||
['modules'], describing_data)
|
['modules'], describing_data)
|
||||||
@ -535,7 +532,9 @@ class Client(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def equipmentId(self):
|
def equipmentId(self):
|
||||||
return self.equipment_id
|
if self.describingData:
|
||||||
|
return self.describingData['properties']['equipment_id']
|
||||||
|
return 'Undetermined'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def protocolVersion(self):
|
def protocolVersion(self):
|
||||||
|
@ -151,7 +151,7 @@ class MainWindow(QMainWindow):
|
|||||||
node = QSECNode({'connectto': host, 'port': port}, parent=self)
|
node = QSECNode({'connectto': host, 'port': port}, parent=self)
|
||||||
host = '%s:%d' % (host, port)
|
host = '%s:%d' % (host, port)
|
||||||
|
|
||||||
host = '%s (%s)' % (node.equipment_id, host)
|
host = '%s (%s)' % (node.equipmentId, host)
|
||||||
self._nodes[host] = node
|
self._nodes[host] = node
|
||||||
node.register_shutdown_callback(self._nodeDisconnected_callback, host)
|
node.register_shutdown_callback(self._nodeDisconnected_callback, host)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user