From: Frederic PAUT Date: Mon, 22 Jul 2013 12:42:02 +0000 (+0200) Subject: dbus service : avoiding multi-connection on each 'run script' button X-Git-Tag: upstream/0.6.1~25^2~2 X-Git-Url: http://review.tizen.org/git/?p=contrib%2Fcloudeebus.git;a=commitdiff_plain;h=2deecd5f7ca46d58e9167a323b71e230a768fbfd dbus service : avoiding multi-connection on each 'run script' button --- diff --git a/doc/agent/client.html b/doc/agent/client.html index 5b92c4d..625d3a1 100644 --- a/doc/agent/client.html +++ b/doc/agent/client.html @@ -53,29 +53,35 @@ function signalHandler(result) { } function gotProxy(proxy) { - if (window.sampleProxy == null) - proxy.connectToSignal("org.cloudeebus.Sample", "ResultChanged", signalHandler); - window.sampleProxy = proxy; + proxy.connectToSignal("org.cloudeebus.Sample", "ResultChanged", signalHandler); logCB(proxy); - + window.sampleProxy = proxy; + testProxy(); +} + +function testProxy() { var dictionary = {Name: "Mickey", Sisters: [""], Married: true, Divorced: 0, Friends: ["Donald", "Dingo"], Others: [""]}; - proxy.Variant(dictionary).then(logCB,errorCB); + window.sampleProxy.Variant(dictionary).then(logCB,errorCB); logCB('Addition'); for (var i=-2; i<2; i++) - proxy.Add(i,i*2).then(gotAddResult,errorCB); + window.sampleProxy.Add(i,i*2).then(gotAddResult,errorCB); } function connectSuccess() { - cloudeebus.SessionBus().getObject("org.cloudeebus.Sample", "/org/cloudeebus/Sample", gotProxy, errorCB); + cloudeebus.SessionBus().getObject("org.cloudeebus.Sample", "/org/cloudeebus/Sample", gotProxy, errorCB); } -cloudeebus.connect("ws://localhost:9002", manifest, connectSuccess, errorCB); +if (!window.sampleProxy) + cloudeebus.connect("ws://localhost:9002", manifest, connectSuccess, errorCB); +else + testProxy(); +
diff --git a/doc/agent/server.html b/doc/agent/server.html index 7f6ea5e..47f7ba9 100644 --- a/doc/agent/server.html +++ b/doc/agent/server.html @@ -70,7 +70,8 @@ function connectSuccess() { cloudeebus.SessionBus().addService("org.cloudeebus.Sample").then(addAgent, errorCB); } -cloudeebus.connect("ws://localhost:9003", manifest, connectSuccess, errorCB); +if (!window.sampleProxy) + cloudeebus.connect("ws://localhost:9003", manifest, connectSuccess, errorCB);
-