Class DBusConnectionOptions
Configuration options for a D-Bus client connection.
public class DBusConnectionOptions
- Inheritance
-
DBusConnectionOptions
- Inherited Members
Constructors
DBusConnectionOptions()
Initializes a new instance of the DBusConnectionOptions class.
protected DBusConnectionOptions()
DBusConnectionOptions(string)
Initializes a new instance of the DBusConnectionOptions class.
public DBusConnectionOptions(string address)
Parameters
addressstringThe address to connect to.
Properties
AutoConnect
Gets or sets a whether to automatically connect when the connection is first used.
public bool AutoConnect { get; set; }
Property Value
OnException
Gets or sets a handler that is called when an exception occurs.
public Action<DBusConnection.ExceptionContext>? OnException { get; set; }
Property Value
Remarks
The primary use-case for this callback is logging. It may be used to override the default disconnect behavior by setting DisconnectConnection.
The handler is called for the following exception sources:
- SignalReader: an exception occurred while reading a signal message. The connection disconnects by default. When EmitOnReaderFailed is set, the exception is emitted to the observer and this handler is not called.
- SignalHandler: an exception occurred in a signal handler callback. Signal handlers should not throw exceptions. The connection disconnects by default.
- MethodHandler: an exception occurred in a method handler. IPathMethodHandler implementations should call HandleException(Exception, bool) to report exceptions and indicate whether the connection should be closed. By default, the connection is not closed.
- ConnectionFailed: the connection failed. The connection is always disconnected.
The handler is called synchronously when the exception occurs and must not throw exceptions.
Methods
SetupAsync(CancellationToken)
Sets up the connection. This method may be overridden in a derived class.
protected virtual ValueTask<DBusConnectionOptions.SetupResult> SetupAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<DBusConnectionOptions.SetupResult>
A ValueTask containing the setup result.
Teardown(object?)
Tears down the connection. This method may be overridden in a derived class.
protected virtual void Teardown(object? token)
Parameters
tokenobjectThe TeardownToken returned from SetupAsync(CancellationToken).