Table of Contents

Struct MessageWriter

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

Provides methods for writing a D-Bus message.

public ref struct MessageWriter
Inherited Members

Methods

CreateMessage()

Creates a buffer that holds the serialized message.

public MessageBuffer CreateMessage()

Returns

MessageBuffer

The created message buffer.

Dispose()

Disposes the message writer and releases associated resources.

public void Dispose()

WriteArray(byte[])

Writes an array of byte values.

public void WriteArray(byte[] value)

Parameters

value byte[]

The array.

WriteArray(IEnumerable<byte>)

Writes an array of byte values.

public void WriteArray(IEnumerable<byte> value)

Parameters

value IEnumerable<byte>

The array.

WriteArray(IEnumerable<double>)

Writes an array of double values.

public void WriteArray(IEnumerable<double> value)

Parameters

value IEnumerable<double>

The array.

WriteArray(IEnumerable<short>)

Writes an array of signed 16-bit integer values.

public void WriteArray(IEnumerable<short> value)

Parameters

value IEnumerable<short>

The array.

WriteArray(IEnumerable<int>)

Writes an array of signed 32-bit integer values.

public void WriteArray(IEnumerable<int> value)

Parameters

value IEnumerable<int>

The array.

WriteArray(IEnumerable<long>)

Writes an array of signed 64-bit integer values.

public void WriteArray(IEnumerable<long> value)

Parameters

value IEnumerable<long>

The array.

WriteArray(IEnumerable<SafeHandle>)

Writes an array of Unix file descriptor handles.

public void WriteArray(IEnumerable<SafeHandle> value)

Parameters

value IEnumerable<SafeHandle>

The array.

WriteArray(IEnumerable<string>)

Writes an array of string values.

public void WriteArray(IEnumerable<string> value)

Parameters

value IEnumerable<string>

The array.

WriteArray(IEnumerable<ushort>)

Writes an array of unsigned 16-bit integer values.

public void WriteArray(IEnumerable<ushort> value)

Parameters

value IEnumerable<ushort>

The array.

WriteArray(IEnumerable<uint>)

Writes an array of unsigned 32-bit integer values.

public void WriteArray(IEnumerable<uint> value)

Parameters

value IEnumerable<uint>

The array.

WriteArray(IEnumerable<ulong>)

Writes an array of unsigned 64-bit integer values.

public void WriteArray(IEnumerable<ulong> value)

Parameters

value IEnumerable<ulong>

The array.

WriteArray(IEnumerable<ObjectPath>)

Writes an array of object path values.

public void WriteArray(IEnumerable<ObjectPath> value)

Parameters

value IEnumerable<ObjectPath>

The array.

WriteArray(IEnumerable<Signature>)

Writes an array of signature values.

public void WriteArray(IEnumerable<Signature> value)

Parameters

value IEnumerable<Signature>

The array.

WriteArray(IEnumerable<VariantValue>)

Writes an array of variant values.

public void WriteArray(IEnumerable<VariantValue> value)

Parameters

value IEnumerable<VariantValue>

The array.

WriteArray(double[])

Writes an array of double values.

public void WriteArray(double[] value)

Parameters

value double[]

The array.

WriteArray(short[])

Writes an array of signed 16-bit integer values.

public void WriteArray(short[] value)

Parameters

value short[]

The array.

WriteArray(int[])

Writes an array of signed 32-bit integer values.

public void WriteArray(int[] value)

Parameters

value int[]

The array.

WriteArray(long[])

Writes an array of signed 64-bit integer values.

public void WriteArray(long[] value)

Parameters

value long[]

The array.

WriteArray(ReadOnlySpan<byte>)

Writes an array of byte values.

public void WriteArray(ReadOnlySpan<byte> value)

Parameters

value ReadOnlySpan<byte>

The array.

WriteArray(ReadOnlySpan<double>)

Writes an array of double values.

public void WriteArray(ReadOnlySpan<double> value)

Parameters

value ReadOnlySpan<double>

The array.

WriteArray(ReadOnlySpan<short>)

Writes an array of signed 16-bit integer values.

public void WriteArray(ReadOnlySpan<short> value)

Parameters

value ReadOnlySpan<short>

The array.

WriteArray(ReadOnlySpan<int>)

Writes an array of signed 32-bit integer values.

public void WriteArray(ReadOnlySpan<int> value)

Parameters

value ReadOnlySpan<int>

The array.

