Skip to content

Add a generic timebase handler to TimeDaemon - #244

Draft
florianfueller wants to merge 2 commits into
eclipse-score:mainfrom
florianfueller:feature/generic_timebase_handler
Draft

florianfueller wants to merge 2 commits into
eclipse-score:mainfrom
florianfueller:feature/generic_timebase_handler

Conversation

@florianfueller

@florianfueller florianfueller commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
  • Move common setup, messaging, and lifecycle code out of SvtHandler
  • Allow TimeDaemon to run multiple handlers through a custom factory
  • Expose public Bazel targets for custom handlers

closes #265

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: c339247d-aeca-4b5b-89ca-d617e0dc6bae
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'platforms', the root module requires module version platforms@1.0.0, but got platforms@1.1.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'score_platform', the root module requires module version score_platform@0.7.1, but got score_platform@0.7.2 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_oci', the root module requires module version rules_oci@2.2.7, but got rules_oci@2.3.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'score_devcontainer', the root module requires module version score_devcontainer@1.8.0, but got score_devcontainer@1.11.1 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 3 packages loaded
WARNING: Target pattern parsing failed.
ERROR: Skipping '//:license-check': no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/time/time/BUILD
ERROR: no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/time/time/BUILD
INFO: Elapsed time: 18.941s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Quality pack traceability report for this pull request:

Status: PASS (workflow run)

Traceability gate input: /home/runner/work/time/time/_build/metrics.json
------------------------------------------------------------------------
[comp_req]
  Requirements with source links: 9/58 (15.52%)
  Requirements with test links:   5/58 (8.62%)
  Requirements fully linked:      5/58 (8.62%)
  Tests linked to requirements:   8/456 (1.75%)
  Broken test references:         0
------------------------------------------------------------------------
Threshold check passed.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-244: https://eclipse-score.github.io/time/pr-244/

@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from 665e84a to bca6aef Compare October 12, 2026 07:45
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from bca6aef to 421c457 Compare October 12, 2026 08:11
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from 6242ad5 to b23ca0b Compare October 16, 2026 18:45
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from b23ca0b to f7e2a49 Compare October 16, 2026 19:00
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from f7e2a49 to 1f74064 Compare October 16, 2026 19:12
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from 1f74064 to e2316e4 Compare October 16, 2026 19:19
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from e2316e4 to d4330e3 Compare October 16, 2026 19:53
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from ef85ca2 to f086710 Compare October 20, 2026 06:38
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from f086710 to 7378db6 Compare October 20, 2026 06:59
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from 7378db6 to 6229b80 Compare October 20, 2026 07:19
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from 6229b80 to c71e31b Compare October 20, 2026 07:28
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from c71e31b to 2fc7c4d Compare October 20, 2026 07:41
@florianfueller
florianfueller force-pushed the feature/generic_timebase_handler branch from 2fc7c4d to 788e7e6 Compare October 20, 2026 07:47
@florianfueller florianfueller changed the title Generic Timebase Handler Add a generic timebase handler to TimeDaemon Oct 20, 2026
- Move common setup, messaging, and lifecycle code out of SvtHandler
- Allow TimeDaemon to run multiple handlers through a custom factory
- Expose public Bazel targets for custom handlers

Refs eclipse-score#265

Signed-off-by: Florian Füller <5454068+florianfueller@users.noreply.github.com>
/// A timeout makes the handler fail.
/// \return The machine passed to Add().
template <typename M>
std::shared_ptr<M> Add(std::shared_ptr<M> machine, std::chrono::seconds init_timeout = std::chrono::seconds{20});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it is a good approach to have the default value here.
would beleave it might be forbidden by misra even

@@ -0,0 +1,103 @@
/********************************************************************************

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it the timebase_handler_factory_test.*?

/// The JobRunner initializes the machines on a worker thread. Once all machines are ready, proactive machines
/// start in Add() order and stop in reverse order. Add machines that must run first before their data sources.
///
/// param T Type of messages sent through the MessageBroker.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// param T Type of messages sent through the MessageBroker.
/// param T Type of messages sent through the MessageBroker.

/// Keeps the machines alive. The MessageBroker holds only weak references.
std::vector<std::shared_ptr<BaseMachine>> machines_;
std::vector<std::shared_ptr<ProactiveMachine>> start_order_; // in Add() order
std::string name_;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall it be const?

bool is_initialized_;
};

template <typename T>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
template <typename T>
template <typename T, typename M>

Comment thread score/time_daemon/BUILD
)

alias(
name = "generic_timebase_handler",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall all these be combined to time_daemon_core?
or, if you ant to split the time daemon, then

  • core
  • main
  • time_handlers

Comment thread score/time_daemon/BUILD
actual = "//score/time_daemon/src/msg_broker",
visibility = ["//visibility:public"],
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also somehow encrease the readability here
group the aliases with

  • the core types and targets, whcih provide the possibility to add any new timebase
  • the svt -related targets
  • the tiem daemon bricks


config/configuration_guide

Choosing Handlers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really a choosing?

Handler Lifecycle
=================

``TimeDaemon`` owns the handlers. ``Initialize()`` fails if the list is empty or any handler is null.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we describe here a small state machine or it wil be too much?


During initialization, the ``Application`` uses a factory pattern to create components in specific order:
``TimeDaemon`` owns the handlers. Its default constructor calls ``CreateTimebaseHandlers()``.
Exactly one linked factory must define this function (see :ref:`time_daemon_user_manual`).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would find that a bit starange, that the detailed design, which is (or should be) way more deatialed and tehcnically filled refernce here the user manual ..

This branch is waiting to be deployed

1 waiting deployment
workflow-approval — e081848b Waiting Oct 29, 2026 by florianfueller via qnx-build (x86_64-qnx) / approval #1124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Time Daemon unit reuse for vendor ECUs

2 participants