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

@@ -36,6 +36,7 @@ HotelTV.hcap = (function() {
'clock_display', 'teletext', 'secure_mmr_pairing', 'dial', 'alljoyn', 'clock_source', 'xait_version', 'clock_display', 'teletext', 'secure_mmr_pairing', 'dial', 'alljoyn', 'clock_source', 'xait_version',
'asl_mode', 'screensaver_control', 'rms_trusted_ip', 'lg_service_xml_version', 'cec_device_control', 'asl_mode', 'screensaver_control', 'rms_trusted_ip', 'lg_service_xml_version', 'cec_device_control',
'input_splash_image', 'block_usb', 'tv_channel_attribute_floating_ui', 'input_splash_image', 'block_usb', 'tv_channel_attribute_floating_ui',
'room_number',
'instant_power', 'hardware_version', 'instant_power', 'hardware_version',
'network_info', 'network_info',
'tv_channel_ui', "mute_on_tv_input", 'tv_channel_ui', "mute_on_tv_input",
@@ -900,7 +901,14 @@ HotelTV.hcap = (function() {
}); });
}) })
// STEP#004::> Power Mode // SETP#004::> Room Number(Device Name)
let _str_newDevName = _devinfo['manufacture'] + "[" + _devconfig.roomNumber.toString() + "]";
if ( _devinfo['room_number']!=_str_newDevName ){
console.log("Set device name and room number as " + _str_newDevName );
_pmFxnArProperty.push(__hcapfxn_set_property('room_number', _str_newDevName));
}
// STEP#005::> Power Mode
if (_devinfo["instant_power"] !== undefined) { if (_devinfo["instant_power"] !== undefined) {
let _instant_pwr_target_mode = 2; let _instant_pwr_target_mode = 2;
if (_devinfo["instant_power"] != _instant_pwr_target_mode) { if (_devinfo["instant_power"] != _instant_pwr_target_mode) {
@@ -936,7 +944,7 @@ HotelTV.hcap = (function() {
} }
} }
// STEP#00X::> SERVICE RELATED PARAMETERS // STEP#006::> SERVICE RELATED PARAMETERS
for (let _cfg in _devconfig) { for (let _cfg in _devconfig) {
if (_cfg == 'video') { if (_cfg == 'video') {
for (let _item in _devconfig.video) { for (let _item in _devconfig.video) {
@@ -1087,42 +1095,42 @@ HotelTV.hcap = (function() {
} }
} }
//Specifial parameters // STEP#007::> Specifial parameters
if (_devinfo["boot_sequence_option"] !== undefined) { if (_devinfo["boot_sequence_option"] !== undefined) {
if (_devinfo["boot_sequence_option"] != 1) { if (_devinfo["boot_sequence_option"] != 1) {
_pmFxnArProperty.push(__hcapfxn_set_property('boot_sequence_option', 1)); _pmFxnArProperty.push(__hcapfxn_set_property('boot_sequence_option', 1));
} }
} }
// Clock Display // STEP#008::> Clock Display
if (_devinfo["clock_display"] !== undefined) { if (_devinfo["clock_display"] !== undefined) {
if (_devinfo["clock_display"] != 0) { if (_devinfo["clock_display"] != 0) {
_pmFxnArProperty.push(__hcapfxn_set_property('clock_display', 0)); _pmFxnArProperty.push(__hcapfxn_set_property('clock_display', 0));
} }
} }
// Input splash Image // STEP#009::> Input splash Image
if (_devinfo["input_splash_image"] !== undefined) { if (_devinfo["input_splash_image"] !== undefined) {
if (_devinfo["input_splash_image"] != 0) { if (_devinfo["input_splash_image"] != 0) {
_pmFxnArProperty.push(__hcapfxn_set_property('input_splash_image', 0)); _pmFxnArProperty.push(__hcapfxn_set_property('input_splash_image', 0));
} }
} }
// USB Device Blocking // STEP#010::> USB Device Blocking
if (_devinfo["block_usb"] !== undefined) { if (_devinfo["block_usb"] !== undefined) {
if (_devinfo["block_usb"] != 1) { if (_devinfo["block_usb"] != 1) {
_pmFxnArProperty.push(__hcapfxn_set_property('block_usb', 1)); _pmFxnArProperty.push(__hcapfxn_set_property('block_usb', 1));
} }
} }
// WOL // STEP#011::> WOL
if (_devinfo["wol_m"] !== undefined) { if (_devinfo["wol_m"] !== undefined) {
if (_devinfo["wol_m"] != "normal") { if (_devinfo["wol_m"] != "normal") {
_pmFxnArProperty.push(__hcapfxn_set_property('wol_m', "normal")); _pmFxnArProperty.push(__hcapfxn_set_property('wol_m', "normal"));
} }
} }
// WIFI SCREEN SHARE // STEP#012::> WIFI SCREEN SHARE
if (_devinfo["wifi_screen_share"] !== undefined) { if (_devinfo["wifi_screen_share"] !== undefined) {
// if (_devinfo["wifi_screen_share"] != 1) { // if (_devinfo["wifi_screen_share"] != 1) {
// _pmFxnArProperty.push(__hcapfxn_set_property('wifi_screen_share', 1)); // _pmFxnArProperty.push(__hcapfxn_set_property('wifi_screen_share', 1));
@@ -1134,77 +1142,77 @@ HotelTV.hcap = (function() {
} }
} }
// SMART SHARE // STEP#013::> SMART SHARE
if (_devinfo["smart_share"] !== undefined) { if (_devinfo["smart_share"] !== undefined) {
if (_devinfo["smart_share"] != 0) { if (_devinfo["smart_share"] != 0) {
_pmFxnArProperty.push(__hcapfxn_set_property('smart_share', 0)); _pmFxnArProperty.push(__hcapfxn_set_property('smart_share', 0));
} }
} }
// SMART PARING // STEP#014::> SMART PARING
if (_devinfo["smart_pairing"] !== undefined) { if (_devinfo["smart_pairing"] !== undefined) {
if (_devinfo["smart_pairing"] != 0) { if (_devinfo["smart_pairing"] != 0) {
_pmFxnArProperty.push(__hcapfxn_set_property('smart_pairing', 0)); _pmFxnArProperty.push(__hcapfxn_set_property('smart_pairing', 0));
} }
} }
// DIAL // STEP#015::> DIAL
if (_devinfo["dial"] !== undefined) { if (_devinfo["dial"] !== undefined) {
if (_devinfo["dial"] != 1) { if (_devinfo["dial"] != 1) {
_pmFxnArProperty.push(__hcapfxn_set_property('dial', 1)); _pmFxnArProperty.push(__hcapfxn_set_property('dial', 1));
} }
} }
// DMR // STEP#016::> DMR
if (_devinfo["dmr"] !== undefined) { if (_devinfo["dmr"] !== undefined) {
if (_devinfo["dmr"] != 0) { if (_devinfo["dmr"] != 0) {
_pmFxnArProperty.push(__hcapfxn_set_property('dmr', 0)); _pmFxnArProperty.push(__hcapfxn_set_property('dmr', 0));
} }
} }
// SOFTAP UI // STEP#017::> SOFTAP UI
if (_devinfo["soft_ap_ui"] !== undefined) { if (_devinfo["soft_ap_ui"] !== undefined) {
if (_devinfo["soft_ap_ui"] != 0) { if (_devinfo["soft_ap_ui"] != 0) {
_pmFxnArProperty.push(__hcapfxn_set_property('soft_ap_ui', 0)); _pmFxnArProperty.push(__hcapfxn_set_property('soft_ap_ui', 0));
} }
} }
// SOFTAP // STEP#018::> SOFTAP
if (_devinfo["soft_ap"] !== undefined) { if (_devinfo["soft_ap"] !== undefined) {
if (_devinfo["soft_ap"] != 0) { if (_devinfo["soft_ap"] != 0) {
_pmFxnArProperty.push(__hcapfxn_set_property('soft_ap', 0)); _pmFxnArProperty.push(__hcapfxn_set_property('soft_ap', 0));
} }
} }
// APPLICATION CHANNEL CONTROL // STEP#019::> APPLICATION CHANNEL CONTROL
if (_devinfo["application_channel_control"] !== undefined) { if (_devinfo["application_channel_control"] !== undefined) {
if (_devinfo["application_channel_control"] != 1) { if (_devinfo["application_channel_control"] != 1) {
_pmFxnArProperty.push(__hcapfxn_set_property('application_channel_control', 1)); _pmFxnArProperty.push(__hcapfxn_set_property('application_channel_control', 1));
} }
} }
// TV CHANNEL UI // STEP#020::> TV CHANNEL UI
if (_devinfo["tv_channel_ui"] !== undefined) { if (_devinfo["tv_channel_ui"] !== undefined) {
if (_devinfo["tv_channel_ui"] != 0) { if (_devinfo["tv_channel_ui"] != 0) {
_pmFxnArProperty.push(__hcapfxn_set_property('tv_channel_ui', 0)); _pmFxnArProperty.push(__hcapfxn_set_property('tv_channel_ui', 0));
} }
} }
// MUTE ON TV INPUT: Prevent TV channel auto play when exit OTT // STEP#021::> MUTE ON TV INPUT: Prevent TV channel auto play when exit OTT
if (_devinfo["mute_on_tv_input"] !== undefined) { if (_devinfo["mute_on_tv_input"] !== undefined) {
if (_devinfo["mute_on_tv_input"] != 1) { if (_devinfo["mute_on_tv_input"] != 1) {
_pmFxnArProperty.push(__hcapfxn_set_property('mute_on_tv_input', 1)); _pmFxnArProperty.push(__hcapfxn_set_property('mute_on_tv_input', 1));
} }
} }
// SECURITY LEVEL // STEP#022::> SECURITY LEVEL
if (_devinfo["security_level"] !== undefined) { if (_devinfo["security_level"] !== undefined) {
if (_devinfo["security_level"] != 1) { if (_devinfo["security_level"] != 1) {
_pmFxnArProperty.push(__hcapfxn_set_property('security_level', 1)); _pmFxnArProperty.push(__hcapfxn_set_property('security_level', 1));
} }
} }
// // OSD LAYER ID // STEP#0XX::> OSD LAYER ID
// if (_devinfo["osd_layer_id"] !== undefined) { // if (_devinfo["osd_layer_id"] !== undefined) {
// if (_devinfo["osd_layer_id"] != 0) { // if (_devinfo["osd_layer_id"] != 0) {
// _pmFxnArProperty.push(__hcapfxn_set_property('osd_layer_id', 0)); // _pmFxnArProperty.push(__hcapfxn_set_property('osd_layer_id', 0));
@@ -1711,19 +1719,33 @@ HotelTV.hcap = (function() {
}, },
// _type은 hcap.externalinput.ExternalInputType형이고, 현재는 HDMI로 고정 /**
// _index는 HDMI포트 번호 * _type은 hcap.externalinput.ExternalInputType형이고, 현재는 HDMI로 고정
* _index는 HDMI포트 번호
* @param {string} _type
* @param {Number} _index
* @returns
* true: Success
* false: Failure
*/
SetExternalInput: function(_type, _index) { SetExternalInput: function(_type, _index) {
try {
hcap.externalinput.setCurrentExternalInput({ hcap.externalinput.setCurrentExternalInput({
"type" : hcap.externalinput.ExternalInputType.HDMI, "type" : hcap.externalinput.ExternalInputType.HDMI,
"index" : _index, "index" : _index,
"onSuccess" : function() { "onSuccess" : function() {
console.log("onSuccess"); console.log("onSuccess");
return true;
}, },
"onFailure" : function(f) { "onFailure" : function(f) {
console.error("onFailure : errorMessage = " + f.errorMessage); console.error("onFailure : errorMessage = " + f.errorMessage);
return false;
} }
}); });
} catch(_err) {
console.log(`fail to perform getCurrentExternalInput() ${_err}`);
return false;
}
}, },
Test: function() { Test: function() {

View File

@@ -57,6 +57,13 @@ var HotelTV = HotelTV || {
'scroll_offset': null, 'scroll_offset': null,
}, },
}, },
'external_input':{
'connected': false,
'last_input': {
'type': 0,
'index': 0
}
},
'hotkey': { 'hotkey': {
"mm": {} "mm": {}
}, },
@@ -664,7 +671,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(true, 'native', true); __fxn_Set_DebugOpt(false, '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

@@ -485,20 +485,40 @@ HotelTV.ui_appfull = (function() {
if ( _evt.connected==true ){ if ( _evt.connected==true ){
_state.menu.stage.prev = _state.menu.stage.cur; _state.menu.stage.prev = _state.menu.stage.cur;
_state.menu.stage.cur = "external_av_hdmi"; _state.menu.stage.cur = "external_av_hdmi";
_state.external_input.connected = true;
_state.external_input.last_input.index = Number(_evt.index)-1;
setTimeout(function(){ setTimeout(function(){
$('body,html').fadeOut(500, 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 ){
}, 1000); _state.external_input.connected = false;
HotelTV.ui_utils.ShowNotificationMsgBalloon(_trTbl.system.notice.event.external_input.hdmi_connected[_state.lang], 5); _state.external_input.last_input.index = 0;
}else{
if ( $('body,html').css('display')=="none" ){ if ( $('body,html').css('display')=="none" ){
$('body,html').fadeIn(500); $('body,html').fadeIn(500, function(){
__uifxn_AppFull_BuildNews();
if ( _state.menu.stage.prev!=null ){ if ( _state.menu.stage.prev!=null ){
_state.menu.stage.cur = _state.menu.stage.prev; _state.menu.stage.cur = _state.menu.stage.prev;
_state.menu.stage.prev = null; _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, 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; let _state = HotelTV.state;
// Set tv playing flag // Set tv playing flag
_state.tv.playing = true;
// {Boolean} param.result - true if the current channel is changed successfully, else false. // {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. // {String} param.errorMessage - in case of failure, this message provides the details.
console.log( if ( _evt.result==true ) {
"Event 'channel_changed' is received. " + _state.tv.playing = true;
"Result = " + _evt.result + "Error message = " + _evt.errorMessage } 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; 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 * HotelTV UI[AppFull] Wrapper Function::> build news
@@ -3810,9 +3885,17 @@ HotelTV.ui_appfull = (function() {
let sz_li_news = ""; let sz_li_news = "";
for (let _nwsIdx = 1; _nwsIdx <= _newsInfo.length; _nwsIdx++) { for (let _nwsIdx = 1; _nwsIdx <= _newsInfo.length; _nwsIdx++) {
if (_newsInfo[_nwsIdx].logo.download != "") { if (_newsInfo[_nwsIdx].logo.download != "") {
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>`; sz_li_news += `<li data-update=item${_nwsIdx}><img src=" ${_newsInfo[_nwsIdx].logo.download}"/>${_newsInfo[_nwsIdx].content[_state.lang]}</li>`;
} else { } else {
sz_li_news += `<li data-update=item${_nwsIdx}><img src=" ${_newsInfo[_nwsIdx].logo.download}"/>${_newsInfo[_nwsIdx].content.default}</li>`;
}
} else {
if (_newsInfo[_nwsIdx].multilanguage == true) {
sz_li_news += `<li data-update=item${_nwsIdx}>${_newsInfo[_nwsIdx].content[_state.lang]}</li>`; 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); _hndlNewsTicker.html(sz_li_news);
@@ -3820,6 +3903,7 @@ HotelTV.ui_appfull = (function() {
height: '26px', height: '26px',
speed: 100 speed: 100
}); });
_hndlNewsTicker.webTicker('update');
} else { } else {
let sz_li_news = ""; let sz_li_news = "";
for (let _nwsIdx = 1; _nwsIdx <= _newsInfo.length; _nwsIdx++) { for (let _nwsIdx = 1; _nwsIdx <= _newsInfo.length; _nwsIdx++) {
@@ -5759,10 +5843,10 @@ HotelTV.ui_appfull = (function() {
} }
} }
} else if (_state.menu.stage.cur == "tvCtgHide") { } else if (_state.menu.stage.cur == "tvCtgHide") {
if (event.keyCode == gRmtKey.chup) { if (event.keyCode == gRmtKey.up || event.keyCode == gRmtKey.chup) {
// 채널 리스트 아이탬 이동(CHUP) // 채널 리스트 아이탬 이동(CHUP)
__ifxn_moveTvChannel(_tvProg, "ch_up"); __ifxn_moveTvChannel(_tvProg, "ch_up");
} else if (event.keyCode == gRmtKey.chdown) { } else if (event.keyCode == gRmtKey.down || event.keyCode == gRmtKey.chdown) {
// 채널 리스트 아이탬 이동(CHDOWN) // 채널 리스트 아이탬 이동(CHDOWN)
__ifxn_moveTvChannel(_tvProg, "ch_down"); __ifxn_moveTvChannel(_tvProg, "ch_down");
} else if (event.keyCode == gRmtKey.back) { } else if (event.keyCode == gRmtKey.back) {
@@ -5806,6 +5890,7 @@ HotelTV.ui_appfull = (function() {
$('#lst_tvCtgbg').on('translated.owl.carousel', function(event) { $('#lst_tvCtgbg').on('translated.owl.carousel', function(event) {
__uifxn_AppFull_TVUpdateChList("on_load"); __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); document.addEventListener("hdmi_connection_changed", __uifxn_AppFull_OnHdmiConChangeEvt, false);
//ADD Event for the result of channel changed //ADD Event for the result of channel changed
document.addEventListener("channel_changed", __uifxn_AppFull_OnTvChChgChangeEvt, false); document.addEventListener("channel_changed", __uifxn_AppFull_OnTvChChgChangeEvt, false);
//ADD power mode changed
document.addEventListener("power_mode_changed", __uifxn_AppFull_OnPwrModeChangeEvt, false);
}, },
Show: function() { Show: function() {

View File

@@ -171,7 +171,7 @@ div#lst_mypagebg div #mp_hotel_infowin {
} }
div#lst_mypagebg div #mp_hotel_infowin .hotelinfo_item { div#lst_mypagebg div #mp_hotel_infowin .hotelinfo_item {
width: 506px; width: 32%;
height: 100%; height: 100%;
display: inline-block; display: inline-block;
padding: 5px; padding: 5px;

View File

@@ -35,8 +35,8 @@
background-image: none; background-image: none;
background-size: contain; background-size: contain;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: left center; background-position: center center;
margin: 10px 0 4px 20px; margin: 10px 0 4px 10px;
display: block; display: block;
} }

View File

@@ -171,7 +171,7 @@ div#lst_mypagebg div #mp_hotel_infowin {
} }
div#lst_mypagebg div #mp_hotel_infowin .hotelinfo_item { div#lst_mypagebg div #mp_hotel_infowin .hotelinfo_item {
width: 506px; width: 32%;
height: 100%; height: 100%;
display: inline-block; display: inline-block;
padding: 5px; padding: 5px;