diff --git a/bambulabs/src/message.rs b/bambulabs/src/message.rs index db1d239..551ab4c 100644 --- a/bambulabs/src/message.rs +++ b/bambulabs/src/message.rs @@ -200,6 +200,8 @@ pub enum Result { pub enum Print { /// Ams control. AmsControl(AmsControl), + /// Ams change filament. + AmsChangeFilament(AmsChangeFilament), /// Calibration. Calibration(Calibration), /// The status of the print. @@ -223,6 +225,7 @@ impl Print { pub fn sequence_id(&self) -> SequenceId { match self { Print::AmsControl(ams_ctrl) => ams_ctrl.sequence_id.clone(), + Print::AmsChangeFilament(ams_change_filament) => ams_change_filament.sequence_id.clone(), Print::Calibration(calibration) => calibration.sequence_id.clone(), Print::PushStatus(push_status) => push_status.sequence_id.clone(), Print::GcodeLine(gcode_line) => gcode_line.sequence_id.clone(), @@ -250,6 +253,25 @@ pub struct AmsControl { other: BTreeMap, } +/// An ams change filament. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct AmsChangeFilament { + /// The sequence id. + pub sequence_id: SequenceId, + /// The reason for the message. + pub reason: Option, + /// The result of the command. + pub result: Result, + /// The error number. + pub errorno: i64, + /// The target temperature. + pub tar_temp: i64, + /// The target. + pub target: i64, + #[serde(flatten)] + other: BTreeMap, +} + /// A calibration command. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct Calibration { diff --git a/openapi/api.json b/openapi/api.json index 0daaf88..af4f572 100644 --- a/openapi/api.json +++ b/openapi/api.json @@ -618,6 +618,67 @@ ], "type": "object" }, + { + "additionalProperties": true, + "description": "Ams change filament.", + "properties": { + "command": { + "enum": [ + "ams_change_filament" + ], + "type": "string" + }, + "errorno": { + "description": "The error number.", + "format": "int64", + "type": "integer" + }, + "reason": { + "allOf": [ + { + "$ref": "#/components/schemas/Reason" + } + ], + "description": "The reason for the message.", + "nullable": true + }, + "result": { + "allOf": [ + { + "$ref": "#/components/schemas/Result" + } + ], + "description": "The result of the command." + }, + "sequence_id": { + "allOf": [ + { + "$ref": "#/components/schemas/SequenceId" + } + ], + "description": "The sequence id." + }, + "tar_temp": { + "description": "The target temperature.", + "format": "int64", + "type": "integer" + }, + "target": { + "description": "The target.", + "format": "int64", + "type": "integer" + } + }, + "required": [ + "command", + "errorno", + "result", + "sequence_id", + "tar_temp", + "target" + ], + "type": "object" + }, { "additionalProperties": true, "description": "Calibration.",