Skip to content

Add event dispatcher & more#10

Merged
miDeb merged 12 commits intomainfrom
feat/more-impl
Apr 5, 2026
Merged

Add event dispatcher & more#10
miDeb merged 12 commits intomainfrom
feat/more-impl

Conversation

@miDeb
Copy link
Copy Markdown
Member

@miDeb miDeb commented Mar 28, 2026

Among other things, this adds an EventDispatcher, that handles communication between different threads. One thread thread can dispatch events that arbitrary other threads can then handle.

Other changes:

  • connect to multiple can interfaces
  • add testcontainers for testing the db. tests now require docker. I added a unit test and an integration test that uses this.
  • removed !#[allow(unused)] from the crate, instead used more granular ignores.

Copy link
Copy Markdown
Member

@raffael0 raffael0 left a comment

Choose a reason for hiding this comment

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

Great work!

Comment thread src/can/mod.rs Outdated
if message_id.receiver_id() == NODE_ID_BROADCAST || message_id.receiver_id() == NODE_ID_SERVER {
let message = CanMessage::try_from(frame).with_context(|| {
format!(
"failed to parse CAN frame into CanMessage for node {}",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please print the message as well in hex

Comment thread src/can/mod.rs
interface
);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a comment that no broadcast messages are forwarded

Comment thread src/events/mod.rs Outdated

pub fn dispatch(&self, event: Event) {
for listener in self.listeners.read().unwrap().iter() {
let _ = listener.send(event.clone());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add some error detection

@raffael0
Copy link
Copy Markdown
Member

raffael0 commented Apr 3, 2026

Can this now be merged?

@miDeb
Copy link
Copy Markdown
Member Author

miDeb commented Apr 5, 2026

yes, forgot about it

@miDeb miDeb merged commit 68dacb8 into main Apr 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants