Table of Contents

Class MethodContext

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

Represents a D-Bus method call that is being handled.

public sealed class MethodContext : IDisposable
Inheritance
MethodContext
Implements
Inherited Members

Properties

Connection

Gets the D-Bus connection associated with this method call.

[Obsolete("Use DBusConnection instead.")]
public Connection Connection { get; }

Property Value

Connection

DBusConnection

Gets the D-Bus connection associated with this method call.

public DBusConnection DBusConnection { get; }

Property Value

DBusConnection

DisposesAsynchronously

Gets or sets a value indicating whether the method will be handled and disposed asynchronously.

public bool DisposesAsynchronously { get; set; }

Property Value

bool

Remarks

When this is set to true, the context must be disposed.

IsDBusIntrospectRequest

Gets a value indicating whether this is an Introspect request to the org.freedesktop.DBus.Introspectable interface.

public bool IsDBusIntrospectRequest { get; }

Property Value

bool

IsPropertiesInterfaceRequest

Gets a value indicating whether this is a request to the org.freedesktop.DBus.Properties interface.

public bool IsPropertiesInterfaceRequest { get; }

Property Value

bool

NoReplyExpected

Gets a value indicating whether no reply is expected for this method call.

public bool NoReplyExpected { get; }

Property Value

bool

ReplySent

Gets a value indicating whether a reply has been sent.

public bool ReplySent { get; }

Property Value

bool

Request

Gets the request message.

public Message Request { get; }

Property Value

Message

RequestAborted

Gets a cancellation token that is cancelled when the request is aborted.

public CancellationToken RequestAborted { get; }

Property Value

CancellationToken

Methods

CreateReplyWriter(string?)

Creates a MessageWriter for writing the method reply.

public MessageWriter CreateReplyWriter(string? signature)

Parameters

signature string

The signature of the reply body, or null if empty.

Returns

MessageWriter

A MessageWriter for writing the reply.

Disconnect(Exception)

Disconnects the D-Bus connection with the specified exception.

public void Disconnect(Exception exception)

Parameters

exception Exception

The exception indicating the reason for disconnection.

Dispose()

Disposes the method context and sends a default reply if needed.

public void Dispose()

Reply(MessageBuffer)

Sends a reply message.

public void Reply(MessageBuffer message)

Parameters

message MessageBuffer

The message to send.

ReplyError(string?, string?)

Sends an error reply.

public void ReplyError(string? errorName = null, string? errorMsg = null)

Parameters

errorName string

The error name, or null to use a default.

errorMsg string

The error message, or null if none.

ReplyIntrospectXml(ReadOnlySpan<ReadOnlyMemory<byte>>)

Sends an introspection XML reply.

public void ReplyIntrospectXml(ReadOnlySpan<ReadOnlyMemory<byte>> interfaceXmls)

Parameters

interfaceXmls ReadOnlySpan<ReadOnlyMemory<byte>>

The interface XML fragments to include in the introspection.

ReplyUnknownMethodError()

Sends an "Unknown Method" error reply.

public void ReplyUnknownMethodError()