WriteArray(ReadOnlySpan<long>)

Writes an array of signed 64-bit integer values.

public void WriteArray(ReadOnlySpan<long> value)

Parameters

value ReadOnlySpan<long>

The array.

WriteArray(ReadOnlySpan<SafeHandle>)

Writes an array of Unix file descriptor handles.

public void WriteArray(ReadOnlySpan<SafeHandle> value)

Parameters

value ReadOnlySpan<SafeHandle>

The array.

WriteArray(ReadOnlySpan<string>)

Writes an array of string values.

public void WriteArray(ReadOnlySpan<string> value)

Parameters

value ReadOnlySpan<string>

The array.

WriteArray(ReadOnlySpan<ushort>)

Writes an array of unsigned 16-bit integer values.

public void WriteArray(ReadOnlySpan<ushort> value)

Parameters

value ReadOnlySpan<ushort>

The array.

WriteArray(ReadOnlySpan<uint>)

Writes an array of unsigned 32-bit integer values.

public void WriteArray(ReadOnlySpan<uint> value)

Parameters

value ReadOnlySpan<uint>

The array.

WriteArray(ReadOnlySpan<ulong>)

Writes an array of unsigned 64-bit integer values.

public void WriteArray(ReadOnlySpan<ulong> value)

Parameters

value ReadOnlySpan<ulong>

The array.

WriteArray(ReadOnlySpan<ObjectPath>)

Writes an array of object path values.

public void WriteArray(ReadOnlySpan<ObjectPath> value)

Parameters

value ReadOnlySpan<ObjectPath>

The array.

WriteArray(ReadOnlySpan<Signature>)

Writes an array of signature values.

public void WriteArray(ReadOnlySpan<Signature> value)

Parameters

value ReadOnlySpan<Signature>

The array.

WriteArray(ReadOnlySpan<VariantValue>)

Writes an array of variant values.

public void WriteArray(ReadOnlySpan<VariantValue> value)

Parameters

value ReadOnlySpan<VariantValue>

The array.

WriteArray(SafeHandle[])

Writes an array of Unix file descriptor handles.

public void WriteArray(SafeHandle[] value)

Parameters

value SafeHandle[]

The array.

WriteArray(string[])

Writes an array of string values.

public void WriteArray(string[] value)

Parameters

value string[]

The array.

WriteArray(ushort[])

Writes an array of unsigned 16-bit integer values.

public void WriteArray(ushort[] value)

Parameters

value ushort[]

The array.

WriteArray(uint[])

Writes an array of unsigned 32-bit integer values.

public void WriteArray(uint[] value)

Parameters

value uint[]

The array.

WriteArray(ulong[])

Writes an array of unsigned 64-bit integer values.

public void WriteArray(ulong[] value)

Parameters

value ulong[]

The array.

WriteArray(ObjectPath[])

Writes an array of object path values.

public void WriteArray(ObjectPath[] value)

Parameters

value ObjectPath[]

The array.

WriteArray(Signature[])

Writes an array of signature values.

public void WriteArray(Signature[] value)

Parameters

value Signature[]

The array.

WriteArray(VariantValue[])

Writes an array of variant values.

public void WriteArray(VariantValue[] value)

Parameters

value VariantValue[]

The array.

WriteArrayEnd(ArrayStart)

Writes the end of an array.

public void WriteArrayEnd(ArrayStart start)

Parameters

start ArrayStart

The ArrayStart token returned by WriteArrayStart.

WriteArrayStart(DBusType)

Writes the start of an array.

public ArrayStart WriteArrayStart(DBusType elementType)

Parameters

elementType DBusType

The type of array elements.

Returns

ArrayStart

An ArrayStart token to pass to WriteArrayEnd.

WriteBool(bool)

Writes a boolean value.

public void WriteBool(bool value)

Parameters

value bool

The boolean value.

WriteByte(byte)

Writes a byte value.

public void WriteByte(byte value)

Parameters

value byte

The byte value.

WriteDictionary(Dictionary<string, VariantValue>)

Writes a dictionary with string keys and variant values.

public void WriteDictionary(Dictionary<string, VariantValue> value)

Parameters

value Dictionary<string, VariantValue>

The dictionary to write.

WriteDictionary(IEnumerable<KeyValuePair<string, VariantValue>>)

Writes a dictionary with string keys and variant values.

public void WriteDictionary(IEnumerable<KeyValuePair<string, VariantValue>> value)

