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

Class used to process data on a single code channel

Inheritance
object
Processor
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DuetControlServer.SPI.Channel
Assembly: DuetControlServer.dll
Syntax
public sealed class Processor
Remarks

This class should be merged with Codes.Pipelines.Firmware at some point

Constructors

Processor(CodeChannel)

Constructor of a code channel processor

Declaration
public Processor(CodeChannel channel)
Parameters
Type Name Description
CodeChannel channel

Code channel of this instance

Properties

BaseState

First item on the stack

Declaration
public State BaseState { get; }
Property Value
Type Description
State

BufferedCodes

List of buffered G/M/T-codes that are being processed by the firmware

Declaration
public List<Code> BufferedCodes { get; }
Property Value
Type Description
List<Code>

BytesBuffered

Occupied space for buffered codes in bytes

Declaration
public int BytesBuffered { get; }
Property Value
Type Description
int

Channel

What code channel this class is about

Declaration
public CodeChannel Channel { get; }
Property Value
Type Description
CodeChannel

CurrentState

Get the current state from the stack

Declaration
public State CurrentState { get; }
Property Value
Type Description
State

IsWaitingForAcknowledgment

Checks if this channel is waiting for acknowledgement

Declaration
public bool IsWaitingForAcknowledgment { get; }
Property Value
Type Description
bool
Remarks

This is volatile to allow fast access without locking this instance first

PendingReplies

Stack of code replies for codes that pushed the stack (e.g. macro files or blocking messages)

Declaration
public Stack<Tuple<MessageTypeFlags, string>> PendingReplies { get; }
Property Value
Type Description
Stack<Tuple<MessageTypeFlags, string>>

Stack

Stack of the different channel states

Declaration
public Stack<State> Stack { get; }
Property Value
Type Description
Stack<State>

Methods

AbortFilesAsync(bool, bool)

Abort the last or all files asynchronously

Declaration
public Task AbortFilesAsync(bool abortAll, bool fromFirmware)
Parameters
Type Name Description
bool abortAll

Whether to abort all files

bool fromFirmware

Whether the request came from the firmware

Returns
Type Description
Task

Asynchronous task

CopyState(Processor)

Copy the state from another channel processor

Declaration
public void CopyState(Processor from)
Parameters
Type Name Description
Processor from

Source

Diagnostics(StringBuilder)

Write channel diagnostics to the given string builder

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

Target to write to

Returns
Type Description
Task

Asynchronous task

DoFirmwareCode(string)

Perform a regular code that was requested from the firmware

Declaration
public void DoFirmwareCode(string code)
Parameters
Type Name Description
string code

Code to perform

DoMacroFile(string, bool)

Attempt to start a file macro

Declaration
public void DoMacroFile(string fileName, bool fromCode)
Parameters
Type Name Description
string fileName

Name of the macro file

bool fromCode

Request comes from a real G/M/T-code

FilesAborted(bool, bool)

Called when the last or all files have been aborted

Declaration
public void FilesAborted(bool abortAll, bool fromFirmware)
Parameters
Type Name Description
bool abortAll

Whether to abort all files

bool fromFirmware

Whether the request came from the firmware

FlushAllAsync()

Flush all pending codes and return true on success or false on failure. This method may be deprecated; in theory it should suffice to flush the pipeline only (with stricter Busy conditions)

Declaration
public Task<bool> FlushAllAsync()
Returns
Type Description
Task<bool>

Whether the codes could be flushed

FlushAsync(CodeFile?)

Flush pending codes and return true on success or false on failure. This method may be deprecated; in theory it should suffice to flush the pipeline only (with stricter Busy conditions)

Declaration
public Task<bool> FlushAsync(CodeFile? file = null)
Parameters
Type Name Description
CodeFile file

Optional code file for the flush target

Returns
Type Description
Task<bool>

Whether the codes could be flushed

HandleReply(MessageTypeFlags, string)

Handle a G-code reply

Declaration
public bool HandleReply(MessageTypeFlags flags, string reply)
Parameters
Type Name Description
MessageTypeFlags flags

Message flags

string reply

Code reply

Returns
Type Description
bool

Whether the reply could be processed

Invalidate()

Invalidate every request and buffered code on this channel

Declaration
public void Invalidate()

InvalidateRegular()

Invalidate buffered and regular codes + requests

Declaration
public void InvalidateRegular()

Lock()

Lock access to this code channel

Declaration
public IDisposable Lock()
Returns
Type Description
IDisposable

Disposable lock

LockAllMovementSystemsAndWaitForStandstill()

Lock all movement systems and wait for standstill

Declaration
public Task<bool> LockAllMovementSystemsAndWaitForStandstill()
Returns
Type Description
Task<bool>

Whether the movement systems could be locked

LockAsync()

Lock access to this code channel asynchronously

Declaration
public AwaitableDisposable<IDisposable> LockAsync()
Returns
Type Description
AwaitableDisposable<IDisposable>

Disposable lock

MacroFileClosed()

Called when RepRapFirmware has closed the last macro file internally

Declaration
public void MacroFileClosed()

MessageAcknowledged()

Called when a message has been acknowledged

Declaration
public void MessageAcknowledged()

Pop()

Pop the last state from the stack

Declaration
public void Pop()

PopAsync()

Pop the last state from the stack

Declaration
public Task PopAsync()
Returns
Type Description
Task

Asynchronous task

PrintPaused()

Called when the print has been paused on the file channel

Declaration
public void PrintPaused()

Push(CodeFile?)

Push a new state on the stack

Declaration
public State Push(CodeFile? file = null)
Parameters
Type Name Description
CodeFile file
Returns
Type Description
State

New state

ResourceLocked()

Called when a resource has been locked

Declaration
public void ResourceLocked()

Run()

Process pending requests on this channel

Declaration
public void Run()

SetMacroPausable(bool)

Flag the currently executing macro file as (not) pausable

Declaration
public Task SetMacroPausable(bool isPausable)
Parameters
Type Name Description
bool isPausable

Whether the macro is pausable or not

Returns
Type Description
Task

Asynchronous task

StartCopiedMacros()

Start copied macros. This must happen later to avoid race conditions

Declaration
public static void StartCopiedMacros()

UnlockAll()

Unlock all resources occupied by the given channel

Declaration
public Task UnlockAll()
Returns
Type Description
Task

Asynchronous task

WaitForAcknowledgement()

Wait for a message to be acknowledged

Declaration
public void WaitForAcknowledgement()
In this article
Back to top Generated by DocFX