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(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | socketPath | Path to the UNIX socket file |
System.Threading.CancellationToken | cancellationToken | Optional cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
Exceptions
Type | Condition |
---|---|
IncompatibleVersionException | API level is incompatible |
System.IO.IOException | Connection mode is unavailable |
System.OperationCanceledException | Operation has been cancelled |
System.Net.Sockets.SocketException | Init message could not be processed |
SetNetworkProtocol(NetworkProtocol, Boolean, 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(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
NetworkProtocol | protocol | Protocol to update |
System.Boolean | enabled | If it is enabled or not |
System.Threading.CancellationToken | cancellationToken | Optional cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
Exceptions
Type | Condition |
---|---|
System.OperationCanceledException | Operation has been cancelled |
System.Net.Sockets.SocketException | Command could not be processed |
SetPluginProcess(String, Int32, 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(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the plugin |
System.Int32 | pid | New process id |
System.Threading.CancellationToken | cancellationToken | Optional cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
Exceptions
Type | Condition |
---|---|
System.OperationCanceledException | Operation has been cancelled |
System.Net.Sockets.SocketException | Command could not be processed |