Table of Contents

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

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

codeFactory CodeFactory

Code factory to create codes

linkInterface LinkInterface

Link interface to the machine

model ObjectModel

Object model

logger ILogger<PeriodicUpdateService>

Logger instance

settings IOptions<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

stoppingToken CancellationToken

Cancellation token

Returns

Task

Asynchronous task

IsProtocolEnabled(NetworkProtocol)

Check if the given protocol is enabled

public bool IsProtocolEnabled(NetworkProtocol protocol)

Parameters

protocol NetworkProtocol

Protocol 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

protocol NetworkProtocol

Disabled protocol

ProtocolEnabled(NetworkProtocol)

Called when a network protocol has been enabled

public void ProtocolEnabled(NetworkProtocol protocol)

Parameters

protocol NetworkProtocol

Enabled protocol

StartAsync(CancellationToken)

Start the periodic update service

public override Task StartAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token

Returns

Task

Asynchronous task