• DuetAPI
  • DuetAPIClient
  • DuetControlServer
  • DuetWebServer
Show / Hide Table of Contents
  • DuetAPI
    • CodeChannel
    • CodeParserException
    • IncompatibleVersionException
    • InternalServerException
    • InvalidParameterTypeException
    • MissingParameterException
  • DuetAPI.Commands
    • Acknowledge
    • AddHttpEndpoint
    • AddUserSession
    • BaseCommand
    • BaseResponse
    • Cancel
    • CheckPassword
    • Code
    • CodeFlags
    • CodeParameter
    • CodeParameterConverter
    • CodeParserBuffer
    • CodeType
    • Command
    • Command<T>
    • ErrorResponse
    • EvaluateExpression
    • Flush
    • GetFileInfo
    • GetObjectModel
    • HttpResponseType
    • Ignore
    • InstallPlugin
    • InstallSystemPackage
    • InvalidateChannel
    • KeywordType
    • LockObjectModel
    • PatchObjectModel
    • ReceivedHttpRequest
    • ReloadPlugin
    • RemoveHttpEndpoint
    • RemoveUserSession
    • Resolve
    • ResolvePath
    • Response<T>
    • SendHttpResponse
    • SetNetworkProtocol
    • SetObjectModel
    • SetPluginData
    • SetPluginProcess
    • SetUpdateStatus
    • SimpleCode
    • StartPlugin
    • StartPlugins
    • StopPlugin
    • StopPlugins
    • SyncObjectModel
    • UninstallPlugin
    • UninstallSystemPackage
    • UnlockObjectModel
    • WriteMessage
  • DuetAPI.Connection
    • ConnectionMode
    • Defaults
    • InterceptionMode
    • SubscriptionMode
  • DuetAPI.Connection.InitMessages
    • ClientInitMessage
    • CodeStreamInitMessage
    • CommandInitMessage
    • InterceptInitMessage
    • PluginServiceInitMessage
    • ServerInitMessage
    • SubscribeInitMessage
  • DuetAPI.ObjectModel
    • Accelerometer
    • AccessLevel
    • AnalogSensor
    • AnalogSensorType
    • AnalogSensorTypeConverter
    • Axis
    • BeepRequest
    • Board
    • BoardClosedLoop
    • BoardState
    • Build
    • BuildObject
    • CPU
    • ClosedLoopCurrentFraction
    • ClosedLoopPositionError
    • Compatibility
    • CoreKinematics
    • CurrentMove
    • DSF
    • DeltaKinematics
    • DeltaTower
    • DeserializationFailedEventArgs
    • DeserializationFailedEventHandler
    • DirectDisplay
    • DirectDisplayController
    • DirectDisplayEncoder
    • DirectDisplayScreen
    • DirectDisplayScreenST7567
    • Directories
    • DistanceUnit
    • DistanceUnitConverter
    • Driver
    • DriverClosedLoop
    • Duet3DFilamentMonitor
    • Endstop
    • EndstopType
    • Extruder
    • ExtruderNonlinear
    • Fan
    • FanThermostaticControl
    • FilamentMonitor
    • FilamentMonitorEnableMode
    • FilamentMonitorStatus
    • FilamentMonitorType
    • GCodeFileInfo
    • GCodeFileInfoConverter
    • GpInputPort
    • GpOutputPort
    • HangprinterKinematics
    • Heat
    • Heater
    • HeaterModel
    • HeaterModelPID
    • HeaterMonitor
    • HeaterMonitorAction
    • HeaterMonitorCondition
    • HeaterState
    • HttpEndpoint
    • HttpEndpointType
    • IGrowingModelCollection
    • IModelCollection
    • IModelDictionary
    • IModelObject
    • InductiveSensor
    • InputChannel
    • InputChannelState
    • InputShaping
    • InputShapingType
    • Inputs
    • Job
    • KeepoutZone
    • KeepoutZoneCoordinates
    • Kinematics
    • KinematicsName
    • KinematicsNameConverter
    • LaserFilamentMonitor
    • LaserFilamentMonitorCalibrated
    • LaserFilamentMonitorConfigured
    • Layer
    • LedStrip
    • LedStripType
    • LimitedResponseCountAttribute
    • Limits
    • LogLevel
    • MachineMode
    • MachineStatus
    • Memory
    • Message
    • MessageBox
    • MessageBoxMode
    • MessageType
    • Microstepping
    • MinMaxCurrent<T>
    • ModelCollection<T>
    • ModelDictionaryConverter
    • ModelDictionary<TValue>
    • ModelGrowingCollection<T>
    • ModelObject
    • MotorsIdleControl
    • Move
    • MoveCalibration
    • MoveCompensation
    • MoveCompensationType
    • MoveDeviations
    • MoveQueueItem
    • MoveRotation
    • MoveSegmentation
    • Network
    • NetworkInterface
    • NetworkInterfaceType
    • NetworkProtocol
    • NetworkState
    • ObjectModel
    • ObjectModelConverter
    • Plugin
    • PluginManifest
    • PolarKinematics
    • Probe
    • ProbeGrid
    • ProbeType
    • PulsedFilamentMonitor
    • PulsedFilamentMonitorCalibrated
    • PulsedFilamentMonitorConfigured
    • RestorePoint
    • RotatingMagnetFilamentMonitor
    • RotatingMagnetFilamentMonitorCalibrated
    • RotatingMagnetFilamentMonitorConfigured
    • SBC
    • SbcPropertyAttribute
    • ScaraKinematics
    • Sensors
    • SessionType
    • Skew
    • Spindle
    • SpindleState
    • StartupError
    • State
    • TemperatureError
    • ThumbnailInfo
    • ThumbnailInfoFormat
    • TiltCorrection
    • TimesLeft
    • Tool
    • ToolRetraction
    • ToolState
    • UserSession
    • Volume
    • ZLeadscrewKinematics
  • DuetAPI.Utility
    • DriverId
    • DriverIdJsonConverter
    • FileLists
    • Heightmap
    • JsonCamelCaseStringEnumConverter
    • JsonCharEnumConverter
    • JsonHelper
    • JsonLowerCaseStringEnumConverter
    • JsonOptionalShortDateTimeConverter
    • JsonPolymorphicWriteOnlyConverter<T>
    • JsonRegexListConverter
    • JsonShortDateTimeConverter
    • RequiredPermissionsAttribute
    • SbcPermissions
    • SbcPermissionsConverter
  • DuetAPIClient
    • BaseCommandConnection
    • BaseConnection
    • CodeStreamConnection
    • CommandConnection
    • HttpEndpointConnection
    • HttpEndpointUnixSocket
    • HttpEndpointUnixSocket.EndpointRequestReceived
    • InterceptConnection
    • SubscribeConnection
  • DuetControlServer
    • Program
    • Settings
  • DuetControlServer.Codes
    • ChannelProcessor
    • PipelineStage
    • Processor
  • DuetControlServer.Codes.Handlers
    • Functions
    • GCodes
    • Keywords
    • MCodes
    • TCodes
  • DuetControlServer.Codes.Pipelines
    • Executed
    • Firmware
    • PipelineBase
    • PipelineStackItem
    • Post
    • Pre
    • ProcessInternally
    • Start
  • DuetControlServer.Commands
    • AddHttpEndpoint
    • AddUserSession
    • CheckPassword
    • Code
    • EvaluateExpression
    • Flush
    • GetFileInfo
    • GetObjectModel
    • IConnectionCommand
    • InstallPlugin
    • InstallSystemPackage
    • InvalidateChannel
    • LockObjectModel
    • PatchObjectModel
    • ReloadPlugin
    • RemoveHttpEndpoint
    • RemoveUserSession
    • ResolvePath
    • SetNetworkProtocol
    • SetObjectModel
    • SetPluginData
    • SetPluginProcess
    • SetUpdateStatus
    • SimpleCode
    • StartPlugin
    • StartPlugins
    • StopPlugin
    • StopPlugins
    • SyncObjectModel
    • UninstallPlugin
    • UninstallSystemPackage
    • UnlockObjectModel
    • WriteMessage
  • DuetControlServer.Files
    • CodeBlock
    • CodeFile
    • FileDirectory
    • FilePath
    • InfoParser
    • JobProcessor
    • MacroFile
  • DuetControlServer.Files.ImageProcessing
    • IconImageParser
    • ImageParser
    • ImageProcessingException
  • DuetControlServer.IPC
    • Connection
    • LockManager
    • Server
  • DuetControlServer.IPC.Processors
    • Base
    • CodeInterception
    • CodeStream
    • Command
    • ModelSubscription
    • PluginService
  • DuetControlServer.Model
    • Expressions
    • Expressions.CustomAsyncFunctionResolver
    • Filter
    • ItemPathNode
    • Observer
    • Observer.PropertyPathChanged
    • PeriodicUpdater
    • PropertyChangeType
    • Provider
    • Updater
  • DuetControlServer.SPI
    • DataTransfer
    • EvaluateExpressionRequest
    • Interface
    • Interface.MovementLock
    • VariableRequest
  • DuetControlServer.SPI.Channel
    • LockRequest
    • Manager
    • Processor
    • State
  • DuetControlServer.SPI.Communication
    • Consts
  • DuetControlServer.SPI.Communication.FirmwareRequests
    • AbortFileHeader
    • CodeBufferUpdateHeader
    • DoCodeHeader
    • EvaluationResultHeader
    • ExecuteMacroHeader
    • FileChunkHeader
    • FileHandleHeader
    • OpenFileHeader
    • PrintPausedHeader
    • PrintPausedReason
    • ReadFileHeader
    • Request
    • SeekFileHeader
  • DuetControlServer.SPI.Communication.SbcRequests
    • AssignFilamentHeader
    • BooleanHeader
    • CodeFlags
    • CodeHeader
    • CodeParameter
    • DeleteLocalVariableHeader
    • FileChunkHeader
    • FileDataHeader
    • GetObjectModelHeader
    • MacroCompleteHeader
    • OpenFileResult
    • PrintStartedHeader
    • PrintStoppedHeader
    • Request
    • SetObjectModelHeader
    • SetVariableHeader
  • DuetControlServer.SPI.Communication.Shared
    • CodeChannelHeader
    • DataType
    • HeightMapHeader
    • MessageHeader
    • MessageTypeFlags
    • PacketHeader
    • PrintStoppedReason
    • StringHeader
    • TransferHeader
    • TransferResponse
  • DuetControlServer.SPI.Serialization
    • Reader
    • Writer
  • DuetControlServer.Utility
    • BuildDateTimeAttribute
    • CRC16
    • CRC32
    • Firmware
    • Logger
    • PriorityThreadRunner
  • DuetWebServer
    • Program
    • Settings
    • Startup
  • DuetWebServer.Authorization
    • Policies
    • SessionKeyAuthenticationHandler
    • SessionKeyAuthenticationSchemeOptions
  • DuetWebServer.Controllers
    • MachineController
    • RepRapFirmwareController
    • WebSocketController
  • DuetWebServer.FileProviders
    • DuetFileProvider
  • DuetWebServer.Middleware
    • CustomEndpointMiddleware
    • FallbackMiddleware
    • FixContentTypeMiddleware
    • HttpEndpointConnection
  • DuetWebServer.Services
    • ModelObserver
    • SessionExpiry
  • DuetWebServer.Singletons
    • IModelProvider
    • IModelProvider.WebDirectoryChanged
    • ISessionStorage
    • ModelProvider
    • SessionStorage
  • DuetWebServer.Utility
    • CRC32

