Class CommandConnection
Connection class for sending commands to the control server
Implements
Inherited Members
Namespace: DuetAPIClient
Assembly: DuetAPIClient.dll
Syntax
public sealed class CommandConnection : BaseCommandConnection, IDisposable
Constructors
CommandConnection()
Create a new connection in command mode
Declaration
public CommandConnection()
Methods
Connect(string, CancellationToken)
Establish a connection to the given UNIX socket file
Declaration
public Task Connect(string socketPath = "/run/dsf/dcs.sock", CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| 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 |
SetNetworkProtocol(NetworkProtocol, bool, CancellationToken)
Update the status of a network protocol. Reserved for internal purposes, do not use
Declaration
public Task SetNetworkProtocol(NetworkProtocol protocol, bool enabled, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| NetworkProtocol | protocol | Protocol to update |
| bool | enabled | If it is enabled or not |
| CancellationToken | cancellationToken | Optional cancellation token |
Returns
| Type | Description |
|---|---|
| Task | Asynchronous task |
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | Operation has been cancelled |
| SocketException | Command could not be processed |
SetPluginProcess(string, int, CancellationToken)
Update the process id of a given plugin. Reserved for internal purposes, do not use
Declaration
public Task SetPluginProcess(string name, int pid, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the plugin |
| int | pid | New process id |
| CancellationToken | cancellationToken | Optional cancellation token |
Returns
| Type | Description |
|---|---|
| Task | Asynchronous task |
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | Operation has been cancelled |
| SocketException | Command could not be processed |