From 593ed6dc72274f86046aae3dc6b264c568241917 Mon Sep 17 00:00:00 2001 From: fulup Date: Tue, 25 Jul 2017 11:37:10 +0200 Subject: Initial version of HAL with Set/Get operation --- htdocs/AudioBinding.js | 102 ++++++++++++++++++++++++++++++++++++------------- htdocs/alsa-core.html | 38 +++++++++--------- htdocs/alsa-hal.html | 10 ++--- 3 files changed, 101 insertions(+), 49 deletions(-) (limited to 'htdocs') diff --git a/htdocs/AudioBinding.js b/htdocs/AudioBinding.js index e000a70..607d31c 100644 --- a/htdocs/AudioBinding.js +++ b/htdocs/AudioBinding.js @@ -2,6 +2,7 @@ var ws; var sndcard="HALNotSelected"; var evtidx=0; + var numid=0; function syntaxHighlight(json) { if (typeof json !== 'string') { @@ -48,31 +49,10 @@ if (!sndname) sndname="PCH"; var mode=getParameterByName("mode"); - if (!mode) mode="99"; + if (!mode) mode="0"; - function init(elemid, api, verb, query) { - - function onopen() { - // check for active HALs - probeActiveHal (elemid, api, verb, query); - - document.getElementById("main").style.visibility = "visible"; - document.getElementById("connected").innerHTML = "Binder WS Active"; - document.getElementById("connected").style.background = "lightgreen"; - ws.onevent("*", gotevent); - } - - function onabort() { - document.getElementById("main").style.visibility = "hidden"; - document.getElementById("connected").innerHTML = "Connected Closed"; - document.getElementById("connected").style.background = "red"; - - } - - ws = new afb.ws(onopen, onabort); - } function replyok(obj) { console.log("replyok:" + JSON.stringify(obj)); @@ -106,9 +86,17 @@ } - // Retrieve the list of active HAL - function probeActiveHal (elemid, api, verb, query) { + // Retreive Select value and Text from the binder + // Note: selection of value/text for a given context is huggly!!! + function querySelectList (elemid, api, verb, query) { + + console.log("querySelectList elemid=%s api=%s verb=%s query=%s", elemid, api, verb, query); + var selectobj = document.getElementById(elemid); + if (!selectobj) { + console.log ("****** elemid=%s does not exit in HTML page ****", elemid); + return; + } // onlick update selected HAL api selectobj.onclick=function(){ @@ -139,12 +127,72 @@ sndcard= selectobj.value; } - - console.log ("subscribe api="+api+" verb="+verb+" query=" +query); - + + var question = urlws +"/"+api +"/" +verb + "?query=" + JSON.stringify(query); + document.getElementById("question").innerHTML = syntaxHighlight(question); + + // request lowlevel ALSA to get API list + ws.call(api+"/"+verb, query).then(gotit, replyerr); + } + + function refresh_list (self, api, verb, query) { + console.log("refresh_list id=%s api=%s verb=%s query=%s", self.id, api, verb, query); + + if (self.value > 0) return; + + // onlick update selected HAL api + self.onclick=function(){ + numid = parseInt(self.value); + console.log ("Default numid=%d", numid); + }; + + function gotit (result) { + + // display response as for normal onclick action + replyok(result); + var response=result.response; + + + + // fulfill select with avaliable active HAL + for (idx=0; idx + - references - +

Selected SndCard + + Select NUMID + API Verbosity -
- + + +
  1. -
  2. -
  3. -
  4. -
    -
  5. -
  6. -
  7. -
  8. -
  9. +
  10. +
  11. +
    + + +
  12. +
  13. +
  14. +
  15. +

  16. diff --git a/htdocs/alsa-hal.html b/htdocs/alsa-hal.html index 7a8655c..7377bd4 100644 --- a/htdocs/alsa-hal.html +++ b/htdocs/alsa-hal.html @@ -27,15 +27,15 @@
      -
    1. +

    2. -
    3. -
    4. -
    5. -
    6. +
    7. +
    8. +
    9. +

    -- cgit 1.2.3-korg