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
MacroFile(CodeFilePath, CodeChannel, Code, int, CodeFactory, CodeProcessor, EventLogger, Expressions, LinkInterface, ObjectModel, IHostApplicationLifetime, ILoggerFactory, IOptions<Settings>)
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
filePathCodeFilePathFilename of the macro
channelCodeChannelCode requesting the macro
startCodeCodeCode starting the macro file
sourceConnectionintOriginal IPC connection requesting this macro file
codeFactoryCodeFactoryCode factory
codeProcessorCodeProcessorCode processor
eventLoggerEventLoggerEvent logger
expressionsExpressionsExpression evaluator
linkInterfaceLinkInterfaceLink interface
modelObjectModelObject model
lifetimeIHostApplicationLifetimeHost application lifetime
loggerFactoryILoggerFactoryLogger factory
settingsIOptions<Settings>Settings
MacroFile(CodeFilePath, CodeChannel, int, CodeFactory, CodeProcessor, EventLogger, Expressions, LinkInterface, ObjectModel, IHostApplicationLifetime, ILoggerFactory, IOptions<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
filePathCodeFilePathFilename of the macro
channelCodeChannelCode requesting the macro
sourceConnectionintOriginal IPC connection requesting this macro file
codeFactoryCodeFactoryCode factory
codeProcessorCodeProcessorCode processor
eventLoggerEventLoggerEvent logger
expressionsExpressionsExpression evaluator
linkInterfaceLinkInterfaceLink interface
modelObjectModelObject model
lifetimeIHostApplicationLifetimeloggerFactoryILoggerFactoryLogger factory
settingsIOptions<Settings>Settings
MacroFile(MacroFile, CodeChannel, CodeProcessor, CodeFactory, Expressions, LinkInterface, ObjectModel, IHostApplicationLifetime, ILoggerFactory, IOptions<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
copyFromMacroFileFile to copy from
channelCodeChannelCode channel to assign
codeProcessorCodeProcessorCode processor
codeFactoryCodeFactoryCode factory
expressionsExpressionsExpression evaluator
linkInterfaceLinkInterfaceLink interface
modelObjectModelObject model
lifetimeIHostApplicationLifetimeHost application lifetime
loggerFactoryILoggerFactoryLogger factory
settingsIOptions<Settings>Settings
Properties
CancellationToken
Cancellation token that is triggered when the file is cancelled/aborted
public CancellationToken CancellationToken { get; }
Property Value
IsAborted
Indicates if the macro file has been aborted
public bool IsAborted { get; }
Property Value
IsConfig
Whether this file is config.g or config.g.bak
public bool IsConfig { get; }
Property Value
IsConfigOverride
Whether this file is config-override.g
public bool IsConfigOverride { get; }
Property Value
IsDsfConfig
Whether this file is dsf-config.g
public bool IsDsfConfig { get; }
Property Value
IsExecuting
Indicates if the macro file is being executed
public bool IsExecuting { get; set; }
Property Value
IsNested
Indicates if this macro was started from a G/M/T-code
public bool IsNested { get; }
Property Value
IsPausable
Indicates if this macro can be aborted on a pause request
public bool IsPausable { get; set; }
Property Value
JustStarted
Indicates if the macro file has just started
public bool JustStarted { get; set; }
Property Value
SourceConnection
IPC connection that (indirectly) requested this macro file
public int SourceConnection { get; }
Property Value
WasStarted
Indicates if the macro was ever started
public bool WasStarted { get; }
Property Value
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
notifyFirmwarebool
WaitForFinishAsync()
Wait for this macro to finish asynchronously
public Task WaitForFinishAsync()
Returns
- Task
Asynchronous task
Remarks
This task is always resolved and never cancelled