issue #10 #11 instand power mode scheme modified and add some time delay for fading out busy window on play welcome movie.

This commit is contained in:
Paul Kim
2024-04-29 19:46:22 +09:00
parent f679231d2d
commit 1880fae37a
4 changed files with 132 additions and 34 deletions

View File

@@ -298,6 +298,50 @@ HotelTV.hcap = (function() {
hcap.property.getHotelMode(param); 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 * HCAP Wrapper Function::> Get Cpu TIme
* @param {callback} callback is callback object * @param {callback} callback is callback object
@@ -858,29 +902,38 @@ HotelTV.hcap = (function() {
// STEP#004::> Power Mode // STEP#004::> Power Mode
if (_devinfo["instant_power"] !== undefined) { 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) { if (_devinfo["instant_power"] != _instant_pwr_target_mode) {
console.log("INSTANT POWER MODE::> off"); console.log("INSTANT POWER MODE::> off");
__hcapfxn_set_property('instant_power', _instant_pwr_target_mode).then(_result => { __hcapfxn_set_property('instant_power', _instant_pwr_target_mode).then(_result => {
hcap.power.getPowerMode({ _devinfo["instant_power"] = _instant_pwr_target_mode;
"onSuccess": function(s) { console.log("instant_power mode set as " + _devinfo["instant_power"]);
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);
}
});
}); });
} }
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 // STEP#00X::> SERVICE RELATED PARAMETERS

View File

@@ -86,9 +86,10 @@ var HotelTV = HotelTV || {
}, },
'dbginfo': { 'dbginfo': {
'en': false, 'en': false,
'emulator': false, //PC 브라우저를 이용할때, true로 설정, 타겟 셋트에서는 false로 설정할것 'emulator': false, //PC에서 emulation할때, true로 설정, 타겟 셋트에서는 false로 설정할것
'hcap_ipc': false, 'hcap_ipc': false, //WEBOS HCAP 라이브러리 내부 메시치 출력 enable/disable
'output': 'osd' 'output': 'osd',
'webdebugger': true //WEBOS 웹 디버거 enable/disable
}, },
'media_hndl': null, 'media_hndl': null,
}; };
@@ -132,6 +133,12 @@ function __fxn_Set_DebugOpt(_enable, _out_option, _init) {
HotelTV.dbginfo['emulator'] = false; HotelTV.dbginfo['emulator'] = false;
HotelTV.devinfo['manufacture'] = "LG"; HotelTV.devinfo['manufacture'] = "LG";
HotelTV.devinfo['tvOS'] = "Web0S"; 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) { } else if (navigator.appVersion.includes("Tizen") == true) {
HotelTV.dbginfo['emulator'] = false; HotelTV.dbginfo['emulator'] = false;
HotelTV.devinfo['manufacture'] = "SAMSUNG"; HotelTV.devinfo['manufacture'] = "SAMSUNG";
@@ -176,12 +183,6 @@ function __fxn_Set_DebugOpt(_enable, _out_option, _init) {
} }
} }
} else { } 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) { if (HotelTV.dbginfo['en'] != true) {
console.log = function(logmsg) { console.log = function(logmsg) {
} }
@@ -200,6 +201,7 @@ HotelTV.Init = async function() {
//SETP#02::> Set Debug Options //SETP#02::> Set Debug Options
__fxn_Set_DebugOpt(false, 'osd', false); __fxn_Set_DebugOpt(false, 'osd', false);
//__fxn_Set_DebugOpt(true, 'native', true);
//STEP#03::> Get Device Info //STEP#03::> Get Device Info
HotelTV.ui_utils.SetBusy(true); HotelTV.ui_utils.SetBusy(true);
@@ -525,7 +527,8 @@ HotelTV.LoadWelCome = async function() {
HotelTV.dbginfo = await JSON.parse(sessionStorage.getItem("dbginfo")); HotelTV.dbginfo = await JSON.parse(sessionStorage.getItem("dbginfo"));
//SETP#02::> Set Debug Options //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.devinfo = await JSON.parse(sessionStorage.getItem("devinfo"));
HotelTV.svrinfo = await JSON.parse(sessionStorage.getItem("svrinfo")); HotelTV.svrinfo = await JSON.parse(sessionStorage.getItem("svrinfo"));
@@ -661,7 +664,7 @@ HotelTV.LoadAppFull = async function() {
//STEP#01: Load session info //STEP#01: Load session info
HotelTV.dbginfo = await JSON.parse(sessionStorage.getItem("dbginfo")); HotelTV.dbginfo = await JSON.parse(sessionStorage.getItem("dbginfo"));
//SETP#02::> Set Debug Options //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.devinfo = await JSON.parse(sessionStorage.getItem("devinfo"));
HotelTV.svrinfo = await JSON.parse(sessionStorage.getItem("svrinfo")); HotelTV.svrinfo = await JSON.parse(sessionStorage.getItem("svrinfo"));

View File

@@ -7129,7 +7129,28 @@ HotelTV.ui_appfull = (function() {
} }
}); });
} else if (_evt == "COMMAND-GUEST-CHECKIN") { } 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") { } else if (_evt == "COMMAND-GUEST-CHECKOUT" || _evt == "COMMAND-SYSTEM-STOP") {
let _tmval = 30; let _tmval = 30;
let _state = HotelTV.state; let _state = HotelTV.state;
@@ -7171,10 +7192,10 @@ HotelTV.ui_appfull = (function() {
if ($('.error #countdown').css("display") == "none") { if ($('.error #countdown').css("display") == "none") {
$('.error #countdown').fadeIn(1000); $('.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() { "cb_eoe": function() {
setTimeout(HotelTV.hcap.PwrOff, 500); setTimeout(HotelTV.hcap.Reboot, 500);
HotelTV.api.ReportEvent([{'power': false, 'location':null}]) HotelTV.api.ReportEvent([{'power': false, 'location':null}])
} }
}); });

View File

@@ -364,7 +364,7 @@ HotelTV.ui_welcome = (function() {
"video/mp4", "video/mp4",
1, 1,
() => { () => {
HotelTV.ui_utils.SetBusy(false); setTimeout(HotelTV.ui_utils.SetBusy, 2000, false);
console.log("STARTUP Done CB."); console.log("STARTUP Done CB.");
//Shows up skip button //Shows up skip button
let _elmnt_btn_skip = $(".control .skip_video"); let _elmnt_btn_skip = $(".control .skip_video");
@@ -484,7 +484,28 @@ HotelTV.ui_welcome = (function() {
} }
}); });
} else if (_evt == "COMMAND-GUEST-CHECKIN") { } 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") { } else if (_evt == "COMMAND-GUEST-CHECKOUT" || _evt == "COMMAND-SYSTEM-STOP") {
let _tmval = 30; let _tmval = 30;
let _state = HotelTV.state; let _state = HotelTV.state;
@@ -526,10 +547,10 @@ HotelTV.ui_welcome = (function() {
if ($('.error #countdown').css("display") == "none") { if ($('.error #countdown').css("display") == "none") {
$('.error #countdown').fadeIn(1000); $('.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() { "cb_eoe": function() {
setTimeout(HotelTV.hcap.PwrOff, 500); setTimeout(HotelTV.hcap.Reboot, 500);
HotelTV.api.ReportEvent([{'power': false, 'location':null}]) HotelTV.api.ReportEvent([{'power': false, 'location':null}])
} }
}); });