projects
/
contrib
/
cloudeebus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0c6de01
)
simplify signal emitter wrapper
author
Luc Yriarte
<luc.yriarte@intel.com>
Wed, 28 Aug 2013 13:16:31 +0000
(15:16 +0200)
committer
Luc Yriarte
<luc.yriarte@intel.com>
Wed, 28 Aug 2013 13:16:31 +0000
(15:16 +0200)
cloudeebus/cloudeebus.js
patch
|
blob
|
history
diff --git
a/cloudeebus/cloudeebus.js
b/cloudeebus/cloudeebus.js
index
6f81a31
..
22aa319
100644
(file)
--- a/
cloudeebus/cloudeebus.js
+++ b/
cloudeebus/cloudeebus.js
@@
-168,9
+168,6
@@
cloudeebus.BusConnection.prototype.getObject = function(busName, objectPath, int
cloudeebus.BusConnection.prototype.addService = function(serviceName) {
var self = this;
cloudeebus.BusConnection.prototype.addService = function(serviceName) {
var self = this;
- if (!serviceName)
- serviceName = "";
-
var promise = new cloudeebus.Promise(function (resolver) {
var cloudeebusService = new cloudeebus.Service(self.wampSession, self, serviceName);
var promise = new cloudeebus.Promise(function (resolver) {
var cloudeebusService = new cloudeebus.Service(self.wampSession, self, serviceName);
@@
-200,13
+197,10
@@
cloudeebus.BusConnection.prototype.addService = function(serviceName) {
/*****************************************************************************/
/*****************************************************************************/
-//Generic definition for an agent. An agent needs :
-//objPath : a DBus path to access it
-//handler : a Javascript handler to process methods,
-//xml : the xml which describe interface/methods/signals...
-cloudeebus.Agent = function(objPath, handler, xml) {
+
+cloudeebus.Agent = function(objectPath, handler, xml) {
this.xml = xml;
this.xml = xml;
- this.objectPath = objPath;
+ this.objectPath = obj
ect
Path;
this.handler = handler;
return this;
};
this.handler = handler;
return this;
};
@@
-298,30
+292,17
@@
cloudeebus.Service.prototype._addMethod = function(ifName, method, agent) {
cloudeebus.Service.prototype._addSignal = function(ifName, signal, agent) {
var service = this;
cloudeebus.Service.prototype._addSignal = function(ifName, signal, agent) {
var service = this;
- var methodExist = false;
-
- if (agent.handler.interfaceProxies && agent.handler.interfaceProxies[ifName])
- if (agent.handler.interfaceProxies[ifName][signal]) {
- methodExist = true;
- } else {
- agent.handler.interfaceProxies[ifName][signal] = function() {
- var args = [];
- for (var i=0; i < arguments.length; i++ )
- args.push(arguments[i]);
- service._emitSignal(agent.objectPath, signal, args);
- };
- return;
- }
- if ((agent.handler[signal] == undefined || agent.handler[signal] == null) && !methodExist)
+ if (agent.handler[signal])
+ cloudeebus.log("Signal '" + signal + "' emitter already implemented");
+ else {
agent.handler[signal] = function() {
var args = [];
for (var i=0; i < arguments.length; i++ )
args.push(arguments[i]);
service._emitSignal(agent.objectPath, signal, args);
};
agent.handler[signal] = function() {
var args = [];
for (var i=0; i < arguments.length; i++ )
args.push(arguments[i]);
service._emitSignal(agent.objectPath, signal, args);
};
- else
- cloudeebus.log("Can not create new method to emit signal '" + signal + "' in object JS this method already exist!");
+ }
};
};