Class Code
Implementation of the Code command
Implements
Inherited Members
Namespace: DuetControlServer.Commands
Assembly: DuetControlServer.dll
Syntax
public sealed class Code : Code, IConnectionCommand
Constructors
Code()
Constructor of a new code
Declaration
public Code()
Code(string)
Constructor of a new code which also parses the given text-based G/M/T-code
Declaration
public Code(string code)
Parameters
Type | Name | Description |
---|---|---|
string | code |
Fields
FileLocks
Lock around the files being written
Declaration
public static readonly AsyncLock[] FileLocks
Field Value
Type | Description |
---|---|
AsyncLock[] |
FilesBeingWritten
Current stream writer of the files being written to (M28/M29)
Declaration
public static readonly StreamWriter?[] FilesBeingWritten
Field Value
Type | Description |
---|---|
StreamWriter[] |
Properties
Connection
Source connection of this command
Declaration
public Connection? Connection { get; set; }
Property Value
Type | Description |
---|---|
Connection |
Methods
CancelPending(CodeChannel)
Cancel pending codes of the given channel
Declaration
public static void CancelPending(CodeChannel channel)
Parameters
Type | Name | Description |
---|---|---|
CodeChannel | channel | Channel to cancel codes from |
EmulatingMarlin()
Check if Marlin is being emulated
Declaration
public Task<bool> EmulatingMarlin()
Returns
Type | Description |
---|---|
Task<bool> | True if Marlin is being emulated |
Execute()
Run an arbitrary G/M/T-code and wait for it to finish or to be enqueued if it is asynchronous
Declaration
public override Task<Message?> Execute()
Returns
Type | Description |
---|---|
Task<Message> | Result of the code |
Overrides
Exceptions
Type | Condition |
---|---|
OperationCanceledException | Code has been cancelled |
Reset()
Resets more Code fields
Declaration
public override void Reset()
Overrides
SetCancelled()
Set this code as cancelled
Declaration
public void SetCancelled()
SetException(Exception)
Set an exception for this code
Declaration
public void SetException(Exception e)
Parameters
Type | Name | Description |
---|---|---|
Exception | e | Exception to set |
SetFinished()
Set this code as complete
Declaration
public void SetFinished()