From 46580439955533903ad19e168bff87f74fc540e2 Mon Sep 17 00:00:00 2001 From: jbernavaprah Date: Thu, 11 Jun 2026 11:12:35 +0200 Subject: [PATCH 1/2] feat(api): add LED, microphone, and speaker component-capability topic leaves The v1 `topic_tree!` only exposed component-capability leaves for the capabilities wired by platform runtimes, leaving the LED, microphone, and speaker payload modules without any `component(id).(cap).()` fluent leaves. Consumers (operator's rerun-proxy visualizer, simulator's Webots controller) consequently had to drop their LED/mic/speaker paths during the v0.5.0 migration. Add the missing leaves against the existing canonical payload types: - `component(id).led(cap).command()` -> led::Command - `component(id).microphone(cap).data()` -> microphone::Frame - `component(id).speaker(cap).audio()` -> speaker::audio::Audio - `component(id).speaker(cap).command()` -> speaker::command::Command Schemas (`v1/component/speaker/audio`, `v1/component/speaker/command`, `v1/component/led/command`, `v1/component/microphone/data`) match the pre-fluent TOPIC_KIND/KIND values, so the wire contract is unchanged. Representative key/schema tests added alongside the other capabilities. Co-Authored-By: Claude Opus 4.8 --- phoxal/src/api/v1/mod.rs | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/phoxal/src/api/v1/mod.rs b/phoxal/src/api/v1/mod.rs index 68824893..4d53f6be 100644 --- a/phoxal/src/api/v1/mod.rs +++ b/phoxal/src/api/v1/mod.rs @@ -162,6 +162,16 @@ crate::topic_tree! { battery(id) { pubsub data: crate::api::v1::component::capability::battery::State, version = 1; } + led(id) { + pubsub command: crate::api::v1::component::capability::led::Command, version = 1; + } + microphone(id) { + pubsub data: crate::api::v1::component::capability::microphone::Frame, version = 1; + } + speaker(id) { + pubsub audio: crate::api::v1::component::capability::speaker::audio::Audio, version = 1; + pubsub command: crate::api::v1::component::capability::speaker::command::Command, version = 1; + } } asset { query get: crate::api::v1::asset::GetRequest => crate::api::v1::asset::GetResponse, version = 1; @@ -791,6 +801,42 @@ mod tests { "v1/component/power_board/battery/main_battery/data", "v1/component/battery/data", ); + assert_pubsub::( + topic::new() + .v1() + .component("status_panel") + .led("status") + .command(), + "v1/component/status_panel/led/status/command", + "v1/component/led/command", + ); + assert_pubsub::( + topic::new() + .v1() + .component("head") + .microphone("mic") + .data(), + "v1/component/head/microphone/mic/data", + "v1/component/microphone/data", + ); + assert_pubsub::( + topic::new() + .v1() + .component("head") + .speaker("speaker") + .audio(), + "v1/component/head/speaker/speaker/audio", + "v1/component/speaker/audio", + ); + assert_pubsub::( + topic::new() + .v1() + .component("head") + .speaker("speaker") + .command(), + "v1/component/head/speaker/speaker/command", + "v1/component/speaker/command", + ); assert_pubsub::( topic::new().v1().simulation().robot("r1").pose(), "v1/simulation/robot/r1/pose", From f36d7d6be33b7d36cfb5b76a67bd5e136670bb2c Mon Sep 17 00:00:00 2001 From: jbernavaprah Date: Thu, 11 Jun 2026 11:18:07 +0200 Subject: [PATCH 2/2] style: rustfmt the microphone topic assertion Co-Authored-By: Claude Opus 4.8 --- phoxal/src/api/v1/mod.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/phoxal/src/api/v1/mod.rs b/phoxal/src/api/v1/mod.rs index 4d53f6be..fc8d64fe 100644 --- a/phoxal/src/api/v1/mod.rs +++ b/phoxal/src/api/v1/mod.rs @@ -811,11 +811,7 @@ mod tests { "v1/component/led/command", ); assert_pubsub::( - topic::new() - .v1() - .component("head") - .microphone("mic") - .data(), + topic::new().v1().component("head").microphone("mic").data(), "v1/component/head/microphone/mic/data", "v1/component/microphone/data", );