Skip to main content

Command

Enum Command 

Source
pub enum Command {
Show 18 variants PushAll, GetVersion, Pause, Resume, Stop, CleanPrintError, GcodeLine(String), GcodeFile(String), PrintSpeed(SpeedLevel), ProjectFile(ProjectFile), Led { node: LedNode, on: bool, }, IpcamTimelapse(TimelapseControl), Reboot, AmsControl(AmsControl), AmsChangeFilament { target: u32, curr_temp: i64, tar_temp: i64, }, AmsUserSetting { ams_id: u32, startup_read: bool, tray_read: bool, }, AmsFilamentSetting(Box<AmsFilamentSetting>), Calibration { bed_level: bool, vibration: bool, motor_noise: bool, },
}
Expand description

A control/query command sent to the printer.

Pure and data-only: rendering to JSON (Command::to_payload) takes the caller-allocated sequence_id, so the value itself carries no mutable state.

Variants§

§

PushAll

Request a full state snapshot (pushing.pushall).

§

GetVersion

Request the module/firmware inventory (info.get_version). A read; the response comes back under /info with a module[] array.

§

Pause

Pause the current print.

§

Resume

Resume a paused print.

§

Stop

Stop (cancel) the current print — irreversible.

§

CleanPrintError

Clear a print error / dismiss the error popup (print.clean_print_error). This is what Bambu Studio sends to acknowledge an error popup. Command name is from vendor docs; the A1 mini ACKs it success (observed). What it does NOT do, observed on this unit: it did not move gcode_state out of FAILED (tested with print_error already 0), and ams_change_filament stayed rejected while FAILED. So treat it as “dismiss the error”, not “return to idle”. Sending it while an error is active is still uncharacterised. [spec]

§

GcodeLine(String)

Send a single raw G-code line (print.gcode_line).

§

GcodeFile(String)

Print a raw G-code file already on the printer (print.gcode_file, single-material — no AMS mapping). The value is the on-printer path.

§

PrintSpeed(SpeedLevel)

Set the print-speed profile (print.print_speed). Effect is read back from spd_lvl; can be sent mid-print.

§

ProjectFile(ProjectFile)

Start a print of a sliced 3MF on the printer (print.project_file).

§

Led

Turn an LED on/off (system.ledctrl). Effect is read back from lights_report for the matching node, not the ACK alone.

Fields

§node: LedNode
§on: bool
§

IpcamTimelapse(TimelapseControl)

Enable/disable the printer’s per-print timelapse recording (camera.ipcam_timelapse). Its effect is read back from the ipcam.timelapse report field. [spec] — shape is from OpenBambuAPI; not device-confirmed (this unit’s camera is hardware-dead).

§

Reboot

Reboot the printer (system.reboot). Undocumented in the spec but accepted by the A1 mini (observed). The connection drops and the printer restarts, so there is no ACK — send it fire-and-forget.

§

AmsControl(AmsControl)

Basic AMS control (print.ams_control): resume/reset/pause. [spec]

§

AmsChangeFilament

Change the loaded filament via the AMS (print.ams_change_filament): target tray, with the old (curr_temp) and new (tar_temp) nozzle temps. Physically moves filament. [spec] — not device-confirmed.

Fields

§target: u32
§curr_temp: i64
§tar_temp: i64
§

AmsUserSetting

AMS RFID-read settings (print.ams_user_setting). [spec]

Fields

§ams_id: u32
§startup_read: bool

Read RFID on startup.

§tray_read: bool

Read RFID on tray insertion.

§

AmsFilamentSetting(Box<AmsFilamentSetting>)

Set a tray’s filament profile (print.ams_filament_setting). [spec]

§

Calibration

Run printer calibration (print.calibration, an option bitmask). (Lidar — bit 0 — is X1-only and intentionally not exposed here.)

Fields

§bed_level: bool

Bed leveling (bit 1 = 2).

§vibration: bool

Vibration compensation (bit 2 = 4).

§motor_noise: bool

Motor-noise calibration (bit 3 = 8).

Implementations§

Source§

impl Command

Source

pub fn category(&self) -> &'static str

The top-level message category — the single JSON key this command nests under, and the key its ACK comes back under (print commands are ACKed at /print/..., system commands at /system/...).

Source

pub fn to_payload(&self, sequence_id: &str) -> Value

Render this command to its request-payload JSON, stamping sequence_id.

Trait Implementations§

Source§

impl Clone for Command

Source§

fn clone(&self) -> Command

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Command

Source§

impl PartialEq for Command

Source§

fn eq(&self, other: &Command) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Command

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more