diff --git a/openapi/machine-api.json b/openapi/machine-api.json index 6da5ee078..9af909f36 100644 --- a/openapi/machine-api.json +++ b/openapi/machine-api.json @@ -13,18 +13,6 @@ } }, "schemas": { - "AccessoryType": { - "description": "The type of accessory.", - "oneOf": [ - { - "description": "No accessory.", - "enum": [ - "none" - ], - "type": "string" - } - ] - }, "Error": { "description": "Error information from a response.", "properties": { @@ -44,516 +32,143 @@ ], "type": "object" }, - "Info": { - "description": "An info command.", - "oneOf": [ - { - "additionalProperties": true, - "description": "Get the version.", - "properties": { - "command": { - "enum": [ - "get_version" - ], - "type": "string" - }, - "module": { - "description": "The info module.", - "items": { - "$ref": "#/components/schemas/InfoModule" - }, - "type": "array" - }, - "reason": { - "allOf": [ - { - "$ref": "#/components/schemas/Reason" - } - ], - "description": "The reason of the info command.", - "nullable": true - }, - "result": { - "allOf": [ - { - "$ref": "#/components/schemas/Result" - } - ], - "description": "The result of the info command.", - "nullable": true - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - } - }, - "required": [ - "command", - "module", - "sequence_id" - ], - "type": "object" - } - ] - }, - "InfoModule": { - "description": "An info module.", - "properties": { - "hw_ver": { - "description": "The hardware version.", - "type": "string" - }, - "loader_ver": { - "description": "The loader version.", - "nullable": true, - "type": "string" - }, - "name": { - "description": "The module name.", - "type": "string" - }, - "ota_ver": { - "description": "The ota version.", - "nullable": true, - "type": "string" - }, - "project_name": { - "description": "The project name.", - "nullable": true, - "type": "string" - }, - "sn": { - "description": "The serial number.", - "type": "string" - }, - "sw_ver": { - "description": "The software version.", - "type": "string" - } - }, - "required": [ - "hw_ver", - "name", - "sn", - "sw_ver" - ], - "type": "object" - }, - "LedMode": { - "description": "The mode for the led.", - "oneOf": [ - { - "description": "Turn the LED on.", - "enum": [ - "on" - ], - "type": "string" - }, - { - "description": "Turn the LED off.", - "enum": [ - "off" - ], - "type": "string" - }, - { - "description": "Flash the LED.", - "enum": [ - "flashing" - ], - "type": "string" - } - ] - }, - "LedNode": { - "description": "The node for the led.", - "oneOf": [ - { - "description": "The chamber light.", - "enum": [ - "chamber_light" - ], - "type": "string" - }, - { - "description": "The work light.", - "enum": [ - "work_light" - ], - "type": "string" - } - ] - }, - "LiveView": { - "description": "A liveview message.", - "oneOf": [ - { - "additionalProperties": true, - "description": "Initialize the live view.", - "properties": { - "command": { - "enum": [ - "init" - ], - "type": "string" - }, - "op_protocols": { - "description": "The op protocols.", - "items": { - "$ref": "#/components/schemas/OperationProtocol" - }, - "type": "array" - }, - "peer_host": { - "description": "The peer host.", - "type": "string" - }, - "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." - } - }, - "required": [ - "command", - "op_protocols", - "peer_host", - "result", - "sequence_id" - ], - "type": "object" - } - ] - }, - "Machine": { - "description": "Details for a 3d printer connected over USB.", - "oneOf": [ - { - "description": "Details for a 3d printer connected over USB.", - "properties": { - "id": { - "type": "string" - }, - "manufacturer": { - "type": "string" - }, - "model": { - "type": "string" - }, - "port": { - "type": "string" - }, - "type": { - "enum": [ - "UsbPrinter" - ], - "type": "string" - } - }, - "required": [ - "id", - "manufacturer", - "model", - "port", - "type" - ], - "type": "object" - }, - { - "description": "Details for a 3d printer connected over network.", - "properties": { - "hostname": { - "description": "The hostname of the printer.", - "nullable": true, - "type": "string" - }, - "ip": { - "description": "The IP address of the printer.", - "format": "ip", - "type": "string" - }, - "manufacturer": { - "allOf": [ - { - "$ref": "#/components/schemas/NetworkPrinterManufacturer" - } - ], - "description": "The manufacturer of the printer." - }, - "model": { - "description": "The model of the printer.", - "nullable": true, - "type": "string" - }, - "port": { - "description": "The port of the printer.", - "format": "uint16", - "minimum": 0, - "nullable": true, - "type": "integer" - }, - "serial": { - "description": "The serial number of the printer.", - "nullable": true, - "type": "string" - }, - "type": { - "enum": [ - "NetworkPrinter" - ], - "type": "string" - } - }, - "required": [ - "ip", - "manufacturer", - "type" - ], - "type": "object" - } - ] - }, - "Message": { - "description": "A message from a machine.", + "ExtraMachineInfoResponse": { + "description": "Extra machine-specific information regarding a connected machine.", "oneOf": [ { "additionalProperties": false, "properties": { - "UsbPrinter": { - "$ref": "#/components/schemas/Message2" - } - }, - "required": [ - "UsbPrinter" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "NetworkPrinter": { - "$ref": "#/components/schemas/Message3" - } - }, - "required": [ - "NetworkPrinter" - ], - "type": "object" - } - ] - }, - "Message2": { - "description": "A message from the printer.", - "enum": [ - "ok" - ], - "type": "string" - }, - "Message3": { - "description": "A message from the printer.", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "Bambu": { - "$ref": "#/components/schemas/Message4" - } - }, - "required": [ - "Bambu" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "Formlabs": { + "Moonraker": { "type": "object" } }, "required": [ - "Formlabs" - ], - "type": "object" - } - ] - }, - "Message4": { - "description": "A message from/to the printer.", - "oneOf": [ - { - "additionalProperties": false, - "description": "A print message.", - "properties": { - "print": { - "$ref": "#/components/schemas/Print" - } - }, - "required": [ - "print" + "Moonraker" ], "type": "object" }, { "additionalProperties": false, - "description": "An info message.", "properties": { - "info": { - "$ref": "#/components/schemas/Info" + "Usb": { + "type": "object" } }, "required": [ - "info" + "Usb" ], "type": "object" }, { "additionalProperties": false, - "description": "A system message.", "properties": { - "system": { - "$ref": "#/components/schemas/System" + "Bambu": { + "type": "object" } }, "required": [ - "system" - ], - "type": "object" - }, - { - "additionalProperties": false, - "description": "A security message.", - "properties": { - "security": { - "$ref": "#/components/schemas/Security" - } - }, - "required": [ - "security" - ], - "type": "object" - }, - { - "additionalProperties": false, - "description": "A liveview message.", - "properties": { - "live_view": { - "$ref": "#/components/schemas/LiveView" - } - }, - "required": [ - "live_view" - ], - "type": "object" - }, - { - "additionalProperties": false, - "description": "An unknown Json message.", - "properties": { - "json": {} - }, - "required": [ - "json" - ], - "type": "object" - }, - { - "additionalProperties": false, - "description": "The message could not be parsed. The `Option` contains the raw message. If the message could not be parsed as a string, the `Option` will be `None`.", - "properties": { - "unknown": { - "nullable": true, - "type": "string" - } - }, - "required": [ - "unknown" - ], - "type": "object" - } - ] - }, - "NetworkPrinterManufacturer": { - "description": "Network printer manufacturer.", - "oneOf": [ - { - "description": "Bambu.", - "enum": [ "Bambu" ], - "type": "string" - }, - { - "description": "Formlabs.", - "enum": [ - "Formlabs" - ], - "type": "string" + "type": "object" } ] }, - "NozzleType": { - "description": "A nozzle type.", - "oneOf": [ - { - "description": "Hardened steel nozzle.", - "enum": [ - "hardened_steel" - ], - "type": "string" - }, - { - "description": "Stainless steel nozzle.", - "enum": [ - "stainless_steel" - ], - "type": "string" - } - ] - }, - "OperationProtocol": { - "additionalProperties": true, - "description": "An operation protocol.", + "MachineInfoResponse": { + "description": "Information regarding a connected machine.", "properties": { - "protocol": { - "description": "The protocol.", + "extra": { + "allOf": [ + { + "$ref": "#/components/schemas/ExtraMachineInfoResponse" + } + ], + "description": "Additional, per-machine information which is specific to the underlying machine type.", + "nullable": true + }, + "id": { + "description": "Machine Identifier (ID) for the specific Machine.", "type": "string" }, - "version": { - "description": "The version.", - "type": "string" + "machine_type": { + "allOf": [ + { + "$ref": "#/components/schemas/MachineType" + } + ], + "description": "Information regarding the method of manufacture." + }, + "make_model": { + "allOf": [ + { + "$ref": "#/components/schemas/MachineMakeModel" + } + ], + "description": "Information regarding the make and model of the attached Machine." + }, + "max_part_volume": { + "allOf": [ + { + "$ref": "#/components/schemas/Volume" + } + ], + "description": "Maximum part size that can be manufactured by this device. This may be some sort of theoretical upper bound, getting close to this limit seems like maybe a bad idea.\n\nThis may be `None` if the maximum size is not knowable by the Machine API.\n\nWhat \"close\" means is up to you!", + "nullable": true } }, "required": [ - "protocol", - "version" + "id", + "machine_type", + "make_model" ], "type": "object" }, + "MachineMakeModel": { + "description": "Information regarding the make/model of a discovered endpoint.", + "properties": { + "manufacturer": { + "description": "The manufacturer that built the connected Machine.", + "nullable": true, + "type": "string" + }, + "model": { + "description": "The model of the connected Machine.", + "nullable": true, + "type": "string" + }, + "serial": { + "description": "The unique serial number of the connected Machine.", + "nullable": true, + "type": "string" + } + }, + "type": "object" + }, + "MachineType": { + "description": "Specific technique by which this Machine takes a design, and produces a real-world 3D object.", + "oneOf": [ + { + "description": "Use light to cure a resin to build up layers.", + "enum": [ + "Stereolithography" + ], + "type": "string" + }, + { + "description": "Fused Deposition Modeling, layers of melted plastic.", + "enum": [ + "FusedDeposition" + ], + "type": "string" + }, + { + "description": "\"Computer numerical control\" - machine that grinds away material from a hunk of material to construct a part.", + "enum": [ + "Cnc" + ], + "type": "string" + } + ] + }, "Pong": { "description": "The response from the `/ping` endpoint.", "properties": { @@ -567,1019 +182,6 @@ ], "type": "object" }, - "Print": { - "description": "A print command.", - "oneOf": [ - { - "additionalProperties": true, - "description": "Ams control.", - "properties": { - "command": { - "enum": [ - "ams_control" - ], - "type": "string" - }, - "param": { - "description": "The param.", - "nullable": true, - "type": "string" - }, - "reason": { - "allOf": [ - { - "$ref": "#/components/schemas/Reason" - } - ], - "description": "The reason for the message." - }, - "result": { - "allOf": [ - { - "$ref": "#/components/schemas/Result" - } - ], - "description": "The result of the command." - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - } - }, - "required": [ - "command", - "reason", - "result", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Ams change filament.", - "properties": { - "command": { - "enum": [ - "ams_change_filament" - ], - "type": "string" - }, - "errorno": { - "description": "The error number.", - "format": "int64", - "nullable": true, - "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", - "nullable": true, - "type": "integer" - }, - "target": { - "description": "The target.", - "format": "int64", - "type": "integer" - } - }, - "required": [ - "command", - "result", - "sequence_id", - "target" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Calibration.", - "properties": { - "command": { - "enum": [ - "calibration" - ], - "type": "string" - }, - "option": { - "description": "The option.", - "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." - } - }, - "required": [ - "command", - "option", - "result", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "The status of the print.", - "properties": { - "ams": { - "allOf": [ - { - "$ref": "#/components/schemas/PrintAms" - } - ], - "description": "The ams.", - "nullable": true - }, - "ams_rfid_status": { - "description": "The ams rfid status.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "ams_status": { - "description": "The ams status.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "aux_part_fan": { - "description": "The aux part fan.", - "nullable": true, - "type": "boolean" - }, - "bed_target_temper": { - "description": "The target bed temperature.", - "format": "double", - "nullable": true, - "type": "number" - }, - "bed_temper": { - "description": "The bed temperature.", - "format": "double", - "nullable": true, - "type": "number" - }, - "big_fan1_speed": { - "description": "The big fan 1 speed.", - "nullable": true, - "type": "string" - }, - "big_fan2_speed": { - "description": "The big fan 2 speed.", - "nullable": true, - "type": "string" - }, - "chamber_temper": { - "description": "The chamber temperature.", - "format": "double", - "nullable": true, - "type": "number" - }, - "command": { - "enum": [ - "push_status" - ], - "type": "string" - }, - "cooling_fan_speed": { - "description": "The cooling fan speed.", - "nullable": true, - "type": "string" - }, - "fan_gear": { - "description": "The fan gear.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "force_upgrade": { - "description": "Force upgrade?", - "nullable": true, - "type": "boolean" - }, - "gcode_file": { - "description": "The gcode file.", - "nullable": true, - "type": "string" - }, - "gcode_file_prepare_percent": { - "description": "The gcode file prepare percent.", - "nullable": true, - "type": "string" - }, - "gcode_state": { - "description": "The gcode state.", - "nullable": true, - "type": "string" - }, - "heatbreak_fan_speed": { - "description": "The heatbreak fan speed.", - "nullable": true, - "type": "string" - }, - "hms": { - "description": "The hms.", - "items": {}, - "nullable": true, - "type": "array" - }, - "home_flag": { - "description": "The home flag.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "hw_switch_state": { - "description": "The hw switch state.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "ipcam": { - "allOf": [ - { - "$ref": "#/components/schemas/PrintIpcam" - } - ], - "description": "The ipcam.", - "nullable": true - }, - "layer_num": { - "description": "The layer num.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "lifecycle": { - "description": "The lifecycle.", - "nullable": true, - "type": "string" - }, - "lights_report": { - "description": "The lights report.", - "items": { - "$ref": "#/components/schemas/PrintLightsReport" - }, - "nullable": true, - "type": "array" - }, - "mc_percent": { - "description": "The percentage of the print completed.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "mc_print_line_number": { - "description": "The mc print line number.", - "nullable": true, - "type": "string" - }, - "mc_print_stage": { - "description": "The print stage.", - "nullable": true, - "type": "string" - }, - "mc_print_sub_stage": { - "description": "The mc print sub stage.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "mc_remaining_time": { - "description": "The remaining time of the print.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "mess_production_state": { - "description": "The mess production state.", - "nullable": true, - "type": "string" - }, - "msg": { - "description": "The message.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "nozzle_diameter": { - "description": "The nozzle diameter.", - "nullable": true, - "type": "string" - }, - "nozzle_target_temper": { - "description": "The target nozzle temperature.", - "format": "double", - "nullable": true, - "type": "number" - }, - "nozzle_temper": { - "description": "The nozzle temperature.", - "format": "double", - "nullable": true, - "type": "number" - }, - "nozzle_type": { - "allOf": [ - { - "$ref": "#/components/schemas/NozzleType" - } - ], - "description": "The nozzle type.", - "nullable": true - }, - "online": { - "allOf": [ - { - "$ref": "#/components/schemas/PrintOnline" - } - ], - "description": "Online status.", - "nullable": true - }, - "print_error": { - "description": "The print error.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "print_type": { - "description": "The print type.", - "nullable": true, - "type": "string" - }, - "profile_id": { - "description": "The profile id.", - "nullable": true, - "type": "string" - }, - "project_id": { - "description": "The project id.", - "nullable": true, - "type": "string" - }, - "queue_est": { - "description": "The queue est.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "queue_number": { - "description": "The queue number.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "queue_sts": { - "description": "The queue sts.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "queue_total": { - "description": "The queue total.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "s_obj": { - "description": "The s obj.", - "items": {}, - "nullable": true, - "type": "array" - }, - "sdcard": { - "description": "Sdcard?", - "nullable": true, - "type": "boolean" - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - }, - "spd_lvl": { - "description": "The spd lvl.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "spd_mag": { - "description": "The spd mag.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "stg": { - "description": "The stg.", - "items": {}, - "nullable": true, - "type": "array" - }, - "stg_cur": { - "description": "The stg cur.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "subtask_id": { - "description": "The subtask id.", - "nullable": true, - "type": "string" - }, - "subtask_name": { - "description": "The subtask name.", - "nullable": true, - "type": "string" - }, - "task_id": { - "description": "The task id.", - "nullable": true, - "type": "string" - }, - "total_layer_num": { - "description": "The total layer num.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "upgrade_state": { - "allOf": [ - { - "$ref": "#/components/schemas/PrintUpgradeState" - } - ], - "description": "The upgrade state.", - "nullable": true - }, - "upload": { - "allOf": [ - { - "$ref": "#/components/schemas/PrintUpload" - } - ], - "description": "The upload.", - "nullable": true - }, - "vt_tray": { - "allOf": [ - { - "$ref": "#/components/schemas/PrintTray" - } - ], - "description": "The tray.", - "nullable": true - }, - "wifi_signal": { - "description": "The wifi signal.", - "nullable": true, - "type": "string" - } - }, - "required": [ - "command", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "The gcode line.", - "properties": { - "command": { - "enum": [ - "gcode_line" - ], - "type": "string" - }, - "param": { - "description": "The gcode line.", - "nullable": true, - "type": "string" - }, - "reason": { - "allOf": [ - { - "$ref": "#/components/schemas/Reason" - } - ], - "description": "The reason for the message." - }, - "result": { - "allOf": [ - { - "$ref": "#/components/schemas/Result" - } - ], - "description": "The result of the command." - }, - "return_code": { - "description": "The return code.", - "nullable": true, - "type": "string" - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - }, - "source": { - "description": "The source.", - "format": "int64", - "nullable": true, - "type": "integer" - } - }, - "required": [ - "command", - "reason", - "result", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "A gcode file.", - "properties": { - "command": { - "enum": [ - "gcode_file" - ], - "type": "string" - }, - "param": { - "description": "The param.", - "nullable": true, - "type": "string" - }, - "print_type": { - "description": "The print type.", - "nullable": true, - "type": "string" - }, - "reason": { - "allOf": [ - { - "$ref": "#/components/schemas/Reason" - } - ], - "description": "The reason for the message." - }, - "result": { - "allOf": [ - { - "$ref": "#/components/schemas/Result" - } - ], - "description": "The result of the command." - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - } - }, - "required": [ - "command", - "reason", - "result", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Project file.", - "properties": { - "command": { - "enum": [ - "project_file" - ], - "type": "string" - }, - "gcode_file": { - "description": "The gcode file.", - "nullable": true, - "type": "string" - }, - "profile_id": { - "description": "The profile id.", - "type": "string" - }, - "project_id": { - "description": "The project id.", - "type": "string" - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - }, - "subtask_id": { - "description": "The subtask id.", - "type": "string" - }, - "subtask_name": { - "description": "The subtask name.", - "type": "string" - }, - "task_id": { - "description": "The task id.", - "type": "string" - } - }, - "required": [ - "command", - "profile_id", - "project_id", - "sequence_id", - "subtask_id", - "subtask_name", - "task_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Pause the print.", - "properties": { - "command": { - "enum": [ - "pause" - ], - "type": "string" - }, - "reason": { - "allOf": [ - { - "$ref": "#/components/schemas/Reason" - } - ], - "description": "The reason for the message." - }, - "result": { - "allOf": [ - { - "$ref": "#/components/schemas/Result" - } - ], - "description": "The result of the command." - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - } - }, - "required": [ - "command", - "reason", - "result", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Print speed.", - "properties": { - "command": { - "enum": [ - "print_speed" - ], - "type": "string" - }, - "param": { - "description": "The param.", - "type": "string" - }, - "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." - } - }, - "required": [ - "command", - "param", - "result", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Resume the print.", - "properties": { - "command": { - "enum": [ - "resume" - ], - "type": "string" - }, - "reason": { - "allOf": [ - { - "$ref": "#/components/schemas/Reason" - } - ], - "description": "The reason for the message." - }, - "result": { - "allOf": [ - { - "$ref": "#/components/schemas/Result" - } - ], - "description": "The result of the command." - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - } - }, - "required": [ - "command", - "reason", - "result", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Stop the print.", - "properties": { - "command": { - "enum": [ - "stop" - ], - "type": "string" - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - } - }, - "required": [ - "command", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Extrusion calibration get.", - "properties": { - "command": { - "enum": [ - "extrusion_cali_get" - ], - "type": "string" - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - } - }, - "required": [ - "command", - "sequence_id" - ], - "type": "object" - } - ] - }, - "PrintAms": { - "additionalProperties": true, - "description": "The print ams.", - "properties": { - "ams": { - "description": "The ams.", - "items": { - "$ref": "#/components/schemas/PrintAmsData" - }, - "nullable": true, - "type": "array" - }, - "ams_exist_bits": { - "description": "The ams exist bits.", - "nullable": true, - "type": "string" - }, - "insert_flag": { - "description": "The insert flag.", - "nullable": true, - "type": "boolean" - }, - "power_on_flag": { - "description": "The power on flag.", - "nullable": true, - "type": "boolean" - }, - "tray_exist_bits": { - "description": "The tray exist bits.", - "nullable": true, - "type": "string" - }, - "tray_is_bbl_bits": { - "description": "The tray is bbl bits.", - "nullable": true, - "type": "string" - }, - "tray_now": { - "description": "The tray now.", - "nullable": true, - "type": "string" - }, - "tray_pre": { - "description": "The tray pre.", - "nullable": true, - "type": "string" - }, - "tray_read_done_bits": { - "description": "The tray read done bits.", - "nullable": true, - "type": "string" - }, - "tray_reading_bits": { - "description": "The tray reading bits.", - "nullable": true, - "type": "string" - }, - "tray_tar": { - "description": "The tray tar.", - "nullable": true, - "type": "string" - }, - "version": { - "description": "The version.", - "format": "int64", - "nullable": true, - "type": "integer" - } - }, - "type": "object" - }, - "PrintAmsData": { - "additionalProperties": true, - "description": "The print ams data.", - "properties": { - "humidity": { - "description": "The humidity.", - "type": "string" - }, - "id": { - "description": "The id.", - "type": "string" - }, - "temp": { - "description": "The temperature.", - "type": "string" - }, - "tray": { - "description": "The tray.", - "items": { - "$ref": "#/components/schemas/PrintTray" - }, - "type": "array" - } - }, - "required": [ - "humidity", - "id", - "temp", - "tray" - ], - "type": "object" - }, - "PrintIpcam": { - "additionalProperties": true, - "description": "The print ipcam.", - "properties": { - "ipcam_dev": { - "description": "The ipcam dev.", - "nullable": true, - "type": "string" - }, - "ipcam_record": { - "description": "The ipcam record.", - "nullable": true, - "type": "string" - }, - "mode_bits": { - "description": "The mode bits.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "timelapse": { - "description": "The timelapse.", - "nullable": true, - "type": "string" - } - }, - "type": "object" - }, "PrintJobResponse": { "description": "The response from the `/print` endpoint.", "properties": { @@ -1602,58 +204,6 @@ ], "type": "object" }, - "PrintLightsReport": { - "additionalProperties": true, - "description": "A print lights report.", - "properties": { - "mode": { - "allOf": [ - { - "$ref": "#/components/schemas/LedMode" - } - ], - "description": "The mode." - }, - "node": { - "allOf": [ - { - "$ref": "#/components/schemas/LedNode" - } - ], - "description": "The node." - } - }, - "required": [ - "mode", - "node" - ], - "type": "object" - }, - "PrintOnline": { - "additionalProperties": true, - "description": "The print online.", - "properties": { - "ahb": { - "description": "The ahb.", - "type": "boolean" - }, - "rfid": { - "description": "The rfid.", - "nullable": true, - "type": "boolean" - }, - "version": { - "description": "The version.", - "format": "int64", - "type": "integer" - } - }, - "required": [ - "ahb", - "version" - ], - "type": "object" - }, "PrintParameters": { "description": "Parameters for printing.", "properties": { @@ -1672,518 +222,31 @@ ], "type": "object" }, - "PrintTray": { - "additionalProperties": true, - "description": "The print tray.", + "Volume": { + "description": "Set of three values to represent the extent of a 3-D Volume. This contains the width, depth, and height values, generally used to represent some maximum or minimum.\n\nAll measurements are in millimeters.", "properties": { - "bed_temp": { - "description": "The bed temperature.", - "nullable": true, - "type": "string" - }, - "bed_temp_type": { - "description": "The bed temperature type.", - "nullable": true, - "type": "string" - }, - "id": { - "description": "The id.", - "type": "string" - }, - "k": { - "description": "The tray k.", + "depth": { + "description": "Depth of the volume (\"front to back\"), in millimeters.", "format": "double", - "nullable": true, "type": "number" }, - "n": { - "description": "The tray n.", - "format": "int64", - "nullable": true, - "type": "integer" + "height": { + "description": "Height of the volume (\"up and down\"), in millimeters.", + "format": "double", + "type": "number" }, - "nozzle_temp_max": { - "description": "The nozzle temperature max.", - "nullable": true, - "type": "string" - }, - "nozzle_temp_min": { - "description": "The nozzle temperature min.", - "nullable": true, - "type": "string" - }, - "remain": { - "description": "The tray remain.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "tag_uid": { - "description": "The tag uid.", - "nullable": true, - "type": "string" - }, - "tray_color": { - "description": "The tray color.", - "nullable": true, - "type": "string" - }, - "tray_diameter": { - "description": "The tray diameter.", - "nullable": true, - "type": "string" - }, - "tray_id_name": { - "description": "The tray id name.", - "nullable": true, - "type": "string" - }, - "tray_info_idx": { - "description": "The tray info index.", - "nullable": true, - "type": "string" - }, - "tray_sub_brands": { - "description": "The tray sub brands.", - "nullable": true, - "type": "string" - }, - "tray_temp": { - "description": "The tray temperature.", - "nullable": true, - "type": "string" - }, - "tray_time": { - "description": "The tray time.", - "nullable": true, - "type": "string" - }, - "tray_type": { - "description": "The tray type.", - "nullable": true, - "type": "string" - }, - "tray_uuid": { - "description": "The tray uuid.", - "nullable": true, - "type": "string" - }, - "tray_weight": { - "description": "The tray weight.", - "nullable": true, - "type": "string" - }, - "xcam_info": { - "description": "The xcam info.", - "nullable": true, - "type": "string" + "width": { + "description": "Width of the volume (\"left and right\"), in millimeters.", + "format": "double", + "type": "number" } }, "required": [ - "id" + "depth", + "height", + "width" ], "type": "object" - }, - "PrintUpgradeState": { - "additionalProperties": true, - "description": "A print upgrade state.", - "properties": { - "consistency_request": { - "description": "The consistency request.", - "nullable": true, - "type": "boolean" - }, - "dis_state": { - "description": "The dis state.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "err_code": { - "description": "The error code.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "force_upgrade": { - "description": "Force upgrade?", - "nullable": true, - "type": "boolean" - }, - "message": { - "description": "The message.", - "nullable": true, - "type": "string" - }, - "module": { - "description": "The module.", - "nullable": true, - "type": "string" - }, - "new_ver_list": { - "description": "The new version list.", - "items": {}, - "nullable": true, - "type": "array" - }, - "new_version_state": { - "description": "The new version state.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "progress": { - "description": "The progress.", - "nullable": true, - "type": "string" - }, - "sequence_id": { - "description": "The sequence id.", - "format": "int64", - "nullable": true, - "type": "integer" - }, - "status": { - "description": "The status.", - "nullable": true, - "type": "string" - } - }, - "type": "object" - }, - "PrintUpload": { - "additionalProperties": true, - "description": "The print upload.", - "properties": { - "message": { - "description": "The message.", - "type": "string" - }, - "progress": { - "description": "The progress.", - "format": "int64", - "type": "integer" - }, - "status": { - "description": "The status.", - "type": "string" - } - }, - "required": [ - "message", - "progress", - "status" - ], - "type": "object" - }, - "Reason": { - "description": "A reason for a message.", - "oneOf": [ - { - "description": "Success.", - "enum": [ - "SUCCESS" - ], - "type": "string" - }, - { - "description": "Fail.", - "enum": [ - "FAIL" - ], - "type": "string" - }, - { - "additionalProperties": false, - "description": "Some unknown string.", - "properties": { - "UNKNOWN": { - "type": "string" - } - }, - "required": [ - "UNKNOWN" - ], - "type": "object" - } - ] - }, - "Result": { - "description": "The result of a message.", - "oneOf": [ - { - "description": "Success.", - "enum": [ - "SUCCESS" - ], - "type": "string" - }, - { - "description": "Fail.", - "enum": [ - "FAIL" - ], - "type": "string" - } - ] - }, - "Security": { - "description": "A security message.", - "oneOf": [ - { - "additionalProperties": true, - "description": "Get the serial number.", - "properties": { - "address": { - "description": "The address.", - "format": "int64", - "type": "integer" - }, - "chip_sn": { - "description": "The chip sn.", - "type": "string" - }, - "chipsn_len": { - "description": "The chip sn length.", - "format": "int64", - "type": "integer" - }, - "command": { - "enum": [ - "get_sn" - ], - "type": "string" - }, - "length": { - "description": "The length.", - "format": "int64", - "type": "integer" - }, - "module": { - "description": "The module.", - "type": "string" - }, - "reason": { - "allOf": [ - { - "$ref": "#/components/schemas/Reason" - } - ], - "description": "The reason for the message.", - "nullable": true - }, - "sequence_id": { - "allOf": [ - { - "$ref": "#/components/schemas/SequenceId" - } - ], - "description": "The sequence id." - }, - "sn": { - "description": "The serial number.", - "type": "string" - }, - "status": { - "description": "The status.", - "type": "string" - } - }, - "required": [ - "address", - "chip_sn", - "chipsn_len", - "command", - "length", - "module", - "sequence_id", - "sn", - "status" - ], - "type": "object" - } - ] - }, - "SequenceId": { - "anyOf": [ - { - "description": "A string sequence id.", - "type": "string" - }, - { - "description": "An integer sequence id.", - "format": "uint32", - "minimum": 0, - "type": "integer" - } - ], - "description": "The sequence id type." - }, - "System": { - "description": "A system command.", - "oneOf": [ - { - "additionalProperties": true, - "description": "Led control.", - "properties": { - "command": { - "enum": [ - "ledctrl" - ], - "type": "string" - }, - "interval_time": { - "description": "The interval time.", - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "led_mode": { - "allOf": [ - { - "$ref": "#/components/schemas/LedMode" - } - ], - "description": "The LED mode." - }, - "led_node": { - "allOf": [ - { - "$ref": "#/components/schemas/LedNode" - } - ], - "description": "The LED node." - }, - "led_off_time": { - "description": "The LED off time.", - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "led_on_time": { - "description": "The LED on time.", - "format": "uint32", - "minimum": 0, - "type": "integer" - }, - "loop_times": { - "description": "The loop times.", - "format": "uint32", - "minimum": 0, - "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." - } - }, - "required": [ - "command", - "interval_time", - "led_mode", - "led_node", - "led_off_time", - "led_on_time", - "loop_times", - "result", - "sequence_id" - ], - "type": "object" - }, - { - "additionalProperties": true, - "description": "Get accessories.", - "properties": { - "accessory_type": { - "allOf": [ - { - "$ref": "#/components/schemas/AccessoryType" - } - ], - "description": "The accessory type." - }, - "aux_part_fan": { - "description": "The aux part fan.", - "type": "boolean" - }, - "command": { - "enum": [ - "get_accessories" - ], - "type": "string" - }, - "nozzle_diameter": { - "description": "The nozzle diameter.", - "format": "double", - "type": "number" - }, - "nozzle_type": { - "allOf": [ - { - "$ref": "#/components/schemas/NozzleType" - } - ], - "description": "The nozzle type." - }, - "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." - } - }, - "required": [ - "accessory_type", - "aux_part_fan", - "command", - "nozzle_diameter", - "nozzle_type", - "result", - "sequence_id" - ], - "type": "object" - } - ] } } }, @@ -2231,11 +294,11 @@ "content": { "application/json": { "schema": { - "additionalProperties": { - "$ref": "#/components/schemas/Machine" + "items": { + "$ref": "#/components/schemas/MachineInfoResponse" }, - "title": "Map_of_Machine", - "type": "object" + "title": "Array_of_MachineInfoResponse", + "type": "array" } } }, @@ -2273,7 +336,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Message" + "$ref": "#/components/schemas/MachineInfoResponse" } } }, diff --git a/src/components/NetworkMachineIndicator.tsx b/src/components/NetworkMachineIndicator.tsx index 2065a0f4c..c80a0a8c6 100644 --- a/src/components/NetworkMachineIndicator.tsx +++ b/src/components/NetworkMachineIndicator.tsx @@ -49,7 +49,11 @@ export const NetworkMachineIndicator = ({ {Object.entries(machineManager.machines).map( ([hostname, machine]) => (
  • -

    {machine.model || machine.manufacturer}

    +

    + {machine.make_model.model || + machine.make_model.manufacturer || + 'Unknown Machine'} +

    Hostname {hostname}

    diff --git a/src/lib/commandBarConfigs/modelingCommandConfig.ts b/src/lib/commandBarConfigs/modelingCommandConfig.ts index 9801d29ac..bf1d9c272 100644 --- a/src/lib/commandBarConfigs/modelingCommandConfig.ts +++ b/src/lib/commandBarConfigs/modelingCommandConfig.ts @@ -25,7 +25,7 @@ export type ModelingCommandSchema = { storage?: StorageUnion } Make: { - machine: components['schemas']['Machine'] + machine: components['schemas']['MachineInfoResponse'] } Extrude: { selection: Selections // & { type: 'face' } would be cool to lock that down @@ -179,21 +179,25 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig< machine: { inputType: 'options', required: true, - valueSummary: (machine: components['schemas']['Machine']) => - machine.model || machine.manufacturer, + valueSummary: (machine: components['schemas']['MachineInfoResponse']) => + machine.make_model.model || + machine.make_model.manufacturer || + 'Unknown Machine', options: () => { return Object.entries(machineManager.machines).map( - ([hostname, machine]) => ({ - name: `${machine.model || machine.manufacturer}, ${hostname}`, + ([_, machine]) => ({ + name: `${machine.id} (${ + machine.make_model.model || machine.make_model.manufacturer + }) via ${machineManager.machineApiIp || 'the local network'}`, isCurrent: false, - value: machine as components['schemas']['Machine'], + value: machine as components['schemas']['MachineInfoResponse'], }) ) }, defaultValue: () => { return Object.values( machineManager.machines - )[0] as components['schemas']['Machine'] + )[0] as components['schemas']['MachineInfoResponse'] }, }, }, diff --git a/src/lib/exportMake.ts b/src/lib/exportMake.ts index f1e11909a..423136e7a 100644 --- a/src/lib/exportMake.ts +++ b/src/lib/exportMake.ts @@ -26,15 +26,7 @@ export async function exportMake(data: ArrayBuffer): Promise { return null } - let machineId = null - if ('id' in currentMachine) { - machineId = currentMachine.id - } else if ('hostname' in currentMachine && currentMachine.hostname) { - machineId = currentMachine.hostname - } else if ('ip' in currentMachine && currentMachine.ip) { - machineId = currentMachine.ip - } - + let machineId = currentMachine?.id if (!machineId) { console.error('No machine id available', currentMachine) toast.error('No machine id available') diff --git a/src/lib/machine-api.d.ts b/src/lib/machine-api.d.ts index 5539d0279..5b450a16d 100644 --- a/src/lib/machine-api.d.ts +++ b/src/lib/machine-api.d.ts @@ -93,587 +93,56 @@ export interface paths { export type webhooks = Record export interface components { schemas: { - /** @description The type of accessory. */ - AccessoryType: 'none' /** @description Error information from a response. */ Error: { error_code?: string message: string request_id: string } - /** @description An info command. */ - Info: { - /** @enum {string} */ - command: 'get_version' - /** @description The info module. */ - module: components['schemas']['InfoModule'][] - /** @description The reason of the info command. */ - reason?: components['schemas']['Reason'] | null - /** @description The result of the info command. */ - result?: components['schemas']['Result'] | null - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown + /** @description Extra machine-specific information regarding a connected machine. */ + ExtraMachineInfoResponse: + | { + Moonraker: Record + } + | { + Usb: Record + } + | { + Bambu: Record + } + /** @description Information regarding a connected machine. */ + MachineInfoResponse: { + /** @description Additional, per-machine information which is specific to the underlying machine type. */ + extra?: components['schemas']['ExtraMachineInfoResponse'] | null + /** @description Machine Identifier (ID) for the specific Machine. */ + id: string + /** @description Information regarding the method of manufacture. */ + machine_type: components['schemas']['MachineType'] + /** @description Information regarding the make and model of the attached Machine. */ + make_model: components['schemas']['MachineMakeModel'] + /** @description Maximum part size that can be manufactured by this device. This may be some sort of theoretical upper bound, getting close to this limit seems like maybe a bad idea. + * + * This may be `None` if the maximum size is not knowable by the Machine API. + * + * What "close" means is up to you! */ + max_part_volume?: components['schemas']['Volume'] | null } - /** @description An info module. */ - InfoModule: { - /** @description The hardware version. */ - hw_ver: string - /** @description The loader version. */ - loader_ver?: string | null - /** @description The module name. */ - name: string - /** @description The ota version. */ - ota_ver?: string | null - /** @description The project name. */ - project_name?: string | null - /** @description The serial number. */ - sn: string - /** @description The software version. */ - sw_ver: string - } - /** @description The mode for the led. */ - LedMode: 'on' | 'off' | 'flashing' - /** @description The node for the led. */ - LedNode: 'chamber_light' | 'work_light' - /** @description A liveview message. */ - LiveView: { - /** @enum {string} */ - command: 'init' - /** @description The op protocols. */ - op_protocols: components['schemas']['OperationProtocol'][] - /** @description The peer host. */ - peer_host: string - /** @description The reason for the message. */ - reason?: components['schemas']['Reason'] | null - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - } - /** @description Details for a 3d printer connected over USB. */ - Machine: - | { - id: string - manufacturer: string - model: string - port: string - /** @enum {string} */ - type: 'UsbPrinter' - } - | { - /** @description The hostname of the printer. */ - hostname?: string | null - /** - * Format: ip - * @description The IP address of the printer. - */ - ip: string - /** @description The manufacturer of the printer. */ - manufacturer: components['schemas']['NetworkPrinterManufacturer'] - /** @description The model of the printer. */ - model?: string | null - /** - * Format: uint16 - * @description The port of the printer. - */ - port?: number | null - /** @description The serial number of the printer. */ - serial?: string | null - /** @enum {string} */ - type: 'NetworkPrinter' - } - /** @description A message from a machine. */ - Message: - | { - UsbPrinter: components['schemas']['Message2'] - } - | { - NetworkPrinter: components['schemas']['Message3'] - } - /** - * @description A message from the printer. - * @enum {string} - */ - Message2: 'ok' - /** @description A message from the printer. */ - Message3: - | { - Bambu: components['schemas']['Message4'] - } - | { - Formlabs: Record - } - /** @description A message from/to the printer. */ - Message4: - | { - print: components['schemas']['Print'] - } - | { - info: components['schemas']['Info'] - } - | { - system: components['schemas']['System'] - } - | { - security: components['schemas']['Security'] - } - | { - live_view: components['schemas']['LiveView'] - } - | { - json: unknown - } - | { - unknown: string | null - } - /** @description Network printer manufacturer. */ - NetworkPrinterManufacturer: 'Bambu' | 'Formlabs' - /** @description A nozzle type. */ - NozzleType: 'hardened_steel' | 'stainless_steel' - /** @description An operation protocol. */ - OperationProtocol: { - /** @description The protocol. */ - protocol: string - /** @description The version. */ - version: string - } & { - [key: string]: unknown + /** @description Information regarding the make/model of a discovered endpoint. */ + MachineMakeModel: { + /** @description The manufacturer that built the connected Machine. */ + manufacturer?: string | null + /** @description The model of the connected Machine. */ + model?: string | null + /** @description The unique serial number of the connected Machine. */ + serial?: string | null } + /** @description Specific technique by which this Machine takes a design, and produces a real-world 3D object. */ + MachineType: 'Stereolithography' | 'FusedDeposition' | 'Cnc' /** @description The response from the `/ping` endpoint. */ Pong: { /** @description The pong response. */ message: string } - /** @description A print command. */ - Print: - | ({ - /** @enum {string} */ - command: 'ams_control' - /** @description The param. */ - param?: string | null - /** @description The reason for the message. */ - reason: components['schemas']['Reason'] - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'ams_change_filament' - /** - * Format: int64 - * @description The error number. - */ - errorno?: number | null - /** @description The reason for the message. */ - reason?: components['schemas']['Reason'] | null - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - /** - * Format: int64 - * @description The target temperature. - */ - tar_temp?: number | null - /** - * Format: int64 - * @description The target. - */ - target: number - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'calibration' - /** - * Format: int64 - * @description The option. - */ - option: number - /** @description The reason for the message. */ - reason?: components['schemas']['Reason'] | null - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - | ({ - /** @description The ams. */ - ams?: components['schemas']['PrintAms'] | null - /** - * Format: int64 - * @description The ams rfid status. - */ - ams_rfid_status?: number | null - /** - * Format: int64 - * @description The ams status. - */ - ams_status?: number | null - /** @description The aux part fan. */ - aux_part_fan?: boolean | null - /** - * Format: double - * @description The target bed temperature. - */ - bed_target_temper?: number | null - /** - * Format: double - * @description The bed temperature. - */ - bed_temper?: number | null - /** @description The big fan 1 speed. */ - big_fan1_speed?: string | null - /** @description The big fan 2 speed. */ - big_fan2_speed?: string | null - /** - * Format: double - * @description The chamber temperature. - */ - chamber_temper?: number | null - /** @enum {string} */ - command: 'push_status' - /** @description The cooling fan speed. */ - cooling_fan_speed?: string | null - /** - * Format: int64 - * @description The fan gear. - */ - fan_gear?: number | null - /** @description Force upgrade? */ - force_upgrade?: boolean | null - /** @description The gcode file. */ - gcode_file?: string | null - /** @description The gcode file prepare percent. */ - gcode_file_prepare_percent?: string | null - /** @description The gcode state. */ - gcode_state?: string | null - /** @description The heatbreak fan speed. */ - heatbreak_fan_speed?: string | null - /** @description The hms. */ - hms?: unknown[] | null - /** - * Format: int64 - * @description The home flag. - */ - home_flag?: number | null - /** - * Format: int64 - * @description The hw switch state. - */ - hw_switch_state?: number | null - /** @description The ipcam. */ - ipcam?: components['schemas']['PrintIpcam'] | null - /** - * Format: int64 - * @description The layer num. - */ - layer_num?: number | null - /** @description The lifecycle. */ - lifecycle?: string | null - /** @description The lights report. */ - lights_report?: components['schemas']['PrintLightsReport'][] | null - /** - * Format: int64 - * @description The percentage of the print completed. - */ - mc_percent?: number | null - /** @description The mc print line number. */ - mc_print_line_number?: string | null - /** @description The print stage. */ - mc_print_stage?: string | null - /** - * Format: int64 - * @description The mc print sub stage. - */ - mc_print_sub_stage?: number | null - /** - * Format: int64 - * @description The remaining time of the print. - */ - mc_remaining_time?: number | null - /** @description The mess production state. */ - mess_production_state?: string | null - /** - * Format: int64 - * @description The message. - */ - msg?: number | null - /** @description The nozzle diameter. */ - nozzle_diameter?: string | null - /** - * Format: double - * @description The target nozzle temperature. - */ - nozzle_target_temper?: number | null - /** - * Format: double - * @description The nozzle temperature. - */ - nozzle_temper?: number | null - /** @description The nozzle type. */ - nozzle_type?: components['schemas']['NozzleType'] | null - /** @description Online status. */ - online?: components['schemas']['PrintOnline'] | null - /** - * Format: int64 - * @description The print error. - */ - print_error?: number | null - /** @description The print type. */ - print_type?: string | null - /** @description The profile id. */ - profile_id?: string | null - /** @description The project id. */ - project_id?: string | null - /** - * Format: int64 - * @description The queue est. - */ - queue_est?: number | null - /** - * Format: int64 - * @description The queue number. - */ - queue_number?: number | null - /** - * Format: int64 - * @description The queue sts. - */ - queue_sts?: number | null - /** - * Format: int64 - * @description The queue total. - */ - queue_total?: number | null - /** @description The s obj. */ - s_obj?: unknown[] | null - /** @description Sdcard? */ - sdcard?: boolean | null - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - /** - * Format: int64 - * @description The spd lvl. - */ - spd_lvl?: number | null - /** - * Format: int64 - * @description The spd mag. - */ - spd_mag?: number | null - /** @description The stg. */ - stg?: unknown[] | null - /** - * Format: int64 - * @description The stg cur. - */ - stg_cur?: number | null - /** @description The subtask id. */ - subtask_id?: string | null - /** @description The subtask name. */ - subtask_name?: string | null - /** @description The task id. */ - task_id?: string | null - /** - * Format: int64 - * @description The total layer num. - */ - total_layer_num?: number | null - /** @description The upgrade state. */ - upgrade_state?: components['schemas']['PrintUpgradeState'] | null - /** @description The upload. */ - upload?: components['schemas']['PrintUpload'] | null - /** @description The tray. */ - vt_tray?: components['schemas']['PrintTray'] | null - /** @description The wifi signal. */ - wifi_signal?: string | null - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'gcode_line' - /** @description The gcode line. */ - param?: string | null - /** @description The reason for the message. */ - reason: components['schemas']['Reason'] - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The return code. */ - return_code?: string | null - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - /** - * Format: int64 - * @description The source. - */ - source?: number | null - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'gcode_file' - /** @description The param. */ - param?: string | null - /** @description The print type. */ - print_type?: string | null - /** @description The reason for the message. */ - reason: components['schemas']['Reason'] - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'project_file' - /** @description The gcode file. */ - gcode_file?: string | null - /** @description The profile id. */ - profile_id: string - /** @description The project id. */ - project_id: string - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - /** @description The subtask id. */ - subtask_id: string - /** @description The subtask name. */ - subtask_name: string - /** @description The task id. */ - task_id: string - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'pause' - /** @description The reason for the message. */ - reason: components['schemas']['Reason'] - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'print_speed' - /** @description The param. */ - param: string - /** @description The reason for the message. */ - reason?: components['schemas']['Reason'] | null - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'resume' - /** @description The reason for the message. */ - reason: components['schemas']['Reason'] - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'stop' - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - | ({ - /** @enum {string} */ - command: 'extrusion_cali_get' - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - /** @description The print ams. */ - PrintAms: { - /** @description The ams. */ - ams?: components['schemas']['PrintAmsData'][] | null - /** @description The ams exist bits. */ - ams_exist_bits?: string | null - /** @description The insert flag. */ - insert_flag?: boolean | null - /** @description The power on flag. */ - power_on_flag?: boolean | null - /** @description The tray exist bits. */ - tray_exist_bits?: string | null - /** @description The tray is bbl bits. */ - tray_is_bbl_bits?: string | null - /** @description The tray now. */ - tray_now?: string | null - /** @description The tray pre. */ - tray_pre?: string | null - /** @description The tray read done bits. */ - tray_read_done_bits?: string | null - /** @description The tray reading bits. */ - tray_reading_bits?: string | null - /** @description The tray tar. */ - tray_tar?: string | null - /** - * Format: int64 - * @description The version. - */ - version?: number | null - } & { - [key: string]: unknown - } - /** @description The print ams data. */ - PrintAmsData: { - /** @description The humidity. */ - humidity: string - /** @description The id. */ - id: string - /** @description The temperature. */ - temp: string - /** @description The tray. */ - tray: components['schemas']['PrintTray'][] - } & { - [key: string]: unknown - } - /** @description The print ipcam. */ - PrintIpcam: { - /** @description The ipcam dev. */ - ipcam_dev?: string | null - /** @description The ipcam record. */ - ipcam_record?: string | null - /** - * Format: int64 - * @description The mode bits. - */ - mode_bits?: number | null - /** @description The timelapse. */ - timelapse?: string | null - } & { - [key: string]: unknown - } /** @description The response from the `/print` endpoint. */ PrintJobResponse: { /** @description The job id used for this print. */ @@ -681,29 +150,6 @@ export interface components { /** @description The parameters used for this print. */ parameters: components['schemas']['PrintParameters'] } - /** @description A print lights report. */ - PrintLightsReport: { - /** @description The mode. */ - mode: components['schemas']['LedMode'] - /** @description The node. */ - node: components['schemas']['LedNode'] - } & { - [key: string]: unknown - } - /** @description The print online. */ - PrintOnline: { - /** @description The ahb. */ - ahb: boolean - /** @description The rfid. */ - rfid?: boolean | null - /** - * Format: int64 - * @description The version. - */ - version: number - } & { - [key: string]: unknown - } /** @description Parameters for printing. */ PrintParameters: { /** @description The name for the job. */ @@ -711,219 +157,26 @@ export interface components { /** @description The machine id to print to. */ machine_id: string } - /** @description The print tray. */ - PrintTray: { - /** @description The bed temperature. */ - bed_temp?: string | null - /** @description The bed temperature type. */ - bed_temp_type?: string | null - /** @description The id. */ - id: string + /** @description Set of three values to represent the extent of a 3-D Volume. This contains the width, depth, and height values, generally used to represent some maximum or minimum. + * + * All measurements are in millimeters. */ + Volume: { /** * Format: double - * @description The tray k. + * @description Depth of the volume ("front to back"), in millimeters. */ - k?: number | null + depth: number /** - * Format: int64 - * @description The tray n. + * Format: double + * @description Height of the volume ("up and down"), in millimeters. */ - n?: number | null - /** @description The nozzle temperature max. */ - nozzle_temp_max?: string | null - /** @description The nozzle temperature min. */ - nozzle_temp_min?: string | null + height: number /** - * Format: int64 - * @description The tray remain. + * Format: double + * @description Width of the volume ("left and right"), in millimeters. */ - remain?: number | null - /** @description The tag uid. */ - tag_uid?: string | null - /** @description The tray color. */ - tray_color?: string | null - /** @description The tray diameter. */ - tray_diameter?: string | null - /** @description The tray id name. */ - tray_id_name?: string | null - /** @description The tray info index. */ - tray_info_idx?: string | null - /** @description The tray sub brands. */ - tray_sub_brands?: string | null - /** @description The tray temperature. */ - tray_temp?: string | null - /** @description The tray time. */ - tray_time?: string | null - /** @description The tray type. */ - tray_type?: string | null - /** @description The tray uuid. */ - tray_uuid?: string | null - /** @description The tray weight. */ - tray_weight?: string | null - /** @description The xcam info. */ - xcam_info?: string | null - } & { - [key: string]: unknown + width: number } - /** @description A print upgrade state. */ - PrintUpgradeState: { - /** @description The consistency request. */ - consistency_request?: boolean | null - /** - * Format: int64 - * @description The dis state. - */ - dis_state?: number | null - /** - * Format: int64 - * @description The error code. - */ - err_code?: number | null - /** @description Force upgrade? */ - force_upgrade?: boolean | null - /** @description The message. */ - message?: string | null - /** @description The module. */ - module?: string | null - /** @description The new version list. */ - new_ver_list?: unknown[] | null - /** - * Format: int64 - * @description The new version state. - */ - new_version_state?: number | null - /** @description The progress. */ - progress?: string | null - /** - * Format: int64 - * @description The sequence id. - */ - sequence_id?: number | null - /** @description The status. */ - status?: string | null - } & { - [key: string]: unknown - } - /** @description The print upload. */ - PrintUpload: { - /** @description The message. */ - message: string - /** - * Format: int64 - * @description The progress. - */ - progress: number - /** @description The status. */ - status: string - } & { - [key: string]: unknown - } - /** @description A reason for a message. */ - Reason: - | 'SUCCESS' - | 'FAIL' - | { - UNKNOWN: string - } - /** @description The result of a message. */ - Result: 'SUCCESS' | 'FAIL' - /** @description A security message. */ - Security: { - /** - * Format: int64 - * @description The address. - */ - address: number - /** @description The chip sn. */ - chip_sn: string - /** - * Format: int64 - * @description The chip sn length. - */ - chipsn_len: number - /** @enum {string} */ - command: 'get_sn' - /** - * Format: int64 - * @description The length. - */ - length: number - /** @description The module. */ - module: string - /** @description The reason for the message. */ - reason?: components['schemas']['Reason'] | null - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - /** @description The serial number. */ - sn: string - /** @description The status. */ - status: string - } & { - [key: string]: unknown - } - /** @description The sequence id type. */ - SequenceId: string | number - /** @description A system command. */ - System: - | ({ - /** @enum {string} */ - command: 'ledctrl' - /** - * Format: uint32 - * @description The interval time. - */ - interval_time: number - /** @description The LED mode. */ - led_mode: components['schemas']['LedMode'] - /** @description The LED node. */ - led_node: components['schemas']['LedNode'] - /** - * Format: uint32 - * @description The LED off time. - */ - led_off_time: number - /** - * Format: uint32 - * @description The LED on time. - */ - led_on_time: number - /** - * Format: uint32 - * @description The loop times. - */ - loop_times: number - /** @description The reason for the message. */ - reason?: components['schemas']['Reason'] | null - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) - | ({ - /** @description The accessory type. */ - accessory_type: components['schemas']['AccessoryType'] - /** @description The aux part fan. */ - aux_part_fan: boolean - /** @enum {string} */ - command: 'get_accessories' - /** - * Format: double - * @description The nozzle diameter. - */ - nozzle_diameter: number - /** @description The nozzle type. */ - nozzle_type: components['schemas']['NozzleType'] - /** @description The reason for the message. */ - reason?: components['schemas']['Reason'] | null - /** @description The result of the command. */ - result: components['schemas']['Result'] - /** @description The sequence id. */ - sequence_id: components['schemas']['SequenceId'] - } & { - [key: string]: unknown - }) } responses: { /** @description Error */ @@ -980,9 +233,7 @@ export interface operations { [name: string]: unknown } content: { - 'application/json': { - [key: string]: components['schemas']['Machine'] - } + 'application/json': components['schemas']['MachineInfoResponse'][] } } '4XX': components['responses']['Error'] @@ -1007,7 +258,7 @@ export interface operations { [name: string]: unknown } content: { - 'application/json': components['schemas']['Message'] + 'application/json': components['schemas']['MachineInfoResponse'] } } '4XX': components['responses']['Error'] diff --git a/src/lib/machineManager.ts b/src/lib/machineManager.ts index da0fcca80..d514b8dd9 100644 --- a/src/lib/machineManager.ts +++ b/src/lib/machineManager.ts @@ -1,15 +1,16 @@ import { isDesktop } from './isDesktop' import { components } from './machine-api' -export type MachinesListing = { - [key: string]: components['schemas']['Machine'] -} +export type MachinesListing = Array< + components['schemas']['MachineInfoResponse'] +> export class MachineManager { private _isDesktop: boolean = isDesktop() - private _machines: MachinesListing = {} + private _machines: MachinesListing = [] private _machineApiIp: string | null = null - private _currentMachine: components['schemas']['Machine'] | null = null + private _currentMachine: components['schemas']['MachineInfoResponse'] | null = + null constructor() { if (!this._isDesktop) { @@ -44,7 +45,7 @@ export class MachineManager { } machineCount(): number { - return Object.keys(this._machines).length + return this._machines.length } get machineApiIp(): string | null { @@ -64,11 +65,13 @@ export class MachineManager { return 'Machine API server was discovered, but no machines are available' } - get currentMachine(): components['schemas']['Machine'] | null { + get currentMachine(): components['schemas']['MachineInfoResponse'] | null { return this._currentMachine } - set currentMachine(machine: components['schemas']['Machine'] | null) { + set currentMachine( + machine: components['schemas']['MachineInfoResponse'] | null + ) { this._currentMachine = machine } diff --git a/src/preload.ts b/src/preload.ts index 9a19fdbf5..5f55f145a 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -52,7 +52,7 @@ const kittycad = (access: string, args: any) => // bite our butts. const listMachines = async (): Promise => { const machineApi = await ipcRenderer.invoke('find_machine_api') - if (!machineApi) return {} + if (!machineApi) return [] return fetch(`http://${machineApi}/machines`).then((resp) => resp.json()) }