From 1880fae37ad5b2efa370fff10984b18b27b53592 Mon Sep 17 00:00:00 2001 From: Paul Kim Date: Mon, 29 Apr 2024 19:46:22 +0900 Subject: [PATCH] issue #10 #11 instand power mode scheme modified and add some time delay for fading out busy window on play welcome movie. --- procentric/application/lib/hoteltv.hcap.js | 89 +++++++++++++++---- procentric/application/lib/hoteltv.js | 25 +++--- .../application/lib/hoteltv.ui_appfull.js | 25 +++++- .../application/lib/hoteltv.ui_welcome.js | 27 +++++- 4 files changed, 132 insertions(+), 34 deletions(-) diff --git a/procentric/application/lib/hoteltv.hcap.js b/procentric/application/lib/hoteltv.hcap.js index ae98bf5..7189bfc 100755 --- a/procentric/application/lib/hoteltv.hcap.js +++ b/procentric/application/lib/hoteltv.hcap.js @@ -298,6 +298,50 @@ HotelTV.hcap = (function() { hcap.property.getHotelMode(param); }; + /** + * HCAP Wrapper Function::> Set Device Power Mode(Realted HCAP API:hcap.power.setPowerMode) + * @param {string} sz_key property key name. + * @param {object} value is object to setting property + */ + function __hcapfxn_set_powermode(sz_key, value) { + return new Promise((resolve, reject) => { + let _pwrMode = null; + try { + hcap.power.getPowerMode({ + "onSuccess" : function(s) { + console.log("onSuccess power mode " + s.mode); + if ( s.mode!=value ) + { + hcap.power.setPowerMode({ + "mode" : value, + "onSuccess" : function() { + console.log("onSuccess set power mode to " + value); + _pwrMode = s.mode; + resolve({ "key": sz_key, "value": value }); + }, + "onFailure" : function(f) { + console.log("onFailure : errorMessage = " + f.errorMessage); + resolve({ "key": sz_key, "value": "unknown" }); + } + }); + } + else + { + _pwrMode = s.mode; + resolve({ "key": sz_key, "value": value }); + } + }, + "onFailure": function(f) { + console.log("onFailure : errorMessage = " + f.errorMessage); + resolve({ "key": sz_key, "value": "unknown" }); + } + }); + } catch { + resolve({ "key": sz_key, "value": "unknown" }); + } + }); + }; + /** * HCAP Wrapper Function::> Get Cpu TIme * @param {callback} callback is callback object @@ -858,29 +902,38 @@ HotelTV.hcap = (function() { // STEP#004::> Power Mode if (_devinfo["instant_power"] !== undefined) { - let _instant_pwr_target_mode = 0; + let _instant_pwr_target_mode = 2; if (_devinfo["instant_power"] != _instant_pwr_target_mode) { console.log("INSTANT POWER MODE::> off"); __hcapfxn_set_property('instant_power', _instant_pwr_target_mode).then(_result => { - hcap.power.getPowerMode({ - "onSuccess": function(s) { - console.log("onSuccess power mode " + s.mode); - if (s.mode != hcap.power.PowerMode.WARM) { - hcap.power.setPowerMode({ - "mode": hcap.power.PowerMode.WARM, - "onSuccess": null, - "onFailure": function(f) { - console.log("onFailure : errorMessage = " + f.errorMessage); - } - }); - } - }, - "onFailure": function(f) { - console.log("onFailure : errorMessage = " + f.errorMessage); - } - }); + _devinfo["instant_power"] = _instant_pwr_target_mode; + console.log("instant_power mode set as " + _devinfo["instant_power"]); }); } + + if ( _instant_pwr_target_mode==2 ){ + __hcapfxn_set_powermode('power_mode', hcap.power.PowerMode.NORMAL).then(_result => { + _devinfo["power_mode"] = hcap.power.PowerMode.NORMAL; + console.log("power_mode mode set as " + _devinfo["power_mode"]); + }); + // hcap.power.getPowerMode({ + // "onSuccess": function(s) { + // console.log("onSuccess power mode " + s.mode); + // if (s.mode != hcap.power.PowerMode.NORMAL) { + // hcap.power.setPowerMode({ + // "mode": hcap.power.PowerMode.NORMAL, + // "onSuccess": null, + // "onFailure": function(f) { + // console.log("onFailure : errorMessage = " + f.errorMessage); + // } + // }); + // } + // }, + // "onFailure": function(f) { + // console.log("onFailure : errorMessage = " + f.errorMessage); + // } + // }); + } } // STEP#00X::> SERVICE RELATED PARAMETERS diff --git a/procentric/application/lib/hoteltv.js b/procentric/application/lib/hoteltv.js index 02914d3..1d6281e 100755 --- a/procentric/application/lib/hoteltv.js +++ b/procentric/application/lib/hoteltv.js @@ -86,9 +86,10 @@ var HotelTV = HotelTV || { }, 'dbginfo': { 'en': false, - 'emulator': false, //PC 브라우저를 이용할때, true로 설정, 타겟 셋트에서는 false로 설정할것 - 'hcap_ipc': false, - 'output': 'osd' + 'emulator': false, //PC에서 emulation할때, true로 설정, 타겟 셋트에서는 false로 설정할것 + 'hcap_ipc': false, //WEBOS HCAP 라이브러리 내부 메시치 출력 enable/disable + 'output': 'osd', + 'webdebugger': true //WEBOS 웹 디버거 enable/disable }, 'media_hndl': null, }; @@ -132,6 +133,12 @@ function __fxn_Set_DebugOpt(_enable, _out_option, _init) { HotelTV.dbginfo['emulator'] = false; HotelTV.devinfo['manufacture'] = "LG"; HotelTV.devinfo['tvOS'] = "Web0S"; + + /** Set HCAP Debug Options */ + if (HotelTV.dbginfo['emulator'] == false) { + //Enable/Disable browser debug mode + HotelTV.hcap.SetBrowserDebug(HotelTV.dbginfo['hcap_ipc'], HotelTV.dbginfo['webdebugger']); + } } else if (navigator.appVersion.includes("Tizen") == true) { HotelTV.dbginfo['emulator'] = false; HotelTV.devinfo['manufacture'] = "SAMSUNG"; @@ -176,12 +183,6 @@ function __fxn_Set_DebugOpt(_enable, _out_option, _init) { } } } else { - /** Set HCAP Debug Options */ - if (HotelTV.dbginfo['emulator'] == false) { - //Enable/Disable browser debug mode - HotelTV.hcap.SetBrowserDebug(HotelTV.dbginfo['hcap_ipc'], HotelTV.dbginfo['en']); - } - if (HotelTV.dbginfo['en'] != true) { console.log = function(logmsg) { } @@ -200,6 +201,7 @@ HotelTV.Init = async function() { //SETP#02::> Set Debug Options __fxn_Set_DebugOpt(false, 'osd', false); + //__fxn_Set_DebugOpt(true, 'native', true); //STEP#03::> Get Device Info HotelTV.ui_utils.SetBusy(true); @@ -525,7 +527,8 @@ HotelTV.LoadWelCome = async function() { HotelTV.dbginfo = await JSON.parse(sessionStorage.getItem("dbginfo")); //SETP#02::> Set Debug Options - __fxn_Set_DebugOpt(true, 'osd', true); + __fxn_Set_DebugOpt(false, 'native', true); + //__fxn_Set_DebugOpt(true, 'native', true); HotelTV.devinfo = await JSON.parse(sessionStorage.getItem("devinfo")); HotelTV.svrinfo = await JSON.parse(sessionStorage.getItem("svrinfo")); @@ -661,7 +664,7 @@ HotelTV.LoadAppFull = async function() { //STEP#01: Load session info HotelTV.dbginfo = await JSON.parse(sessionStorage.getItem("dbginfo")); //SETP#02::> Set Debug Options - __fxn_Set_DebugOpt(false, 'native', true); + __fxn_Set_DebugOpt(true, 'native', true); HotelTV.devinfo = await JSON.parse(sessionStorage.getItem("devinfo")); HotelTV.svrinfo = await JSON.parse(sessionStorage.getItem("svrinfo")); diff --git a/procentric/application/lib/hoteltv.ui_appfull.js b/procentric/application/lib/hoteltv.ui_appfull.js index da88b8c..6bc059e 100755 --- a/procentric/application/lib/hoteltv.ui_appfull.js +++ b/procentric/application/lib/hoteltv.ui_appfull.js @@ -7129,7 +7129,28 @@ HotelTV.ui_appfull = (function() { } }); } else if (_evt == "COMMAND-GUEST-CHECKIN") { + let _tmval = 10; + let _state = HotelTV.state; + let _trTbl = HotelTV.translation; + HotelTV.ui_utils.ShowSysNoticeMsg(true, + "notice", + "SYSTEM NOTICE", + _trTbl.system.notice.event.mqtt.system_reboot[_state.lang], { + "timeout": _tmval, + "cb_disp": function() { + _tmval -= 1; + console.log("time..." + _tmval); + if ($('.error #countdown').css("display") == "none") { + $('.error #countdown').fadeIn(1000); + } + $('.error #countdown #message').text(`System will be restart in ${_tmval} second...`); + }, + "cb_eoe": function() { + setTimeout(HotelTV.hcap.Reboot, 500); + HotelTV.api.ReportEvent([{'power': false, 'location':null}]) + } + }); } else if (_evt == "COMMAND-GUEST-CHECKOUT" || _evt == "COMMAND-SYSTEM-STOP") { let _tmval = 30; let _state = HotelTV.state; @@ -7171,10 +7192,10 @@ HotelTV.ui_appfull = (function() { if ($('.error #countdown').css("display") == "none") { $('.error #countdown').fadeIn(1000); } - $('.error #countdown #message').text(`System will be shutdown in ${_tmval} second...`); + $('.error #countdown #message').text(`System will be restart in ${_tmval} second...`); }, "cb_eoe": function() { - setTimeout(HotelTV.hcap.PwrOff, 500); + setTimeout(HotelTV.hcap.Reboot, 500); HotelTV.api.ReportEvent([{'power': false, 'location':null}]) } }); diff --git a/procentric/application/lib/hoteltv.ui_welcome.js b/procentric/application/lib/hoteltv.ui_welcome.js index 8162487..fed55d8 100755 --- a/procentric/application/lib/hoteltv.ui_welcome.js +++ b/procentric/application/lib/hoteltv.ui_welcome.js @@ -364,7 +364,7 @@ HotelTV.ui_welcome = (function() { "video/mp4", 1, () => { - HotelTV.ui_utils.SetBusy(false); + setTimeout(HotelTV.ui_utils.SetBusy, 2000, false); console.log("STARTUP Done CB."); //Shows up skip button let _elmnt_btn_skip = $(".control .skip_video"); @@ -484,7 +484,28 @@ HotelTV.ui_welcome = (function() { } }); } else if (_evt == "COMMAND-GUEST-CHECKIN") { + let _tmval = 10; + let _state = HotelTV.state; + let _trTbl = HotelTV.translation; + HotelTV.ui_utils.ShowSysNoticeMsg(true, + "notice", + "SYSTEM NOTICE", + _trTbl.system.notice.event.mqtt.system_reboot[_state.lang], { + "timeout": _tmval, + "cb_disp": function() { + _tmval -= 1; + console.log("time..." + _tmval); + if ($('.error #countdown').css("display") == "none") { + $('.error #countdown').fadeIn(1000); + } + $('.error #countdown #message').text(`System will be restart in ${_tmval} second...`); + }, + "cb_eoe": function() { + setTimeout(HotelTV.hcap.Reboot, 500); + HotelTV.api.ReportEvent([{'power': false, 'location':null}]) + } + }); } else if (_evt == "COMMAND-GUEST-CHECKOUT" || _evt == "COMMAND-SYSTEM-STOP") { let _tmval = 30; let _state = HotelTV.state; @@ -526,10 +547,10 @@ HotelTV.ui_welcome = (function() { if ($('.error #countdown').css("display") == "none") { $('.error #countdown').fadeIn(1000); } - $('.error #countdown #message').text(`System will be shutdown in ${_tmval} second...`); + $('.error #countdown #message').text(`System will be restart in ${_tmval} second...`); }, "cb_eoe": function() { - setTimeout(HotelTV.hcap.PwrOff, 500); + setTimeout(HotelTV.hcap.Reboot, 500); HotelTV.api.ReportEvent([{'power': false, 'location':null}]) } });