summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjobol <jose.bollo@iot.bzh>2016-06-06 11:32:19 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-06-08 11:48:35 +0200
commitcee4240979b3b9c4ebb877631e66157918598c3d (patch)
tree3072776b681121e48fc73c87548fb77f39f559c1 /test
parent7c8b8a78f9029d8568a89e5f2a27c88a75b1daa2 (diff)
DBus binding: first draft
Implements the verb 'rawcall' Change-Id: Id83b065f778f2fd61ecf6e4e13bff3cc17d8ef18 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'test')
-rw-r--r--test/test-dbus-rawcall.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/test-dbus-rawcall.html b/test/test-dbus-rawcall.html
new file mode 100644
index 00000000..74e57624
--- /dev/null
+++ b/test/test-dbus-rawcall.html
@@ -0,0 +1,57 @@
+<html>
+<head>
+ <title>Test of DBUS binding</title>
+ <script type="text/javascript" src="AFB.js"></script>
+ <script type="text/javascript">
+ var afb = new AFB("api", "hello");
+ var ws;
+ var names = [ "bus", "destination", "path", "interface", "member", "arguments", "signature" ];
+
+ function onopen() {
+ document.getElementById("main").style.visibility = "visible";
+ document.getElementById("connected").innerHTML = "Connected to WebSocket server";
+ ws.onevent("*", gotevent);
+ }
+ function onabort() {
+ document.getElementById("main").style.visibility = "hidden";
+ document.getElementById("connected").innerHTML = "Connection Closed";
+ }
+ function init() {
+ ws = new afb.ws(onopen, onabort);
+ }
+ function replyok(obj) {
+ document.getElementById("output").innerHTML = "OK: "+JSON.stringify(obj);
+ }
+ function replyerr(obj) {
+ document.getElementById("output").innerHTML = "ERROR: "+JSON.stringify(obj);
+ }
+ function gotevent(obj) {
+ document.getElementById("outevt").innerHTML = JSON.stringify(obj);
+ }
+ function send() {
+ var req = { };
+ names.forEach(function(n){
+ var v = document.getElementById(n).value;
+ if(v) req[n] = n == "arguments" ? JSON.parse(v) : v;
+ });
+ ws.call("dbus/rawcall", req).then(replyok, replyerr);
+ }
+ </script>
+
+<body onload="init();">
+ <h1>WebSocket Echo</h1>
+ <div id="connected">Not Connected</div>
+ <div id="main" style="visibility:hidden">
+ bus: <input id="bus" type="text" size="80"/><br/>
+ destination: <input id="destination" type="text" size="80"/><br/>
+ path: <input id="path" type="text" size="80"/><br/>
+ interface: <input id="interface" type="text" size="80"/><br/>
+ member: <input id="member" type="text" size="80"/><br/>
+ signature: <input id="signature" type="text" size="80"/><br/>
+ arguments: <input id="arguments" type="text" size="80"/><br/>
+ <input type="button" onclick="send()" value="SEND..."/><br/>
+ Server says... <div id="output"></div>
+ Events: <div id="outevt"></div>
+ </div>
+
+