Parameters

value IEnumerable<KeyValuePair<string, VariantValue>>

The dictionary entries to write.

WriteDictionary(KeyValuePair<string, VariantValue>[])

Writes a dictionary with string keys and variant values.

public void WriteDictionary(KeyValuePair<string, VariantValue>[] value)

Parameters

value KeyValuePair<string, VariantValue>[]

The dictionary entries to write.

WriteDictionaryEnd(ArrayStart)

Writes the end of a dictionary.

public void WriteDictionaryEnd(ArrayStart start)

Parameters

start ArrayStart

The ArrayStart token returned by WriteDictionaryStart().

WriteDictionaryEntryStart()

Writes the start of a dictionary entry.

public void WriteDictionaryEntryStart()

WriteDictionaryStart()

Writes the start of a dictionary.

public ArrayStart WriteDictionaryStart()

Returns

ArrayStart

An ArrayStart token to pass to WriteDictionaryEnd(ArrayStart).

WriteDouble(double)

Writes a double.

public void WriteDouble(double value)

Parameters

value double

The double.

WriteError(uint, ReadOnlySpan<byte>, string?, string?)

Writes an error message header and optional error message.

public void WriteError(uint replySerial, ReadOnlySpan<byte> destination = default, string? errorName = null, string? errorMsg = null)

Parameters

replySerial uint

The serial number of the method call being replied to.

destination ReadOnlySpan<byte>

The destination name.

errorName string

The error name.

errorMsg string

The error message.

WriteHandle(SafeHandle)

Writes a file descriptor handle.

public void WriteHandle(SafeHandle value)

Parameters

value SafeHandle

The handle to write.

WriteInt16(short)

Writes a signed 16-bit integer.

public void WriteInt16(short value)

Parameters

value short

The signed 16-bit integer.

WriteInt32(int)

Writes a signed 32-bit integer.

public void WriteInt32(int value)

Parameters

value int

The signed 32-bit integer.

WriteInt64(long)

Writes a signed 64-bit integer.

public void WriteInt64(long value)

Parameters

value long

The signed 64-bit integer.

WriteIntrospectionXml(scoped ReadOnlySpan<ReadOnlyMemory<byte>>, IEnumerable<string>)

Writes D-Bus introspection XML for the specified interfaces and child node names.

public void WriteIntrospectionXml(scoped ReadOnlySpan<ReadOnlyMemory<byte>> interfaceXmls, IEnumerable<string> childNames)

Parameters

interfaceXmls ReadOnlySpan<ReadOnlyMemory<byte>>

The interface XML fragments to include.

childNames IEnumerable<string>

The names of child nodes.

WriteMethodCallHeader(string?, string?, string?, string?, string?, MessageFlags)

Writes a method call message header.

public void WriteMethodCallHeader(string? destination = null, string? path = null, string? @interface = null, string? member = null, string? signature = null, MessageFlags flags = MessageFlags.None)

Parameters

destination string

The destination bus name.

path string

The object path.

interface string

The interface name.

member string

The method name.

signature string

The method signature.

flags MessageFlags

Message flags.

WriteMethodReturnHeader(uint, ReadOnlySpan<byte>, string?)

Writes a method return message header.

public void WriteMethodReturnHeader(uint replySerial, ReadOnlySpan<byte> destination = default, string? signature = null)

Parameters

replySerial uint

The serial number of the method call being replied to.

destination ReadOnlySpan<byte>

The destination.

signature string

The body signature.

WriteObjectPath(scoped ReadOnlySpan<byte>)

Writes an object path.

public void WriteObjectPath(scoped ReadOnlySpan<byte> value)

Parameters

value ReadOnlySpan<byte>

The object path.

WriteObjectPath(string)

Writes an object path.

public void WriteObjectPath(string value)

Parameters

value string

The object path string.

WriteObjectPath(ObjectPath)

Writes an object path.

public void WriteObjectPath(ObjectPath value)

Parameters

value ObjectPath

The object path.

WriteSignalHeader(string?, string?, string?, string?, string?)

Writes a signal message header.

public void WriteSignalHeader(string? destination = null, string? path = null, string? @interface = null, string? member = null, string? signature = null)

Parameters

destination string

The destination name.

path string

The object path.

interface string

The interface name.

member string

The signal name.

signature string

The body signature.

WriteSignature(scoped ReadOnlySpan<byte>)

Writes a signature.

