Table of Contents

Class SimpleCode

Namespace
DuetControlServer.Commands
Assembly
DuetControlServer.dll

Implementation of the SimpleCode command

public sealed class SimpleCode : SimpleCode, IConnectionCommand
Inheritance
SimpleCode
Implements
Inherited Members

Constructors

SimpleCode(CodeFactory, ObjectModel, IHostApplicationLifetime)

Implementation of the SimpleCode command

public SimpleCode(CodeFactory codeFactory, ObjectModel model, IHostApplicationLifetime lifetime)

Parameters

codeFactory CodeFactory

Code factory

model ObjectModel

Object model

lifetime IHostApplicationLifetime

Host application lifetime

Properties

Connection

Source connection of this command

public Connection? Connection { get; set; }

Property Value

Connection

IsFromFirmware

Indicates if the code comes from the firmware. Only used internally

[JsonIgnore]
public bool IsFromFirmware { get; set; }

Property Value

bool

Methods

ExecuteAsync(CancellationToken)

Converts simple G/M/T-codes to a regular Code instances, executes them and returns the result as text

public override Task<string> ExecuteAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional cancellation token

Returns

Task<string>

Code result as text

Exceptions

OperationCanceledException

Code has been cancelled

ParseAsync()

Parse codes from the given input string asynchronously

public IAsyncEnumerable<Code> ParseAsync()

Returns

IAsyncEnumerable<Code>

Parsed G/M/T-codes