Class CodeInterception
Interception processor that notifies clients about G/M/T-codes or comments being processed
Inherited Members
Namespace: DuetControlServer.IPC.Processors
Assembly: DuetControlServer.dll
Syntax
public sealed class CodeInterception : Base
Constructors
CodeInterception(Connection, ClientInitMessage)
Constructor of the interception processor
Declaration
public CodeInterception(Connection conn, ClientInitMessage initMessage)
Parameters
Type | Name | Description |
---|---|---|
Connection | conn | Connection instance |
ClientInitMessage | initMessage | Initialization message |
Fields
SupportedCommands
List of supported commands in this mode
Declaration
public static readonly Type[] SupportedCommands
Field Value
Type | Description |
---|---|
Type[] |
Remarks
In addition to these commands, commands of the Command interpreter are supported while a code is being intercepted
Methods
Diagnostics(StringBuilder)
Print diagnostics
Declaration
public static void Diagnostics(StringBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
StringBuilder | builder | String builder to write to |
GetCodeBeingIntercepted(Connection?, out InterceptionMode)
Get the code being intercepted by a given connection
Declaration
public static Code? GetCodeBeingIntercepted(Connection? connection, out InterceptionMode mode)
Parameters
Type | Name | Description |
---|---|---|
Connection | connection | Connection to look up |
InterceptionMode | mode | Mode of the corresponding interceptor |
Returns
Type | Description |
---|---|
Code | Code being intercepted |
Intercept(Code, InterceptionMode)
Called by the Code class to intercept a code. This method goes through each connected interception channel and notifies the clients.
Declaration
public static ValueTask<bool> Intercept(Code code, InterceptionMode type)
Parameters
Type | Name | Description |
---|---|---|
Code | code | Code to intercept |
InterceptionMode | type | Type of the interception |
Returns
Type | Description |
---|---|
ValueTask<bool> | True if the code has been resolved |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | Code has been cancelled |
IsInterceptingConnection(Connection?)
Checks if the given connection is currently intercepting a code
Declaration
public static bool IsInterceptingConnection(Connection? connection)
Parameters
Type | Name | Description |
---|---|---|
Connection | connection | Connection ID to check |
Returns
Type | Description |
---|---|
bool | True if the connection is intercepting a code |
Process()
Waits for commands to be received and enqueues them in a concurrent queue so that a Code can decide when to cancel/resume/resolve the execution.
Declaration
public override Task Process()
Returns
Type | Description |
---|---|
Task | Task that represents the lifecycle of the connection |