From 0d3bb5c8d940b416ccc06a68a8ccfc35370fdbd4 Mon Sep 17 00:00:00 2001 From: thlo Date: Fri, 5 Apr 2013 17:43:54 +0200 Subject: Selection of audio tracks. First version of web video (yt) support. various bug fixes. --- smarttv-client/Javascript/Comm.js | 101 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 smarttv-client/Javascript/Comm.js (limited to 'smarttv-client/Javascript/Comm.js') diff --git a/smarttv-client/Javascript/Comm.js b/smarttv-client/Javascript/Comm.js new file mode 100644 index 0000000..d4cdd18 --- /dev/null +++ b/smarttv-client/Javascript/Comm.js @@ -0,0 +1,101 @@ + +var Comm = { + customMgr : {}, + deviceInstance : [] +}; + +Comm.init = function () { + // >> Register custom manager callback to receive device connect and disconnect events + Comm.customMgr = webapis.customdevice || {}; + + Comm.customMgr.registerManagerCallback(Comm.onDeviceStatusChange); + + // >> Initializes custom device profile and gets available devices + Comm.customMgr.getCustomDevices(Comm.onCustomObtained); + Main.log("curWidget.id= " + curWidget.id); + Main.logToServer("curWidget.id= (" + curWidget.id+")"); +}; + +Comm.onDeviceStatusChange = function (sParam) { + switch( Number(sParam.eventType) ) { + case Comm.customMgr.MGR_EVENT_DEV_CONNECT: + Main.logToServer("onDeviceStatusChange - MGR_EVENT_DEV_CONNECT: name= " + sParam.name + " type= " +sParam.deviceType); + break; + case Comm.customMgr.MGR_EVENT_DEV_DISCONNECT: + Main.logToServer("onDeviceStatusChange - MGR_EVENT_DEV_DISCONNECT: name= " + sParam.name + " type= " +sParam.deviceType); + break; + default: + Main.logToServer("onDeviceStatusChange - Unknown event eType= " + sParam.eventType + " name= " + sParam.name+ " dType= "+sParam.deviceType); + break; + } + Comm.customMgr.getCustomDevices(Comm.onCustomObtained); +}; + +Comm.onCustomObtained = function (customs) { + Main.logToServer("onCustomObtained - found " + customs.length + " custom device(s)"); + for(var i=0; i