Wire InfoCommand through as one real, runnable example

BambuRequest::Info(InfoCommand) is now live (was commented out) —
examples/bambu_protocol_demo.rs constructs one, serializes it, and prints
it next to Bambu's real wire JSON for comparison. Run it and copy this
exact shape (proto message -> use it here -> add an enum variant) for
every other command.
This commit is contained in:
2026-08-28 22:41:55 +00:00
parent 6e18215af5
commit 8e5d85202f
4 changed files with 83 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
//! Run with: cargo run --example bambu_protocol_demo
//!
//! Proves the whole pipeline end to end: a message written in
//! continuum-schemas' proto/bambulab/v1/request.proto, compiled by prost
//! into a real Rust struct, wrapped in the hand-written BambuRequest enum,
//! and serialized by plain serde — no protobuf binary encoding involved,
//! since Bambu's actual wire format is JSON over MQTT.
use continuum_proxy::printer::BambuRequest;
use continuum_types::bambulab::v1::InfoCommand;
fn main() {
let request = BambuRequest::Info(InfoCommand {
sequence_id: "0".to_string(),
command: "get_version".to_string(),
});
let actual = serde_json::to_string(&request).unwrap();
let expected = r#"{"info":{"sequence_id":"0","command":"get_version"}}"#;
println!("generated: {actual}");
println!("Bambu's real wire format: {expected}");
println!("match: {}", actual == expected);
}