Class ObjectModel
- Namespace
- DuetControlServer.Model
- Assembly
- DuetControlServer.dll
Main object model with extensions for synchronization
[DiagnosticsPriority(-3)]
public class ObjectModel : ObjectModel, INotifyPropertyChanging, IStaticModelObject, IModelObject, ICloneable, INotifyPropertyChanged
- Inheritance
-
ObjectModel
- Implements
- Inherited Members
Constructors
ObjectModel(IHostApplicationLifetime, ILogger<ObjectModel>, IOptions<Settings>)
Main constructor
public ObjectModel(IHostApplicationLifetime lifetime, ILogger<ObjectModel> logger, IOptions<Settings> settings)
Parameters
lifetimeIHostApplicationLifetimeHost application lifetime
loggerILogger<ObjectModel>Logger instance
settingsIOptions<Settings>Settings
Fields
MultipleMotionSystemsConfigured
Indicates whether multiple motion systems are configured. When false, the channel Active check in FlushAsync is skipped for performance. Updated by the model update service when the "move" key is refreshed.
public volatile bool MultipleMotionSystemsConfigured
Field Value
Methods
AccessReadOnly()
Access the machine model for read operations only
public IDisposable AccessReadOnly()
Returns
- IDisposable
Disposable lock object to be used with a using directive
AccessReadOnly(CancellationToken)
Access the machine model for read operations only
public IDisposable AccessReadOnly(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationToken
Returns
- IDisposable
Disposable lock object to be used with a using directive
AccessReadOnlyAsync()
Access the machine model asynchronously for read operations only
public Task<IDisposable> AccessReadOnlyAsync()
Returns
- Task<IDisposable>
Disposable lock object to be used with a using directive
AccessReadOnlyAsync(CancellationToken)
Access the machine model asynchronously for read operations only
public Task<IDisposable> AccessReadOnlyAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationToken
Returns
- Task<IDisposable>
Disposable lock object to be used with a using directive
AccessReadWrite()
Access the machine model for read/write operations
public IDisposable AccessReadWrite()
Returns
- IDisposable
Disposable lock object to be used with a using directive
AccessReadWrite(CancellationToken)
Access the machine model for read/write operations
public IDisposable AccessReadWrite(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationToken
Returns
- IDisposable
Disposable lock object to be used with a using directive
AccessReadWriteAsync()
Access the machine model asynchronously for read/write operations
public Task<IDisposable> AccessReadWriteAsync()
Returns
- Task<IDisposable>
Disposable lock object to be used with a using directive
AccessReadWriteAsync(CancellationToken)
Access the machine model asynchronously for read/write operations
public Task<IDisposable> AccessReadWriteAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationToken
Returns
- Task<IDisposable>
Disposable lock object to be used with a using directive
GetCpuHardware()
Get the CPU hardware
public string? GetCpuHardware()
Returns
- string
CPU hardware or null if unknown
GetCpuNumCores()
Get the number of processor cores/threads
public int GetCpuNumCores()
Returns
- int
Number of cores/threads or 1 if unknown
GetDistribution()
Get the current Linux distribution
public string? GetDistribution()
Returns
- string
Distribution name or null if unknown
GetDistributionBuildTime()
Determine when the current Linux distribution was built
public DateTime? GetDistributionBuildTime()
Returns
- DateTime?
Build datetime or null if unknown
GetSbcModel()
Get the SBC model name
public string? GetSbcModel()
Returns
- string
SBC model or null if unknown
GetSbcSerial()
Get the SBC serial
public string? GetSbcSerial()
Returns
- string
SBC model or null if unknown
GetTotalMemory()
Get the total memory of this SBC
public long? GetTotalMemory()
Returns
- long?
HandleMacroErrorAsync(string, long, string)
Handle a macro file error asynchronously. Must be called WITHOUT locking this instance first!
public Task HandleMacroErrorAsync(string fileName, long lineNumber, string message)
Parameters
Returns
Exceptions
IsEmulatingMarlinAsync(CodeChannel, CancellationToken)
Check asynchronously if Marlin is being emulated on the given channel
public Task<bool> IsEmulatingMarlinAsync(CodeChannel channel, CancellationToken cancellationToken = default)
Parameters
channelCodeChannelCode channel
cancellationTokenCancellationTokenCancellation token
Returns
Output(EventLogLevel, Message, CancellationToken)
Output a generic message
public bool Output(EventLogLevel level, Message message, CancellationToken cancellationToken = default)
Parameters
levelEventLogLevelLog level
messageMessageMessage to output
cancellationTokenCancellationToken
Returns
- bool
Whether the message has been written
Output(Message, CancellationToken)
Output a generic message
public void Output(Message message, CancellationToken cancellationToken = default)
Parameters
messageMessageMessage to output
cancellationTokenCancellationTokenCancellation token
Output(MessageType, string)
Output a generic message
public void Output(MessageType type, string content)
Parameters
typeMessageTypeType of the message
contentstringContent of the message
OutputAsync(EventLogLevel, Message, CancellationToken)
Output a generic message asynchronously
public Task<bool> OutputAsync(EventLogLevel level, Message message, CancellationToken cancellationToken = default)
Parameters
levelEventLogLevelLog level
messageMessageMessage to output
cancellationTokenCancellationTokenCancellation token
Returns
OutputAsync(Message, CancellationToken)
Output a generic message asynchronously
public Task OutputAsync(Message message, CancellationToken cancellationToken = default)
Parameters
messageMessageMessage to output
cancellationTokenCancellationTokenCancellation token
Returns
- Task
Asynchronous task
OutputAsync(MessageType, string, CancellationToken)
Output a generic message asynchronously
public Task OutputAsync(MessageType type, string content, CancellationToken cancellationToken)
Parameters
typeMessageTypeType of the message
contentstringContent of the message
cancellationTokenCancellationTokenCancellation token
Returns
- Task
Asynchronous task
PrintDiagnostics(StringBuilder)
Report the diagnostics of this class
public void PrintDiagnostics(StringBuilder builder)
Parameters
builderStringBuilderTarget to write to
SetExecutingConfig(bool)
Flag asynchronously that a start-up file is being executed. Must be called WITHOUT locking this instance first!
public void SetExecutingConfig(bool executing)
Parameters
executingboolWhether a start-up file is being executed or not
WaitForFullUpdate()
Wait for the model to be fully updated from RepRapFirmware
public void WaitForFullUpdate()
WaitForFullUpdateAsync(CancellationToken)
Wait asynchronously for the model to be fully updated from RepRapFirmware
public Task WaitForFullUpdateAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token
Returns
- Task
Asynchronous task
WaitForUpdate()
Wait for an update to occur
public void WaitForUpdate()
WaitForUpdate(CancellationToken)
Wait for an update to occur
public void WaitForUpdate(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token
WaitForUpdateAsync()
Wait for an update to occur asynchronously
public Task WaitForUpdateAsync()
Returns
- Task
Asynchronous task
WaitForUpdateAsync(CancellationToken)
Wait for an update to occur asynchronously
public Task WaitForUpdateAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token
Returns
- Task
Asynchronous task
Events
OnConnectionLost
Event that is raised when the connection to the firmware has been lost
public event EventHandler? OnConnectionLost