Class Provider

Provider for the machine's object model to provides thread-safe read/write access. Make sure to access the machine model only when atomic operations are performed so that pending updates can be performed as quickly as possible.

Inheritance
object
Provider
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DuetControlServer.Model
Assembly: DuetControlServer.dll
Syntax
public static class Provider

Properties

Get

Get the machine model. Make sure to call the acquire the corresponding lock first!

Declaration
public static ObjectModel Get { get; }
Property Value
Type Description
ObjectModel

Current Duet machine object model

See Also
AccessReadOnlyAsync()
AccessReadWriteAsync()
WaitForUpdate(CancellationToken)
WaitForFullUpdate(CancellationToken)

IsUpdating

Whether the current machine status is overridden because an update is in progress

Declaration
public static bool IsUpdating { get; set; }
Property Value
Type Description
bool

Password

Configured password (see M551)

Declaration
public static string Password { get; set; }
Property Value
Type Description
string

Methods

AccessReadOnly()

Access the machine model for read operations only

Declaration
public static IDisposable AccessReadOnly()
Returns
Type Description
IDisposable

Disposable lock object to be used with a using directive

AccessReadOnly(CancellationToken)

Access the machine model for read operations only

Declaration
public static IDisposable AccessReadOnly(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
IDisposable

Disposable lock object to be used with a using directive

AccessReadOnlyAsync()

Access the machine model asynchronously for read operations only

Declaration
public static Task<IDisposable> AccessReadOnlyAsync()
Returns
Type Description
Task<IDisposable>

Disposable lock object to be used with a using directive

AccessReadOnlyAsync(CancellationToken)

Access the machine model asynchronously for read operations only

Declaration
public static Task<IDisposable> AccessReadOnlyAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<IDisposable>

Disposable lock object to be used with a using directive

AccessReadWrite()

Access the machine model for read/write operations

Declaration
public static IDisposable AccessReadWrite()
Returns
Type Description
IDisposable

Disposable lock object to be used with a using directive

AccessReadWrite(CancellationToken)

Access the machine model for read/write operations

Declaration
public static IDisposable AccessReadWrite(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
IDisposable

Disposable lock object to be used with a using directive

AccessReadWriteAsync()

Access the machine model asynchronously for read/write operations

Declaration
public static Task<IDisposable> AccessReadWriteAsync()
Returns
Type Description
Task<IDisposable>

Disposable lock object to be used with a using directive

AccessReadWriteAsync(CancellationToken)

Access the machine model asynchronously for read/write operations

Declaration
public static Task<IDisposable> AccessReadWriteAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<IDisposable>

Disposable lock object to be used with a using directive

Diagnostics(StringBuilder)

Report the diagnostics of this class

Declaration
public static void Diagnostics(StringBuilder builder)
Parameters
Type Name Description
StringBuilder builder

Target to write to

GetCpuHardware()

Get the CPU hardware

Declaration
public static string? GetCpuHardware()
Returns
Type Description
string

CPU hardware or null if unknown

GetCpuNumCores()

Get the number of processor cores/threads

Declaration
public static int GetCpuNumCores()
Returns
Type Description
int

Number of cores/threads or 1 if unknown

GetDistribution()

Get the current Linux distribution

Declaration
public static string? GetDistribution()
Returns
Type Description
string

Distribution name or null if unknown

GetDistributionBuildTime()

Determine when the current Linux distribution was built

Declaration
public static DateTime? GetDistributionBuildTime()
Returns
Type Description
DateTime?

Build datetime or null if unknown

GetSbcModel()

Get the SBC model name

Declaration
public static string? GetSbcModel()
Returns
Type Description
string

SBC model or null if unknown

GetSbcSerial()

Get the SBC serial

Declaration
public static string? GetSbcSerial()
Returns
Type Description
string

SBC model or null if unknown

GetTotalMemory()

Get the total memory of this SBC

Declaration
public static long? GetTotalMemory()
Returns
Type Description
long?

HandleMacroErrorAsync(string, long, string)

Handle a macro file error asynchronously. Must be called WITHOUT locking this instance first!

Declaration
public static Task HandleMacroErrorAsync(string fileName, long lineNumber, string message)
Parameters
Type Name Description
string fileName
long lineNumber
string message
Returns
Type Description
Task
Exceptions
Type Condition
NotImplementedException

Init()

Initialize the object model provider with values that are not expected to change

Declaration
public static void Init()

Output(LogLevel, Message)

Output a generic message

Declaration
public static bool Output(LogLevel level, Message message)
Parameters
Type Name Description
LogLevel level

Log level

Message message

Message to output

Returns
Type Description
bool

Whether the message has been written

Output(Message)

Output a generic message

Declaration
public static void Output(Message message)
Parameters
Type Name Description
Message message

Message to output

Output(MessageType, string)

Output a generic message

Declaration
public static void Output(MessageType type, string content)
Parameters
Type Name Description
MessageType type

Type of the message

string content

Content of the message

OutputAsync(LogLevel, Message)

Output a generic message asynchronously

Declaration
public static Task<bool> OutputAsync(LogLevel level, Message message)
Parameters
Type Name Description
LogLevel level

Log level

Message message

Message to output

Returns
Type Description
Task<bool>

Whether the message has been written

OutputAsync(Message)

Output a generic message asynchronously

Declaration
public static Task OutputAsync(Message message)
Parameters
Type Name Description
Message message

Message to output

Returns
Type Description
Task

Asynchronous task

OutputAsync(MessageType, string)

Output a generic message asynchronously

Declaration
public static Task OutputAsync(MessageType type, string content)
Parameters
Type Name Description
MessageType type

Type of the message

string content

Content of the message

Returns
Type Description
Task

Asynchronous task

SetExecutingConfig(bool)

Flag asynchronously that a start-up file is being executed. Must be called WITHOUT locking this instance first!

Declaration
public static void SetExecutingConfig(bool executing)
Parameters
Type Name Description
bool executing

WaitForUpdate()

Wait for an update to occur

Declaration
public static void WaitForUpdate()

WaitForUpdate(CancellationToken)

Wait for an update to occur

Declaration
public static void WaitForUpdate(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

Cancellation token

WaitForUpdateAsync()

Wait for an update to occur asynchronously

Declaration
public static Task WaitForUpdateAsync()
Returns
Type Description
Task

Asynchronous task

WaitForUpdateAsync(CancellationToken)

Wait for an update to occur asynchronously

Declaration
public static Task WaitForUpdateAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

Cancellation token

Returns
Type Description
Task

Asynchronous task

In this article
Back to top Generated by DocFX