public void WriteSignature(scoped ReadOnlySpan<byte> value)

Parameters

value ReadOnlySpan<byte>

The signature.

WriteSignature(string)

Writes a signature.

public void WriteSignature(string s)

Parameters

s string

The signature string.

WriteSignature(Signature)

Writes a signature.

public void WriteSignature(Signature value)

Parameters

value Signature

The signature.

WriteString(scoped ReadOnlySpan<byte>)

Writes a string.

public void WriteString(scoped ReadOnlySpan<byte> value)

Parameters

value ReadOnlySpan<byte>

The string.

WriteString(string)

Writes a string.

public void WriteString(string value)

Parameters

value string

The string.

WriteStructureStart()

Writes the start of a structure.

public void WriteStructureStart()

WriteUInt16(ushort)

Writes an unsigned 16-bit integer.

public void WriteUInt16(ushort value)

Parameters

value ushort

The unsigned 16-bit integer.

WriteUInt32(uint)

Writes an unsigned 32-bit integer.

public void WriteUInt32(uint value)

Parameters

value uint

The unsigned 32-bit integer.

WriteUInt64(ulong)

Writes an unsigned 64-bit integer.

public void WriteUInt64(ulong value)

Parameters

value ulong

The unsigned 64-bit integer.

WriteVariant(VariantValue)

Writes a variant.

public void WriteVariant(VariantValue value)

Parameters

value VariantValue

The variant value to write.

WriteVariantBool(bool)

Writes a variant-wrapped boolean value.

public void WriteVariantBool(bool value)

Parameters

value bool

The boolean value.

WriteVariantByte(byte)

Writes a variant-wrapped byte.

public void WriteVariantByte(byte value)

Parameters

value byte

The byte value.

WriteVariantDouble(double)

Writes a variant-wrapped double.

public void WriteVariantDouble(double value)

Parameters

value double

The double.

WriteVariantHandle(SafeHandle)

Writes a variant-wrapped file descriptor handle.

public void WriteVariantHandle(SafeHandle value)

Parameters

value SafeHandle

The handle to write.

WriteVariantInt16(short)

Writes a variant-wrapped signed 16-bit integer.

public void WriteVariantInt16(short value)

Parameters

value short

The signed 16-bit integer.

WriteVariantInt32(int)

Writes a variant-wrapped signed 32-bit integer.

public void WriteVariantInt32(int value)

Parameters

value int

The signed 32-bit integer.

WriteVariantInt64(long)

Writes a variant-wrapped signed 64-bit integer.

public void WriteVariantInt64(long value)

Parameters

value long

The signed 64-bit integer.

WriteVariantObjectPath(scoped ReadOnlySpan<byte>)

Writes a variant-wrapped object path value.

public void WriteVariantObjectPath(scoped ReadOnlySpan<byte> value)

Parameters

value ReadOnlySpan<byte>

The object path.

WriteVariantObjectPath(string)

Writes a variant-wrapped object path value.

public void WriteVariantObjectPath(string value)

Parameters

value string

The object path string.

WriteVariantSignature(scoped ReadOnlySpan<byte>)

Writes a variant-wrapped signature value.

public void WriteVariantSignature(scoped ReadOnlySpan<byte> value)

Parameters

value ReadOnlySpan<byte>

The signature.

WriteVariantSignature(string)

Writes a variant-wrapped signature value.

public void WriteVariantSignature(string value)

Parameters

value string

The signature string.

WriteVariantString(scoped ReadOnlySpan<byte>)

Writes a variant-wrapped string value.

public void WriteVariantString(scoped ReadOnlySpan<byte> value)

Parameters

value ReadOnlySpan<byte>

The string.

WriteVariantString(string)

Writes a variant-wrapped string value.

public void WriteVariantString(string value)

Parameters

value string

The string value.

WriteVariantUInt16(ushort)

Writes a variant-wrapped unsigned 16-bit integer.

public void WriteVariantUInt16(ushort value)

Parameters

value ushort

The unsigned 16-bit integer.

WriteVariantUInt32(uint)

Writes a variant-wrapped unsigned 32-bit integer.

public void WriteVariantUInt32(uint value)

Parameters

value uint

The unsigned 32-bit integer.

WriteVariantUInt64(ulong)

Writes a variant-wrapped unsigned 64-bit integer.

public void WriteVariantUInt64(ulong value)

Parameters

value ulong

The unsigned 64-bit integer.