cloudeebus.log(error.desc ? error.desc : error);
}
+function gotDictResult(result) {
+ cloudeebus.log("gotDictResult: " + JSON.stringify(result));
+ cloudeebus.log("Name: " + result.Name);
+}
+
function gotDivResult(result) {
cloudeebus.log("gotDivResult: " + result);
+ var dictionary = {Name: "Mickey",
+ Sisters: [""],
+ Married: true,
+ Divorced: 0,
+ Friends: ["Donald", "Dingo"],
+ Others: [""]};
+ sampleProxy.Variant(dictionary,gotDictResult,errorCB);
// sampleProxy.Release();
}
}
function gotProxy(proxy) {
- logCB(proxy);
- proxy.connectToSignal("org.cloudeebus.Sample1", "ResultChanged", signalHandler);
- logCB('Addition');
- for (var i=-10; i<10; i++)
- proxy.Add(i,i*2,gotAddResult,errorCB);
- sampleProxy = proxy;
+ sampleProxy = proxy;
+ logCB(sampleProxy);
+ if (0) {
+ proxy.Release();
+ return;
+ } else {
+ proxy.connectToSignal("org.cloudeebus.Sample1", "ResultChanged", signalHandler);
+ logCB('Addition');
+ proxy.Add(4,5,gotAddResult,errorCB);
+ return;
+
+ for (var i=-10; i<10; i++)
+ proxy.Add(i,i*2,gotAddResult,errorCB);
+ }
}
<body>
<center><h1>cloudeebus</h1></center>
<br>
- <textarea style="width:80%" rows="32" id="script">var sampleXml= '<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"\n"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">\n<node><interface name="org.cloudeebus.Sample1"><method name="Release"></method><method name="Add"><arg type="i" name="arg1"/><arg type="i" name="arg2"/><arg type="i" name="result" direction="out"/></method><method name="Variant"><arg type="d" name="arg1"/><arg type="d" name="result" direction="out"/></method><signal name="ResultChanged"><arg type="d" name="result"/></signal></interface><interface name="org.cloudeebus.Sample2"><method name="Div"><arg type="d" name="arg1"/><arg type="d" name="arg2"/><arg type="d" name="result" direction="out"/></method></interface></node>';
+ <textarea style="width:80%" rows="32" id="script">var sampleXml= '<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"\n"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">\n<node><interface name="org.cloudeebus.Sample1"><method name="Release"></method><method name="Add"><arg type="i" name="arg1"/><arg type="i" name="arg2"/><arg type="i" name="result" direction="out"/></method><method name="Variant"><arg type="a{sv}" name="arg1"/><arg type="a{sv}" name="result" direction="out"/></method><signal name="ResultChanged"><arg type="v" name="result"/></signal></interface><interface name="org.cloudeebus.Sample2"><method name="Div"><arg type="d" name="arg1"/><arg type="d" name="arg2"/><arg type="d" name="result" direction="out"/></method></interface></node>';
cloudeebus.log = function(msg) {
document.getElementById("log").innerHTML += msg + "\n";
}
sampleObjectHandler = {
Add: function(a,b) {
+ cloudeebus.log("Add " + a + " + " + b);
this.ResultChanged(a+b);
return a+b;
},
Variant: function(a) {
+ cloudeebus.log("Get and return :" + JSON.stringify(a));
return a;
},
Release: function() {
interfaceProxies : {
"org.cloudeebus.Sample2" : {
Div: function(a,b) {
+ cloudeebus.log("Div " + a + " / " + b);
this.ResultChanged(a/b);
return a/b;
}