Table of Contents

Class BaseCommand

Namespace
DuetAPI.Commands
Assembly
DuetAPI.dll

Base class of a command. When an instance of this class is processed in the control server, the connection identifier of the channel it was received from is assigned.

public abstract class BaseCommand
Inheritance
BaseCommand
Derived
Inherited Members

Constructors

BaseCommand()

Creates a new instance of the BaseCommand

protected BaseCommand()

Properties

Command

Name of the command to execute

[JsonPropertyOrder(-1)]
public string Command { get; set; }

Property Value

string

Methods

InvokeAsync(CancellationToken)

Invokes the command implementation

public virtual Task<object?> InvokeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional cancellation token

Returns

Task<object>

Result of the command

UpdateFromJson(JsonElement)

Update the command object from a JSON element

public abstract void UpdateFromJson(JsonElement jsonElement)

Parameters

jsonElement JsonElement

JSON element

UpdateFromJsonReader(ref Utf8JsonReader)

Update the command object from a JSON reader

public abstract void UpdateFromJsonReader(ref Utf8JsonReader reader)

Parameters

reader Utf8JsonReader

JSON reader