issue #10 #11 Change to online mode to local-storage mode.

This commit is contained in:
paul kim
2024-07-04 16:23:31 +09:00
parent f2e0890c3d
commit 16ecff93d8
8 changed files with 149 additions and 90 deletions

View File

@@ -212,11 +212,57 @@ HotelTV.Init = async function() {
//STEP#03::> Get Device Info
HotelTV.ui_utils.SetBusy(true);
const __ifxn_showFatalErr_Network = function() {
let _tmval = 10;
setTimeout(HotelTV.hal.Reboot, 10000);
HotelTV.ui_utils.SetBusy(false);
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-devinfo",
"SYSTEM ERROR",
"Network is un-available.\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": null
});
}
try {
//
let __netStatus = await HotelTV.hal.GetNetworkStatus();
if ( __netStatus.info==null || __netStatus.error==true ){
console.info("aa");
__ifxn_showFatalErr_Network();
return;
} else {
console.info("bb");
if ( __netStatus.info.ip_address=="0.0.0.0" || __netStatus.info.gateway=="0.0.0.0" ) {
console.info("Fatall.......");
__ifxn_showFatalErr_Network();
return;
}
}
} catch ( _err ) {
console.info("cc");
__ifxn_showFatalErr_Network();
return;
}
try {
await HotelTV.hal.GetDevInfo();
//await HotelTV.hal.ShowDevInfo();
} catch (_error) {
let _tmval = 50;
setTimeout(HotelTV.hal.Reboot, 49000);
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-devinfo",
"SYSTEM ERROR",
@@ -230,9 +276,7 @@ HotelTV.Init = async function() {
}
$('.error #countdown #message').text(`System will be reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hal.Reboot, 500);
}
"cb_eoe": null
});
}
@@ -244,6 +288,7 @@ HotelTV.Init = async function() {
HotelTV.state['registration'] = await HotelTV.api.CheckRegistration();
} catch (_error) {
let _tmval = 50;
setTimeout(HotelTV.hal.Reboot, 49000);
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.check-registration",
"SYSTEM ERROR",
@@ -257,9 +302,7 @@ HotelTV.Init = async function() {
}
$('.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.hal.Reboot, 500);
}
"cb_eoe": null
});
}
@@ -278,6 +321,7 @@ HotelTV.Init = async function() {
HotelTV.ui_utils.SetBusy(false);
let _tmval = 20;
setTimeout(HotelTV.hal.Reboot, 20000);
HotelTV.ui_utils.ShowErrMsg(true,
"system.info.change-configuration",
"SYSTEM INFO",
@@ -291,14 +335,13 @@ HotelTV.Init = async function() {
}
$('.error #countdown #message').text(`System will be reboot in ${_tmval} second...`);
},
"cb_eoe": function() {
setTimeout(HotelTV.hal.Reboot, 500);
}
"cb_eoe": null
});
return;
}
} catch (_error) {
let _tmval = 50;
setTimeout(HotelTV.hal.Reboot, 49000);
HotelTV.ui_utils.ShowErrMsg(true,
"system.set-devinfo",
"SYSTEM ERROR",
@@ -312,9 +355,7 @@ HotelTV.Init = async function() {
}
$('.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.hal.Reboot, 500);
}
"cb_eoe": null
});
}
@@ -322,6 +363,7 @@ HotelTV.Init = async function() {
HotelTV.hotelinfo = await HotelTV.api.GetHotelInfo();
} catch (_error) {
let _tmval = 50;
setTimeout(HotelTV.hal.Reboot, 49000);
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-hotelinfo",
"SYSTEM ERROR",
@@ -335,9 +377,7 @@ HotelTV.Init = async function() {
}
$('.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.hal.Reboot, 500);
}
"cb_eoe": null
});
}
// state[theme_root] 정의
@@ -351,6 +391,7 @@ HotelTV.Init = async function() {
HotelTV.guestinfo = await HotelTV.api.GetGuestInfo();
} catch (_error) {
let _tmval = 50;
setTimeout(HotelTV.hal.Reboot, 49000);
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-guestinfo",
"SYSTEM ERROR",
@@ -364,9 +405,7 @@ HotelTV.Init = async function() {
}
$('.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.hal.Reboot, 500);
}
"cb_eoe": null
});
}
@@ -374,6 +413,7 @@ HotelTV.Init = async function() {
HotelTV.opening = await HotelTV.api.GetOpeningCtz();
} catch (_error) {
let _tmval = 50;
setTimeout(HotelTV.hal.Reboot, 49000);
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-openingctzinfo",
"SYSTEM ERROR",
@@ -387,9 +427,7 @@ HotelTV.Init = async function() {
}
$('.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.hal.Reboot, 500);
}
"cb_eoe": null
});
}
@@ -409,6 +447,7 @@ HotelTV.Init = async function() {
HotelTV.widget = await HotelTV.api.GetWidgetCtz();
} catch (_error) {
let _tmval = 50;
setTimeout(HotelTV.hal.Reboot, 49000);
//console.log("Display Error page for get widget info");
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-widget",
@@ -423,9 +462,7 @@ HotelTV.Init = async function() {
}
$('.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.hal.Reboot, 500);
}
"cb_eoe": null
});
}
@@ -433,6 +470,7 @@ HotelTV.Init = async function() {
HotelTV.tvguide = await HotelTV.api.GetProgramCtz();
} catch (_error) {
let _tmval = 50;
setTimeout(HotelTV.hal.Reboot, 49000);
//console.log("Display Error page for get tvguide info");
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.get-tvguideinfo",
@@ -447,9 +485,7 @@ HotelTV.Init = async function() {
}
$('.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.hal.Reboot, 500);
}
"cb_eoe": null
});
}
@@ -516,6 +552,7 @@ HotelTV.Init = async function() {
}
} else {
let _tmval = 60;
setTimeout(HotelTV.hal.Reboot, 59000);
HotelTV.ui_utils.ShowErrMsg(true,
"system.error.unregistered-device",
"SYSTEM ERROR",
@@ -529,17 +566,14 @@ HotelTV.Init = async function() {
$('.error #countdown').fadeIn(1000);
}
},
"cb_eoe": function() {
$('.error #countdown #message').text(`The Device ID is ${HotelTV.devinfo.serial_number}.\r\n\r\nSystem will be reboot`);
setTimeout(HotelTV.hal.Reboot, 500);
}
"cb_eoe": null
}
);
}
console.log("Initialization:: Done");
HotelTV.ui_utils.SetBusy(false);
SpatialNavigation.init();
//SpatialNavigation.init();
};
HotelTV.LoadWelCome = async function() {