ValueBuffer is now the default buffer object for storing data for recording and processing purposes, a simple recording implementation has been done, core.py example starts recording as soon as the core has started then on exit it saves the output as a csv file through the ValueBuffer export_csv method
33 lines
766 B
Python
33 lines
766 B
Python
import logging
|
|
|
|
from rich.logging import RichHandler
|
|
|
|
from dynalab_core import Core
|
|
from dynalab_core.config import CoreConfig
|
|
|
|
logging.basicConfig(
|
|
level=logging.DEBUG,
|
|
format="%(name)s %(message)s",
|
|
datefmt="%H:%M:%S",
|
|
handlers=[RichHandler(rich_tracebacks=True, show_path=False)],
|
|
force=True,
|
|
)
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
config = CoreConfig(port=8765)
|
|
log.info("Configured manual core on %s", config.bind_str())
|
|
dl_core = Core(config)
|
|
dl_core.start()
|
|
dl_core.start_recording()
|
|
|
|
try:
|
|
while True:
|
|
dl_core.wait(1)
|
|
values = dl_core.get_all_live_values()
|
|
log.debug(f"Core values: {values}")
|
|
except KeyboardInterrupt:
|
|
log.info("Received keyboard interrupt")
|
|
dl_core.stop_recording()
|
|
dl_core.stop()
|