Updated docs and updated API to fetch signal descriptors in all modes
API and Protocol docs have been updated (GPT 5.6) The API methods for fetching a sepcific signal descriptor and fetching all signal descriptors now work in offline mode, the core_tui.py example has been updated to fit the new tri mode architecture and loading recording offload -> processing and then processing -> playback engine all works
This commit is contained in:
6 files changed
+356
-596
No files matched your search
@@ -270,18 +270,7 @@ class Core:
|
||||
"Cannot load processing because no recording buffer is available",
|
||||
code="no_playback_data",
|
||||
)
|
||||
loaded_data = DLPak().set_data(copy(self._recording_buffer))
|
||||
connector_signal_descriptors = (
|
||||
self._connector_registry.get_all_signal_descriptors()
|
||||
)
|
||||
derive_signal_descriptors = (
|
||||
self._derive_registry.get_all_signal_descriptors()
|
||||
)
|
||||
|
||||
loaded_data.set_manifest(
|
||||
self._recording_timestamp,
|
||||
connector_signal_descriptors + derive_signal_descriptors,
|
||||
)
|
||||
loaded_data = copy(self._offload_buffer)
|
||||
else:
|
||||
loaded_data = DLPak().read(input)
|
||||
self._processing_buffer = loaded_data
|
||||
@@ -363,6 +352,16 @@ class Core:
|
||||
if signal is None:
|
||||
signal = self._derive_registry.get_signal_descriptor(signal_id)
|
||||
|
||||
elif self._mode.value == "offline" and self._processing_buffer is not None:
|
||||
signal = next(
|
||||
(
|
||||
signal
|
||||
for signal in self._processing_buffer.get_all_signal_descriptors()
|
||||
if signal.id == signal_id
|
||||
),
|
||||
None,
|
||||
)
|
||||
|
||||
elif self._mode.value == "playback":
|
||||
signal = self._playback_engine.get_signal_descriptor(signal_id)
|
||||
|
||||
@@ -376,14 +375,17 @@ class Core:
|
||||
derive_signals: list[SignalDescriptor] = []
|
||||
if self._mode.value == "realtime":
|
||||
root_signals = self._connector_registry.get_all_signal_descriptors()
|
||||
elif self._mode.value == "offline" and self._processing_buffer is not None:
|
||||
root_signals = self._processing_buffer.get_all_signal_descriptors()
|
||||
elif self._mode.value == "playback":
|
||||
root_signals = self._playback_engine.get_all_signal_descriptors()
|
||||
|
||||
if (
|
||||
self._core_config.playback_mode == "reprocess"
|
||||
or self._mode.value == "realtime"
|
||||
):
|
||||
and self._mode.value == "playback"
|
||||
) or self._mode.value == "realtime":
|
||||
derive_signals = self._derive_registry.get_all_signal_descriptors()
|
||||
|
||||
return copy(root_signals + derive_signals)
|
||||
|
||||
def get_live_value(self, signal_id: UUID) -> float | None:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from copy import copy
|
||||
from datetime import datetime, timezone
|
||||
import logging
|
||||
from pathlib import Path
|
||||
@@ -58,6 +59,9 @@ class DLPak:
|
||||
timestamp=timestamp, signals=manifest_signals, comments=""
|
||||
)
|
||||
|
||||
def get_all_signal_descriptors(self) -> list[SignalDescriptor]:
|
||||
return copy([signal.to_pure() for signal in self._manifest.signals])
|
||||
|
||||
def read(self, file: str | Path) -> Self:
|
||||
input_path = Path(file)
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class PlaybackEngine:
|
||||
and self._core_config.playback_mode == "reprocess"
|
||||
):
|
||||
return None
|
||||
return signal
|
||||
return signal.to_pure()
|
||||
return None
|
||||
|
||||
def get_all_signal_descriptors(self) -> list[SignalDescriptor]:
|
||||
@@ -86,7 +86,7 @@ class PlaybackEngine:
|
||||
if signal.origin != "derived"
|
||||
]
|
||||
elif self._core_config.playback_mode == "read":
|
||||
return self._data._manifest.signals
|
||||
return [signal.to_pure() for signal in self._data._manifest.signals]
|
||||
|
||||
return list[SignalDescriptor]()
|
||||
|
||||
|
||||
Reference in new issue
Block a user