Compare commits

..

2 Commits

Author SHA1 Message Date
octoturge 99c1d038f9 Add InfoCommand as one fully-wired real example in bambulab.v1
The rest of proto/bambulab/ was pure boilerplate/comments with nothing
concrete to copy from. This one message (sequence_id + command, matching
Bambu's real get_version request) is wired all the way through: real
proto, real generated Rust struct, lib.rs actually include!'d instead of
commented out. continuum-proxy's bambu_protocol_demo example serializes it
and diffs the output against Bambu's actual wire JSON byte for byte.

Verified with cargo build (this crate) and cargo run --example
bambu_protocol_demo (continuum-proxy) - output matches exactly.
2026-08-28 22:41:42 +00:00
octoturge f0bb8714a3 Document how to wire up bambulab modules in lib.rs once messages exist 2026-08-28 22:39:55 +00:00
2 changed files with 32 additions and 4 deletions
+18
View File
@@ -7,3 +7,21 @@ pub mod continuum {
pub use continuum::v1::{ pub use continuum::v1::{
MaterialProfile, PrintJob, PrintJobStatus, PrintParameters, Template, MaterialProfile, PrintJob, PrintJobStatus, PrintParameters, Template,
}; };
pub mod bambulab {
// common.proto and bambulab/v2/*.proto have no messages yet, so
// there's nothing for prost to emit for them — `include!` against a
// nonexistent file breaks the build. Uncomment each once it has real
// content:
//
// include!(concat!(env!("OUT_DIR"), "/bambulab.rs")); // common.proto's messages
pub mod v1 {
// request.proto + report.proto both declare `package bambulab.v1;`,
// so prost combines them into one output file, regardless of which
// input file each message came from.
include!(concat!(env!("OUT_DIR"), "/bambulab.v1.rs"));
}
// pub mod v2 {
// include!(concat!(env!("OUT_DIR"), "/bambulab.v2.rs"));
// }
}
+14 -4
View File
@@ -2,12 +2,22 @@ syntax = "proto3";
package bambulab.v1; package bambulab.v1;
// import "bambulab/common.proto"; once common.proto has a shared message // One real, fully-wired example — copy this shape for every other command
// worth embedding (composition, not inheritance — see that file). // (pushing/pushall, print control, etc.). sequence_id is `string`, not
// int64: Bambu sends it as a JSON string ("0"), and this crosses the wire
// as JSON over MQTT, not binary protobuf — the Rust type needs to match
// what serde_json actually produces, not what "feels more correct" for a
// counter.
message InfoCommand {
string sequence_id = 1;
string command = 2;
}
// Your command messages go here, e.g.: // Add your next message here, e.g.:
// //
// message InfoCommand { // message PushingCommand {
// string sequence_id = 1; // string sequence_id = 1;
// string command = 2; // string command = 2;
// int32 version = 3;
// int32 push_target = 4;
// } // }