diff --git a/schemas/bambulab/common/envelope.schema.json b/schemas/bambulab/common/envelope.schema.json index c929844..ddf96f8 100644 --- a/schemas/bambulab/common/envelope.schema.json +++ b/schemas/bambulab/common/envelope.schema.json @@ -2,7 +2,7 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/common/envelope.schema.json", "title": "CommandEnvelope", - "description": "Fields every Bambu MQTT command/response shares, across both protocol generations - unversioned, at the bambulab/ root, not duplicated under v1/ or v2/. This is the 'base class' - other schemas extend it via allOf + $ref. JSON Schema doesn't have inheritance either, strictly speaking (no 'extends' keyword) - allOf is composition: it says the instance must satisfy THIS schema AND whatever else is listed alongside it. It's the closest thing to real inheritance ergonomics of anything used across this project's schema stack (proto, Rust), because $ref + allOf lets you name and reuse a shape without re-declaring its fields, which proto/Rust composition can't quite do (there you still write `common: PrinterReportCommon` by hand on every struct).", + "description": "Fields every Bambu MQTT command/response shares, across both protocol generations - unversioned, at the bambulab/ root, not duplicated under v1/ or v2/. This is the 'base class' - other schemas extend it via allOf + $ref. JSON Schema doesn't have inheritance either, strictly speaking (no 'extends' keyword) - allOf is composition: it says the instance must satisfy THIS schema AND whatever else is listed alongside it. It's the closest thing to real inheritance ergonomics of anything used across this project's schema stack (proto, Rust), because $ref + allOf lets you name and reuse a shape without re-declaring its fields, which proto/Rust composition can't quite do (there you still write `common: PrinterReportCommon` by hand on every struct). Additionally, any field not defined by the schema will be returned by the printer int the original form - useful when making telemetrics.", "type": "object", "properties": { "sequence_id": { @@ -21,6 +21,10 @@ "reason": { "type": "string", "description": "Optional reason or error message" + }, + "is_from_mqtt": { + "type": "boolean", + "description": "Used by BambuMQTT v2" } }, "required": ["sequence_id", "command"] diff --git a/schemas/bambulab/v1/report/print/gcode_file.schema.json b/schemas/bambulab/v1/report/print/gcode_file.schema.json new file mode 100644 index 0000000..a2548d4 --- /dev/null +++ b/schemas/bambulab/v1/report/print/gcode_file.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/report/print/gcode_file.schema.json", + "title": "GcodeFileRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "gcode_file" }, + "param": { "description": "Full path to GCODE file in printer's FS", "type": "string" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v1/report/print/gcode_line.schema.json b/schemas/bambulab/v1/report/print/gcode_line.schema.json new file mode 100644 index 0000000..0954682 --- /dev/null +++ b/schemas/bambulab/v1/report/print/gcode_line.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/report/print/gcode_line.schema.json", + "title": "GcodeLineReport", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "gcode_line" }, + "param": { "description": "use \n for multiple lines", "type": "string" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v1/report/print/print.schema.json b/schemas/bambulab/v1/report/print/print.schema.json index 8603cf4..a0492f7 100644 --- a/schemas/bambulab/v1/report/print/print.schema.json +++ b/schemas/bambulab/v1/report/print/print.schema.json @@ -51,7 +51,7 @@ "print_error": { "type": "integer" }, "lifecycle": { "type": "string", "enum": ["product"] }, "wifi_signal": { "type": "string", "pattern": "^-([0-9]{1,2}|100)dBm$" }, - "gcode_state": { "type": "string", "enum": [ "idle", "IDLE", "finish", "FINISH" ] }, + "gcode_state": { "type": "string", "enum": [ "idle", "IDLE", "finish", "FINISH", "running", "RUNNING" ] }, "gcode_file_prepare_percent": { "type": "string" }, "queue_number": { "type": "integer" }, "queue_total": { "type": "integer" }, diff --git a/schemas/bambulab/v1/report/print/print_speed.schema.json b/schemas/bambulab/v1/report/print/print_speed.schema.json new file mode 100644 index 0000000..db896f8 --- /dev/null +++ b/schemas/bambulab/v1/report/print/print_speed.schema.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/report/print/print_speed.schema.json", + "title": "PrintSpeedReport", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "print_speed" }, + "param": { + "description": "1 - silent (50%), 2 - standard (100%), 3 - sport (124%), 4 - ludicrous (166%)", + "type": "string", + "enum": ["1", "2", "3", "4"] + } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v1/request/print/calibration.schema.json b/schemas/bambulab/v1/request/print/calibration.schema.json new file mode 100644 index 0000000..3d2e15d --- /dev/null +++ b/schemas/bambulab/v1/request/print/calibration.schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/request/print/calibration.schema.json", + "title": "CalibrationRequest", + "description": "Printer responds with `push_status` instead of `calibration` with following fields set: `{ \"mc_print_stage\": 2, \"gcode_state\": \"RUNNING\", \"gcode_file_prepare_percent\": 100, \"subtask_name\": \"auto_cali_for_user_param.gcode\", \"gcode_file\": \"auto_cali_for_user_param.gcode\", \"print_type\": \"system\" }`", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "calibration" }, + "option": { + "description": "Following bitmask is required for the `option` field: `if (lidarCalibration) bitmask |= 1; if (bedLevelling) bitmask |= 1 << 1; if (vibrationCompensation) bitmask |= 1 << 2; if (motorCancellation) bitmask |= 1 << 3;`", + "type": "integer", + "minimum": 0, + "maximum": 15 + } + }, + "required": ["option"] + } + ] +} diff --git a/schemas/bambulab/v1/request/print/gcode_file.schema.json b/schemas/bambulab/v1/request/print/gcode_file.schema.json new file mode 100644 index 0000000..24f0cf1 --- /dev/null +++ b/schemas/bambulab/v1/request/print/gcode_file.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/request/print/gcode_file.schema.json", + "title": "GcodeFileRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "gcode_file" }, + "param": { "description": "Full path to GCODE file in printer's FS", "type": "string" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v1/request/print/gcode_line.schema.json b/schemas/bambulab/v1/request/print/gcode_line.schema.json new file mode 100644 index 0000000..c1e6de0 --- /dev/null +++ b/schemas/bambulab/v1/request/print/gcode_line.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/request/print/gcode_line.schema.json", + "title": "GcodeLineRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "gcode_line" }, + "param": { "description": "use \n for multiple lines", "type": "string" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v1/request/print/print_speed.schema.json b/schemas/bambulab/v1/request/print/print_speed.schema.json new file mode 100644 index 0000000..b6c8c73 --- /dev/null +++ b/schemas/bambulab/v1/request/print/print_speed.schema.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/request/print/print_speed.schema.json", + "title": "PrintSpeedRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "print_speed" }, + "param": { + "description": "1 - silent (50%), 2 - standard (100%), 3 - sport (124%), 4 - ludicrous (166%)", + "type": "string", + "enum": ["1", "2", "3", "4"] + } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v1/request/print/unload_filament.schema.json b/schemas/bambulab/v1/request/print/unload_filament.schema.json new file mode 100644 index 0000000..5c773ee --- /dev/null +++ b/schemas/bambulab/v1/request/print/unload_filament.schema.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/request/print/gcode_line.schema.json", + "title": "GcodeLineRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "unload_filament" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v2/report/print/calibration.schema.json b/schemas/bambulab/v2/report/print/calibration.schema.json new file mode 100644 index 0000000..93a1a5e --- /dev/null +++ b/schemas/bambulab/v2/report/print/calibration.schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v2/report/print/calibration.schema.json", + "title": "CalibrationReport", + "description": "In contrast to Bambu MQTT v1, printer responds with `calibration` command, however it will still send `push_status` with following fields set: `{\"subtask_name\":\"auto_cali_for_user_param.gcode\",\"file\":\"/usr/etc/print/O1C2/auto_cali_for_user_param.gcode\",\"gcode_file\":\"/usr/etc/print/O1C2/auto_cali_for_user_param.gcode\",\"gcode_file_prepare_percent\":\"100\",\"gcode_state\":\"FAILED\",\"mc_print_stage\":\"1\"}`", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "calibration" }, + "option": { + "description": "Following bitmask is required for the `option` field: `if (lidarCalibration) bitmask |= 1; if (bedLevelling) bitmask |= 1 << 1; if (vibrationCompensation) bitmask |= 1 << 2; if (motorCancellation) bitmask |= 1 << 3;`", + "type": "integer", + "minimum": 0, + "maximum": 15 + } + }, + "required": ["option"] + } + ] +} diff --git a/schemas/bambulab/v2/report/print/gcode_file.schema.json b/schemas/bambulab/v2/report/print/gcode_file.schema.json new file mode 100644 index 0000000..0c59de4 --- /dev/null +++ b/schemas/bambulab/v2/report/print/gcode_file.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v2/report/print/gcode_file.schema.json", + "title": "GcodeFileRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "gcode_file" }, + "param": { "description": "Full path to GCODE file in printer's FS", "type": "string" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v2/report/print/gcode_line.schema.json b/schemas/bambulab/v2/report/print/gcode_line.schema.json new file mode 100644 index 0000000..c21f48e --- /dev/null +++ b/schemas/bambulab/v2/report/print/gcode_line.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v2/report/print/gcode_line.schema.json", + "title": "GcodeLineReport", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "gcode_line" }, + "param": { "description": "use \n for multiple lines", "type": "string" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v2/report/print/print.schema.json b/schemas/bambulab/v2/report/print/print.schema.json index 58b7d4c..92c9f93 100644 --- a/schemas/bambulab/v2/report/print/print.schema.json +++ b/schemas/bambulab/v2/report/print/print.schema.json @@ -60,7 +60,7 @@ "fail_reason": { "type": "string" }, "file": { "type": "string" }, "gcode_file": { "type": "string" }, - "gcode_state": { "type": "string", "enum": [ "idle", "IDLE", "finish", "FINISH" ] }, + "gcode_state": { "type": "string", "enum": [ "idle", "IDLE", "finish", "FINISH", "running", "RUNNING" ] }, "gcode_file_prepare_percent": { "type": "string" }, "force_upgrade": { "type": "boolean" }, diff --git a/schemas/bambulab/v2/report/print/print_speed.schema.json b/schemas/bambulab/v2/report/print/print_speed.schema.json new file mode 100644 index 0000000..e4a5da4 --- /dev/null +++ b/schemas/bambulab/v2/report/print/print_speed.schema.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v2/report/print/print_speed.schema.json", + "title": "PrintSpeedReport", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "print_speed" }, + "param": { + "description": "1 - silent (50%), 2 - standard (100%), 3 - sport (124%), 4 - ludicrous (166%)", + "type": "string", + "enum": ["1", "2", "3", "4"] + } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v2/request/print/calibration.schema.json b/schemas/bambulab/v2/request/print/calibration.schema.json new file mode 100644 index 0000000..6f293bb --- /dev/null +++ b/schemas/bambulab/v2/request/print/calibration.schema.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v2/request/print/calibration.schema.json", + "title": "CalibrationRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "calibration" }, + "option": { + "description": "Following bitmask is required for the `option` field: `if (lidarCalibration) bitmask |= 1; if (bedLevelling) bitmask |= 1 << 1; if (vibrationCompensation) bitmask |= 1 << 2; if (motorCancellation) bitmask |= 1 << 3;`", + "type": "integer", + "minimum": 0, + "maximum": 15 + } + }, + "required": ["option"] + } + ] +} diff --git a/schemas/bambulab/v2/request/print/gcode_file.schema.json b/schemas/bambulab/v2/request/print/gcode_file.schema.json new file mode 100644 index 0000000..e0b2a2d --- /dev/null +++ b/schemas/bambulab/v2/request/print/gcode_file.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v2/request/print/gcode_file.schema.json", + "title": "GcodeFileRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "gcode_file" }, + "param": { "description": "Full path to GCODE file in printer's FS", "type": "string" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v2/request/print/gcode_line.schema.json b/schemas/bambulab/v2/request/print/gcode_line.schema.json new file mode 100644 index 0000000..df55727 --- /dev/null +++ b/schemas/bambulab/v2/request/print/gcode_line.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v2/request/print/gcode_line.schema.json", + "title": "GcodeLineRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "gcode_line" }, + "param": { "description": "use \n for multiple lines", "type": "string" } + }, + "required": ["param"] + } + ] +} diff --git a/schemas/bambulab/v2/request/print/print_speed.schema.json b/schemas/bambulab/v2/request/print/print_speed.schema.json new file mode 100644 index 0000000..540be5d --- /dev/null +++ b/schemas/bambulab/v2/request/print/print_speed.schema.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v2/request/print/print_speed.schema.json", + "title": "PrintSpeedRequest", + "allOf": [ + { "$ref": "../../../common/envelope.schema.json" }, + { + "type": "object", + "properties": { + "command": { "const": "print_speed" }, + "param": { + "description": "1 - silent (50%), 2 - standard (100%), 3 - sport (124%), 4 - ludicrous (166%)", + "type": "string", + "enum": ["1", "2", "3", "4"] + } + }, + "required": ["param"] + } + ] +}