diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2017-03-08 14:23:35 +0100 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2017-03-08 14:23:35 +0100 |
commit | 1393b5d318e22dbd1625692847a51c27932fd442 (patch) | |
tree | 19fd954a04456be8e1c7ebde5b3aaefbe08dbcad /htdocs/audio-logic.html | |
parent | 0964e7da8576b8761e8d3d16b50cc842406c7e67 (diff) |
Events Partially Working
Diffstat (limited to 'htdocs/audio-logic.html')
-rw-r--r-- | htdocs/audio-logic.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/htdocs/audio-logic.html b/htdocs/audio-logic.html new file mode 100644 index 0000000..ff806ad --- /dev/null +++ b/htdocs/audio-logic.html @@ -0,0 +1,40 @@ +<html> +<head> + <title>Hello world test</title> + + <script type="text/javascript" src="websock.js"></script> + <script type="text/javascript"> + var ws; + + function onopen() { + document.getElementById("main").style.visibility = "visible"; + document.getElementById("connected").innerHTML = "WebSocket Open"; + } + function onabort() { + document.getElementById("main").style.visibility = "hidden"; + document.getElementById("connected").innerHTML = "Connected Closed"; + } + function init() { + ws = new AfbWsItf("api", onopen, onabort, new AfbCtxItf("mysecret")); + } + function replyok(obj) { + document.getElementById("output").innerHTML = "OK: "+JSON.stringify(obj); + } + function replyerr(obj) { + document.getElementById("output").innerHTML = "ERROR: "+JSON.stringify(obj); + } + function subscribe(devid) { + ws.call("alsacore", "subctl", {devid:devid}, replyok, replyerr); + } + </script> + +<body onload="init();"> + <h1>Hello world test</h1> + <ol> + <li><a href="api/audio/setvol?devid=hw:0&pcm=master&vol=50%">Set Master PCM volume to 50%</a> + <li><a href="api/audio/getvol?devid=hw:0&pcm=master">Get Master PCM volume</a> + <li><a href="api/alsacore/monitor?devid=hw:0">Activate devid=hw:0 monitoring</a> + <li><button id="connected" onclick="subscribe('hw:0')">Click to Subscribe</button></li> + <div id="main" style="visibility:hidden"> + Server says... <div id="output"></div> + </div> |