1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
namespace DBus
{
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
// FIXME add code to verify that size of DBus.Error
// matches the C code.
[StructLayout (LayoutKind.Sequential)]
internal struct Error
{
internal IntPtr name;
internal IntPtr message;
private int dummies;
private IntPtr padding1;
public void Init()
{
dbus_error_init(ref this);
}
public void Free()
{
dbus_error_free(ref this);
}
public string Message
{
get
{
return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(message);
}
}
public string Name
{
get
{
return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(name);
}
}
public bool IsSet
{
get
{
return (name != IntPtr.Zero);
}
}
[DllImport ("dbus-1", EntryPoint="dbus_error_init")]
private extern static void dbus_error_init (ref Error error);
[DllImport ("dbus-1", EntryPoint="dbus_error_free")]
private extern static void dbus_error_free (ref Error error);
}
}
|