Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ futures-util = "0.3.31"
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["ansi", "env-filter"] }
tokio-util = { version = "0.7.16", features = ["full"] }
crossterm = { version = "0.28", features = ["event-stream"] }
can-dbc = "6.0.0"
serde_json.workspace = true
schemars.workspace = true
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@ Ex. `cansend vcan0 702#01010101FFFFFFFF`
Now view calypso interpret the can message and broadcast it on `mqttui`


### Manual Simulation (Interactive Injection)

`manual-sim` lets you inject MQTT messages by pressing keys in the terminal. Each key maps to a topic and publishes a randomized value within that topic's defined range.

1. Create a keymap JSON file mapping single characters to topics:
```json
{
"v": "BMS/Pack/Voltage",
"c": "BMS/Pack/Current",
"s": "BMS/Pack/SOC"
}
```
See `manual_sim_keymap.example.json` for a starting point. Use `--list-topics` to see all available topics:
```
cargo run --bin manual-sim -- --list-topics
```

2. Run with your keymap:
```
cargo run --bin manual-sim -- --key-map manual_sim_keymap.example.json
```

3. Press the mapped keys to inject values. Press `Ctrl+C` to exit.

To use a remote broker: `cargo run --bin manual-sim -- --key-map manual_sim_keymap.example.json -u 10.0.0.5:1883`

### Simulation Mode
#### Run from build
- Same setup as above, then use the entry point `simulate` instead of `main`
Expand Down
6 changes: 6 additions & 0 deletions manual_sim_keymap.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"v": "BMS/Pack/Voltage",
"c": "BMS/Pack/Current",
"s": "BMS/Pack/SOC",
"h": "BMS/Pack/Health"
}
Loading