Table of Contents

Class MacroFile

Namespace
DuetControlServer.Files
Assembly
DuetControlServer.dll

Class representing a macro being executed

public sealed class MacroFile : CodeFile, IDisposable
Inheritance
MacroFile
Implements
Inherited Members

Constructors

Constructor of a macro started by a G/M/T-code

public MacroFile(CodeFilePath filePath, CodeChannel channel, Code startCode, int sourceConnection, CodeFactory codeFactory, CodeProcessor codeProcessor, EventLogger eventLogger, Expressions expressions, LinkInterface linkInterface, ObjectModel model, IHostApplicationLifetime lifetime, ILoggerFactory loggerFactory, IOptions<Settings> settings)

Parameters

filePath CodeFilePath

Filename of the macro

channel CodeChannel

Code requesting the macro

startCode Code

Code starting the macro file

sourceConnection int

Original IPC connection requesting this macro file

codeFactory CodeFactory

Code factory

codeProcessor CodeProcessor

Code processor

eventLogger EventLogger

Event logger

expressions Expressions

Expression evaluator

linkInterface LinkInterface

Link interface

model ObjectModel

Object model

lifetime IHostApplicationLifetime

Host application lifetime

loggerFactory ILoggerFactory

Logger factory

settings IOptions<Settings>

Settings

Constructor of a system macro

public MacroFile(CodeFilePath filePath, CodeChannel channel, int sourceConnection, CodeFactory codeFactory, CodeProcessor codeProcessor, EventLogger eventLogger, Expressions expressions, LinkInterface linkInterface, ObjectModel model, IHostApplicationLifetime lifetime, ILoggerFactory loggerFactory, IOptions<Settings> settings)

Parameters

filePath CodeFilePath

Filename of the macro

channel CodeChannel

Code requesting the macro

sourceConnection int

Original IPC connection requesting this macro file

codeFactory CodeFactory

Code factory

codeProcessor CodeProcessor

Code processor

eventLogger EventLogger

Event logger

expressions Expressions

Expression evaluator

linkInterface LinkInterface

Link interface

model ObjectModel

Object model

lifetime IHostApplicationLifetime
loggerFactory ILoggerFactory

Logger factory

settings IOptions<Settings>

Settings

Copy constructor

public MacroFile(MacroFile copyFrom, CodeChannel channel, CodeProcessor codeProcessor, CodeFactory codeFactory, Expressions expressions, LinkInterface linkInterface, ObjectModel model, IHostApplicationLifetime lifetime, ILoggerFactory loggerFactory, IOptions<Settings> settings)

Parameters

copyFrom MacroFile

File to copy from

channel CodeChannel

Code channel to assign

codeProcessor CodeProcessor

Code processor

codeFactory CodeFactory

Code factory

expressions Expressions

Expression evaluator

linkInterface LinkInterface

Link interface

model ObjectModel

Object model

lifetime IHostApplicationLifetime

Host application lifetime

loggerFactory ILoggerFactory

Logger factory

settings IOptions<Settings>

Settings

Properties

CancellationToken

Cancellation token that is triggered when the file is cancelled/aborted

public CancellationToken CancellationToken { get; }

Property Value

CancellationToken

IsAborted

Indicates if the macro file has been aborted

public bool IsAborted { get; }

Property Value

bool

IsConfig

Whether this file is config.g or config.g.bak

public bool IsConfig { get; }

Property Value

bool

IsConfigOverride

Whether this file is config-override.g

public bool IsConfigOverride { get; }

Property Value

bool

IsDsfConfig

Whether this file is dsf-config.g

public bool IsDsfConfig { get; }

Property Value

bool

IsExecuting

Indicates if the macro file is being executed

public bool IsExecuting { get; set; }

Property Value

bool

IsNested

Indicates if this macro was started from a G/M/T-code

public bool IsNested { get; }

Property Value

bool

IsPausable

Indicates if this macro can be aborted on a pause request

public bool IsPausable { get; set; }

Property Value

bool

JustStarted

Indicates if the macro file has just started

public bool JustStarted { get; set; }

Property Value

bool

SourceConnection

IPC connection that (indirectly) requested this macro file

public int SourceConnection { get; }

Property Value

int

WasStarted

Indicates if the macro was ever started

public bool WasStarted { get; }

Property Value

bool

Methods

Abort()

Abort this macro

public void Abort()

Dispose()

Dispose this instance

public override void Dispose()

Start(bool)

Start executing this macro file in the background

public void Start(bool notifyFirmware = true)

Parameters

notifyFirmware bool

WaitForFinishAsync()

Wait for this macro to finish asynchronously

public Task WaitForFinishAsync()

Returns

Task

Asynchronous task

Remarks

This task is always resolved and never cancelled