Table of Contents

Class DBusConnectionOptions

Namespace
Tmds.DBus.Protocol
Assembly
Tmds.DBus.Protocol.dll

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

address string

The 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

bool

OnException

Gets or sets a handler that is called when an exception occurs.

public Action<DBusConnection.ExceptionContext>? OnException { get; set; }

Property Value

Action<DBusConnection.ExceptionContext>

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

cancellationToken CancellationToken

The 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

token object

The TeardownToken returned from SetupAsync(CancellationToken).