Custom topic injection mode with per-topic intervals#291
Open
Custom topic injection mode with per-topic intervals#291
Conversation
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.
Changes
Added
--topic "TOPIC=INTERVAL_MS"flag to the simulator for selecting specific topics with custom per-topic loop intervals. This is the "injection mode" from #289 — only the specified topics are published, each on their own frequency.Also gated
imd_pollbehindcfg(target_os = "linux")to fix macOS builds (matches the existing linux-onlysocketcandep in Cargo.toml).Notes
Refactored
simulate_outso component creation and filtering now happen inmainat startup. This means invalid topic names fail immediately with a clear error instead of silently inside the async task. Extractedcompile_regex_patternshelper to deduplicate the blacklist/whitelist regex loops while I was in there.The
--topicflag conflicts with--enable-topicand--disable-topicsince they're different modes.Test Cases
simulate --topic "BMS/Pack/Voltage=30000"— only publishes BMS/Pack/Voltage at 30s intervalssimulate --topic "BMS/Pack/Voltage=30000" --topic "BMS/Pack/Current=10000"— publishes both at their own intervalssimulate --topic "Nonexistent/Topic=1000"— fails at startup with "Unknown topic(s): Nonexistent/Topic"simulate --topic "BadFormat"— fails with "expected TOPIC=INTERVAL_MS"simulate --topic "BMS/Pack/Voltage=0"— fails with "Interval must be positive"simulate(no flags) — all topics published at default intervals, unchanged behaviorChecklist
Closes #289