issue#1 Support error screen. Support notification balloon for neflix service preparing. Going on tune up UI.

This commit is contained in:
Paul Kim
2022-06-08 02:22:39 +09:00
parent 8b0160bfda
commit cf95ff42b0
16 changed files with 628 additions and 250 deletions

View File

@@ -6,7 +6,7 @@
* @summary short description for the file
* @author Joel <joel.kim@centirm.com>
*
* Created at : 2020-11-26 02:21:56
* Created at : 2020-11-26 02:21:56
* Last modified : 2020-11-26 15:31:40
*/
@@ -74,7 +74,7 @@ var HotelTV = HotelTV || {
HotelTV.namespace = function(ns_string) {
var parts = ns_string.split('.'),
parent = HotelTV,
i; // 처음에 중복되는 전역 객체명은 제거한다.
i; // 처음에 중복되는 전역 객체명은 제거한다.
if (parts[0] == 'HotelTV') {
parts = parts.slice(1);
}
@@ -157,7 +157,7 @@ function __fxn_Set_DebugOpt() {
HotelTV.Init = async function() {
console.log("Start Initialization:: ");
//STEP#01::> Shutdown Channel
//STEP#01::> Shutdown Channel
HotelTV.hcap.ChannelShutDown();
//SETP#02::> Set Debug Options
@@ -169,7 +169,24 @@ HotelTV.Init = async function() {
await HotelTV.hcap.GetDevInfo();
//await HotelTV.hcap.ShowDevInfo();
} catch (_error) {
console.log("Fail to get device information");
let _tmval = 10;
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-devinfo",
"SYSTEM ERROR",
"Fail to get System Information.\r\nplease contact your system administrator.", {
"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 reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hcap.Reboot(), 500);
}
});
}
//STEP#04::> API Module INIT
@@ -179,7 +196,24 @@ HotelTV.Init = async function() {
let __apiRet = await HotelTV.api.CheckRegistration();
HotelTV.state['registration'] = await HotelTV.api.CheckRegistration();
} catch (_error) {
console.log("Display Error page for check registration");
let _tmval = 50;
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.check-registration",
"SYSTEM ERROR",
"Un registered device.\r\nplease contact your system administrator.", {
"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(`The Device ID is ${HotelTV.devinfo.serial_number}.\r\n\r\nSystem will be reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hcap.Reboot(), 500);
}
});
}
if (HotelTV.state['registration'].registered != true) {
@@ -195,30 +229,115 @@ HotelTV.Init = async function() {
if (need_reboot == true) {
console.log("System Need to Reboot");
HotelTV.ui_utils.SetBusy(false);
HotelTV.ui_utils.ShowErrMsg(true, "", "");
setTimeout(HotelTV.hcap.Reboot(), 3000);
let _tmval = 20;
HotelTV.ui_utils.ShowErrMsg(true,
"system.info.change-configuration",
"SYSTEM INFO",
`System configuration was changed.\r\n\r\nSystem information summary::\r\nDevice Serial Number: ${HotelTV.devinfo.serial_number}\r\nThe Device Model Name: ${HotelTV.devinfo.model_name}\r\nNetwork Configuration:${HotelTV.devinfo.network_info.ip_address}/${HotelTV.devinfo.network_info.subnet_mask}/${HotelTV.devinfo.network_info.gateway}`, {
"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 reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hcap.Reboot(), 500);
}
});
return;
}
} catch (_error) {
console.log("Display Error page for get stttings");
let _tmval = 50;
HotelTV.ui_utils.ShowErrMsg(true,
"system.set-devinfo",
"SYSTEM ERROR",
"Fail to configure device.\r\nplease contact your system administrator.", {
"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(`The Device ID is ${HotelTV.devinfo.serial_number}.\r\n\r\nSystem will be reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hcap.Reboot(), 500);
}
});
}
try {
HotelTV.hotelinfo = await HotelTV.api.GetHotelInfo();
} catch (_error) {
console.log("Display Error page for get hotel info");
let _tmval = 50;
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-hotelinfo",
"SYSTEM ERROR",
"Fail to get hotel information.\r\nplease contact your system administrator.", {
"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(`The Device ID is ${HotelTV.devinfo.serial_number}.\r\n\r\nSystem will be reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hcap.Reboot(), 500);
}
});
}
try {
HotelTV.guestinfo = await HotelTV.api.GetGuestInfo();
} catch (_error) {
console.log("Display Error page for get Guest info");
let _tmval = 50;
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-guestinfo",
"SYSTEM ERROR",
"Fail to get guest information.\r\nplease contact your system administrator.", {
"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(`The Device ID is ${HotelTV.devinfo.serial_number}.\r\n\r\nSystem will be reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hcap.Reboot(), 500);
}
});
}
try {
HotelTV.opening = await HotelTV.api.GetOpeningCtz();
} catch (_error) {
console.log("Display Error page for get Opening Contents");
let _tmval = 50;
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-openingctzinfo",
"SYSTEM ERROR",
"Fail to get opening contents information.\r\nplease contact your system administrator.", {
"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(`The Device ID is ${HotelTV.devinfo.serial_number}.\r\n\r\nSystem will be reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hcap.Reboot(), 500);
}
});
}
try {
@@ -236,7 +355,24 @@ HotelTV.Init = async function() {
try {
HotelTV.tvguide = await HotelTV.api.GetProgramCtz();
} catch (_error) {
console.log("Display Error page for get tvguide info");
//console.log("Display Error page for get tvguide info");
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-tvguideinfo",
"SYSTEM ERROR",
"Fail to get tv program contents information.\r\nplease contact your system administrator.", {
"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(`The Device ID is ${HotelTV.devinfo.serial_number}.\r\n\r\nSystem will be reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hcap.Reboot(), 500);
}
});
}
try {
@@ -403,30 +539,44 @@ HotelTV.LoadAppFull = async function() {
//STEP#03: INIT HCAP for HotelTV FullAPP
try {
let siAppToken = null;
let siAppName = null;
// siApp Token Authentication
let _progam = HotelTV.tvguide.program;
for (let _i = 1; _i <= _progam.length; _i++) {
if (_progam[_i].type == "application" && _progam[_i].service == "netflix") {
siAppToken = await HotelTV.api.DownloadData(_progam[_i].license.file.download);
siAppName = _progam[_i].service;
//siAppToken = _progam[_i].service;
if (siAppName && siAppToken) {
HotelTV.hcap.siAppAuth(siAppName, siAppToken, false);
}
let tmrAppAuth = setInterval(async function() {
let _foundNetflix = false;
let _hcapAppInfo = await HotelTV.hcap.PreAppGetInfo(false);
HotelTV.state['hcap_app'] = _hcapAppInfo.applist;
for (_i = 0; _i < HotelTV.state['hcap_app'].length; _i++) {
if (HotelTV.state['hcap_app'][_i].title == "Netflix") {
console.log("Found out netflix among of pre hcap app-list.")
clearInterval(tmrAppAuth);
}
}
} catch (_error) {
console.log("Display Error page for get siApp Auth");
}
if (_foundNetflix == false) {
try {
let siAppToken = null;
let siAppName = null;
// siApp Token Authentication
let _progam = HotelTV.tvguide.program;
for (let _i = 1; _i <= _progam.length; _i++) {
if (_progam[_i].type == "application" && _progam[_i].service == "netflix") {
siAppToken = await HotelTV.api.DownloadData(_progam[_i].license.file.download);
siAppName = _progam[_i].service;
//siAppToken = _progam[_i].service;
if (siAppName && siAppToken) {
HotelTV.hcap.siAppAuth(siAppName, siAppToken, false);
}
}
}
} catch (_error) {
console.log("Display Error page for get siApp Auth");
}
}
}, 5000);
//STEP#05: Set Display size
let _res = HotelTV.devinfo.display_resolution.split("x");
HotelTV.ui_appfull.Init(_res[0], _res[1]);
HotelTV.hcap.PreAppGetInfo(false);
//STEP#06; Show UI
//await HotelTV.hcap.ShowDevInfo();
@@ -470,28 +620,28 @@ HotelTV.LoadAppFull = async function() {
// }
// } else if (recvMsg.event == "update_weather") {
// } else if (recvMsg.event == "update_report") {
// // HotelTV.hcap.GetUptime();
// // HotelTV.hcap.GetDeviceUsage().then(_usage => {
// // //console.log(`USAGE::> CPU[${_usage.cpu}%] RAM[${_usage.mem}%]`);
// // //HotelTV.api.ReportBrief(HotelTV.devinfo, HotelTV.guestinfo, _usage);
// // });
// } else if (recvMsg.event == "mqtt_events") {
// console.log(`MQTTMSG::> ${recvMsg.data}`);
// }
// if (recvMsg.event == "update_report") {
// HotelTV.hcap.GetUptime();
// HotelTV.hcap.GetDeviceUsage().then(_usage => {
// console.log(`USAGE::> CPU[${_usage.cpu}%] RAM[${_usage.mem}%]`);
// //HotelTV.api.ReportBrief(HotelTV.devinfo, HotelTV.guestinfo, _usage);
// });
// }
}
} else {
console.log('Your browser doesn\'t support web workers.')
}
//STEP#07 MQTT Service
//STEP#07 MQTT Service
if (HotelTV.services) {
if (HotelTV.services.mqtt) {
let _mqttSvcInfo = HotelTV.services.mqtt;
if (_mqttSvcInfo.protocol == "ws") {
var client = mqtt.connect(
//'ws://' + HotelTV.svrinfo.ipaddr + ':9001',
//'ws://' + HotelTV.svrinfo.ipaddr + ':9001',
'ws://' + _mqttSvcInfo.host + ':' + _mqttSvcInfo.port, {
clean: true, // retain session
connectTimeout: 4000, // Timeout period
@@ -502,20 +652,6 @@ HotelTV.LoadAppFull = async function() {
);
client.on('connect', function() {
// let sz_topic = ['ctlxb0_' + HotelTV.devinfo.serial_number + '/topic', 'ctlxb0_all/topic'];
// client.subscribe(sz_topic[0], function(err) {
// if (err) {
// console.log(`Fail to subscribe::TOPIC[${sz_topic[0]}]`);
// }
// });
// client.subscribe(sz_topic[1], function(err) {
// if (err) {
// console.log(`Fail to subscribe::TOPIC[${sz_topic[1]}]`);
// }
// })
client.subscribe(_mqttSvcInfo.topic, function(err) {
if (err) {
console.log(`Fail to subscribe::TOPIC[${_mqttSvcInfo.topic}]`);