diff options
author | Owen Fraser-Green <owen@discobabe.net> | 2004-03-23 18:07:48 +0000 |
---|---|---|
committer | Owen Fraser-Green <owen@discobabe.net> | 2004-03-23 18:07:48 +0000 |
commit | 632d54e0dbf5e405258be7afffbaa48942c06cbc (patch) | |
tree | 0b3495f8a0753d427078a90e585dc53a2287200d /mono/Handler.cs | |
parent | 0a673a8cd751d9eae14f3f5d0eeebf749b07bf09 (diff) |
Added InterfaceProxy to Mono bindings to avoid having to generate a proxy for every registered object. Also added object_path functions to dbus-message.
Diffstat (limited to 'mono/Handler.cs')
-rw-r--r-- | mono/Handler.cs | 56 |
1 files changed, 17 insertions, 39 deletions
diff --git a/mono/Handler.cs b/mono/Handler.cs index d565b7ec..a854c9ce 100644 --- a/mono/Handler.cs +++ b/mono/Handler.cs @@ -12,7 +12,6 @@ namespace DBus private string pathName = null; private Introspector introspector = null; private object handledObject = null; - private Hashtable handledMethods = null; private DBusObjectPathVTable vTable; private Connection connection; private Service service; @@ -99,33 +98,20 @@ namespace DBus throw new OutOfMemoryException(); } - private void RegisterMethod(MethodInfo method) - { - string key = method.Name + " " + Arguments.ParseParameters(method); - handledMethods.Add(key, method); - } - public object HandledObject { - get - { - return this.handledObject; - } + get { + return this.handledObject; + } - set - { - this.handledObject = value; - - object[] attributes; - - // Register the methods - this.handledMethods = new Hashtable(); - this.introspector = new Introspector(value.GetType()); - - foreach (MethodInfo method in this.introspector.Methods) { - RegisterMethod(method); - } - } + set { + this.handledObject = value; + + object[] attributes; + + // Register the methods + this.introspector = Introspector.GetIntrospector(value.GetType()); + } } public int Filter_Called(IntPtr rawConnection, @@ -169,22 +155,14 @@ namespace DBus private Result HandleMethod(MethodCall methodCall) { methodCall.Service = service; - - // Check the interface name matches - if (methodCall.InterfaceName != this.introspector.InterfaceName) { - return Result.NotYetHandled; - } - - // Iterate through getting the type codes - string key = methodCall.Name + " " + methodCall.Arguments; - - // Check it's one of our methods - if (!handledMethods.Contains(key)) { + + InterfaceProxy interfaceProxy = this.introspector.GetInterface(methodCall.InterfaceName); + if (interfaceProxy == null || !interfaceProxy.HasMethod(methodCall.Key)) { + // No such interface here. return Result.NotYetHandled; } - - // Got it! - MethodInfo method = (MethodInfo) handledMethods[key]; + + MethodInfo method = interfaceProxy.GetMethod(methodCall.Key); // Now call the method. FIXME: Error handling object [] args = methodCall.Arguments.GetParameters(method); |