From 1197dd8ce47ba1737b26458e80e7badafd43dd09 Mon Sep 17 00:00:00 2001 From: Frederic PAUT Date: Wed, 17 Apr 2013 14:31:11 +0200 Subject: [PATCH] request : adding 'signature' parameter (for nodejs compatibility and future use) --- AUTHORS | 2 +- TODO | 3 +-- cloudeebus/cloudeebus.js | 15 +++++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/AUTHORS b/AUTHORS index 8bb6971..9f2ae5c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,3 @@ Luc Yriarte Christophe Guiraud -Frederic PAUT +Frederic Paut diff --git a/TODO b/TODO index 0c1f5bd..9dafb5d 100644 --- a/TODO +++ b/TODO @@ -13,11 +13,10 @@ Proxy object properties: API style: ---------- - use "Promises" pattern for asynchronous APIs -- support adding DBus signatures / force JSON description of numbers as floats when needed +- force JSON description of numbers as floats when needed DBus service support: --------------------- - support publishing a DBus service - support sending signals - diff --git a/cloudeebus/cloudeebus.js b/cloudeebus/cloudeebus.js index 7a03c8b..c7a3fc2 100644 --- a/cloudeebus/cloudeebus.js +++ b/cloudeebus/cloudeebus.js @@ -210,17 +210,20 @@ cloudeebus.ProxyObject.prototype._introspect = function(successCB, errorCB) { while (ifChild) { if (ifChild.nodeName == "method") { var nArgs = 0; + var signature = ""; var metChild = ifChild.firstChild; while (metChild) { if (metChild.nodeName == "arg" && - metChild.attributes.getNamedItem("direction").value == "in") + metChild.attributes.getNamedItem("direction").value == "in") { + signature += metChild.attributes.getNamedItem("type").value; nArgs++; + } metChild = metChild.nextSibling; } var metName = ifChild.attributes.getNamedItem("name").value; if (!self[metName]) - self._addMethod(ifName, metName, nArgs); - self.interfaceProxies[ifName]._addMethod(ifName, metName, nArgs); + self._addMethod(ifName, metName, nArgs, signature); + self.interfaceProxies[ifName]._addMethod(ifName, metName, nArgs, signature); } else if (ifChild.nodeName == "property") { if (!hasProperties) @@ -248,7 +251,7 @@ cloudeebus.ProxyObject.prototype._introspect = function(successCB, errorCB) { }; -cloudeebus.ProxyObject.prototype._addMethod = function(ifName, method, nArgs) { +cloudeebus.ProxyObject.prototype._addMethod = function(ifName, method, nArgs, signature) { var self = this; @@ -256,11 +259,11 @@ cloudeebus.ProxyObject.prototype._addMethod = function(ifName, method, nArgs) { var args = []; for (var i=0; i < nArgs; i++ ) args.push(arguments[i]); - return self.callMethod(ifName, method, args); + return self.callMethod(ifName, method, args, signature); }; }; -cloudeebus.ProxyObject.prototype.callMethod = function(ifName, method, args) { +cloudeebus.ProxyObject.prototype.callMethod = function(ifName, method, args, signature) { var self = this; var request = new cloudeebus.Request(this); -- 2.7.4