summaryrefslogtreecommitdiff
path: root/mono/MethodCall.cs
blob: ab7a4a3657d01c3a954b76b76f249169f34002b0 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
namespace DBus
{
  using System;
  using System.Runtime.InteropServices;
  using System.Diagnostics;
  
  public class MethodCall : Message
  {
    public MethodCall() : base(MessageType.MethodCall)
    {
    }
    
    internal MethodCall(IntPtr rawMessage, Service service) : base(rawMessage, service)
    {
    }

    public MethodCall(Service service) : base(MessageType.MethodCall, service)
    {
    }

    public MethodCall(Service service, string pathName, string interfaceName, string name)
    {
      this.service = service;

      RawMessage = dbus_message_new_method_call(service.Name, pathName, interfaceName, name);
      
      if (RawMessage == IntPtr.Zero) {
	throw new OutOfMemoryException();
      }
      
      this.pathName = pathName;
      this.interfaceName = interfaceName;
      this.name = name;

      dbus_message_unref(RawMessage);
    }
    
    public new string PathName
    {
      get
	{
	  return base.PathName;
	}

      set
	{
	  base.PathName = value;
	}
    }

    public new string InterfaceName
    {
      get
	{
	  return base.InterfaceName;
	}

      set
	{
	  base.InterfaceName = value;
	}
    }

    public new string Name
    {
      get
	{
	  return base.Name;
	}

      set
	{
	  base.Name = value;
	}
    }
    
    [DllImport("dbus-1")]
    private extern static IntPtr dbus_message_new_method_call(string serviceName, string pathName, string interfaceName, string name);
  }
}