node map must be rebuilt for reconnected clients
This commit is contained in:
4
base.py
4
base.py
@@ -60,10 +60,10 @@ class Client(HandlerBase):
|
||||
def change_callback(dictionary=self.dictionary, kind_uri=(kind, uri)):
|
||||
dictionary.pop(kind_uri, None)
|
||||
|
||||
node = server.interactor_classes[kind](uri, self.node_map, change_callback)
|
||||
node = server.interactor_classes[kind](uri, change_callback)
|
||||
|
||||
self.dictionary[kind, uri] = node
|
||||
|
||||
node.update_node_map(self.node_map)
|
||||
self.nodes[uri] = node
|
||||
self.server = server
|
||||
self.instrument_name = instrument_name
|
||||
|
||||
6
secop.py
6
secop.py
@@ -49,7 +49,7 @@ class SecopInteractor(SecopClient):
|
||||
hide_par = ["baseclass", "class", "pollinterval"]
|
||||
skip_par = ["status2"]
|
||||
|
||||
def __init__(self, uri, node_map, change_callback=None):
|
||||
def __init__(self, uri, change_callback=None):
|
||||
super().__init__(uri)
|
||||
self.module_updates = set()
|
||||
self.param_updates = set()
|
||||
@@ -57,11 +57,13 @@ class SecopInteractor(SecopClient):
|
||||
self.change_callback = change_callback
|
||||
try:
|
||||
self.connect()
|
||||
node_map.update({k: self for k in self.modules})
|
||||
self.register_callback(None, updateItem=self.updateItem, descriptiveDataChange=self.descChanged)
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
|
||||
def update_node_map(self, node_map):
|
||||
node_map.update({k: self for k in self.modules})
|
||||
|
||||
def descChanged(self, module, desc):
|
||||
if module is None and self.change_callback:
|
||||
self.change_callback()
|
||||
|
||||
Reference in New Issue
Block a user