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

Static class for reading data from SPI transmissions. It is expected that each data block occupies entire 4-byte blocks. Make sure to keep the data returned by these functions only as long as the underlying buffer is actually valid!

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

Methods

ReadAbortFile(ReadOnlySpan<byte>, out CodeChannel, out bool)

Read information about an abort file request

Declaration
public static int ReadAbortFile(ReadOnlySpan<byte> from, out CodeChannel channel, out bool abortAll)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

CodeChannel channel

Code channel running the file

bool abortAll

Whether all files are supposed to be aborted

Returns
Type Description
int

Number of bytes read

ReadCodeBufferUpdate(ReadOnlySpan<byte>, out ushort)

Read a code buffer update from a memory span

Declaration
public static int ReadCodeBufferUpdate(ReadOnlySpan<byte> from, out ushort bufferSpace)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

ushort bufferSpace

Buffer space

Returns
Type Description
int

Number of bytes read

ReadCodeChannel(ReadOnlySpan<byte>, out CodeChannel)

Read a G-code channel

Declaration
public static int ReadCodeChannel(ReadOnlySpan<byte> from, out CodeChannel channel)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

CodeChannel channel

Channel that has acquired the lock

Returns
Type Description
int

Number of bytes read

ReadDoCode(ReadOnlySpan<byte>, out CodeChannel, out string)

Read a DoCode request

Declaration
public static int ReadDoCode(ReadOnlySpan<byte> from, out CodeChannel channel, out string code)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

CodeChannel channel

Code channel

string code

Code to execute

Returns
Type Description
int

Number of bytes read

ReadEvaluationResult(ReadOnlySpan<byte>, out string, out object?)

Read a EvaluationResult request

Declaration
public static int ReadEvaluationResult(ReadOnlySpan<byte> from, out string expression, out object? result)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

string expression

Expression

object result

Evaluation result

Returns
Type Description
int

Number of bytes read

ReadFileChunkRequest(ReadOnlySpan<byte>, out string, out uint, out int)

Read a file chunk request`

Declaration
public static int ReadFileChunkRequest(ReadOnlySpan<byte> from, out string filename, out uint offset, out int maxLength)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

string filename

Filename to read from

uint offset

Offset in the file

int maxLength

Maximum chunk length

Returns
Type Description
int

Number of bytes read

ReadFileHandle(ReadOnlySpan<byte>, out uint)

Read an arbitrary file handle

Declaration
public static int ReadFileHandle(ReadOnlySpan<byte> from, out uint handle)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

uint handle

File handle

Returns
Type Description
int

Number of bytes read

ReadFileRequest(ReadOnlySpan<byte>, out uint, out int)

Read a request to retrieve data from a file

Declaration
public static int ReadFileRequest(ReadOnlySpan<byte> from, out uint handle, out int maxLength)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

uint handle

File handle

int maxLength

Maximum buffer length

Returns
Type Description
int

Number of bytes read

ReadLegacyConfigResponse(ReadOnlySpan<byte>, out ReadOnlySpan<byte>)

Read a legacy config response from a memory span

Declaration
public static int ReadLegacyConfigResponse(ReadOnlySpan<byte> from, out ReadOnlySpan<byte> json)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

ReadOnlySpan<byte> json

Config response JSON

Returns
Type Description
int

Number of bytes read

ReadMacroRequest(ReadOnlySpan<byte>, out CodeChannel, out bool, out string)

Read a macro file request from a memory span

Declaration
public static int ReadMacroRequest(ReadOnlySpan<byte> from, out CodeChannel channel, out bool fromCode, out string filename)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

CodeChannel channel

Code channel that requested the execution

bool fromCode

Whether the macro request came from the G/M/T-code being executed

string filename

Filename of the macro to execute

Returns
Type Description
int

Number of bytes read

ReadMessage(ReadOnlySpan<byte>, out MessageTypeFlags, out string)

Read a message from a memory span

Declaration
public static int ReadMessage(ReadOnlySpan<byte> from, out MessageTypeFlags messageType, out string reply)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

MessageTypeFlags messageType

Message flags

string reply

Raw message

Returns
Type Description
int

Number of bytes read

ReadOpenFile(ReadOnlySpan<byte>, out string, out bool, out bool, out long)

Read an open file request

Declaration
public static int ReadOpenFile(ReadOnlySpan<byte> from, out string filename, out bool forWriting, out bool append, out long preAllocSize)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

string filename

Filename to open

bool forWriting

Whether the file is supposed to be written to

bool append

Whether data is supposed to be appended in write mode

long preAllocSize

How many bytes to allocate if the file is created or overwritten

Returns
Type Description
int

Number of bytes read

ReadPacketHeader(ReadOnlySpan<byte>, out PacketHeader)

Read a packet header from a memory span

Declaration
public static int ReadPacketHeader(ReadOnlySpan<byte> from, out PacketHeader packet)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

PacketHeader packet

Read packet

Returns
Type Description
int

Number of bytes read

ReadPrintPaused(ReadOnlySpan<byte>, out uint, out PrintPausedReason)

Read a print pause event

Declaration
public static int ReadPrintPaused(ReadOnlySpan<byte> from, out uint filePosition, out PrintPausedReason reason)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

uint filePosition

Position at which the print has been paused

PrintPausedReason reason

Reason why the print has been paused

Returns
Type Description
int

Number of bytes read

ReadSeekFile(ReadOnlySpan<byte>, out uint, out long)

Read a request to seek in a file

Declaration
public static int ReadSeekFile(ReadOnlySpan<byte> from, out uint handle, out long offset)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

uint handle

File handle

long offset

New file position

Returns
Type Description
int

Number of bytes read

ReadStringRequest(ReadOnlySpan<byte>, out ReadOnlySpan<byte>)

Read a UTF-8 encoded string request from a memory span

Declaration
public static int ReadStringRequest(ReadOnlySpan<byte> from, out ReadOnlySpan<byte> data)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

ReadOnlySpan<byte> data

UTF-8 string

Returns
Type Description
int

Number of bytes read

ReadStringRequest(ReadOnlySpan<byte>, out string)

Read a UTF-8 encoded string request from a memory span

Declaration
public static int ReadStringRequest(ReadOnlySpan<byte> from, out string data)
Parameters
Type Name Description
ReadOnlySpan<byte> from

Origin

string data

UTF-8 string

Returns
Type Description
int

Number of bytes read

In this article
Back to top Generated by DocFX