From d155ee789a4a75777330f118ba188cf9bae04aab Mon Sep 17 00:00:00 2001 From: haixuantao Date: Mon, 23 Jun 2025 11:17:34 +0200 Subject: [PATCH] Fix stop in example nodes --- apis/c++/node/src/lib.rs | 2 +- examples/multiple-daemons/node/src/main.rs | 2 +- examples/multiple-daemons/sink/src/main.rs | 4 ++-- examples/rust-dataflow/node/src/main.rs | 2 +- examples/rust-dataflow/sink-dynamic/src/main.rs | 4 ++-- examples/rust-dataflow/sink/src/main.rs | 4 ++-- examples/rust-dataflow/status-node/src/main.rs | 2 +- examples/rust-ros2-dataflow/node/src/main.rs | 2 +- node-hub/dora-keyboard/dora_keyboard/main.py | 2 ++ node-hub/dora-microphone/dora_microphone/main.py | 1 + node-hub/dora-mistral-rs/src/main.rs | 4 ++-- 11 files changed, 16 insertions(+), 13 deletions(-) diff --git a/apis/c++/node/src/lib.rs b/apis/c++/node/src/lib.rs index a7ec233a..4e06e11a 100644 --- a/apis/c++/node/src/lib.rs +++ b/apis/c++/node/src/lib.rs @@ -144,7 +144,7 @@ pub struct DoraEvent(Option); fn event_type(event: &DoraEvent) -> ffi::DoraEventType { match &event.0 { Some(event) => match event { - Event::Stop => ffi::DoraEventType::Stop, + Event::Stop(_) => ffi::DoraEventType::Stop, Event::Input { .. } => ffi::DoraEventType::Input, Event::InputClosed { .. } => ffi::DoraEventType::InputClosed, Event::Error(_) => ffi::DoraEventType::Error, diff --git a/examples/multiple-daemons/node/src/main.rs b/examples/multiple-daemons/node/src/main.rs index 36f42d57..bf1cd424 100644 --- a/examples/multiple-daemons/node/src/main.rs +++ b/examples/multiple-daemons/node/src/main.rs @@ -26,7 +26,7 @@ fn main() -> eyre::Result<()> { } other => eprintln!("Ignoring unexpected input `{other}`"), }, - Event::Stop => println!("Received manual stop"), + Event::Stop(_) => println!("Received stop"), other => eprintln!("Received unexpected input: {other:?}"), } } diff --git a/examples/multiple-daemons/sink/src/main.rs b/examples/multiple-daemons/sink/src/main.rs index e180af08..59316aba 100644 --- a/examples/multiple-daemons/sink/src/main.rs +++ b/examples/multiple-daemons/sink/src/main.rs @@ -24,8 +24,8 @@ fn main() -> eyre::Result<()> { } other => eprintln!("Ignoring unexpected input `{other}`"), }, - Event::Stop => { - println!("Received manual stop"); + Event::Stop(_) => { + println!("Received stop"); } Event::InputClosed { id } => { println!("Input `{id}` was closed"); diff --git a/examples/rust-dataflow/node/src/main.rs b/examples/rust-dataflow/node/src/main.rs index 36f42d57..bf1cd424 100644 --- a/examples/rust-dataflow/node/src/main.rs +++ b/examples/rust-dataflow/node/src/main.rs @@ -26,7 +26,7 @@ fn main() -> eyre::Result<()> { } other => eprintln!("Ignoring unexpected input `{other}`"), }, - Event::Stop => println!("Received manual stop"), + Event::Stop(_) => println!("Received stop"), other => eprintln!("Received unexpected input: {other:?}"), } } diff --git a/examples/rust-dataflow/sink-dynamic/src/main.rs b/examples/rust-dataflow/sink-dynamic/src/main.rs index 58f36e41..db5164b7 100644 --- a/examples/rust-dataflow/sink-dynamic/src/main.rs +++ b/examples/rust-dataflow/sink-dynamic/src/main.rs @@ -25,8 +25,8 @@ fn main() -> eyre::Result<()> { } other => eprintln!("Ignoring unexpected input `{other}`"), }, - Event::Stop => { - println!("Received manual stop"); + Event::Stop(_) => { + println!("Received stop"); } Event::InputClosed { id } => { println!("Input `{id}` was closed"); diff --git a/examples/rust-dataflow/sink/src/main.rs b/examples/rust-dataflow/sink/src/main.rs index e180af08..59316aba 100644 --- a/examples/rust-dataflow/sink/src/main.rs +++ b/examples/rust-dataflow/sink/src/main.rs @@ -24,8 +24,8 @@ fn main() -> eyre::Result<()> { } other => eprintln!("Ignoring unexpected input `{other}`"), }, - Event::Stop => { - println!("Received manual stop"); + Event::Stop(_) => { + println!("Received stop"); } Event::InputClosed { id } => { println!("Input `{id}` was closed"); diff --git a/examples/rust-dataflow/status-node/src/main.rs b/examples/rust-dataflow/status-node/src/main.rs index 09de8184..ff97b97e 100644 --- a/examples/rust-dataflow/status-node/src/main.rs +++ b/examples/rust-dataflow/status-node/src/main.rs @@ -29,7 +29,7 @@ fn main() -> eyre::Result<()> { } other => eprintln!("ignoring unexpected input {other}"), }, - Event::Stop => {} + Event::Stop(_) => {} Event::InputClosed { id } => { println!("input `{id}` was closed"); if *id == "random" { diff --git a/examples/rust-ros2-dataflow/node/src/main.rs b/examples/rust-ros2-dataflow/node/src/main.rs index 395a5e34..32ad5970 100644 --- a/examples/rust-ros2-dataflow/node/src/main.rs +++ b/examples/rust-ros2-dataflow/node/src/main.rs @@ -119,7 +119,7 @@ fn main() -> eyre::Result<()> { } other => eprintln!("Ignoring unexpected input `{other}`"), }, - Event::Stop => println!("Received manual stop"), + Event::Stop(_) => println!("Received stop"), other => eprintln!("Received unexpected input: {other:?}"), }, MergedEvent::External(pose) => { diff --git a/node-hub/dora-keyboard/dora_keyboard/main.py b/node-hub/dora-keyboard/dora_keyboard/main.py index f3858fe0..644c10c5 100644 --- a/node-hub/dora-keyboard/dora_keyboard/main.py +++ b/node-hub/dora-keyboard/dora_keyboard/main.py @@ -11,6 +11,8 @@ def main(): node = Node() always_none = node.next(timeout=0.001) is None + always_none = node.next(timeout=0.001) is None + print("Always None:", always_none) with keyboard.Events() as events: while True: if not always_none: diff --git a/node-hub/dora-microphone/dora_microphone/main.py b/node-hub/dora-microphone/dora_microphone/main.py index b45756bc..aec0eeab 100644 --- a/node-hub/dora-microphone/dora_microphone/main.py +++ b/node-hub/dora-microphone/dora_microphone/main.py @@ -19,6 +19,7 @@ def main(): start_recording_time = tm.time() node = Node() + always_none = node.next(timeout=0.001) is None always_none = node.next(timeout=0.001) is None finished = False diff --git a/node-hub/dora-mistral-rs/src/main.rs b/node-hub/dora-mistral-rs/src/main.rs index bb451e1e..9b123113 100644 --- a/node-hub/dora-mistral-rs/src/main.rs +++ b/node-hub/dora-mistral-rs/src/main.rs @@ -46,8 +46,8 @@ async fn main() -> eyre::Result<()> { } other => eprintln!("Received input `{other}`"), }, - Event::Stop => { - println!("Received manual stop") + Event::Stop(_) => { + println!("Received command"); } Event::InputClosed { id } => { println!("input `{id}` was closed");