Class PeriodicUpdateService
- Namespace
- DuetControlServer.Model
- Assembly
- DuetControlServer.dll
Static class that updates the machine model in certain intervals
public class PeriodicUpdateService : BackgroundService, IHostedService, IDisposable
- Inheritance
-
PeriodicUpdateService
- Implements
- Inherited Members
Constructors
PeriodicUpdateService(CodeFactory, LinkInterface, ObjectModel, ILogger<PeriodicUpdateService>, IOptions<Settings>)
Static class that updates the machine model in certain intervals
public PeriodicUpdateService(CodeFactory codeFactory, LinkInterface linkInterface, ObjectModel model, ILogger<PeriodicUpdateService> logger, IOptions<Settings> settings)
Parameters
codeFactoryCodeFactoryCode factory to create codes
linkInterfaceLinkInterfaceLink interface to the machine
modelObjectModelObject model
loggerILogger<PeriodicUpdateService>Logger instance
settingsIOptions<Settings>Settings of the application
Methods
ExecuteAsync(CancellationToken)
Run model updates in a certain interval. This function updates host properties like network interfaces and storage devices
protected override Task ExecuteAsync(CancellationToken stoppingToken)
Parameters
stoppingTokenCancellationTokenCancellation token
Returns
- Task
Asynchronous task
IsProtocolEnabled(NetworkProtocol)
Check if the given protocol is enabled
public bool IsProtocolEnabled(NetworkProtocol protocol)
Parameters
protocolNetworkProtocolProtocol to check
Returns
- bool
True if the protocol is enabled
ProtocolDisabled(NetworkProtocol)
Called when a network protocol has been disabled
public void ProtocolDisabled(NetworkProtocol protocol)
Parameters
protocolNetworkProtocolDisabled protocol
ProtocolEnabled(NetworkProtocol)
Called when a network protocol has been enabled
public void ProtocolEnabled(NetworkProtocol protocol)
Parameters
protocolNetworkProtocolEnabled protocol
StartAsync(CancellationToken)
Start the periodic update service
public override Task StartAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token
Returns
- Task
Asynchronous task