Repository navigation
feat(knx)!: connection task dispatches and pulls; drop Channels (design 054 §4.9) - #294
Merged
Merged
Conversation
…gn 054 §4.9) The KNX connection task now dispatches inbound telegrams through an `InboundDispatch` and pulls outbound values from `OutboundRoutes` while the tunnel is connected. `build()` returns that one future; core runs no pump for KNX any more. Breaking: `KnxConnector::new(binder, delay, gateway_url)` loses the `&'static Channels<N>` argument and the `N` parameter. `Channels`, `TelegramChannel`, `CommandChannel`, `DEFAULT_QUEUE`, `KnxSink` and `KnxSource` are gone. Values produced during connect or backoff wait in their record buffers and go out after the handshake. An invalid group address or oversize payload is logged and counted as rejected. - client: `TelegramSink::deliver(&str, &[u8])` over `InboundDispatch`, group address formatted on the stack; `CommandSource` and the embassy-sync channel glue removed. - Tests: one future with or without outbound routes; the client tests build `OutboundRoutes` from a test db; an end-to-end round trip through records against a fake gateway; a value produced during connect is sent after the handshake. `topic_provider_tests.rs` becomes `topic_writer_tests.rs`; `shared_channel_on_std.rs` and the `critical-section` dev-dependency are removed. - Demos, `aimdb-codegen`'s KNX templates, the usage guide and the KNX README drop the channels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 15 of the design 054 implementation plan (§4.9). User-facing break.
What changes
The KNX connection task now dispatches inbound telegrams through an
InboundDispatchand pulls outbound values fromOutboundRoutesitself.build()returns that single future, and core runs no pump for KNX any more.connector.rs:Channels,TelegramChannel,CommandChannel,DEFAULT_QUEUE,KnxSink,KnxSourceand theNparameter are removed.client.rs:TelegramSink::deliver(&str, &[u8])is implemented forInboundDispatch. The group address is formatted into a stackTopicBuf.CommandSourceand the embassy-sync channel glue are removed.poll_fnoverpoll_stage. It is active only while connected, latchesReady(None), and keeps the arm-order swap.take_staged→GroupWrite::try_new→handle_command. An invalid address or oversize payload is logged and counted asrejectedinRouteStats.aimdb-codegen's two KNX templates (flatmain.rsand hub)docs/aimdb-usage-guide.mdTests
OutboundRoutesfrom a test database.telegrams_round_trip_through_recordsruns a realKnxConnectoragainst a fake gateway: an inbound telegram reaches its record (with the ACK), and a produced value goes out as aTUNNELING_REQUESTto 1/0/8.a_value_produced_during_connect_is_sent_after_the_handshake. Mutation check: removing theconnectedgate makes this test fail.topic_provider_tests.rs→topic_writer_tests.rs:TopicWriterwith capacity 8.31/7/255fits; one byte less overflows.with_topic_providerlink onknxfails the build.shared_channel_on_std.rs, plus thecritical-sectiondev-dependency it needed. Nothing in the crate uses an embassy-sync channel any more.Verified locally
cargo test -p aimdb-knx-connector --no-default-features --features std(lib, integration and doc tests)--all-targets, thumbv7emconnectorandconnector,defmtstd,connector) with-D warningsmake clippycargo fmt --checkcargo test -p aimdb-codegenmake codegen-drift. The fixture has no KNX connector, so I also did a one-off run with a KNX variant of the fixture; the generated hub withKnxConnectorcompiled.knx-connector-demo-common,tokio-knx-connector-demo, andembassy-knx-connector-demo(thumbv8m.main-none-eabihf), plus clippy on the demos.Left for stage 16
embassy-syncis now unused but stays in the KNXconnectorfeature until it is dropped together with the old SPI.critical-section-std-implstill exists. Its remaining users are the README install snippet, the Tokio demo'sCargo.tomland codegen's generatedCargo.toml. They are harmless and go with that decision.🤖 Generated with Claude Code