From 36bea37e9781276e7162292ea6933a7f6404c5ee Mon Sep 17 00:00:00 2001 From: fulup Date: Thu, 30 Mar 2017 10:12:31 +0200 Subject: Initial working implementation for Alsa UCM. Cleanup format for Alsa control GET. Status: working in progress --- htdocs/AFB-websock.js | 2 ++ htdocs/AudioBinding.js | 7 ++++++- htdocs/README.md | 2 +- htdocs/alsa-core.html | 32 +++++++++++++++++++++++--------- 4 files changed, 32 insertions(+), 11 deletions(-) (limited to 'htdocs') 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 @@ + +http://localhost:1234/alsa-core.html?devid=hw:xx

Hello world test

- +
  1. getinfo: List Sound Cards -
  2. Card info about hw:0 -
  3. List All Controls for hw:0 (quiet) -
  4. List controls for hw:0 (verbose) -
  5. List Controls 1+2 for hw:0 (verbose) -
  6. return control numid=1 for hw:0 +
  7. +
  8. +
  9. +
  10. +
  11. +
    +
  12. +
  13. +
  14. +

  15. -
  16. +

  17. +
  18. +
    +
+ -- cgit 1.2.3-korg