Skip to content

Commit 6113b6b

Browse files
committed
updates
Signed-off-by: Jess Frazelle <[email protected]>
1 parent 3b4958e commit 6113b6b

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

bambulabs/src/message.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ pub enum Result {
9393
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
9494
#[serde(rename_all = "snake_case", tag = "command")]
9595
pub enum Print {
96+
/// Ams control.
97+
AmsControl(AmsControl),
9698
/// The status of the print.
9799
PushStatus(PushStatus),
98100
/// The gcode line.
@@ -113,6 +115,7 @@ impl Print {
113115
/// Returns the sequence id of the message.
114116
pub fn sequence_id(&self) -> SequenceId {
115117
match self {
118+
Print::AmsControl(ams_ctrl) => ams_ctrl.sequence_id.clone(),
116119
Print::PushStatus(push_status) => push_status.sequence_id.clone(),
117120
Print::GcodeLine(gcode_line) => gcode_line.sequence_id.clone(),
118121
Print::ProjectFile(project_file) => project_file.sequence_id.clone(),
@@ -124,6 +127,21 @@ impl Print {
124127
}
125128
}
126129

130+
/// An ams control command.
131+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
132+
pub struct AmsControl {
133+
/// The sequence id.
134+
pub sequence_id: SequenceId,
135+
/// The reason for the message.
136+
pub reason: Reason,
137+
/// The result of the command.
138+
pub result: Result,
139+
/// The param.
140+
pub param: Option<String>,
141+
#[serde(flatten)]
142+
other: BTreeMap<String, Value>,
143+
}
144+
127145
/// A gcode line.
128146
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
129147
pub struct GcodeLine {

openapi/api.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,54 @@
464464
"Print": {
465465
"description": "A print command.",
466466
"oneOf": [
467+
{
468+
"additionalProperties": true,
469+
"description": "Ams control.",
470+
"properties": {
471+
"command": {
472+
"enum": [
473+
"ams_control"
474+
],
475+
"type": "string"
476+
},
477+
"param": {
478+
"description": "The param.",
479+
"nullable": true,
480+
"type": "string"
481+
},
482+
"reason": {
483+
"allOf": [
484+
{
485+
"$ref": "#/components/schemas/Reason"
486+
}
487+
],
488+
"description": "The reason for the message."
489+
},
490+
"result": {
491+
"allOf": [
492+
{
493+
"$ref": "#/components/schemas/Result"
494+
}
495+
],
496+
"description": "The result of the command."
497+
},
498+
"sequence_id": {
499+
"allOf": [
500+
{
501+
"$ref": "#/components/schemas/SequenceId"
502+
}
503+
],
504+
"description": "The sequence id."
505+
}
506+
},
507+
"required": [
508+
"command",
509+
"reason",
510+
"result",
511+
"sequence_id"
512+
],
513+
"type": "object"
514+
},
467515
{
468516
"additionalProperties": true,
469517
"description": "The status of the print.",

0 commit comments

Comments
 (0)