issue #10 #11 Add exception routine for power off by remote with hdmi input mode. Fix news doesn't show correctly after hdmi input disconnected.

This commit is contained in:
Paul Kim
2024-05-01 16:16:22 +09:00
parent 1880fae37a
commit 0dee6a9a92
7 changed files with 2213 additions and 1314 deletions

View File

@@ -485,20 +485,40 @@ HotelTV.ui_appfull = (function() {
if ( _evt.connected==true ){
_state.menu.stage.prev = _state.menu.stage.cur;
_state.menu.stage.cur = "external_av_hdmi";
_state.external_input.connected = true;
_state.external_input.last_input.index = Number(_evt.index)-1;
setTimeout(function(){
$('body,html').fadeOut(500, function(){
HotelTV.hcap.SetExternalInput("HDMI", Number(_evt.index)-1);
let __retSuccess = HotelTV.hcap.SetExternalInput("HDMI", Number(_evt.index)-1);
if ( __retSuccess==false ){
_state.external_input.connected = false;
_state.external_input.last_input.index = 0;
if ( $('body,html').css('display')=="none" ){
$('body,html').fadeIn(500, function(){
__uifxn_AppFull_BuildNews();
if ( _state.menu.stage.prev!=null ){
_state.menu.stage.cur = _state.menu.stage.prev;
_state.menu.stage.prev = null;
}
__uifxn_AppFull_RefreshNews(500);
});
}
}
});
}, 1000);
HotelTV.ui_utils.ShowNotificationMsgBalloon(_trTbl.system.notice.event.external_input.hdmi_connected[_state.lang], 5);
}else{
_state.external_input.connected = false;
_state.external_input.last_input.index = 0;
if ( $('body,html').css('display')=="none" ){
$('body,html').fadeIn(500);
if ( _state.menu.stage.prev!=null ){
_state.menu.stage.cur = _state.menu.stage.prev;
_state.menu.stage.prev = null;
}
$('body,html').fadeIn(500, function(){
__uifxn_AppFull_BuildNews();
if ( _state.menu.stage.prev!=null ){
_state.menu.stage.cur = _state.menu.stage.prev;
_state.menu.stage.prev = null;
}
__uifxn_AppFull_RefreshNews(500);
});
}
}
}
@@ -512,16 +532,52 @@ HotelTV.ui_appfull = (function() {
let _state = HotelTV.state;
// Set tv playing flag
_state.tv.playing = true;
// {Boolean} param.result - true if the current channel is changed successfully, else false.
// {String} param.errorMessage - in case of failure, this message provides the details.
console.log(
"Event 'channel_changed' is received. " +
"Result = " + _evt.result + "Error message = " + _evt.errorMessage
);
if ( _evt.result==true ) {
_state.tv.playing = true;
} else {
console.log("Event 'channel_changed' is failure::> " + _evt.errorMessage );
}
}
/**
* HotelTV UI Wrapper Function::> received event handling function
*/
function __uifxn_AppFull_OnPwrModeChangeEvt() {
let _state = HotelTV.state;
let _tvMenu_stages = "tvCtgHide tvCtgShow tvShortcut tvPreparing";
if ( _tvMenu_stages.includes(_state.menu.stage.cur)==true ){
hcap.power.getPowerMode({
"onSuccess" : function(s) {
console.log("onSuccess power mode " + s.mode);
if ( s.mode==hcap.power.PowerMode.NORMAL ){
console.log("Need to restart channel...");
__uifxn_AppFull_TVRequestChannel(null, null);
}
},
"onFailure" : function(f) {
console.log("onFailure : errorMessage = " + f.errorMessage);
}
});
} else if ( _state.menu.stage.cur=="external_av_hdmi" ) {
let __retSuccess = HotelTV.hcap.SetExternalInput("HDMI", _state.external_input.last_input.index);
if ( __retSuccess==false ){
_state.external_input.connected = false;
_state.external_input.last_input.index = 0;
if ( $('body,html').css('display')=="none" ){
$('body,html').fadeIn(500);
if ( _state.menu.stage.prev!=null ){
_state.menu.stage.cur = _state.menu.stage.prev;
_state.menu.stage.prev = null;
}
}
}
}
console.log("Event 'power_mode_changed' is received. ");
}
/**
@@ -3794,6 +3850,25 @@ HotelTV.ui_appfull = (function() {
return;
}
/**
* HotelTV UI[AppFull] Wrapper Function::> refresh news
*/
function __uifxn_AppFull_RefreshNews(_tmDelay) {
let _hndlNewsTicker = $('.news>.newsctz #hoteltv-news-ticker');
const __ifxn_refreshNewsTicker = function(_timeDelay=2000){
_hndlNewsTicker.webTicker('stop');
_hndlNewsTicker.children().remove();
setTimeout(__uifxn_AppFull_BuildNews, _timeDelay);
}
try {
__ifxn_refreshNewsTicker( _tmDelay );
} catch ( _err ){
console.error(`Fail to update::> ${_err}`);
}
}
/**
* HotelTV UI[AppFull] Wrapper Function::> build news
@@ -3810,9 +3885,17 @@ HotelTV.ui_appfull = (function() {
let sz_li_news = "";
for (let _nwsIdx = 1; _nwsIdx <= _newsInfo.length; _nwsIdx++) {
if (_newsInfo[_nwsIdx].logo.download != "") {
sz_li_news += `<li data-update=item${_nwsIdx}><img src=" ${_newsInfo[_nwsIdx].logo.download}"/>${_newsInfo[_nwsIdx].content[_state.lang]}</li>`;
if (_newsInfo[_nwsIdx].multilanguage == true) {
sz_li_news += `<li data-update=item${_nwsIdx}><img src=" ${_newsInfo[_nwsIdx].logo.download}"/>${_newsInfo[_nwsIdx].content[_state.lang]}</li>`;
} else {
sz_li_news += `<li data-update=item${_nwsIdx}><img src=" ${_newsInfo[_nwsIdx].logo.download}"/>${_newsInfo[_nwsIdx].content.default}</li>`;
}
} else {
sz_li_news += `<li data-update=item${_nwsIdx}>${_newsInfo[_nwsIdx].content[_state.lang]}</li>`;
if (_newsInfo[_nwsIdx].multilanguage == true) {
sz_li_news += `<li data-update=item${_nwsIdx}>${_newsInfo[_nwsIdx].content[_state.lang]}</li>`;
} else {
sz_li_news += `<li data-update=item${_nwsIdx}>${_newsInfo[_nwsIdx].content.default}</li>`;
}
}
}
_hndlNewsTicker.html(sz_li_news);
@@ -3820,6 +3903,7 @@ HotelTV.ui_appfull = (function() {
height: '26px',
speed: 100
});
_hndlNewsTicker.webTicker('update');
} else {
let sz_li_news = "";
for (let _nwsIdx = 1; _nwsIdx <= _newsInfo.length; _nwsIdx++) {
@@ -5759,10 +5843,10 @@ HotelTV.ui_appfull = (function() {
}
}
} else if (_state.menu.stage.cur == "tvCtgHide") {
if (event.keyCode == gRmtKey.chup) {
if (event.keyCode == gRmtKey.up || event.keyCode == gRmtKey.chup) {
// 채널 리스트 아이탬 이동(CHUP)
__ifxn_moveTvChannel(_tvProg, "ch_up");
} else if (event.keyCode == gRmtKey.chdown) {
} else if (event.keyCode == gRmtKey.down || event.keyCode == gRmtKey.chdown) {
// 채널 리스트 아이탬 이동(CHDOWN)
__ifxn_moveTvChannel(_tvProg, "ch_down");
} else if (event.keyCode == gRmtKey.back) {
@@ -5806,6 +5890,7 @@ HotelTV.ui_appfull = (function() {
$('#lst_tvCtgbg').on('translated.owl.carousel', function(event) {
__uifxn_AppFull_TVUpdateChList("on_load");
HotelTV.ui_utils.ShowNotificationMsgBalloon(_trTbl.ui.guide.navi_tvcategory[_state.lang], 10);
});
@@ -6951,6 +7036,8 @@ HotelTV.ui_appfull = (function() {
document.addEventListener("hdmi_connection_changed", __uifxn_AppFull_OnHdmiConChangeEvt, false);
//ADD Event for the result of channel changed
document.addEventListener("channel_changed", __uifxn_AppFull_OnTvChChgChangeEvt, false);
//ADD power mode changed
document.addEventListener("power_mode_changed", __uifxn_AppFull_OnPwrModeChangeEvt, false);
},
Show: function() {