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

Connection class for subscribing to model updates

Inheritance
object
BaseConnection
SubscribeConnection
Implements
IDisposable
Inherited Members
BaseConnection.Dispose()
BaseConnection.Id
BaseConnection.IsConnected
BaseConnection.Close()
BaseConnection.Poll()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DuetAPIClient
Assembly: DuetAPIClient.dll
Syntax
public sealed class SubscribeConnection : BaseConnection, IDisposable

Constructors

SubscribeConnection()

Creates a new connection in subscriber mode

Declaration
public SubscribeConnection()

Properties

Channel

Code channel to receive messages from. If not set, only generic messages are forwarded (as in v3.3 and earlier)

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

This has no effect in Full mode

Filter

Delimited filter expression

Declaration
[Obsolete("Use Filters instead")]
public string? Filter { get; }
Property Value
Type Description
string
See Also
Filters

Filters

Filter expressions

Declaration
public List<string> Filters { get; }
Property Value
Type Description
List<string>
See Also
Filter

Mode

Mode of the subscription

Declaration
public SubscriptionMode Mode { get; }
Property Value
Type Description
SubscriptionMode

Methods

Connect(SubscriptionMode, IEnumerable<string>?, string, CancellationToken)

Establishes a connection to the given UNIX socket file

Declaration
public Task Connect(SubscriptionMode mode, IEnumerable<string>? filters = null, string socketPath = "/run/dsf/dcs.sock", CancellationToken cancellationToken = default)
Parameters
Type Name Description
SubscriptionMode mode

Subscription mode

IEnumerable<string> filters

Optional filter strings

string socketPath

Path to the UNIX socket file

CancellationToken cancellationToken

Optional cancellation token

Returns
Type Description
Task

Asynchronous task

Exceptions
Type Condition
IncompatibleVersionException

API level is incompatible

IOException

Connection mode is unavailable

OperationCanceledException

Operation has been cancelled

SocketException

Init message could not be processed

Connect(SubscriptionMode, CodeChannel?, IEnumerable<string>?, string, CancellationToken)

Establishes a connection to the given UNIX socket file

Declaration
public Task Connect(SubscriptionMode mode, CodeChannel? channel, IEnumerable<string>? filters = null, string socketPath = "/run/dsf/dcs.sock", CancellationToken cancellationToken = default)
Parameters
Type Name Description
SubscriptionMode mode

Subscription mode

CodeChannel? channel

Optional code channel to receive messages from (not applicable in Full mode)

IEnumerable<string> filters

Optional filter strings

string socketPath

Path to the UNIX socket file

CancellationToken cancellationToken

Optional cancellation token

Returns
Type Description
Task

Asynchronous task

Exceptions
Type Condition
IncompatibleVersionException

API level is incompatible

IOException

Connection mode is unavailable

OperationCanceledException

Operation has been cancelled

SocketException

Init message could not be processed

Connect(SubscriptionMode, string, string, CancellationToken)

Establishes a connection to the given UNIX socket file

Declaration
[Obsolete("Use the new Connect overload with a filter list instead")]
public Task Connect(SubscriptionMode mode, string filter, string socketPath = "/run/dsf/dcs.sock", CancellationToken cancellationToken = default)
Parameters
Type Name Description
SubscriptionMode mode

Subscription mode

string filter

Optional delimited filter string

string socketPath

Path to the UNIX socket file

CancellationToken cancellationToken

Optional cancellation token

Returns
Type Description
Task

Asynchronous task

Exceptions
Type Condition
IncompatibleVersionException

API level is incompatible

IOException

Connection mode is unavailable

OperationCanceledException

Operation has been cancelled

SocketException

Init message could not be processed

GetMachineModel(CancellationToken)

Retrieves the full machine model of the machine In subscription mode this is the first command that has to be called once a connection has been established.

Declaration
[Obsolete("Use GetObjectModel instead")]
public Task<ObjectModel> GetMachineModel(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

Optional cancellation token

Returns
Type Description
Task<ObjectModel>

The current machine model

Exceptions
Type Condition
OperationCanceledException

Operation has been cancelled

SocketException

Receipt could not be acknowledged

See Also
ObjectModelRead
ObjectModelReadWrite

GetMachineModelPatch(CancellationToken)

Receive a (partial) machine model update. If the subscription mode is set to Patch, new update patches of the object model need to be applied manually. This method is intended to receive such fragments.

Declaration
[Obsolete("Use GetObjectModelPatch instead")]
public Task<JsonDocument> GetMachineModelPatch(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

An optional cancellation token

Returns
Type Description
Task<JsonDocument>

The partial update JSON

Exceptions
Type Condition
OperationCanceledException

Operation has been cancelled

SocketException

Receipt could not be acknowledged

See Also
GetObjectModel(CancellationToken)
ObjectModelRead
ObjectModelReadWrite

GetObjectModel(CancellationToken)

Retrieves the full object model of the machine In subscription mode this is the first command that has to be called once a connection has been established.

Declaration
public Task<ObjectModel> GetObjectModel(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

Optional cancellation token

Returns
Type Description
Task<ObjectModel>

The current machine model

Exceptions
Type Condition
OperationCanceledException

Operation has been cancelled

SocketException

Receipt could not be acknowledged

See Also
ObjectModelRead
ObjectModelReadWrite

GetObjectModelPatch(CancellationToken)

Receive a (partial) object model update. If the subscription mode is set to Patch, new update patches of the object model need to be applied manually. This method is intended to receive such fragments.

Declaration
public Task<JsonDocument> GetObjectModelPatch(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

An optional cancellation token

Returns
Type Description
Task<JsonDocument>

The partial update JSON

Exceptions
Type Condition
OperationCanceledException

Operation has been cancelled

SocketException

Receipt could not be acknowledged

See Also
GetObjectModel(CancellationToken)
ObjectModelRead
ObjectModelReadWrite

GetSerializedMachineModel(CancellationToken)

Optimized method to query the machine model UTF-8 JSON in any mode. May be used to get machine model patches as well.

Declaration
[Obsolete("Use GetSerializedObjectModel instead")]
public Task<MemoryStream> GetSerializedMachineModel(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

Optional cancellation token

Returns
Type Description
Task<MemoryStream>

Machine model JSON

Exceptions
Type Condition
OperationCanceledException

Operation has been cancelled

SocketException

Receipt could not be acknowledged

See Also
ObjectModelRead
ObjectModelReadWrite

GetSerializedObjectModel(CancellationToken)

Optimized method to query the object model UTF-8 JSON in any mode. May be used to get machine model patches as well.

Declaration
public Task<MemoryStream> GetSerializedObjectModel(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

Optional cancellation token

Returns
Type Description
Task<MemoryStream>

Machine model JSON

Exceptions
Type Condition
OperationCanceledException

Operation has been cancelled

SocketException

Receipt could not be acknowledged

See Also
ObjectModelRead
ObjectModelReadWrite

Implements

IDisposable

See Also

Subscribe
In this article
Back to top Generated by DocFX