waveform: change ddb processing

This commit is contained in:
Simon Renblad 2024-01-15 14:36:37 +08:00
parent 513c9188c4
commit f5f58f8f23

View File

@ -678,7 +678,7 @@ class WaveformDock(QtWidgets.QDockWidget):
self._current_dir = os.getcwd() self._current_dir = os.getcwd()
self.proxy_client = WaveformProxyClient(self._state, loop) self.proxy_client = WaveformProxyClient(self._state, loop)
devices_sub = Subscriber("devices", self.init_ddb) devices_sub = Subscriber("devices", self.init_ddb, self.update_ddb)
proxy_receiver = comm_analyzer.AnalyzerProxyReceiver( proxy_receiver = comm_analyzer.AnalyzerProxyReceiver(
self.on_dump_receive) self.on_dump_receive)
@ -838,19 +838,25 @@ class WaveformDock(QtWidgets.QDockWidget):
except Exception as e: except Exception as e:
logger.error("Failed to open analyzer trace: %s", e) logger.error("Failed to open analyzer trace: %s", e)
# DeviceDB subscriber callbacks def _process_ddb(self):
def init_ddb(self, ddb):
self._ddb = ddb
addr = None addr = None
channel_list = comm_analyzer.get_channel_list(ddb) #for k, v in comm_analyzer.get_channel_list(self._ddb).items():
for k, v in channel_list.items(): # self._channel_model[k] = v
self._channels_mgr[k] = v for name, desc in self._ddb.items():
for name, desc in ddb.items(): if name == "core_analyzer":
if isinstance(desc, dict): logger.info("coreanalyzer exists")
if desc["type"] == "controller" and name == "core_analyzer": addr = desc["host"]
addr = desc["host"] port = desc.get("port_proxy", 1385)
port = desc.get("port_proxy", 1385) port_control = desc.get("port_proxy_control", 1386)
port_control = desc.get("port_proxy_control", 1386)
if addr is not None: if addr is not None:
self.proxy_client.update_address(addr, port, port_control) self.proxy_client.update_address(addr, port, port_control)
def init_ddb(self, ddb):
logger.info("init ddb")
self._ddb = ddb
self._process_ddb()
return ddb return ddb
def update_ddb(self, mod):
logger.info("update ddb")
self._process_ddb()