diff options
Diffstat (limited to 'htdocs')
-rw-r--r-- | htdocs/AFB-websock.js | 2 | ||||
-rw-r--r-- | htdocs/AudioBinding.js | 7 | ||||
-rw-r--r-- | htdocs/README.md | 2 | ||||
-rw-r--r-- | htdocs/alsa-core.html | 32 |
4 files changed, 32 insertions, 11 deletions
diff --git a/htdocs/AFB-websock.js b/htdocs/AFB-websock.js index f904a58..e77ec89 100644 --- a/htdocs/AFB-websock.js +++ b/htdocs/AFB-websock.js @@ -58,6 +58,7 @@ var AFB_websocket; this.ws.onmessage = onmessage.bind(this); this.onopen = onopen; this.onabort = onabort; + this.onclose = onabort; } function onerror(event) { @@ -132,6 +133,7 @@ var AFB_websocket; function close() { this.ws.close(); + this.onabort(); } function call(method, request) { diff --git a/htdocs/AudioBinding.js b/htdocs/AudioBinding.js index a1267b1..e830861 100644 --- a/htdocs/AudioBinding.js +++ b/htdocs/AudioBinding.js @@ -14,13 +14,16 @@ return decodeURIComponent(results[2].replace(/\+/g, " ")); } - // default soundcard is hw:0 + // default soundcard is "PCH" var devid=getParameterByName("devid"); if (!devid) devid="hw:0"; var sndname=getParameterByName("sndname"); if (!sndname) sndname="PCH"; + var quiet=getParameterByName("quiet"); + if (!quiet) quiet="99"; + function init() { ws = new afb.ws(onopen, onabort); } @@ -57,11 +60,13 @@ function send(message) { var api = document.getElementById("api").value; var verb = document.getElementById("verb").value; + document.getElementById("question").innerHTML = "subscribe: "+api+"/"+verb + " (" + JSON.stringify(message) +")"; ws.call(api+"/"+verb, {data:message}).then(replyok, replyerr); } function callbinder(api, verb, query) { console.log ("subscribe api="+api+" verb="+verb+" query=" +query); + document.getElementById("question").innerHTML = "apicall: " + api+"/"+verb +" ("+ JSON.stringify(query)+")"; ws.call(api+"/"+verb, query).then(replyok, replyerr); }
\ No newline at end of file diff --git a/htdocs/README.md b/htdocs/README.md index 79b57d8..bb14b7e 100644 --- a/htdocs/README.md +++ b/htdocs/README.md @@ -3,5 +3,5 @@ ------------------------------------------------------------------------ # Load bindings directly from development tree for debug - afb-daemon --token=x --ldpaths=build/Alsa/core-binding --port=1234 --roothttp=htdocs --verbose + afb-daemon --verbose --verbose --token="" --ldpaths=build --port=1234 --roothttp=htdocs diff --git a/htdocs/alsa-core.html b/htdocs/alsa-core.html index 2987832..9df5d06 100644 --- a/htdocs/alsa-core.html +++ b/htdocs/alsa-core.html @@ -4,22 +4,36 @@ <script type="text/javascript" src="AFB-websock.js"></script> <script type="text/javascript" src="AudioBinding.js"></script> + +<b>http://localhost:1234/alsa-core.html?devid=hw:xx</b> <body onload="init();"> <h1>Hello world test</h1> - <button id="connected">Binder WS Fail</button></li> + <button id="connected" onclick="init()">Binder WS Fail</button></li> <br> <ol> <li><a href="api/alsacore/getinfo">getinfo: List Sound Cards</a> - <li><a href="api/alsacore/getinfo?devid=hw:0">Card info about hw:0</a> - <li><a href="api/alsacore/getctls?devid=hw:0">List All Controls for hw:0 (quiet)</a> - <li><a href="api/alsacore/getctls?devid=hw:0&quiet=0">List controls for hw:0 (verbose)</a> - <li><a href="api/alsacore/getctls?devid=hw:0&numids=[1,2]&quiet=0">List Controls 1+2 for hw:0 (verbose)</a> - <li><a href="api/alsacore/getctls?devid=hw:0&numids=1&quiet=0">return control numid=1 for hw:0</a> + <li><button onclick="callbinder('alsacore','getinfo', {quiet:quiet})">Get All Sound Card info</button></li> + <li><button onclick="callbinder('alsacore','getinfo', {devid:devid, quiet:quiet})">Get Sound Card info devid=xx</button></li> + <li><button onclick="callbinder('alsacore','getctls', {devid:devid, quiet:quiet})">Get all Alsa Ctls for devid=xx</button></li> + <li><button onclick="callbinder('alsacore','getctls', {devid:devid, quiet:quiet, numids:[1,2]})">Get Alsa Ctls numid=1+2</button></li> + <li><button onclick="callbinder('alsacore','getctls', {devid:devid, quiet:quiet, numids:1})">Get Alsa Ctl numid=1</button></li> + <br> + <li><button onclick="callbinder('alsacore','ucmquery', {devid:devid, quiet:quiet})">List UCM verbs</button></li> + <li><button onclick="callbinder('alsacore','ucmset' , {devid:devid, quiet:quiet, verb:'HiFi'})">Set UCM HiFi</button></li> + <li><button onclick="callbinder('alsacore','ucmset' , {devid:devid, quiet:quiet, verb:'HiFi', dev:'Headphone'})">Set UCM HiFi+Headphone</button></li> + <li><button onclick="callbinder('alsacore','ucmset' , {devid:devid, quiet:quiet, verb:'HiFi', dev:'Headphone', mod:'RecordMedia'})">Set UCM HiFi+Headphone+RecordMedia</button></li> <br> - <li><button onclick="callbinder('alsacore','subscribe', {devid:devid})">Subscribe AlsaCtl Events</button></li> + <li><button onclick="callbinder('alsacore','ucmget' , {devid:devid, quiet:quiet, values:['OutputDspName','PlaybackPCM','CapturePCM']})">Get UCM OutputDspName+PlaybackPCM+CapturePCM (after SET UCM)</button></li> <br> + <li><button onclick="callbinder('alsacore','subscribe', {devid:devid})">Subscribe AlsaCtl Events</button></li> + <br> + </ol> + <div id="main" style="visibility:hidden"> - Server says... <div id="output"></div> - Events: <div id="outevt"></div> + <ol> + <li>Question <div id="question"></div> + <li>Response <div id="output"></div> + <li>Events: <div id="outevt"></div> + </ol> </div> |