• 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 Interface

This class accesses RepRapFirmware via SPI and deals with general communication

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

Methods

AbortAllAsync(CodeChannel)

Abort all files in RRF on the given channel asynchronously

Declaration
public static Task AbortAllAsync(CodeChannel channel)
Parameters
Type Name Description
CodeChannel channel

Channel where all the files have been aborted

Returns
Type Description
Task

Asynchronous task

Exceptions
Type Condition
InvalidOperationException

Not connected over SPI

CopyStateAsync(CodeChannel, CodeChannel)

Copy the state from one channel processor to another

Declaration
public static Task CopyStateAsync(CodeChannel from, CodeChannel to)
Parameters
Type Name Description
CodeChannel from

Source channel

CodeChannel to

Target channel

Returns
Type Description
Task
Exceptions
Type Condition
NotImplementedException

Diagnostics(StringBuilder)

Print diagnostics of this class

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

String builder

Returns
Type Description
Task

Asynchronous task

EmergencyStop()

Request an immediate emergency stop

Declaration
public static Task EmergencyStop()
Returns
Type Description
Task

Asynchronous task

EvaluateExpression(CodeChannel, string)

Evaluate an arbitrary expression

Declaration
public static Task<object?> EvaluateExpression(CodeChannel channel, string expression)
Parameters
Type Name Description
CodeChannel channel

Where to evaluate the expression

string expression

Expression to evaluate

Returns
Type Description
Task<object>

Result of the evaluated expression

Exceptions
Type Condition
CodeParserException

Failed to evaluate expression

InvalidOperationException

Not connected over SPI

NotSupportedException

Incompatible firmware version

ArgumentException

Invalid parameter

FlushAsync(CodeChannel, bool)

Wait for all pending codes of the first or last stack item to finish

Declaration
public static Task<bool> FlushAsync(CodeChannel channel, bool flushAll)
Parameters
Type Name Description
CodeChannel channel

Code channel to wait for

bool flushAll

Flush everything

Returns
Type Description
Task<bool>

Whether the codes have been flushed successfully

FlushAsync(Code, bool, bool)

Wait for all pending codes on the same stack level as the given code to finish. By default this replaces all expressions as well for convenient parsing by the code processors.

Declaration
public static Task<bool> FlushAsync(Code code, bool evaluateExpressions = true, bool evaluateAll = true)
Parameters
Type Name Description
Code code

Code waiting for the flush

bool evaluateExpressions

Evaluate all expressions when pending codes have been flushed

bool evaluateAll

Evaluate the expressions or only SBC fields if evaluateExpressions is set to true

Returns
Type Description
Task<bool>

Whether the codes have been flushed successfully

FlushAsync(CodeFile)

Wait for all pending codes to finish

Declaration
public static Task<bool> FlushAsync(CodeFile file)
Parameters
Type Name Description
CodeFile file

Code file

Returns
Type Description
Task<bool>

Whether the codes have been flushed successfully

IsWaitingForAcknowledgment(CodeChannel)

Check if a code channel is waiting for acknowledgement

Declaration
public static bool IsWaitingForAcknowledgment(CodeChannel channel)
Parameters
Type Name Description
CodeChannel channel

Channel to query

Returns
Type Description
bool

Whether the channel is awaiting acknowledgement

LockAllMovementSystemsAndWaitForStandstill(CodeChannel)

Lock all movement systems and wait for standstill

Declaration
public static Task<IAsyncDisposable> LockAllMovementSystemsAndWaitForStandstill(CodeChannel channel)
Parameters
Type Name Description
CodeChannel channel

Code channel acquiring the lock

Returns
Type Description
Task<IAsyncDisposable>

Disposable lock object that releases the lock when disposed

Exceptions
Type Condition
InvalidOperationException

Not connected over SPI

OperationCanceledException

Failed to get movement lock

RequestObjectModel(string, string)

Request a specific update of the object model

Declaration
public static Task<byte[]> RequestObjectModel(string key, string flags)
Parameters
Type Name Description
string key

Key to request

string flags

Object model flags

Returns
Type Description
Task<byte[]>

Deserialized JSON document

ResetFirmware()

Perform a firmware reset and wait for it to finish

Declaration
public static Task ResetFirmware()
Returns
Type Description
Task

Asynchronous task

Run()

Perform communication with the RepRapFirmware controller over SPI

Declaration
public static void Run()

SendMessage(MessageTypeFlags, string)

Send a message to the firmware

Declaration
public static void SendMessage(MessageTypeFlags flags, string message)
Parameters
Type Name Description
MessageTypeFlags flags

Message flags

string message

Message content

Exceptions
Type Condition
InvalidOperationException

Incompatible firmware or not connected over SPI

NotSupportedException

Incompatible firmware version

ArgumentException

Invalid parameter

SetMacroPausable(CodeChannel, bool)

Attempt to flag the currently executing macro file as (not) pausable

Declaration
public static Task SetMacroPausable(CodeChannel channel, bool isPausable)
Parameters
Type Name Description
CodeChannel channel

Code channel where the macro is being executed

bool isPausable

Whether or not the macro file is pausable

Returns
Type Description
Task

Asynchronous task

SetPrintFileInfo()

Update the print file info in the firmware

Declaration
public static Task SetPrintFileInfo()
Returns
Type Description
Task

Asynchronous task

Exceptions
Type Condition
InvalidOperationException

Not connected over SPI

SetVariable(CodeChannel, bool, string, string?)

Set or delete a global or local variable

Declaration
public static Task<object?> SetVariable(CodeChannel channel, bool createVariable, string varName, string? expression)
Parameters
Type Name Description
CodeChannel channel

Where to evaluate the expression

bool createVariable

Whether the variable shall be created

string varName

Name of the variable

string expression

Expression to evaluate

Returns
Type Description
Task<object>

Result of the evaluated expression

Exceptions
Type Condition
CodeParserException

Failed to assign or delete variable

InvalidOperationException

Not connected over SPI

NotSupportedException

Incompatible firmware version

ArgumentException

Invalid parameter

ShutdownAsync()

Called to shut down the SPI subsystem asynchronously

Declaration
public static Task ShutdownAsync()
Returns
Type Description
Task

Asynchronous task

StopPrint(PrintStoppedReason)

Notify the firmware that the file print has been stopped

Declaration
public static Task StopPrint(PrintStoppedReason reason)
Parameters
Type Name Description
PrintStoppedReason reason

Reason why the print has stopped

Returns
Type Description
Task

Asynchronous task

Exceptions
Type Condition
InvalidOperationException

Not connected over SPI

UpdateFirmware(Stream, Stream)

Perform an update of the main firmware via IAP

Declaration
public static Task UpdateFirmware(Stream iapStream, Stream firmwareStream)
Parameters
Type Name Description
Stream iapStream

IAP binary

Stream firmwareStream

Firmware binary

Returns
Type Description
Task

Asynchronous task

Exceptions
Type Condition
InvalidOperationException

Firmware is already being updated or not connected over SPI

WaitForUpdate()

Wait for potential firmware update to finish

Declaration
public static void WaitForUpdate()

WaitForUpdateAsync()

Wait for potential firmware update to finish

Declaration
public static Task WaitForUpdateAsync()
Returns
Type Description
Task

Asynchronous task

In this article
Back to top Generated by DocFX