Replace proto-based bambu_protocol with plain-Rust bambu_commands/

One file per command (get_version.rs, pushall.rs), each holding its
request AND response together. CommandEnvelope (sequence_id + command) is
the shared-fields piece every command embeds via #[serde(flatten)] — the
'inheritance' replacement for these structs, same composition idea as
BambuGenericPrinter in bambu.rs, just expressed as a struct field instead
of impl-block delegation.

examples/bambu_commands_demo.rs round-trips both commands against Bambu's
exact real JSON (from the original conversation) and confirms byte-for-
byte matches, same as the removed proto version did — this replacement is
behaviorally identical, just without protoc/build.rs in the loop.
This commit is contained in:
2026-08-28 22:49:06 +00:00
parent 8e5d85202f
commit 166761479b
8 changed files with 145 additions and 78 deletions
+4 -2
View File
@@ -29,12 +29,14 @@
//! `tokio::spawn`, not yet).
mod bambu;
mod bambu_protocol;
mod bambu_commands;
mod klipper;
mod prusa;
pub use bambu::{BambuGenericPrinter, BambuTls, BambuV1Printer, BambuV2Printer};
pub use bambu_protocol::{BambuReport, BambuRequest};
pub use bambu_commands::{
BambuReport, BambuRequest, CommandEnvelope, GetVersionRequest, GetVersionResponse, PushallRequest, PushallResponse,
};
pub use klipper::KlipperPrinter;
pub use prusa::{PrusaLinkPrinter, PrusaSerialPrinter};