2004-03-23 12:10:32 +00:00
|
|
|
namespace DBus
|
|
|
|
|
{
|
|
|
|
|
|
2003-06-22 22:59:31 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Runtime.InteropServices;
|
2004-03-23 12:10:32 +00:00
|
|
|
using System.Diagnostics;
|
2003-06-22 22:59:31 +00:00
|
|
|
|
|
|
|
|
// FIXME add code to verify that size of DBus.Error
|
|
|
|
|
// matches the C code.
|
2004-03-23 12:10:32 +00:00
|
|
|
|
2003-06-22 22:59:31 +00:00
|
|
|
[StructLayout (LayoutKind.Sequential)]
|
2004-03-23 12:10:32 +00:00
|
|
|
internal struct Error
|
|
|
|
|
{
|
2003-06-22 22:59:31 +00:00
|
|
|
internal IntPtr name;
|
|
|
|
|
internal IntPtr message;
|
|
|
|
|
private int dummies;
|
|
|
|
|
private IntPtr padding1;
|
2004-03-23 12:10:32 +00:00
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
|
{
|
|
|
|
|
dbus_error_init(ref this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Free()
|
|
|
|
|
{
|
|
|
|
|
dbus_error_free(ref this);
|
2003-06-22 22:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
2004-03-23 12:10:32 +00:00
|
|
|
public string Message
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(message);
|
|
|
|
|
}
|
2003-06-22 22:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
2004-03-23 12:10:32 +00:00
|
|
|
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")]
|
2003-06-22 22:59:31 +00:00
|
|
|
private extern static void dbus_error_init (ref Error error);
|
2004-03-23 12:10:32 +00:00
|
|
|
|
|
|
|
|
[DllImport ("dbus-1", EntryPoint="dbus_error_free")]
|
2003-06-22 22:59:31 +00:00
|
|
|
private extern static void dbus_error_free (ref Error error);
|
|
|
|
|
}
|
|
|
|
|
}
|