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.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(
self.on_dump_receive)
@ -838,19 +838,25 @@ class WaveformDock(QtWidgets.QDockWidget):
except Exception as e:
logger.error("Failed to open analyzer trace: %s", e)
# DeviceDB subscriber callbacks
def init_ddb(self, ddb):
self._ddb = ddb
def _process_ddb(self):
addr = None
channel_list = comm_analyzer.get_channel_list(ddb)
for k, v in channel_list.items():
self._channels_mgr[k] = v
for name, desc in ddb.items():
if isinstance(desc, dict):
if desc["type"] == "controller" and name == "core_analyzer":
addr = desc["host"]
port = desc.get("port_proxy", 1385)
port_control = desc.get("port_proxy_control", 1386)
#for k, v in comm_analyzer.get_channel_list(self._ddb).items():
# self._channel_model[k] = v
for name, desc in self._ddb.items():
if name == "core_analyzer":
logger.info("coreanalyzer exists")
addr = desc["host"]
port = desc.get("port_proxy", 1385)
port_control = desc.get("port_proxy_control", 1386)
if addr is not None:
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
def update_ddb(self, mod):
logger.info("update ddb")
self._process_ddb()