373
procentric/application/lib/acmeticker.js
Executable file
373
procentric/application/lib/acmeticker.js
Executable file
@@ -0,0 +1,373 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
$.fn.AcmeTicker = function(options) {
|
||||
/*Merge options and default options*/
|
||||
let opts = $.extend({}, $.fn.AcmeTicker.defaults, options);
|
||||
|
||||
/*Functions Scope*/
|
||||
let thisTicker = $(this),
|
||||
intervalID, timeoutID, isPause = false;
|
||||
|
||||
/*Always wrap, used in many place*/
|
||||
thisTicker.wrap("<div class='acmeticker-wrap'></div>");
|
||||
|
||||
/*Wrap is always relative*/
|
||||
thisTicker.parent().css({
|
||||
position: 'relative'
|
||||
})
|
||||
/*Hide expect first*/
|
||||
thisTicker.children("li").not(":first").hide();
|
||||
|
||||
/*Lets init*/
|
||||
init();
|
||||
|
||||
function init() {
|
||||
switch (opts.type) {
|
||||
case 'vertical':
|
||||
case 'horizontal':
|
||||
vertiZontal()
|
||||
break;
|
||||
|
||||
case 'marquee':
|
||||
marQuee()
|
||||
break;
|
||||
|
||||
case 'typewriter':
|
||||
typeWriter()
|
||||
break;
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/*Vertical - horizontal
|
||||
* **Do not change code lines*/
|
||||
function vertiZontal(prevNext = false) {
|
||||
let speed = opts.speed,
|
||||
autoplay = opts.autoplay,
|
||||
direction = opts.direction;
|
||||
|
||||
if (prevNext) {
|
||||
speed = 0;
|
||||
autoplay = 0;
|
||||
clearInterval(intervalID);
|
||||
intervalID = false;
|
||||
}
|
||||
|
||||
function play() {
|
||||
if (isPause) {
|
||||
clearInterval(intervalID);
|
||||
intervalID = false;
|
||||
return false;
|
||||
}
|
||||
let dChild,
|
||||
eqType,
|
||||
mType,
|
||||
mVal;
|
||||
|
||||
dChild = thisTicker.find('li:first');
|
||||
if (direction === 'up' || direction === 'right') {
|
||||
eqType = '-=';
|
||||
} else {
|
||||
eqType = '+=';
|
||||
}
|
||||
if (opts.type === 'horizontal') {
|
||||
mType = 'left';
|
||||
mVal = dChild.outerWidth(true);
|
||||
} else {
|
||||
mType = 'margin-top';
|
||||
mVal = dChild.outerHeight(true);
|
||||
}
|
||||
if (prevNext === 'prev') {
|
||||
thisTicker.find('li:last').detach().prependTo(thisTicker);
|
||||
} else {
|
||||
dChild.detach().appendTo(thisTicker);
|
||||
}
|
||||
|
||||
thisTicker.find('li').css({
|
||||
opacity: '0',
|
||||
display: 'none'
|
||||
});
|
||||
thisTicker.find('li:first').css({
|
||||
opacity: '1',
|
||||
position: 'absolute',
|
||||
display: 'block',
|
||||
[mType]: eqType + mVal + 'px',
|
||||
});
|
||||
thisTicker.find('li:first').animate({
|
||||
[mType]: '0px'
|
||||
},
|
||||
speed,
|
||||
function() {
|
||||
clearInterval(intervalID);
|
||||
intervalID = false;
|
||||
vertiZontal();
|
||||
});
|
||||
}
|
||||
if (intervalID) {
|
||||
return false
|
||||
}
|
||||
intervalID = setInterval(play, autoplay);
|
||||
}
|
||||
|
||||
/*Type-Writer
|
||||
* **Do not change code lines*/
|
||||
function typeWriter(prevNext = false) {
|
||||
if (isPause) {
|
||||
return false;
|
||||
}
|
||||
if (prevNext) {
|
||||
clearInterval(intervalID);
|
||||
intervalID = false;
|
||||
|
||||
clearTimeout(timeoutID);
|
||||
timeoutID = false;
|
||||
|
||||
if (prevNext === 'prev') {
|
||||
thisTicker.find('li:last').detach().prependTo(thisTicker);
|
||||
} else {
|
||||
thisTicker.find('li:first').detach().appendTo(thisTicker);
|
||||
}
|
||||
}
|
||||
|
||||
let speed = opts.speed,
|
||||
autoplay = opts.autoplay,
|
||||
typeEl = thisTicker.find('li:first'),
|
||||
wrapEl = typeEl.children(),
|
||||
count = 0;
|
||||
|
||||
if (typeEl.attr('data-text')) {
|
||||
wrapEl.text(typeEl.attr('data-text'))
|
||||
}
|
||||
|
||||
let allText = typeEl.text();
|
||||
|
||||
thisTicker.find('li').css({
|
||||
opacity: '0',
|
||||
display: 'none'
|
||||
});
|
||||
|
||||
function tNext() {
|
||||
thisTicker.find('li:first').detach().appendTo(thisTicker);
|
||||
|
||||
clearTimeout(timeoutID);
|
||||
timeoutID = false;
|
||||
|
||||
typeWriter();
|
||||
}
|
||||
|
||||
function type() {
|
||||
count++;
|
||||
let typeText = allText.substring(0, count);
|
||||
if (!typeEl.attr('data-text')) {
|
||||
typeEl.attr('data-text', allText);
|
||||
}
|
||||
|
||||
if (count <= allText.length) {
|
||||
wrapEl.text(typeText);
|
||||
typeEl.css({
|
||||
opacity: '1',
|
||||
display: 'block',
|
||||
});
|
||||
} else {
|
||||
clearInterval(intervalID);
|
||||
intervalID = false;
|
||||
timeoutID = setTimeout(tNext, autoplay);
|
||||
}
|
||||
}
|
||||
if (!intervalID) {
|
||||
intervalID = setInterval(type, speed);
|
||||
}
|
||||
}
|
||||
|
||||
/*marQuee
|
||||
* **Do not change code lines*/
|
||||
function marQuee() {
|
||||
/*Marquee Special*/
|
||||
let speed = opts.speed,
|
||||
direction = opts.direction,
|
||||
wrapWidth,
|
||||
dir = 'left',
|
||||
totalTravel,
|
||||
defTiming,
|
||||
listWidth = 0,
|
||||
mPause = false;
|
||||
|
||||
mInit();
|
||||
|
||||
function mInit() {
|
||||
thisTicker.css({
|
||||
position: 'absolute'
|
||||
})
|
||||
thisTicker.find('li').css({
|
||||
display: 'inline-block',
|
||||
marginRight: '10px',
|
||||
});
|
||||
let tickerList = thisTicker.find("li");
|
||||
wrapWidth = thisTicker.parent().outerWidth(true);
|
||||
|
||||
if (direction === 'right') {
|
||||
dir = 'right'
|
||||
}
|
||||
|
||||
/*Calculating ticker width*/
|
||||
thisTicker.width(10000); /*temporary width to prevent inline elements wrapping to initial width of ticker*/
|
||||
tickerList.each(function() {
|
||||
listWidth += $(this).outerWidth(true) + 5; /*+5 for some missing px*/
|
||||
});
|
||||
thisTicker.width(listWidth);
|
||||
|
||||
totalTravel = listWidth + wrapWidth;
|
||||
defTiming = totalTravel / speed;
|
||||
|
||||
marQueeIt(listWidth, listWidth / speed);
|
||||
}
|
||||
|
||||
function marQueeIt(lPos, lSpeed) {
|
||||
thisTicker.animate({
|
||||
[dir]: '-=' + lPos
|
||||
},
|
||||
lSpeed,
|
||||
"linear",
|
||||
function() {
|
||||
thisTicker.css({
|
||||
[dir]: wrapWidth
|
||||
});
|
||||
marQueeIt(totalTravel, defTiming);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function mRestart() {
|
||||
let offset = thisTicker.offset(),
|
||||
rOffset = direction === 'right' ? (listWidth - offset.left) : offset.left,
|
||||
remainingSpace = rOffset + listWidth,
|
||||
remainingTime = remainingSpace / speed;
|
||||
|
||||
marQueeIt(remainingSpace, remainingTime);
|
||||
}
|
||||
|
||||
function mToggle() {
|
||||
console.log('mToggle')
|
||||
|
||||
mPause = !mPause;
|
||||
$(document).trigger('acmeTickerToggle', thisTicker, mPause)
|
||||
if (mPause) {
|
||||
thisTicker.stop();
|
||||
} else {
|
||||
mRestart();
|
||||
}
|
||||
}
|
||||
|
||||
opts.controls.toggle && opts.controls.toggle.on('click', function(e) {
|
||||
mToggle();
|
||||
});
|
||||
if (opts.pauseOnHover) {
|
||||
thisTicker.on('mouseenter', function() {
|
||||
thisTicker.stop();
|
||||
}).on('mouseleave', function() {
|
||||
mRestart();
|
||||
});
|
||||
}
|
||||
if (opts.pauseOnFocus) {
|
||||
thisTicker.on('focusin', function() {
|
||||
thisTicker.stop();
|
||||
}).on('focusout', function() {
|
||||
mRestart();
|
||||
});
|
||||
}
|
||||
}
|
||||
/*marQuee End*/
|
||||
|
||||
/*Actions/Controls*/
|
||||
if (opts.type !== 'marquee') {
|
||||
opts.controls.prev && opts.controls.prev.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
switch (opts.type) {
|
||||
case 'typewriter':
|
||||
typeWriter('prev')
|
||||
break;
|
||||
|
||||
default:
|
||||
vertiZontal('prev')
|
||||
break
|
||||
}
|
||||
});
|
||||
opts.controls.next && opts.controls.next.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
switch (opts.type) {
|
||||
case 'typewriter':
|
||||
typeWriter('next')
|
||||
break;
|
||||
|
||||
default:
|
||||
vertiZontal('next')
|
||||
break
|
||||
}
|
||||
});
|
||||
|
||||
function restart() {
|
||||
if (!isPause) {
|
||||
init();
|
||||
}
|
||||
}
|
||||
opts.controls.toggle && opts.controls.toggle.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
isPause = !isPause;
|
||||
$(document).trigger('acmeTickerToggle', thisTicker, isPause)
|
||||
restart();
|
||||
});
|
||||
if (opts.pauseOnHover) {
|
||||
thisTicker.on('mouseenter', function() {
|
||||
isPause = true;
|
||||
restart();
|
||||
}).on('mouseleave', function() {
|
||||
isPause = false;
|
||||
restart();
|
||||
});
|
||||
}
|
||||
if (opts.pauseOnFocus) {
|
||||
thisTicker.on('focusin', function() {
|
||||
isPause = true;
|
||||
restart();
|
||||
}).on('focusout', function() {
|
||||
isPause = false;
|
||||
restart();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// plugin defaults - added as a property on our plugin function
|
||||
$.fn.AcmeTicker.defaults = {
|
||||
/*Note: Marquee only take speed not autoplay*/
|
||||
type: 'horizontal',
|
||||
/*vertical/horizontal/marquee/typewriter*/
|
||||
autoplay: 2000,
|
||||
/*true/false/number*/
|
||||
/*For vertical/horizontal 4000*/
|
||||
/*For typewriter 2000*/
|
||||
speed: 50,
|
||||
/*true/false/number*/
|
||||
/*For vertical/horizontal 600*/
|
||||
/*For marquee 0.05*/
|
||||
/*For typewriter 50*/
|
||||
direction: 'up',
|
||||
/*up/down/left/right*/
|
||||
/*For vertical up/down*/
|
||||
/*For horizontal/marquee right/left*/
|
||||
/*For typewriter direction doesnot work*/
|
||||
pauseOnFocus: true,
|
||||
pauseOnHover: true,
|
||||
controls: {
|
||||
prev: '',
|
||||
/*Can be used for vertical/horizontal/typewriter*/
|
||||
/*not work for marquee*/
|
||||
next: '',
|
||||
/*Can be used for vertical/horizontal/typewriter*/
|
||||
/*not work for marquee*/
|
||||
toggle: '' /*Can be used for vertical/horizontal/marquee/typewriter*/
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
2
procentric/application/lib/acmeticker.min.js
vendored
Executable file
2
procentric/application/lib/acmeticker.min.js
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
!function(t){"use strict";t.fn.AcmeTicker=function(e){let n,i,o=t.extend({},t.fn.AcmeTicker.defaults,e),c=t(this),r=!1;function a(){switch(o.type){case"vertical":case"horizontal":l();break;case"marquee":!function(){let e,n,i,r=o.speed,a=o.direction,l="left",s=0,u=!1;function f(t,o){c.animate({[l]:"-="+t},o,"linear",function(){c.css({[l]:e}),f(n,i)})}function p(){let t=c.offset(),e="right"===a?s-t.left:t.left,n=e+s,i=n/r;f(n,i)}(function(){c.css({position:"absolute"}),c.find("li").css({display:"inline-block",marginRight:"10px"});let o=c.find("li");e=c.parent().outerWidth(!0),"right"===a&&(l="right"),c.width(1e4),o.each(function(){s+=t(this).outerWidth(!0)+5}),c.width(s),i=(n=s+e)/r,f(s,s/r)})(),o.controls.toggle&&o.controls.toggle.on("click",function(e){console.log("mToggle"),u=!u,t(document).trigger("acmeTickerToggle",c,u),u?c.stop():p()}),o.pauseOnHover&&c.on("mouseenter",function(){c.stop()}).on("mouseleave",function(){p()});o.pauseOnFocus&&c.on("focusin",function(){c.stop()}).on("focusout",function(){p()})}();break;case"typewriter":s()}}function l(t=!1){let e=o.speed,i=o.autoplay,a=o.direction;if(t&&(e=0,i=0,clearInterval(n),n=!1),n)return!1;n=setInterval(function(){if(r)return clearInterval(n),n=!1,!1;let i,s,u,f;i=c.find("li:first"),s="up"===a||"right"===a?"-=":"+=","horizontal"===o.type?(u="left",f=i.outerWidth(!0)):(u="margin-top",f=i.outerHeight(!0)),"prev"===t?c.find("li:last").detach().prependTo(c):i.detach().appendTo(c),c.find("li").css({opacity:"0",display:"none"}),c.find("li:first").css({opacity:"1",position:"absolute",display:"block",[u]:s+f+"px"}),c.find("li:first").animate({[u]:"0px"},e,function(){clearInterval(n),n=!1,l()})},i)}function s(t=!1){if(r)return!1;t&&(clearInterval(n),n=!1,clearTimeout(i),i=!1,"prev"===t?c.find("li:last").detach().prependTo(c):c.find("li:first").detach().appendTo(c));let e=o.speed,a=o.autoplay,l=c.find("li:first"),u=l.children(),f=0;l.attr("data-text")&&u.text(l.attr("data-text"));let p=l.text();function d(){c.find("li:first").detach().appendTo(c),clearTimeout(i),i=!1,s()}c.find("li").css({opacity:"0",display:"none"}),n||(n=setInterval(function(){f++;let t=p.substring(0,f);l.attr("data-text")||l.attr("data-text",p),f<=p.length?(u.text(t),l.css({opacity:"1",display:"block"})):(clearInterval(n),n=!1,i=setTimeout(d,a))},e))}if(c.wrap("<div class='acmeticker-wrap'></div>"),c.parent().css({position:"relative"}),c.children("li").not(":first").hide(),a(),"marquee"!==o.type){function u(){r||a()}o.controls.prev&&o.controls.prev.on("click",function(t){switch(t.preventDefault(),o.type){case"typewriter":s("prev");break;default:l("prev")}}),o.controls.next&&o.controls.next.on("click",function(t){switch(t.preventDefault(),o.type){case"typewriter":s("next");break;default:l("next")}}),o.controls.toggle&&o.controls.toggle.on("click",function(e){e.preventDefault(),r=!r,t(document).trigger("acmeTickerToggle",c,r),u()}),o.pauseOnHover&&c.on("mouseenter",function(){r=!0,u()}).on("mouseleave",function(){r=!1,u()}),o.pauseOnFocus&&c.on("focusin",function(){r=!0,u()}).on("focusout",function(){r=!1,u()})}},t.fn.AcmeTicker.defaults={type:"horizontal",autoplay:2e3,speed:50,direction:"up",pauseOnFocus:!0,pauseOnHover:!0,controls:{prev:"",next:"",toggle:""}}}(jQuery);
|
||||
//# sourceMappingURL=acmeticker.min.js.map
|
||||
530
procentric/application/lib/hcap.debug.js
Executable file
530
procentric/application/lib/hcap.debug.js
Executable file
@@ -0,0 +1,530 @@
|
||||
/*!
|
||||
* ============================================================================
|
||||
* Creative Innovation Center, LG ELECTRONICS INC., SEOUL, KOREA
|
||||
* Copyright(c) 2018 by LG Electronics Inc.
|
||||
*
|
||||
* Release Version : 1.24.2.5850
|
||||
* ============================================================================
|
||||
*/
|
||||
var extHcapSecure;
|
||||
var extRegisterHcapCloseHandler;
|
||||
var extDisableHcapConsoleLog;
|
||||
var extWebWorker;
|
||||
var hcap;
|
||||
if (hcap === undefined) {
|
||||
(function() { hcap = { API_VERSION: "1.24.2.5850" }; var g = [],
|
||||
e = 0,
|
||||
i = [{ command_id: "0", param_text: '{"command_id" : "0", "command" : "notify_sdk_version", "hcap_js_extension_version" : "1.24.2.5850"}' }],
|
||||
k = null,
|
||||
o = false,
|
||||
d = false,
|
||||
n = false,
|
||||
c = null,
|
||||
f = null,
|
||||
l = null,
|
||||
b = false,
|
||||
m = null,
|
||||
a = null;
|
||||
|
||||
function j(r) { if (extDisableHcapConsoleLog !== true) { var t; if (r.length > 1024) { t = r.substring(0, 1024) } else { t = r } if (extWebWorker !== true) { console.log(t) } } } if (extDisableHcapConsoleLog === true) { if (extWebWorker !== true) { console.log("hcap console log is disabled") } } else { if (extWebWorker !== true) { console.log("hcap console log is enabled") } }
|
||||
j("check external value : extDisableHcapConsoleLog = " + extDisableHcapConsoleLog + ", extHcapSecure = " + extHcapSecure + ", extRegisterHcapCloseHandler = " + extRegisterHcapCloseHandler);
|
||||
|
||||
function p() { var r = navigator.userAgent,
|
||||
t = r.match(/Windows/),
|
||||
s = r.match(/Macintosh/),
|
||||
u = r.match(/Mac OS X/);
|
||||
j("UA = '" + r + "'"); if (t || s || u) { j("HCAP websocket off"); return true } return false }
|
||||
b = p();
|
||||
|
||||
function h(r, x, s, y) { var v = "",
|
||||
t = "",
|
||||
u = "";
|
||||
u = x[r]; try { v = s[u];
|
||||
t = typeof v } catch (w) { v = "<unknown value>";
|
||||
t = "unknown" } if (t === "function") { v = "{/*function*/}" } else { if (t === "object") { v = m("", v) } else { if (t === "string") { v = '"' + v + '"' } } }
|
||||
y += '"' + u + '" : ' + v; if (r < x.length - 1) { y += ", " } return y }
|
||||
m = function(u, s) { var t = 0,
|
||||
r = "",
|
||||
v = [],
|
||||
w = ""; for (r in s) { if (s.hasOwnProperty(r)) { v.push(r) } }
|
||||
v.sort(); for (t = 0; t < v.length; t += 1) { w = h(t, v, s, w) } return u + "{" + w + "}" };
|
||||
|
||||
function q(v, u) { if (extWebWorker !== true) { var t = "",
|
||||
s = v,
|
||||
r = document.createEvent("HTMLEvents");
|
||||
j(m("event received, ", u));
|
||||
r.initEvent(s, true, false); for (t in u) { if (u.hasOwnProperty(t)) { r[t] = u[t] } }
|
||||
document.dispatchEvent(r) } }
|
||||
c = function() { if (d) { j("websocket : connection is in progress"); return }
|
||||
d = true; if (extHcapSecure !== true) { j("default hcap connection");
|
||||
k = new WebSocket("ws://127.0.0.1:8053/hcap_command") } else { j("secure hcap connection");
|
||||
k = new WebSocket("wss://localhost:8054/hcap_command") }
|
||||
k.onopen = function() { j("websocket : onopen");
|
||||
d = false;
|
||||
o = true;
|
||||
setTimeout(f, 5) };
|
||||
k.onmessage = function(r) { var w = JSON.parse(r.data),
|
||||
s = w.command_id,
|
||||
v = w.command,
|
||||
u = w.result; if (s === "event") { if (v === "debug_event_received") { if (w.enable_log) { if (extWebWorker !== true) { console.log("hcap console log is enabled") } } else { if (extWebWorker !== true) { console.log("hcap console log is disabled") } }
|
||||
extDisableHcapConsoleLog = !w.enable_log } else { q(v, w) } } else { if (i.length > 0 && i[0].command_id === s) { j(m("command_id = " + s + " received, ", w)); if (u) { if (i[0].onSuccess) { try { i[0].onSuccess(w) } catch (t) { j(m("exception : onSuccess : " + t)) } } } else { if (i[0].onFailure) { try { i[0].onFailure(w) } catch (t) { j(m("exception : onFailure : " + t)) } } }
|
||||
i.splice(0, 1);
|
||||
n = false;
|
||||
f() } else { j(m("invalid response from server ", w));
|
||||
n = false;
|
||||
f() } } };
|
||||
k.onclose = function() { j("websocket : onclose");
|
||||
d = false;
|
||||
o = false;
|
||||
n = false;
|
||||
setTimeout(f, 50) }; if (extRegisterHcapCloseHandler === "onbeforeunload") { window.onbeforeunload = function() { j("close hcap websocket in onbeforeunload handler");
|
||||
k.onclose = function() { return undefined };
|
||||
k.close() } } else { if (extRegisterHcapCloseHandler === "onunload") { window.onunload = function() { j("close hcap websocket in onunload handler");
|
||||
k.onclose = function() { return undefined };
|
||||
k.close() } } } };
|
||||
f = function() { if (n) { return }
|
||||
n = true; if (o) { if (i.length > 0) { j(m("command_id = " + i[0].command_id + " sent, ", JSON.parse(i[0].param_text)));
|
||||
k.send(i[0].param_text); return } } else { c() }
|
||||
n = false };
|
||||
l = function(u, t) { if (u === null || u === "" || u === undefined) { j('[ERROR] command should not null or empty string! command === null || command === "" || command === undefined'); return } if (Object.prototype.toString.call(t) === "[object Array]") { j("[ERROR] param should be Object type({})! param is Array. command = " + u); return } if (t === null || t === undefined) { j("[ERROR] param should be Object type({})! param === null || param === undefined. command = " + u); return } if (b) { if (t.onFailure) { t.onFailure({ errorMessage: "HCAP WebSocket is not available in this browser" }) } return } if (e > 1024) { e = 0 } else { e += 1 } var r = e.toString(),
|
||||
s = "";
|
||||
t.command_id = r;
|
||||
t.command = u;
|
||||
s = JSON.stringify(t, null);
|
||||
i[i.length] = { command_id: r, param_text: s, onSuccess: t.onSuccess, onFailure: t.onFailure };
|
||||
j(m("command_id = " + r + " added, ", i[i.length - 1]));
|
||||
f() }; if (!b) { setTimeout(f, 200) }
|
||||
hcap.preloadedApplication = {};
|
||||
hcap.preloadedApplication.getPreloadedApplicationList = function(r) { l("get_preloaded_application_list", r) };
|
||||
hcap.preloadedApplication.launchPreloadedApplication = function(r) { l("launch_preloaded_application", r) };
|
||||
hcap.preloadedApplication.destroyPreloadedApplication = function(r) { l("destroy_preloaded_application", r) };
|
||||
hcap.application = {};
|
||||
hcap.application.getServiceXml = function(r) { l("get_service_xml", r) };
|
||||
hcap.application.getDefaultServiceXml = function(r) { l("get_default_service_xml", r) };
|
||||
hcap.application.getApplicationList = function(r) { l("get_application_list", r) };
|
||||
hcap.application.launchApplication = function(r) { l("launch_application", r) };
|
||||
hcap.application.destroyApplication = function(r) { l("destroy_application", r) };
|
||||
hcap.application.RegisterSIApplicationList = function(r) { l("register_si_app_list", r) };
|
||||
hcap.video = {};
|
||||
hcap.video.getVideoSize = function(r) { l("get_video_size", r) };
|
||||
hcap.video.setVideoSize = function(r) { l("set_video_size", r) };
|
||||
hcap.video.getOsdTransparencyLevel = function(r) { l("get_osd_transparency_level", r) };
|
||||
hcap.video.setOsdTransparencyLevel = function(r) { l("set_osd_transparency_level", r) };
|
||||
hcap.video.isVideoMute = function(r) { l("get_video_mute", r) };
|
||||
hcap.video.setVideoMute = function(r) { l("set_video_mute", r) };
|
||||
hcap.volume = {};
|
||||
hcap.volume.getVolumeLevel = function(r) { l("get_volume_level", r) };
|
||||
hcap.volume.setVolumeLevel = function(r) { l("set_volume_level", r) };
|
||||
hcap.volume.getExternalSpeakerVolumeLevel = function(r) { l("get_external_speaker_volume_level", r) };
|
||||
hcap.volume.setExternalSpeakerVolumeLevel = function(r) { l("set_external_speaker_volume_level", r) };
|
||||
hcap.volume.getHeadphoneVolumeLevel = function(r) { l("get_headphone_volume_level", r) };
|
||||
hcap.volume.setHeadphoneVolumeLevel = function(r) { l("set_headphone_volume_level", r) };
|
||||
hcap.volume.setHealthcareHeadphoneMode = function(r) { l("set_healthcare_headphone_mode", r) };
|
||||
hcap.volume.getHealthcareHeadphoneMode = function(r) { l("get_healthcare_headphone_mode", r) };
|
||||
hcap.channel = {};
|
||||
hcap.channel.NO_STREAM_PID = 8191;
|
||||
hcap.channel.ChannelType = { UNKNOWN: 0, RF: 1, IP: 2, RF_DATA: 3, IP_DATA: 4 };
|
||||
hcap.channel.Polarization = { UNKNOWN: 0, VERTICAL: 1, HORIZONTAL: 2, LEFT_HAND_CIRCULAR: 3, RIGHT_HAND_CIRCULAR: 4 };
|
||||
hcap.channel.RfBroadcastType = { UNKNOWN: 0, TERRESTRIAL: 16, TERRESTRIAL_2: 17, SATELLITE: 32, SATELLITE_2: 33, SATELLITE_CS1: 34, SATELLITE_CS2: 35, SATELLITE_S3_BS: 36, SATELLITE_S3_CS: 37, CABLE: 48, CABLE_STD: 49, CABLE_HRC: 50, CABLE_IRC: 51, ANALOG_PAL_BG: 64, ANALOG_PAL_DK: 65, ANALOG_PAL_I: 66, ANALOG_PAL_M: 67, ANALOG_PAL_N: 68, ANALOG_SECAM_BG: 69, ANALOG_SECAM_DK: 70, ANALOG_SECAM_L: 71, ANALOG_NTSC: 72, TERRESTRIAL_ATSC3: 80, CABLE_ATSC3: 81 };
|
||||
hcap.channel.IpBroadcastType = { UNKNOWN: 0, UDP: 16, RTP: 32 };
|
||||
hcap.channel.VideoStreamType = { MPEG1: 1, MPEG2: 2, MPEG4_VISUAL: 16, MPEG4_AVC_H264: 27, HEVC: 36, AVS: 66 };
|
||||
hcap.channel.AudioStreamType = { MPEG1: 3, MPEG2: 4, MPEG2_AAC: 15, MPEG4_HEAAC: 17, AC3: 129, EAC3: 130, ANALOG_BG: 256, ANALOG_I: 257, ANALOG_DK: 258, ANALOG_L: 259, ANALOG_MN: 260, ANALOG_LP: 261, ANALOG_END: 262 };
|
||||
hcap.channel.InbandDataServiceType = { UNKNOWN: 0, MHP: 1, MHEG: 2, HBBTV: 3, NONE: 4 };
|
||||
hcap.channel.ChannelStatus = { UNKNOWN: 0, AUDIO_VIDEO_NOT_BLOCKED: 16, AV_DISPLAYED: 16, AUDIO_VIDEO_BLOCKED: 33, NO_SIGNAL: 33, AUDIO_ONLY_BLOCKED: 34, VIDEO_ONLY_BLOCKED: 35 };
|
||||
hcap.channel.requestChangeCurrentChannel = function(r) { l("request_channel_change", r) };
|
||||
hcap.channel.getCurrentChannel = function(r) { l("get_current_channel", r) };
|
||||
hcap.channel.replayCurrentChannel = function(r) { l("replay_current_channel", r) };
|
||||
hcap.channel.stopCurrentChannel = function(r) { l("stop_current_channel", r) };
|
||||
hcap.channel.getDataChannel = function(r) { l("get_data_channel", r) };
|
||||
hcap.channel.getChannelMap = function(r) { l("get_channel_map", r) };
|
||||
hcap.channel.getStartChannel = function(r) { l("get_start_channel", r) };
|
||||
hcap.channel.setStartChannel = function(r) { l("set_start_channel", r) };
|
||||
hcap.channel.getCurrentChannelAudioLanguageList = function(r) { l("get_current_channel_audio_language_list", r) };
|
||||
hcap.channel.getCurrentChannelAudioLanguageIndex = function(r) { l("get_current_channel_audio_language_index", r) };
|
||||
hcap.channel.setCurrentChannelAudioLanguageIndex = function(r) { l("set_current_channel_audio_language_index", r) };
|
||||
hcap.channel.getCurrentChannelSubtitleList = function(r) { l("get_current_channel_subtitle_language_list", r) };
|
||||
hcap.channel.getCurrentChannelSubtitleIndex = function(r) { l("get_current_channel_subtitle_language_index", r) };
|
||||
hcap.channel.setCurrentChannelSubtitleIndex = function(r) { l("set_current_channel_subtitle_language_index", r) };
|
||||
hcap.channel.getProgramInfo = function(r) { l("get_program_info", r) };
|
||||
hcap.channel.launchInbandDataService = function(r) { l("launch_inband_data_service", r) };
|
||||
hcap.channel.getReadyInbandDataService = function(r) { l("get_ready_inband_data_service", r) };
|
||||
hcap.channel.getChannelSignalStatus = function(r) { l("get_channel_signal_status", r) };
|
||||
hcap.externalinput = {};
|
||||
hcap.externalinput.ExternalInputType = { TV: 1, COMPOSITE: 2, SVIDEO: 3, COMPONENT: 4, RGB: 5, HDMI: 6, SCART: 7, USB: 8, OTHERS: 9 };
|
||||
hcap.externalinput.getCurrentExternalInput = function(r) { l("get_external_input", r) };
|
||||
hcap.externalinput.setCurrentExternalInput = function(r) { l("set_external_input", r) };
|
||||
hcap.externalinput.isExternalInputConnected = function(r) { l("check_external_input_connected", r) };
|
||||
hcap.externalinput.getExternalInputList = function(r) { l("get_external_input_list", r) };
|
||||
hcap.carousel = {};
|
||||
hcap.carousel.requestCacheCarouselData = function(r) { l("request_content", r) };
|
||||
hcap.carousel.isCarouselDataCached = function(r) { l("is_content_loaded", r) };
|
||||
hcap.carousel.clearCarouselDataCache = function(r) { l("clear_content_cache", r) };
|
||||
hcap.mpi = {};
|
||||
hcap.mpi.sendAndReceiveMpiData = function(r) { l("send_and_receive_mpi_data", r) };
|
||||
hcap.mpi.sendMpiData = function(r) { l("send_mpi_data", r) };
|
||||
hcap.power = {};
|
||||
hcap.power.PowerMode = { WARM: 2, NORMAL: 1 };
|
||||
hcap.power.getPowerMode = function(r) { l("get_power_mode", r) };
|
||||
hcap.power.setPowerMode = function(r) { l("set_power_mode", r) };
|
||||
hcap.power.isWarmUpdate = function(r) { l("is_power_warm_update", r) };
|
||||
hcap.power.powerOff = function(r) { l("power_off", r) };
|
||||
hcap.power.reboot = function(r) { l("reboot", r) };
|
||||
hcap.time = {};
|
||||
hcap.time.setLocalTime = function(r) { l("set_tv_localtime", r) };
|
||||
hcap.time.getLocalTime = function(r) { l("get_tv_localtime", r) };
|
||||
hcap.time.getPowerOffTimer = function(r) { l("get_power_off_timer_in_min", r) };
|
||||
hcap.time.setPowerOffTimer = function(r) { l("set_power_off_timer_in_min", r) };
|
||||
hcap.time.getPowerOnTime = function(r) { l("get_power_on_time", r) };
|
||||
hcap.time.setPowerOnTime = function(r) { l("set_power_on_time", r) };
|
||||
hcap.time.getAlarmInformation = function(r) { l("get_alarm_information", r) };
|
||||
hcap.time.setAlarmInformation = function(r) { l("set_alarm_information", r) };
|
||||
hcap.time.getCpuTime = function(r) { l("get_cpu_time", r) };
|
||||
hcap.network = {};
|
||||
hcap.network.getNumberOfNetworkDevices = function(r) { l("get_number_of_network_devices", r) };
|
||||
hcap.network.getNetworkDevice = function(r) { l("get_network_device", r) };
|
||||
hcap.network.setNetworkDevice = function(r) { l("set_network_device", r) };
|
||||
hcap.network.ping = function(r) { l("ping", r) };
|
||||
hcap.network.NetworkEventType = { UNKNOWN: 0, ETHERNET_PLUGGED: 1, ETHERNET_UNPLUGGED: 2, WIFI_DONGLE_PLUGGED: 3, WIFI_DONGLE_UNPLUGGED: 4, IP_CONFLICT: 5, IP_NOT_CONFLICT: 6, DHCP_SUCCESS: 7, DHCP_FAIL: 8, UNABLE_REACH_GATEWAY: 9, ABLE_REACH_GATEWAY: 10, UNABLE_REACH_DNS: 11, ABLE_REACH_DNS: 12, UNABLE_REACH_INTERNET: 13, ABLE_REACH_INTERNET: 14, WIFI_AP_SEARCH_COMPLETE: 15, WIFI_CONNECTED: 16, WIFI_CONNECT_FAIL: 17, WIFI_LINK_DROPPED: 18 };
|
||||
hcap.network.NetworkMode = { UNKNOWN: 0, WIRE: 1, WIRELESS: 2, NOT_REACHABLE: 3 };
|
||||
hcap.network.WirelessMode = { UNKNOWN: 0, INFRA: 1, ADHOC: 2 };
|
||||
hcap.network.WifiSecurityType = { UNKNOWN: 0, OPEN: 1, WEP: 2, WPA_PSK_TKIP: 3, WPA_PSK_AES: 4, WPA2_PSK_TKIP: 5, WPA2_PSK_AES: 6, WPA12_PSK_AES_TKIPAES: 7 };
|
||||
hcap.network.DhcpState = { UNKNOWN: 0, INIT: 1, SELECTING: 2, REQUESTING: 3, BOUND: 4, RENEWING: 5, REBINDING: 6, INIT_REBOOT: 7, REBOOTING: 8 };
|
||||
hcap.network.getNetworkInformation = function(r) { l("get_network_information", r) };
|
||||
hcap.network.getSoftAP = function(r) { l("get_soft_ap", r) };
|
||||
hcap.network.setSoftAP = function(r) { l("set_soft_ap", r) };
|
||||
hcap.network.getWifiDiagnostics = function(r) { l("get_wifi_diagnostics", r) };
|
||||
hcap.network.asyncPing = function(r) { l("async_ping", r) };
|
||||
hcap.network.setVlanIdMode = function(r) { l("set_vlan_id_mode", r) };
|
||||
hcap.network.getVlanIdMode = function(r) { l("get_vlan_id_mode", r) };
|
||||
hcap.network.getLanId = function(r) { l("get_lan_id", r) };
|
||||
hcap.network.setLanId = function(r) { l("set_lan_id", r) };
|
||||
hcap.network.getAuxLanId = function(r) { l("get_aux_lan_id", r) };
|
||||
hcap.network.setAuxLanId = function(r) { l("set_aux_lan_id", r) };
|
||||
hcap.network.getBlockedPortList = function(r) { l("get_blocked_port_list", r) };
|
||||
hcap.network.setBlockedPortList = function(r) { l("set_blocked_port_list", r) };
|
||||
hcap.mode = {};
|
||||
hcap.mode.HCAP_MODE_0 = 257;
|
||||
hcap.mode.HCAP_MODE_1 = 258;
|
||||
hcap.mode.HCAP_MODE_2 = 259;
|
||||
hcap.mode.HCAP_MODE_3 = 260;
|
||||
hcap.mode.HCAP_MODE_4 = 261;
|
||||
hcap.mode.getHcapMode = function(r) { l("get_mw_mode", r) };
|
||||
hcap.mode.setHcapMode = function(r) { l("set_mw_mode", r) };
|
||||
hcap.key = {};
|
||||
hcap.key.Code = { NUM_0: 48, NUM_1: 49, NUM_2: 50, NUM_3: 51, NUM_4: 52, NUM_5: 53, NUM_6: 54, NUM_7: 55, NUM_8: 56, NUM_9: 57, CH_UP: 427, CH_DOWN: 428, GUIDE: 458, INFO: 457, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, ENTER: 13, BACK: 461, EXIT: 1001, RED: 403, GREEN: 404, YELLOW: 405, BLUE: 406, STOP: 413, PLAY: 415, PAUSE: 19, REWIND: 412, FAST_FORWARD: 417, LAST_CH: 711, PORTAL: 602, ORDER: 623, MINUS: 704, POWER: 409, VOL_UP: 447, VOL_DOWN: 448, MUTE: 449, RECORD: 416, PAGE_UP: 33, PAGE_DOWN: 34, RF_BYPASS: 29, NEXT_DAY: 425, PREV_DAY: 424, APPS: 93, LINK: 606, FORWARD: 167, ZOOM: 251, SETTINGS: 611, NEXT_FAV_CH: 176, RES_1: 112, RES_2: 113, RES_3: 114, RES_4: 115, RES_5: 116, RES_6: 117, LOCK: 619, SKIP: 620, LIST: 1006, LIVE: 622, ON_DEMAND: 623, PINP_MOVE: 624, PINP_UP: 625, PINP_DOWN: 626, MENU: 18, AD: 700, ALARM: 701, AV_MODE: 31, SUBTITLE: 460, CC: 1008, DISC_POWER_OFF: 705, DISC_POWER_ON: 706, DVD: 707, EJECT: 414, ENERGY_SAVING: 709, FAV: 710, FLASHBK: 711, INPUT: 712, MARK: 713, NETCAST: 1000, PIP: 715, PIP_CH_DOWN: 716, PIP_CH_UP: 717, PIP_INPUT: 718, PIP_SWAP: 719, Q_MENU: 1002, Q_VIEW: 1007, RATIO: 1005, SAP: 723, SIMPLINK: 724, STB: 725, T_OPT: 1004, TEXT: 459, SLEEP_TIMER: 729, TV: 730, TV_RAD: 731, VCR: 732, POWER_LOWBATTERY: 733, SMART_HOME: 734, SCREEN_REMOTE: 735, POINTER: 736, LG_3D: 737, DATA: 738, ASSISTIVE_MENU: 739, THREE_DIGIT_INPUT: 740, LIVETV: 741, GOTOPREV: 742, GOTONEXT: 743, TER: 744, BS: 745, CS1: 746, CS2: 747, CS4K: 748, BS4K: 749, NUM_11: 750, NUM_12: 751 };
|
||||
g[hcap.key.Code.NUM_0] = hcap.key.Code.NUM_0;
|
||||
g[hcap.key.Code.NUM_1] = hcap.key.Code.NUM_1;
|
||||
g[hcap.key.Code.NUM_2] = hcap.key.Code.NUM_2;
|
||||
g[hcap.key.Code.NUM_3] = hcap.key.Code.NUM_3;
|
||||
g[hcap.key.Code.NUM_4] = hcap.key.Code.NUM_4;
|
||||
g[hcap.key.Code.NUM_5] = hcap.key.Code.NUM_5;
|
||||
g[hcap.key.Code.NUM_6] = hcap.key.Code.NUM_6;
|
||||
g[hcap.key.Code.NUM_7] = hcap.key.Code.NUM_7;
|
||||
g[hcap.key.Code.NUM_8] = hcap.key.Code.NUM_8;
|
||||
g[hcap.key.Code.NUM_9] = hcap.key.Code.NUM_9;
|
||||
g[hcap.key.Code.CH_UP] = hcap.key.Code.CH_UP;
|
||||
g[hcap.key.Code.CH_DOWN] = hcap.key.Code.CH_DOWN;
|
||||
g[hcap.key.Code.GUIDE] = hcap.key.Code.GUIDE;
|
||||
g[hcap.key.Code.INFO] = hcap.key.Code.INFO;
|
||||
g[hcap.key.Code.LEFT] = hcap.key.Code.LEFT;
|
||||
g[hcap.key.Code.UP] = hcap.key.Code.UP;
|
||||
g[hcap.key.Code.RIGHT] = hcap.key.Code.RIGHT;
|
||||
g[hcap.key.Code.DOWN] = hcap.key.Code.DOWN;
|
||||
g[hcap.key.Code.ENTER] = 10;
|
||||
g[hcap.key.Code.BACK] = 608;
|
||||
g[hcap.key.Code.EXIT] = 601;
|
||||
g[hcap.key.Code.RED] = hcap.key.Code.RED;
|
||||
g[hcap.key.Code.GREEN] = hcap.key.Code.GREEN;
|
||||
g[hcap.key.Code.YELLOW] = hcap.key.Code.YELLOW;
|
||||
g[hcap.key.Code.BLUE] = hcap.key.Code.BLUE;
|
||||
g[hcap.key.Code.STOP] = hcap.key.Code.STOP;
|
||||
g[hcap.key.Code.PLAY] = hcap.key.Code.PLAY;
|
||||
g[hcap.key.Code.PAUSE] = hcap.key.Code.PAUSE;
|
||||
g[hcap.key.Code.REWIND] = hcap.key.Code.REWIND;
|
||||
g[hcap.key.Code.FAST_FORWARD] = hcap.key.Code.FAST_FORWARD;
|
||||
g[hcap.key.Code.LAST_CH] = 607;
|
||||
g[hcap.key.Code.PORTAL] = hcap.key.Code.PORTAL;
|
||||
g[hcap.key.Code.ORDER] = hcap.key.Code.ORDER;
|
||||
g[hcap.key.Code.MINUS] = 45;
|
||||
g[hcap.key.Code.POWER] = hcap.key.Code.POWER;
|
||||
g[hcap.key.Code.VOL_UP] = hcap.key.Code.VOL_UP;
|
||||
g[hcap.key.Code.VOL_DOWN] = hcap.key.Code.VOL_DOWN;
|
||||
g[hcap.key.Code.MUTE] = hcap.key.Code.MUTE;
|
||||
g[hcap.key.Code.RECORD] = hcap.key.Code.RECORD;
|
||||
g[hcap.key.Code.PAGE_UP] = hcap.key.Code.PAGE_UP;
|
||||
g[hcap.key.Code.PAGE_DOWN] = hcap.key.Code.PAGE_DOWN;
|
||||
g[hcap.key.Code.RF_BYPASS] = 600;
|
||||
g[hcap.key.Code.NEXT_DAY] = 603;
|
||||
g[hcap.key.Code.PREV_DAY] = 604;
|
||||
g[hcap.key.Code.APPS] = 605;
|
||||
g[hcap.key.Code.LINK] = hcap.key.Code.LINK;
|
||||
g[hcap.key.Code.FORWARD] = 609;
|
||||
g[hcap.key.Code.ZOOM] = 610;
|
||||
g[hcap.key.Code.SETTINGS] = hcap.key.Code.SETTINGS;
|
||||
g[hcap.key.Code.NEXT_FAV_CH] = 612;
|
||||
g[hcap.key.Code.RES_1] = 613;
|
||||
g[hcap.key.Code.RES_2] = 614;
|
||||
g[hcap.key.Code.RES_3] = 615;
|
||||
g[hcap.key.Code.RES_4] = 616;
|
||||
g[hcap.key.Code.RES_5] = 617;
|
||||
g[hcap.key.Code.RES_6] = 618;
|
||||
g[hcap.key.Code.LOCK] = hcap.key.Code.LOCK;
|
||||
g[hcap.key.Code.SKIP] = hcap.key.Code.SKIP;
|
||||
g[hcap.key.Code.LIST] = 621;
|
||||
g[hcap.key.Code.LIVE] = hcap.key.Code.LIVE;
|
||||
g[hcap.key.Code.ON_DEMAND] = hcap.key.Code.ON_DEMAND;
|
||||
g[hcap.key.Code.PINP_MOVE] = hcap.key.Code.PINP_MOVE;
|
||||
g[hcap.key.Code.PINP_UP] = hcap.key.Code.PINP_UP;
|
||||
g[hcap.key.Code.PINP_DOWN] = hcap.key.Code.PINP_DOWN;
|
||||
g[hcap.key.Code.MENU] = 627;
|
||||
g[hcap.key.Code.AD] = hcap.key.Code.AD;
|
||||
g[hcap.key.Code.ALARM] = hcap.key.Code.ALARM;
|
||||
g[hcap.key.Code.AV_MODE] = 702;
|
||||
g[hcap.key.Code.SUBTITLE] = 726;
|
||||
g[hcap.key.Code.CC] = 726;
|
||||
g[hcap.key.Code.DISC_POWER_OFF] = hcap.key.Code.DISC_POWER_OFF;
|
||||
g[hcap.key.Code.DISC_POWER_ON] = hcap.key.Code.DISC_POWER_ON;
|
||||
g[hcap.key.Code.DVD] = hcap.key.Code.DVD;
|
||||
g[hcap.key.Code.EJECT] = 708;
|
||||
g[hcap.key.Code.ENERGY_SAVING] = hcap.key.Code.ENERGY_SAVING;
|
||||
g[hcap.key.Code.FAV] = hcap.key.Code.FAV;
|
||||
g[hcap.key.Code.FLASHBK] = hcap.key.Code.FLASHBK;
|
||||
g[hcap.key.Code.INPUT] = hcap.key.Code.INPUT;
|
||||
g[hcap.key.Code.MARK] = hcap.key.Code.MARK;
|
||||
g[hcap.key.Code.NETCAST] = 714;
|
||||
g[hcap.key.Code.PIP] = hcap.key.Code.PIP;
|
||||
g[hcap.key.Code.PIP_CH_DOWN] = hcap.key.Code.PIP_CH_DOWN;
|
||||
g[hcap.key.Code.PIP_CH_UP] = hcap.key.Code.PIP_CH_UP;
|
||||
g[hcap.key.Code.PIP_INPUT] = hcap.key.Code.PIP_INPUT;
|
||||
g[hcap.key.Code.PIP_SWAP] = hcap.key.Code.PIP_SWAP;
|
||||
g[hcap.key.Code.Q_MENU] = 720;
|
||||
g[hcap.key.Code.Q_VIEW] = 721;
|
||||
g[hcap.key.Code.RATIO] = 722;
|
||||
g[hcap.key.Code.SAP] = hcap.key.Code.SAP;
|
||||
g[hcap.key.Code.SIMPLINK] = hcap.key.Code.SIMPLINK;
|
||||
g[hcap.key.Code.STB] = hcap.key.Code.STB;
|
||||
g[hcap.key.Code.T_OPT] = 727;
|
||||
g[hcap.key.Code.TEXT] = 728;
|
||||
g[hcap.key.Code.SLEEP_TIMER] = hcap.key.Code.SLEEP_TIMER;
|
||||
g[hcap.key.Code.TV] = hcap.key.Code.TV;
|
||||
g[hcap.key.Code.TV_RAD] = hcap.key.Code.TV_RAD;
|
||||
g[hcap.key.Code.VCR] = hcap.key.Code.VCR;
|
||||
g[hcap.key.Code.POWER_LOWBATTERY] = hcap.key.Code.POWER_LOWBATTERY;
|
||||
g[hcap.key.Code.SMART_HOME] = hcap.key.Code.SMART_HOME;
|
||||
g[hcap.key.Code.SCREEN_REMOTE] = hcap.key.Code.SCREEN_REMOTE;
|
||||
g[hcap.key.Code.POINTER] = hcap.key.Code.POINTER;
|
||||
g[hcap.key.Code.LG_3D] = hcap.key.Code.LG_3D;
|
||||
g[hcap.key.Code.DATA] = hcap.key.Code.DATA;
|
||||
g[hcap.key.Code.ASSISTIVE_MENU] = hcap.key.Code.ASSISTIVE_MENU;
|
||||
g[hcap.key.Code.THREE_DIGIT_INPUT] = hcap.key.Code.THREE_DIGIT_INPUT;
|
||||
g[hcap.key.Code.LIVETV] = hcap.key.Code.LIVETV;
|
||||
g[hcap.key.Code.GOTOPREV] = hcap.key.Code.GOTOPREV;
|
||||
g[hcap.key.Code.GOTONEXT] = hcap.key.Code.GOTONEXT;
|
||||
g[hcap.key.Code.TER] = hcap.key.Code.TER;
|
||||
g[hcap.key.Code.BS] = hcap.key.Code.BS;
|
||||
g[hcap.key.Code.CS1] = hcap.key.Code.CS1;
|
||||
g[hcap.key.Code.CS2] = hcap.key.Code.CS2;
|
||||
g[hcap.key.Code.CS4K] = hcap.key.Code.CS4K;
|
||||
g[hcap.key.Code.BS4K] = hcap.key.Code.BS4K;
|
||||
g[hcap.key.Code.NUM_11] = hcap.key.Code.NUM_11;
|
||||
g[hcap.key.Code.NUM_12] = hcap.key.Code.NUM_12;
|
||||
hcap.key.addKeyItem = function(r) { r.virtualKeycode = g[r.virtualKeycode];
|
||||
l("add_key_item", r) };
|
||||
hcap.key.removeKeyItem = function(r) { l("remove_key_item", r) };
|
||||
hcap.key.clearKeyTable = function(r) { l("clear_key_table", r) };
|
||||
hcap.key.sendKey = function(r) { r.virtualKeycode = g[r.virtualKeycode];
|
||||
l("send_key", r) };
|
||||
hcap.mouse = {};
|
||||
hcap.mouse.isMouseVisible = function(r) { l("get_mouse_visible", r) };
|
||||
hcap.mouse.setMouseVisible = function(r) { l("set_mouse_visible", r) };
|
||||
hcap.mouse.isPointerOn = function(r) { l("is_pointer_on", r) };
|
||||
hcap.mouse.setPointerOn = function(r) { l("set_pointer_on", r) };
|
||||
hcap.mouse.getPointerPosition = function(r) { l("get_pointer_position", r) };
|
||||
hcap.mouse.setPointerPosition = function(r) { l("set_pointer_position", r) };
|
||||
hcap.mouse.clickPointer = function(r) { l("click_pointer", r) };
|
||||
hcap.mouse.setPointerSize = function(r) { l("set_pointer_size", r) };
|
||||
hcap.property = {};
|
||||
hcap.property.getHotelMode = function(r) { l("get_hotel_mode", r) };
|
||||
hcap.property.setHotelMode = function(r) { l("set_hotel_mode", r) };
|
||||
hcap.property.PicturePropertyKey = { BACKLIGHT: 1, CONTRAST: 2, BRIGHTNESS: 3, SHARPNESS: 4, COLOR: 5, TINT: 6, COLOR_TEMPERATURE: 7, ASPECT_RATIO: 8 };
|
||||
hcap.property.getPictureProperty = function(r) { l("get_picture_property", r) };
|
||||
hcap.property.setPictureProperty = function(r) { l("set_picture_property", r) };
|
||||
hcap.property.PictureMode = { VIVID: 1, STANDARD: 2, ECO: 3, CINEMA: 4, SPORTS: 5, GAME: 6, PHOTO: 7, EXPERT_BRIGHT_ROOM: 8, EXPERT_DARK_ROOM: 9 };
|
||||
hcap.property.getPictureMode = function(r) { l("get_picture_mode", r) };
|
||||
hcap.property.setPictureMode = function(r) { l("set_picture_mode", r) };
|
||||
hcap.property.getProperty = function(r) { l("get_property", r) };
|
||||
hcap.property.setProperty = function(r) { l("set_property", r) };
|
||||
hcap.property.InstallerMenuItem = { INSTALLER_SEQ: 0, POWER_MANAGE: 1, AC_ON: 2, BAND: 3, STRT_CHANNEL: 4, CHAN_LOCK: 5, STRT_VOLUME: 7, MIN_VOLUME: 8, MAX_VOLUME: 9, MUTE_DISABLE: 10, KEY_DEFEAT: 11, IR_BANKS_ENABLE: 12, SCAN_MODE: 13, STRT_CH_IN_SM: 14, SLEEP_TIMER: 15, EN_TIMER: 16, ALARM: 17, FEATURE_LEVEL: 20, V_CHIP: 21, MAX_BLK_HRS: 22, CAPTION_LOCK: 23, FUNCTION_PRE: 25, HOSPITAL_MODE: 27, CH_OVERIDE: 28, REMAP_AUX_INPS: 29, ACK_MASK: 30, POLL_RATE: 31, TIMING_PULSE: 32, COMPORT_EN: 34, HDMI1_ENABLE: 35, REAR_AUX_EN: 39, SIMPLINK_EN: 41, AUTO_INPUTS: 42, STRT_AUX_SRCE: 46, AUX_STATUS: 47, DIS_AUDIO_M: 49, DIS_CH_TIME: 53, EN_CH_T_COL: 69, FOR_CH_TIME: 70, BCK_CH_TIME: 71, CH_NOT_AVBLE: 73, REVERT_CH: 75, QUICK_SHUTOFF: 77, UPN_MSB: 78, UPN_MSB_1: 79, UPN_MSB_2: 80, UPN_LSB: 81, CHKSUM_ERROR: 82, HANDSHK_TIME: 83, PERMANENT_BLK: 84, V_MUTE_TIME: 86, REAR_RGB_EN: 87, EN_NOISE_MUTE: 88, KEY_LOCK: 90, HDMI2_ENABLE: 91, HDMI3_ENABLE: 92, RJP_AVAILABLE: 93, SAP_MENU_EN: 94, DEF_ASP_RATIO: 96, AUDIO_OUTPUT: 97, PROCENTRIC: 98, BACK_LIGHTING: 99, VIDEO_INTERFACE: 100, IR_FEEDBACK: 101, ATSC_BAND: 102, ATSC_TUNE_MODE: 103, START_MINOR_CH: 104, VID_OUT_FORMAT: 105, ASP_RATIO_LOCK: 106, BANNER_SELECT: 107, PANEL_COM: 108, PANEL_HNDSHAKE: 109, PANEL_DELAY: 110, PANEL_VOL_PRE: 111, PANEL_STRT_VOL: 112, PANEL_TYPE: 113, PANEL_MIN_VOL: 114, PANEL_MAX_VOL: 115, VIDEO_MUTE_EN: 116, FACT_DEFAULT: 117, POWER_SAVINGS: 118, DATA_CHANNEL: 119, UPDATE_TIME_HR: 121, UPDATE_TIME_MN: 122 };
|
||||
hcap.property.getInstallerMenuItem = function(r) { l("get_installer_menu_item", r) };
|
||||
hcap.property.setInstallerMenuItem = function(r) { l("set_installer_menu_item", r) };
|
||||
hcap.Media = function() {};
|
||||
hcap.Media.startUp = function(r) { l("media_startup", r) };
|
||||
hcap.Media.shutDown = function(r) { l("media_shutdown", r) };
|
||||
hcap.Media.createMedia = function(r) { if (r === null) { return a } if (a === null && r.url !== null && r.mimeType !== null) { a = new hcap.Media();
|
||||
l("media_create_media", r); return a } return null };
|
||||
hcap.Media.prototype.play = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_play", r) };
|
||||
hcap.Media.prototype.pause = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_pause", r) };
|
||||
hcap.Media.prototype.resume = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_resume", r) };
|
||||
hcap.Media.prototype.stop = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_stop", r) };
|
||||
hcap.Media.prototype.destroy = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_destroy", r);
|
||||
a = null };
|
||||
hcap.Media.prototype.getInformation = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_get_information", r) };
|
||||
hcap.Media.prototype.getPlayPosition = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_get_play_position", r) };
|
||||
hcap.Media.prototype.setPlayPosition = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_set_play_position", r) };
|
||||
hcap.Media.prototype.getPlaySpeed = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_get_play_speed", r) };
|
||||
hcap.Media.prototype.setPlaySpeed = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_set_play_speed", r) };
|
||||
hcap.Media.prototype.setSubtitleOn = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_set_subtitle_on", r) };
|
||||
hcap.Media.prototype.getSubtitleOn = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_get_subtitle_on", r) };
|
||||
hcap.Media.prototype.setSubtitleUrl = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_set_subtitle_url", r) };
|
||||
hcap.Media.prototype.getState = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_get_state", r) };
|
||||
hcap.Media.prototype.getAudioLanguage = function(r) { l("media_get_audio_language", r) };
|
||||
hcap.Media.prototype.setAudioLanguage = function(r) { l("media_set_audio_language", r) };
|
||||
hcap.Media.prototype.getSubtitle = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_get_subtitle", r) };
|
||||
hcap.Media.prototype.setSubtitle = function(r) { if (a === null) { r.onFailure({ errorMessage: "already destroyed." }); return }
|
||||
l("media_set_subtitle", r) };
|
||||
hcap.Media.SubtitleType = { NONE: 0, INTERNAL_SUBTITLE: 1, EXTERNAL_SUBTITLE: 2, CLOSED_CAPTION: 3 };
|
||||
hcap.rms = {};
|
||||
hcap.rms.requestRms = function(r) { l("request_rms", r) };
|
||||
hcap.socket = {};
|
||||
hcap.socket.openUdpDaemon = function(r) { l("open_udp_daemon", r) };
|
||||
hcap.socket.closeUdpDaemon = function(r) { l("close_udp_daemon", r) };
|
||||
hcap.socket.openTcpDaemon = function(r) { l("open_tcp_daemon", r) };
|
||||
hcap.socket.closeTcpDaemon = function(r) { l("close_tcp_daemon", r) };
|
||||
hcap.socket.sendUdpData = function(r) { l("send_udp_data", r) };
|
||||
hcap.drm = {};
|
||||
hcap.drm.securemedia = {};
|
||||
hcap.drm.securemedia.initialize = function(r) { l("secure_media_drm_initialize", r) };
|
||||
hcap.drm.securemedia.unregister = function(r) { l("secure_media_drm_unregister", r) };
|
||||
hcap.drm.securemedia.isRegistration = function(r) { l("secure_media_drm_is_registration", r) };
|
||||
hcap.drm.securemedia.register = function(r) { l("secure_media_drm_register", r) };
|
||||
hcap.drm.securemedia.finalize = function(r) { l("secure_media_drm_finalize", r) };
|
||||
hcap.file = {};
|
||||
hcap.file.getUsbStorageList = function(r) { l("get_usb_storage_list", r) };
|
||||
hcap.file.getUsbStorageFileList = function(r) { l("get_usb_storage_file_list", r) };
|
||||
hcap.file.downloadFileToUsb = function(r) { l("download_file_to_usb", r) };
|
||||
hcap.file.deleteUsbFile = function(r) { l("delete_usb_file", r) };
|
||||
hcap.rs232c = {};
|
||||
hcap.rs232c.BaudRate = { BR_UNKNOWN: 0, BR_110: 110, BR_300: 300, BR_600: 600, BR_1200: 1200, BR_2400: 2400, BR_4800: 4800, BR_9600: 9600, BR_14400: 14400, BR_19200: 19200, BR_38400: 38400, BR_57600: 57600, BR_115200: 115200, BR_128000: 128000, BR_230400: 230400, BR_256000: 256000, BR_512000: 512000, BR_768000: 768000, BR_921600: 921600, BR_1024000: 1024000 };
|
||||
hcap.rs232c.DataBit = { BIT_UNKNOWN: 0, BIT_7: 7, BIT_8: 8 };
|
||||
hcap.rs232c.Parity = { UNKNOWN: 0, NONE: 1, EVEN: 2, ODD: 3 };
|
||||
hcap.rs232c.StopBit = { UNKNOWN: 0, BIT_1: 1, BIT_2: 2 };
|
||||
hcap.rs232c.FlowControl = { UNKNOWN: 0, NONE: 1, XON_XOFF: 2, HARDWARE: 3 };
|
||||
hcap.rs232c.getConfiguration = function(r) { l("rs232c_get_configuration", r) };
|
||||
hcap.rs232c.setConfiguration = function(r) { l("rs232c_set_configuration", r) };
|
||||
hcap.rs232c.sendData = function(r) { l("rs232c_send_data", r) };
|
||||
hcap.rs232c.setStartupData = function(r) { l("rs232c_set_teaching_data", r) };
|
||||
hcap.rs232c.clearStartupData = function(r) { l("rs232c_clear_teaching_data", r) };
|
||||
hcap.system = {};
|
||||
hcap.system.requestScreenCaptureImage = function(r) { l("request_screen_capture_image", r) };
|
||||
hcap.system.getScreenCaptureImage = function(r) { l("get_screen_capture_image", r) };
|
||||
hcap.system.launchHcapHtmlApplication = function(r) { l("launch_hcap_html_application", r) };
|
||||
hcap.system.getMemoryUsage = function(r) { l("get_memory_usage", r) };
|
||||
hcap.system.getCpuUsage = function(r) { l("get_cpu_usage", r) };
|
||||
hcap.system.requestFocus = function(r) { l("request_focus", r) };
|
||||
hcap.system.getFocused = function(r) { l("get_focused", r) };
|
||||
hcap.system.requestCloning = function(r) { l("request_cloning", r) };
|
||||
hcap.system.getLocaleList = function(r) { l("get_locale_list", r) };
|
||||
hcap.system.getLocale = function(r) { l("get_locale", r) };
|
||||
hcap.system.requestLocaleChange = function(r) { l("request_locale_change", r) };
|
||||
hcap.system.getProcentricServer = function(r) { l("get_procentric_server", r) };
|
||||
hcap.system.setProcentricServer = function(r) { l("set_procentric_server", r) };
|
||||
hcap.system.SoundOutputType = { UNKNOWN: 0, INTERNAL_TV_SPEAKER: 1, WIRED_HEADPHONES: 2, OFF: 3, OPTICAL: 4, OPTICAL_LGSOUNDSYNC: 5, EXTERNAL_ARC: 6 };
|
||||
hcap.system.getSoundOutput = function(r) { l("get_sound_output", r) };
|
||||
hcap.system.getDefaultSoundOutput = function(r) { l("get_default_sound_output", r) };
|
||||
hcap.system.setSoundOutput = function(r) { l("set_sound_output", r) };
|
||||
hcap.system.setDefaultSoundOutput = function(r) { l("set_default_sound_output", r) };
|
||||
hcap.system.beginDestroy = function(r) { l("begin_destroy", r) };
|
||||
hcap.system.endDestroy = function(r) { l("end_destroy", r) };
|
||||
hcap.system.getAudioPtsOffset = function(r) { l("get_audio_pts_offset", r) };
|
||||
hcap.system.setAudioPtsOffset = function(r) { l("set_audio_pts_offset", r) };
|
||||
hcap.system.getVideoPtsOffset = function(r) { l("get_video_pts_offset", r) };
|
||||
hcap.system.setVideoPtsOffset = function(r) { l("set_video_pts_offset", r) };
|
||||
hcap.system.getProxyServer = function(r) { l("get_proxy_server", r) };
|
||||
hcap.system.setProxyServer = function(r) { l("set_proxy_server", r) };
|
||||
hcap.system.expireProxyServer = function(r) { l("expire_proxy_server", r) };
|
||||
hcap.system.getBrowserDebugMode = function(r) { l("get_browser_debug_mode", r) };
|
||||
hcap.system.setBrowserDebugMode = function(r) { l("set_browser_debug_mode", r) };
|
||||
hcap.system.getNoSignalImage = function(r) { l("get_no_signal_image", r) };
|
||||
hcap.system.setNoSignalImage = function(r) { l("set_no_signal_image", r) };
|
||||
hcap.system.getScreenKeyboardLanguageList = function(r) { l("get_screen_keyboard_language_list", r) };
|
||||
hcap.system.setScreenKeyboardLanguage = function(r) { l("set_screen_keyboard_language", r) };
|
||||
hcap.system.getUsbPowerControl = function(r) { l("get_usb_power_control", r) };
|
||||
hcap.system.setUsbPowerControl = function(r) { l("set_usb_power_control", r) };
|
||||
hcap.system.showToastMessage = function(r) { l("show_toast_message", r) };
|
||||
hcap.system.startManualUpdate = function(r) { l("start_manual_update", r) };
|
||||
hcap.system.cancelUpdate = function(r) { l("cancel_update", r) };
|
||||
hcap.system.getUpdateProgress = function(r) { l("get_update_progress", r) };
|
||||
hcap.checkout = {};
|
||||
hcap.checkout.requestCheckout = function(r) { l("request_checkout", r) };
|
||||
hcap.checkout.takeCheckoutSnapshot = function(r) { l("take_checkout_snapshot", r) };
|
||||
hcap.beacon = {};
|
||||
hcap.beacon.setBeaconMode = function(r) { l("set_beacon_mode", r) };
|
||||
hcap.beacon.requestiBeacon = function(r) { l("request_iBeacon", r) };
|
||||
hcap.beacon.requestEddystoneUid = function(r) { l("request_eddystone_uid", r) };
|
||||
hcap.beacon.requestEddystoneUrl = function(r) { l("request_eddystone_url", r) };
|
||||
hcap.beacon.getBeaconInformation = function(r) { l("get_beacon_information", r) };
|
||||
hcap.bluetooth = {};
|
||||
hcap.bluetooth.setScanState = function(r) { l("bt_gap_set_scan_state", r) };
|
||||
hcap.bluetooth.disconnect = function(r) { l("bt_service_disconnect", r) };
|
||||
hcap.bluetooth.setBluetoothSoundSync = function(r) { l("set_bt_sound_sync", r) };
|
||||
hcap.bluetooth.getBluetoothSoundSync = function(r) { l("get_bt_sound_sync", r) };
|
||||
hcap.bluetooth.audio = {};
|
||||
hcap.bluetooth.audio.play = function(r) { l("bt_audio_play", r) };
|
||||
hcap.bluetooth.audio.stop = function(r) { l("bt_audio_stop", r) };
|
||||
hcap.bluetooth.audio.pause = function(r) { l("bt_audio_pause", r) };
|
||||
hcap.bluetooth.audio.forward = function(r) { l("bt_audio_forward", r) };
|
||||
hcap.bluetooth.audio.backward = function(r) { l("bt_audio_backward", r) };
|
||||
hcap.webrtc = {};
|
||||
hcap.webrtc.startPreviewVideo = function(r) { l("webrtc_start_preview_video", r) };
|
||||
hcap.webrtc.stopPreviewVideo = function(r) { l("webrtc_stop_preview_video", r) };
|
||||
hcap.webrtc.incomingCall = function(r) { l("webrtc_incoming_call", r) };
|
||||
hcap.webrtc.outgoingCall = function(r) { l("webrtc_outgoing_call", r) };
|
||||
hcap.webrtc.endCall = function(r) { l("webrtc_end_call", r) };
|
||||
hcap.webrtc.acceptMessage = function(r) { l("webrtc_accept_message", r) };
|
||||
hcap.webrtc.startCheckAudio = function(r) { l("webrtc_start_check_audio", r) };
|
||||
hcap.webrtc.stopCheckAudio = function(r) { l("webrtc_stop_check_audio", r) };
|
||||
hcap.webrtc.setConfiguration = function(r) { l("webrtc_set_configuration", r) };
|
||||
hcap.webrtc.getConfiguration = function(r) { l("webrtc_get_configuration", r) };
|
||||
hcap.webrtc.showDiagnostics = function(r) { l("webrtc_show_diagnostics", r) };
|
||||
hcap.security = {};
|
||||
hcap.security.registerServerCertificate = function(r) { l("register_server_certificate", r) };
|
||||
hcap.security.registerClientCertificate = function(r) { l("register_client_certificate", r) };
|
||||
hcap.security.unregisterServerCertificate = function(r) { l("unregister_server_certificate", r) };
|
||||
hcap.security.unregisterClientCertificate = function(r) { l("unregister_client_certificate", r) };
|
||||
hcap.security.existServerCertificate = function(r) { l("exist_server_certificate", r) };
|
||||
hcap.security.existClientCertificate = function(r) { l("exist_client_certificate", r) };
|
||||
hcap.iot = {};
|
||||
hcap.iot.requestSetBridgeStatus = function(r) { l("iot_request_set_bridge_status", r) };
|
||||
hcap.iot.getBridgeStatus = function(r) { l("iot_get_bridge_status", r) };
|
||||
hcap.iot.requestRegisterThing = function(r) { l("iot_request_register_thing", r) };
|
||||
hcap.iot.requestRejectThing = function(r) { l("iot_request_reject_thing", r) };
|
||||
hcap.iot.getThingList = function(r) { l("iot_get_thing_list", r) };
|
||||
hcap.iot.getBindingIdList = function(r) { l("iot_get_binding_id_list", r) };
|
||||
hcap.iot.requestSetComponent = function(r) { l("iot_request_set_component", r) };
|
||||
hcap.iot.requestUnregisterThing = function(r) { l("iot_request_unregister_thing", r) };
|
||||
hcap.iot.setThingNickname = function(r) { l("iot_set_thing_nickname", r) };
|
||||
hcap.iot.requestSynchronizeThing = function(r) { l("iot_request_synchronize_thing", r) };
|
||||
hcap.iot.getFrameworkStatus = function(r) { l("iot_get_framework_status", r) };
|
||||
hcap.iot.requestFactoryReset = function(r) { l("iot_request_factory_reset", r) };
|
||||
hcap.iot.getVersions = function(r) { l("iot_get_versions", r) };
|
||||
hcap.iot.getThingListPrivate = function(r) { l("iot_get_thing_list_private", r) };
|
||||
hcap.speech = {};
|
||||
hcap.speech.setSpeechRecognition = function(r) { l("set_speech_recognition", r) };
|
||||
hcap.speech.getSpeechRecognition = function(r) { l("get_speech_recognition", r) };
|
||||
hcap.speech.HostType = { NOT_SUPPORT: 0, APPLICATION: 1, TV: 2 };
|
||||
hcap.speech.decideHost = function(r) { l("decide_host", r) } }()) };
|
||||
9
procentric/application/lib/hcap.js
Executable file
9
procentric/application/lib/hcap.js
Executable file
File diff suppressed because one or more lines are too long
9
procentric/application/lib/hcap.js.v1.23
Executable file
9
procentric/application/lib/hcap.js.v1.23
Executable file
File diff suppressed because one or more lines are too long
728
procentric/application/lib/hoteltv.api.js
Executable file
728
procentric/application/lib/hoteltv.api.js
Executable file
@@ -0,0 +1,728 @@
|
||||
/**
|
||||
* Copyright (c) 2020
|
||||
*
|
||||
* CENTIRM HotelTV HCAP module javascript.
|
||||
*
|
||||
* @summary short description for the file
|
||||
* @author Joel <joel.kim@centirm.com>
|
||||
*
|
||||
* Created at : 2020-11-26 02:21:56
|
||||
* Last modified : 2020-11-26 15:31:40
|
||||
*/
|
||||
|
||||
HotelTV.namespace('HotelTV.api');
|
||||
HotelTV.api = (function() {
|
||||
//// 의존 관계 선언
|
||||
let _api_ver = Object.prototype.toString,
|
||||
_svr_ip = Object.prototype.toString,
|
||||
_serial_num = Object.prototype.toString,
|
||||
_dev_familly = Object.prototype.toString,
|
||||
_license = Object.prototype.toString,
|
||||
_token = "aLc*eBgTijklRnopq4s",
|
||||
_registered = false,
|
||||
_exist = false,
|
||||
_svr_port = 0;
|
||||
|
||||
//// 비공개 프로퍼티
|
||||
|
||||
/// 초기화 루틴
|
||||
|
||||
//// 비공개 매써드
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function __apifxn_init(param) {
|
||||
_api_ver = param.api_ver;
|
||||
_serial_num = param.serial_num;
|
||||
_svr_ip = param.svr_ip;
|
||||
_svr_port = param.svr_port;
|
||||
_dev_familly = param.dev_familly;
|
||||
_license = param.license;
|
||||
_token = param.apikey;
|
||||
_registered = param.registered;
|
||||
_exist = param.exist;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API Wrapper Function::> Get API base URI
|
||||
*/
|
||||
function __apifxn_get_base_url() {
|
||||
var sz_base_url = "http://" + _svr_ip + ":" + _svr_port;
|
||||
return sz_base_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* API Wrapper Function::> Get Device License
|
||||
*/
|
||||
function __apifxn_get_license() {
|
||||
return _license;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API Wrapper Function::> Get Device Registered
|
||||
*/
|
||||
function __apifxn_get_registered() {
|
||||
return { 'registered': _registered, 'exist': _exist, 'license': _license };
|
||||
}
|
||||
|
||||
/**
|
||||
* API Wrapper Function::> Get API Token
|
||||
*/
|
||||
function __apifxn_get_token() {
|
||||
return _token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.system.getProcentricServer)
|
||||
*/
|
||||
function __apifxn_get_api_url(api_type) {
|
||||
var dic_api_url = {
|
||||
"get_translation": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/translation",
|
||||
"get_device_settings": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/setting",
|
||||
"get_site_info": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/info",
|
||||
"get_guest_info": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/guest",
|
||||
"get_opening_ctz": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/opening",
|
||||
"get_program_ctz": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/program",
|
||||
"get_epg_info": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/epg",
|
||||
"get_weather": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/weather",
|
||||
"get_flight": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/flight",
|
||||
"get_services": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/services",
|
||||
"get_news": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/news",
|
||||
"get_message": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/messages",
|
||||
"get_carts_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/carts",
|
||||
"put_carts_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/carts",
|
||||
"update_carts_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/carts",
|
||||
"delete_carts_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/carts",
|
||||
"get_order_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/orders",
|
||||
"put_order_amenity": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/amenity/orders",
|
||||
"get_carts_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/carts",
|
||||
"put_carts_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/carts",
|
||||
"update_carts_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/carts",
|
||||
"delete_carts_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/carts",
|
||||
"get_order_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/orders",
|
||||
"put_order_roomservice": __apifxn_get_base_url() + "/api/" + _api_ver + "/assets/" + _dev_familly + "/" + _serial_num + "/requests/roomService/orders",
|
||||
|
||||
/*
|
||||
"get_emergency": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/emergency",
|
||||
"get_news": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/news",
|
||||
"get_message": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/messages",
|
||||
"set_message_status": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/messages",
|
||||
"set_device_status": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/state",
|
||||
"get_epg_info": __apifxn_get_base_url() + "/api/" + _api_ver + "/channels/epg",
|
||||
"set_device_opmode": __apifxn_get_base_url() + "/api/" + _api_ver + "/settops/" + _serial_num + "/bbdoors/opmode",
|
||||
*/
|
||||
}
|
||||
|
||||
if (api_type in dic_api_url) {
|
||||
return dic_api_url[api_type];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function __apifxn_CallCmsApi(_method, sz_url, api_type, dic_param) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let isPostMsg = false;
|
||||
let xhr = new XMLHttpRequest();
|
||||
// let formData = new FormData();
|
||||
let _ret = { type: api_type, error: true, reason: null, data: null };
|
||||
|
||||
//xhr.timeout = 500;
|
||||
if (dic_param !== null) {
|
||||
isPostMsg = true;
|
||||
// for (_key in dic_param) {
|
||||
// formData.append(_key.toString(), dic_param[_key]);
|
||||
// }
|
||||
}
|
||||
|
||||
xhr.onload = function() {
|
||||
if (xhr.status === 200 || xhr.status === 201) {
|
||||
_ret.error = false;
|
||||
_ret.data = xhr.response;
|
||||
resolve(_ret);
|
||||
} else {
|
||||
reject(_ret);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.ontimeout = function(e) {
|
||||
// XMLHttpRequest timed out. Do something here.
|
||||
_ret.reason = "TIMEOUT";
|
||||
reject(_ret);
|
||||
};
|
||||
|
||||
xhr.onerror = function() {
|
||||
_ret.reason = "FATAL";
|
||||
reject(_ret);
|
||||
}
|
||||
|
||||
switch (_method) {
|
||||
case "GET":
|
||||
xhr.open('GET', sz_url, true);
|
||||
xhr.setRequestHeader("Accept", "application/json");
|
||||
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
xhr.setRequestHeader("Authorization", "Bearer " + __apifxn_get_token());
|
||||
xhr.send(null);
|
||||
break;
|
||||
case "POST":
|
||||
xhr.open('POST', sz_url);
|
||||
xhr.setRequestHeader("Accept", "application/json");
|
||||
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
xhr.setRequestHeader("Authorization", "Bearer " + __apifxn_get_token());
|
||||
xhr.send(JSON.stringify(dic_param)); // 폼 데이터 객체 전송
|
||||
break;
|
||||
case "PATCH":
|
||||
xhr.open('PATCH', sz_url);
|
||||
xhr.setRequestHeader("Accept", "application/json");
|
||||
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
xhr.setRequestHeader("Authorization", "Bearer " + __apifxn_get_token());
|
||||
xhr.send(JSON.stringify(dic_param)); // 폼 데이터 객체 전송
|
||||
break;
|
||||
case "DELETE":
|
||||
xhr.open('DELETE', sz_url, true);
|
||||
xhr.setRequestHeader("Accept", "application/json");
|
||||
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
xhr.setRequestHeader("Authorization", "Bearer " + __apifxn_get_token());
|
||||
xhr.send(null);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// 공개 API
|
||||
return {
|
||||
Init: function(ip, port, model, serial) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (HotelTV.state.token) {
|
||||
let _token = HotelTV.state.token;
|
||||
__apifxn_init({ 'dev_familly': model, 'serial_num': serial, 'svr_ip': ip, 'svr_port': port, 'api_ver': _token.version, "license": _token.license, "apikey": _token.apikey, "registered": _token.registered, "exist": _token.exist });
|
||||
resolve(0);
|
||||
} else {
|
||||
// licenses api format
|
||||
// <svr ip:svr port>/api/licenses/us761h0n/103INLV4B896
|
||||
var sz_api_url = "http://" + ip + ":" + port + "/api/licenses" + "/" + model + "/" + serial;
|
||||
console.log("Debug: request token url:" + sz_api_url);
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetToken", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
HotelTV.state.token = JSON.parse(_result.data);
|
||||
__apifxn_init({ 'dev_familly': model, 'serial_num': serial, 'svr_ip': ip, 'svr_port': port, 'api_ver': HotelTV.state.token.version, "license": HotelTV.state.token.license, "apikey": HotelTV.state.token.apikey, "registered": HotelTV.state.token.registered, "exist": HotelTV.state.token.exist });
|
||||
resolve(0);
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
GetBaseUrl: function() {
|
||||
return __apifxn_get_base_url();
|
||||
},
|
||||
|
||||
CheckRegistration: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_registered();
|
||||
resolve(sz_api_url);
|
||||
});
|
||||
},
|
||||
|
||||
DownloadData: function(dl_url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
__apifxn_CallCmsApi("GET", dl_url, "DownloadData", null).then(_result => {
|
||||
resolve(_result.data);
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetTranslation: function(group, locale) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_translation");
|
||||
//let sz_api_param = null;
|
||||
if (group) {
|
||||
sz_api_url += `/&group=${group};`;
|
||||
}
|
||||
if (locale) {
|
||||
sz_api_url += `/&locales=${locale};`;
|
||||
}
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetTranslation", null).then(_result => {
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetServiceInfo: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_services");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetServiceInfo", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetSettings: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_device_settings");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetDeviceSettings", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetHotelInfo: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_site_info");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetHotelInfo", null).then(_result => {
|
||||
///console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetGuestInfo: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_guest_info");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetGuestInfo", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetOpeningCtz: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_opening_ctz");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetOpeningCtz", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetWeather: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_weather");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetWeather", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetFlight: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_flight");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetFlight", null).then(_result => {
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetProgramCtz: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_program_ctz");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetProgramCtz", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetEpg: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_epg_info");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetEpg", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetNews: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_news");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetNews", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
GetMessage: function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_message");
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "GetMessage", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
SetMessageStatus: function(msgID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_message") + "/" + msgID;
|
||||
__apifxn_CallCmsApi("GET", sz_api_url, "SetMessageStatus", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
let _rspJson = JSON.parse(_result.data);
|
||||
if (_rspJson.status == 'ok') {
|
||||
resolve(_rspJson.data);
|
||||
} else {
|
||||
resolve(null);
|
||||
}
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get amenity carts info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
GetAmenityCarts: function(_item_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_carts_amenity");
|
||||
__apifxn_CallCmsApi((_item_id) ? "POST" : "GET", sz_api_url, "GetAmenityCarts", _item_id).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> put amenity carts info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
PutAmenityCarts: function(_item_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("put_carts_amenity");
|
||||
__apifxn_CallCmsApi("POST", sz_api_url, "PutAmenityCarts", { "itemId": _item_id, "quantity": _quantity }).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> update amenity carts info
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
UpdateAmenityCarts: function(_cart_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("update_carts_amenity");
|
||||
__apifxn_CallCmsApi("PATCH", `${sz_api_url}/${_cart_id}`, "UpdateAmenityCarts", { "quantity": _quantity }).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> delete amenity carts info
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
DeleteAmenityCarts: function(_cart_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("delete_carts_amenity");
|
||||
__apifxn_CallCmsApi("DELETE", `${sz_api_url}/${_cart_id}`, "DeleteAmenityCarts", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get amenity order info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
GetAmenityOrders: function(_item_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_order_amenity");
|
||||
__apifxn_CallCmsApi((_item_id) ? "POST" : "GET", sz_api_url, "GetAmenityOrders", _item_id).then(_result => {
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> order amenity
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
PutAmenityOrders: function(_cart_item) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("put_order_amenity");
|
||||
__apifxn_CallCmsApi("POST", `${sz_api_url}`, "PutAmenityOrders", _cart_item).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get room service carts info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
GetRoomserviceCarts: function(_item_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_carts_roomservice");
|
||||
__apifxn_CallCmsApi((_item_id) ? "POST" : "GET", sz_api_url, "GetRoomserviceCarts", _item_id).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> put room service carts info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
PutRoomserviceCarts: function(_item_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("put_carts_roomservice");
|
||||
__apifxn_CallCmsApi("POST", sz_api_url, "PutRoomserviceCarts", { "itemId": _item_id, "quantity": _quantity }).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> update room service carts info
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
UpdateRoomserviceCarts: function(_cart_id, _quantity) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("update_carts_roomservice");
|
||||
__apifxn_CallCmsApi("PATCH", `${sz_api_url}/${_cart_id}`, "UpdateRoomserviceCarts", { "quantity": _quantity }).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> delete room service carts info
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
DeleteRoomserviceCarts: function(_cart_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("delete_carts_roomservice");
|
||||
__apifxn_CallCmsApi("DELETE", `${sz_api_url}/${_cart_id}`, "DeleteRoomserviceCarts", null).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> get room service order info
|
||||
* @param {dictionary} _item_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
GetRoomserviceOrders: function(_item_id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("get_order_roomservice");
|
||||
__apifxn_CallCmsApi((_item_id) ? "POST" : "GET", sz_api_url, "GetRoomserviceOrders", _item_id).then(_result => {
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* HotelTV API ::> order room service
|
||||
* @param {dictionary} _cart_id if _item_id isn't null it will return specified info with _item_id
|
||||
*/
|
||||
PutRoomserviceOrders: function(_cart_item) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sz_api_url = __apifxn_get_api_url("put_order_roomservice");
|
||||
__apifxn_CallCmsApi("POST", `${sz_api_url}`, "PutRoomserviceOrders", _cart_item).then(_result => {
|
||||
//console.log(`Success::>${_result.data}`);
|
||||
resolve(JSON.parse(_result.data));
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
reject(_error.reason);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
ReportBrief: function(_dev_inf, _gst_info, _usage_inf) {
|
||||
let _json_report = {
|
||||
"updated": "YYYY-MM-DD HH:MM:SS",
|
||||
"brnote": "IN-SERVICE",
|
||||
"guest_language": "",
|
||||
"guest_name": "Jason Smith",
|
||||
"guest_checkin": "1899-12-31",
|
||||
"guest_checkout": "1899-12-31",
|
||||
"guest_roomid": "7635",
|
||||
"ker_ver": "0.00.00",
|
||||
"cpu_usage": [],
|
||||
"free_mem": null,
|
||||
"disk_space_free": {
|
||||
"flash": { "total": 0, "free": 0, "used": 0, "percent": "0" },
|
||||
"storage": { "total": 0, "free": 0, "used": 0, "percent": "0" }
|
||||
},
|
||||
"cpu_freq": { "current": 0, "min": 0, "max": 0 },
|
||||
"ip_addr": "xxx.xxx.xxx.xxx",
|
||||
"mac_addr": "",
|
||||
"mac_wifi": "",
|
||||
"mac_bt": "",
|
||||
"speed": 0,
|
||||
"manufacture": "LG",
|
||||
"model": "",
|
||||
"hw_ver": "1.00",
|
||||
"sw_ver": "1.1.5",
|
||||
"scr_resolution": "1920x1080@60.00Hz - Full screen",
|
||||
"temp": 0,
|
||||
"uptime": {
|
||||
"second": 344632,
|
||||
"string": "03d23h43m52s"
|
||||
},
|
||||
"api_ver": "v1"
|
||||
};
|
||||
|
||||
const _fxn_cvtDateFmt1 = function(_date) {
|
||||
var _year = _date.getFullYear();
|
||||
var _month = _date.getMonth() + 1;
|
||||
if (_month < 10) _month = '0' + _month;
|
||||
var _day = _date.getDate();
|
||||
if (_day < 10) _day = '0' + _day;
|
||||
var _hour = _date.getHours();
|
||||
if (_hour < 10) _hour = '0' + _hour;
|
||||
var _min = _date.getMinutes();
|
||||
if (_min < 10) _min = '0' + _min;
|
||||
var _sec = _date.getSeconds();
|
||||
if (_sec < 10) _sec = '0' + _sec;
|
||||
return _year + "-" + _month + "-" + _day + " " + _hour + ":" + _min + ":" + _sec;
|
||||
};
|
||||
|
||||
const _fxn_sec2Date = function toDateTime(secs) {
|
||||
var __t = new Date(1970, 0, 1); // Epoch
|
||||
__t.setSeconds(secs);
|
||||
var _day = (__t.getDate() - 1);
|
||||
if (_day < 10) _day = '0' + _day;
|
||||
var _hour = __t.getHours();
|
||||
if (_hour < 10) _hour = '0' + _hour;
|
||||
var _min = __t.getMinutes();
|
||||
if (_min < 10) _min = '0' + _min;
|
||||
var _sec = __t.getSeconds();
|
||||
if (_sec < 10) _sec = '0' + _sec;
|
||||
return _day + "d" + _hour + "h" + _min + "m" + _sec + "s";
|
||||
}
|
||||
_json_report.updated = _fxn_cvtDateFmt1(new Date());
|
||||
_json_report.ker_ver = _dev_inf.boot_version.major + "." + _dev_inf.boot_version.minor + "." + _dev_inf.boot_version.revision;
|
||||
_json_report.cpu_usage = [_usage_inf.cpu];
|
||||
_json_report.brnote = 'IN-SERVICE';
|
||||
_json_report.free_mem = {
|
||||
"available": 0,
|
||||
"inactive": 0,
|
||||
"cached": 0,
|
||||
"shared": 0,
|
||||
"total": (_usage_inf.mem.total * 1048576),
|
||||
"percent": _usage_inf.mem.percent.toString(),
|
||||
"free": (_usage_inf.mem.free * 1048576),
|
||||
};
|
||||
_json_report.guest_language = _gst_info.language;
|
||||
_json_report.guest_name = _gst_info.name;
|
||||
_json_report.guest_checkin = _gst_info.cidt;
|
||||
_json_report.guest_checkout = _gst_info.codt;
|
||||
_json_report.guest_roomid = _gst_info.roomid;
|
||||
_json_report.ip_addr = _dev_inf.network_info.ip_address;
|
||||
_json_report.mac_addr = _dev_inf.network_info.details[0].mac;
|
||||
_json_report.mac_wifi = _dev_inf.network_info.details[1].mac;
|
||||
_json_report.mac_bt = '';
|
||||
|
||||
_json_report.model = _dev_inf.model_name;
|
||||
_json_report.hw_ver = _dev_inf.hardware_version.major + "." + _dev_inf.hardware_version.minor;
|
||||
_json_report.sw_ver = _dev_inf.hcap_middleware_version.major + "." + _dev_inf.hcap_middleware_version.minor + "." + _dev_inf.hcap_middleware_version.revision;
|
||||
_json_report.scr_resolution = _dev_inf.display_resolution;
|
||||
|
||||
_json_report.uptime.second = Math.floor(_dev_inf.uptime / 1000);
|
||||
_json_report.uptime.string = _fxn_sec2Date(_json_report.uptime.second);
|
||||
|
||||
let sz_api_url = __apifxn_get_api_url("set_device_status");
|
||||
__apifxn_CallCmsApi("POST", sz_api_url, "SetDeviceStatus", _json_report).then(_result => {
|
||||
console.log(`Success::>${_result.data}`);
|
||||
}).catch(_error => {
|
||||
console.log(`Failure::>${_error.reason}`);
|
||||
});
|
||||
},
|
||||
}
|
||||
})();
|
||||
1591
procentric/application/lib/hoteltv.hcap.js
Executable file
1591
procentric/application/lib/hoteltv.hcap.js
Executable file
File diff suppressed because it is too large
Load Diff
558
procentric/application/lib/hoteltv.js
Executable file
558
procentric/application/lib/hoteltv.js
Executable file
@@ -0,0 +1,558 @@
|
||||
/**
|
||||
* Copyright (c) 2020
|
||||
*
|
||||
* CENTIRM HotelTV Core javascript.
|
||||
*
|
||||
* @summary short description for the file
|
||||
* @author Joel <joel.kim@centirm.com>
|
||||
*
|
||||
* Created at : 2020-11-26 02:21:56
|
||||
* Last modified : 2020-11-26 15:31:40
|
||||
*/
|
||||
|
||||
|
||||
var HotelTV = HotelTV || {
|
||||
'devinfo': {},
|
||||
'svrinfo': {},
|
||||
'services': {},
|
||||
'settings': {},
|
||||
'hotelinfo': {},
|
||||
'guestinfo': {},
|
||||
'opening': {},
|
||||
'flight': {},
|
||||
'weather': {},
|
||||
'epg': {},
|
||||
'news': {},
|
||||
'tvguide': {},
|
||||
'message': {},
|
||||
'translation': {},
|
||||
'state': {
|
||||
'lang': 'kr',
|
||||
'menu': {
|
||||
'stage': null,
|
||||
'main': {
|
||||
'cnt': 0,
|
||||
'cur': null,
|
||||
'prev': null,
|
||||
},
|
||||
},
|
||||
'media': {
|
||||
'playing': false,
|
||||
},
|
||||
'hotkey': {
|
||||
"mm": {}
|
||||
},
|
||||
'token': null
|
||||
},
|
||||
'carts': {
|
||||
'amenity': {
|
||||
|
||||
},
|
||||
'roomservice': {
|
||||
|
||||
}
|
||||
},
|
||||
'orders': {
|
||||
'amenity': {
|
||||
|
||||
},
|
||||
'roomservice': {
|
||||
|
||||
}
|
||||
},
|
||||
'dbginfo': {
|
||||
'en': false,
|
||||
'emulator': false, //PC 브라우저를 이용할때, true로 설정, 타겟 셋트에서는 false로 설정할것
|
||||
'hcap_ipc': false,
|
||||
'output': 'osd'
|
||||
},
|
||||
'media_hndl': null,
|
||||
};
|
||||
|
||||
|
||||
|
||||
HotelTV.namespace = function(ns_string) {
|
||||
var parts = ns_string.split('.'),
|
||||
parent = HotelTV,
|
||||
i; // 처음에 중복되는 전역 객체명은 제거한다.
|
||||
if (parts[0] == 'HotelTV') {
|
||||
parts = parts.slice(1);
|
||||
}
|
||||
for (i = 0; i < parts.length; i += 1) {
|
||||
if (typeof parent[parts[i]] == 'undefined') {
|
||||
parent[parts[i]] = {};
|
||||
}
|
||||
parent = parent[parts[i]];
|
||||
}
|
||||
return parent;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//// 비공개 매써드
|
||||
/**
|
||||
* HCAP Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.system.getHotelMode)
|
||||
* @param {string} sz_key property key name.
|
||||
* @param {callback} callback is callback object
|
||||
*/
|
||||
function __fxn_Set_DebugOpt() {
|
||||
HotelTV.dbginfo['en'] = true;
|
||||
HotelTV.dbginfo['output'] = 'native';
|
||||
|
||||
HotelTV.hcap.Init();
|
||||
|
||||
/** Develop Mode definitions */
|
||||
console.log("OPT" + navigator.appVersion);
|
||||
if (navigator.appVersion.includes("Web0S") == true) {
|
||||
HotelTV.dbginfo['emulator'] = false;
|
||||
} else {
|
||||
HotelTV.dbginfo['emulator'] = true;
|
||||
}
|
||||
|
||||
if (HotelTV.dbginfo['output'] == 'osd') {
|
||||
if (HotelTV.dbginfo['en'] == true) {
|
||||
(function() {
|
||||
var old = console.log;
|
||||
var logger = document.getElementById('debugwin');
|
||||
var dateNow = new Date();
|
||||
var hours = dateNow.getHours();
|
||||
var minutes = dateNow.getMinutes();
|
||||
var seconds = dateNow.getSeconds();
|
||||
if (hours < 10) {
|
||||
hours = "0" + hours;
|
||||
}
|
||||
if (minutes < 10) {
|
||||
minutes = "0" + minutes;
|
||||
}
|
||||
if (seconds < 10) {
|
||||
seconds = "0" + seconds;
|
||||
}
|
||||
console.log = function(logmsg) {
|
||||
var _dispMsg = hours + ":" + minutes + ":" + seconds + "-> ";
|
||||
if (typeof logmsg == 'object') {
|
||||
_dispMsg += (JSON && JSON.stringify ? JSON.stringify(logmsg) : logmsg) + '<br />';
|
||||
} else {
|
||||
_dispMsg += logmsg + '<br />';
|
||||
}
|
||||
_dispMsg += logger.innerHTML;
|
||||
|
||||
logger.innerHTML = _dispMsg;
|
||||
}
|
||||
})();
|
||||
}
|
||||
} 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']);
|
||||
} else {
|
||||
//Below for Non WebOS
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
HotelTV.Init = async function() {
|
||||
console.log("Start Initialization:: ");
|
||||
//STEP#01::> Shutdown Channel
|
||||
HotelTV.hcap.ChannelShutDown();
|
||||
|
||||
//SETP#02::> Set Debug Options
|
||||
__fxn_Set_DebugOpt();
|
||||
|
||||
//STEP#03::> Get Device Info
|
||||
HotelTV.ui_utils.SetBusy(true);
|
||||
try {
|
||||
await HotelTV.hcap.GetDevInfo();
|
||||
//await HotelTV.hcap.ShowDevInfo();
|
||||
} catch (_error) {
|
||||
console.log("Fail to get device information");
|
||||
}
|
||||
|
||||
//STEP#04::> API Module INIT
|
||||
await HotelTV.api.Init(HotelTV.svrinfo.ipaddr, HotelTV.svrinfo.port, HotelTV.devinfo.model_name.substring(2, HotelTV.devinfo.model_name.length - 1), HotelTV.devinfo.serial_number);
|
||||
|
||||
try {
|
||||
let __apiRet = await HotelTV.api.CheckRegistration();
|
||||
HotelTV.state['registration'] = await HotelTV.api.CheckRegistration();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for check registration");
|
||||
}
|
||||
|
||||
if (HotelTV.state['registration'].registered != true) {
|
||||
console.log("Show up and unregistered device");
|
||||
}
|
||||
|
||||
//STEP05::> CHECK HOTELTV LICENSE
|
||||
if (HotelTV.state['registration'].license == 'hotel-full') {
|
||||
// FULL LICENSE MODE
|
||||
try {
|
||||
HotelTV.settings = await HotelTV.api.GetSettings();
|
||||
let need_reboot = await HotelTV.hcap.SetDevice(HotelTV.settings);
|
||||
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);
|
||||
return;
|
||||
}
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get stttings");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.hotelinfo = await HotelTV.api.GetHotelInfo();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get hotel info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.guestinfo = await HotelTV.api.GetGuestInfo();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get Guest info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.opening = await HotelTV.api.GetOpeningCtz();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get Opening Contents");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.weather = await HotelTV.api.GetWeather();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get Weather info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.flight = await HotelTV.api.GetFlight();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get flight info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.tvguide = await HotelTV.api.GetProgramCtz();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get tvguide info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.epg = await HotelTV.api.GetEpg();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get epg info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.news = await HotelTV.api.GetNews();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get news info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.message = await HotelTV.api.GetMessage();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get news info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.translation = await HotelTV.api.GetTranslation();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get translation info");
|
||||
}
|
||||
|
||||
|
||||
//Save to Session
|
||||
sessionStorage.setItem("devinfo", JSON.stringify(HotelTV.devinfo));
|
||||
sessionStorage.setItem("svrinfo", JSON.stringify(HotelTV.svrinfo));
|
||||
sessionStorage.setItem("settings", JSON.stringify(HotelTV.settings));
|
||||
sessionStorage.setItem("state", JSON.stringify(HotelTV.state));
|
||||
sessionStorage.setItem("hotelinfo", JSON.stringify(HotelTV.hotelinfo));
|
||||
sessionStorage.setItem("guestinfo", JSON.stringify(HotelTV.guestinfo));
|
||||
sessionStorage.setItem("opening", JSON.stringify(HotelTV.opening));
|
||||
sessionStorage.setItem("flight", JSON.stringify(HotelTV.flight));
|
||||
sessionStorage.setItem("weather", JSON.stringify(HotelTV.weather));
|
||||
sessionStorage.setItem("tvguide", JSON.stringify(HotelTV.tvguide));
|
||||
sessionStorage.setItem("news", JSON.stringify(HotelTV.news));
|
||||
sessionStorage.setItem("message", JSON.stringify(HotelTV.message));
|
||||
sessionStorage.setItem("translation", JSON.stringify(HotelTV.translation));
|
||||
|
||||
//Now Switch Over Welcome page
|
||||
if (HotelTV.opening != null) {
|
||||
$(".startup").fadeOut(1000, function() {
|
||||
window.location.replace('./wellcome.html');
|
||||
});
|
||||
} else {
|
||||
if (HotelTV.state['registration'].license == 'hotel-full') {
|
||||
setTimeout(function() {
|
||||
window.location.replace('./app_hoteltv_full.html');
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log("Display Error page for invalid license type.");
|
||||
}
|
||||
console.log("Initialization:: Done");
|
||||
HotelTV.ui_utils.SetBusy(false);
|
||||
|
||||
SpatialNavigation.init();
|
||||
};
|
||||
|
||||
HotelTV.LoadWelCome = async function() {
|
||||
HotelTV.devinfo = await JSON.parse(sessionStorage.getItem("devinfo"));
|
||||
HotelTV.svrinfo = await JSON.parse(sessionStorage.getItem("svrinfo"));
|
||||
HotelTV.state = await JSON.parse(sessionStorage.getItem("state"));
|
||||
//STEP#03:API Module INIT
|
||||
await HotelTV.api.Init(HotelTV.svrinfo.ipaddr, HotelTV.svrinfo.port, HotelTV.devinfo.model_name.substring(2, HotelTV.devinfo.model_name.length - 1), HotelTV.devinfo.serial_number);
|
||||
HotelTV.settings = await JSON.parse(sessionStorage.getItem("settings"));
|
||||
HotelTV.guestinfo = await JSON.parse(sessionStorage.getItem("guestinfo"));
|
||||
HotelTV.hotelinfo = await JSON.parse(sessionStorage.getItem("hotelinfo"));
|
||||
HotelTV.opening = await JSON.parse(sessionStorage.getItem("opening"));
|
||||
HotelTV.tvguide = await JSON.parse(sessionStorage.getItem("tvguide"));
|
||||
try {
|
||||
HotelTV.services = await HotelTV.api.GetServiceInfo();
|
||||
sessionStorage.setItem("services", JSON.stringify(HotelTV.services));
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get service info");
|
||||
}
|
||||
//HotelTV.translation = await JSON.parse(sessionStorage.getItem("translation"));
|
||||
try {
|
||||
HotelTV.translation = await HotelTV.api.GetTranslation();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get translation info");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Set checkined guest language
|
||||
HotelTV.state.lang = HotelTV.guestinfo.language;
|
||||
|
||||
let _res = HotelTV.devinfo.display_resolution.split("x");
|
||||
HotelTV.ui_welcome.Init(_res[0], _res[1]);
|
||||
|
||||
//await HotelTV.hcap.ShowDevInfo();
|
||||
HotelTV.ui_welcome.Show();
|
||||
}
|
||||
|
||||
HotelTV.UnloadWelCome = async function() {
|
||||
sessionStorage.setItem("state", JSON.stringify(HotelTV.state));
|
||||
HotelTV.ui_welcome.Close();
|
||||
if (HotelTV.state['registration'].license == 'hotel-full') {
|
||||
setTimeout(function() {
|
||||
window.location.replace('./app_hoteltv_full.html');
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HotelTV.LoadAppFull = async function() {
|
||||
HotelTV.ui_utils.SetBusy(true);
|
||||
|
||||
//STEP#01: Load session info
|
||||
HotelTV.devinfo = await JSON.parse(sessionStorage.getItem("devinfo"));
|
||||
HotelTV.svrinfo = await JSON.parse(sessionStorage.getItem("svrinfo"));
|
||||
HotelTV.services = await JSON.parse(sessionStorage.getItem("services"));
|
||||
HotelTV.state = await JSON.parse(sessionStorage.getItem("state"));
|
||||
|
||||
//STEP#02: Init HotelTV API
|
||||
await HotelTV.api.Init(HotelTV.svrinfo.ipaddr, HotelTV.svrinfo.port, HotelTV.devinfo.model_name.substring(2, HotelTV.devinfo.model_name.length - 1), HotelTV.devinfo.serial_number);
|
||||
HotelTV.settings = await JSON.parse(sessionStorage.getItem("settings"));
|
||||
HotelTV.guestinfo = await JSON.parse(sessionStorage.getItem("guestinfo"));
|
||||
HotelTV.hotelinfo = await JSON.parse(sessionStorage.getItem("hotelinfo"));
|
||||
HotelTV.weather = await JSON.parse(sessionStorage.getItem("weather"));
|
||||
HotelTV.opening = await JSON.parse(sessionStorage.getItem("opening"));
|
||||
HotelTV.tvguide = await JSON.parse(sessionStorage.getItem("tvguide"));
|
||||
HotelTV.flight = await JSON.parse(sessionStorage.getItem("flight"));
|
||||
HotelTV.news = await JSON.parse(sessionStorage.getItem("news"));
|
||||
HotelTV.message = await JSON.parse(sessionStorage.getItem("message"));
|
||||
//HotelTV.epg = await JSON.parse(sessionStorage.getItem("epg"));
|
||||
|
||||
try {
|
||||
HotelTV.carts.amenity = await HotelTV.api.GetAmenityCarts(null);
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get amenity carts info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.carts.roomservice = await HotelTV.api.GetRoomserviceCarts();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get roomservicec carts info");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
HotelTV.orders.amenity = await HotelTV.api.GetAmenityOrders(null);
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get amenity order info");
|
||||
}
|
||||
|
||||
try {
|
||||
HotelTV.orders.roomservice = await HotelTV.api.GetRoomserviceOrders(null);
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get roomservice order info");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
HotelTV.translation = await HotelTV.api.GetTranslation();
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get translation info");
|
||||
}
|
||||
//HotelTV.translation = await JSON.parse(sessionStorage.getItem("translation"));
|
||||
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (_error) {
|
||||
console.log("Display Error page for get siApp Auth");
|
||||
}
|
||||
|
||||
//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();
|
||||
HotelTV.ui_appfull.Show();
|
||||
|
||||
//STEP#06 Register Service web worker
|
||||
if (window.SharedWorker) {
|
||||
const myWorker = new SharedWorker("./lib/hoteltv.service.js");
|
||||
|
||||
myWorker.port.postMessage({
|
||||
'cmd': "start_service",
|
||||
"param": {
|
||||
"token": HotelTV.state.token,
|
||||
"dev_family": HotelTV.devinfo.model_name.substring(2, HotelTV.devinfo.model_name.length - 1),
|
||||
"dev_snum": HotelTV.devinfo.serial_number,
|
||||
"svrinfo": HotelTV.svrinfo,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
myWorker.port.onmessage = function(e) {
|
||||
let recvMsg = e.data;
|
||||
//console.log(`Recv Msg[${recvMsg.event}]::> ${recvMsg.ret} ::> ${recvMsg.data}`);
|
||||
//console.log(`Recv Msg[${recvMsg.event}]::> ${recvMsg.ret}`);
|
||||
|
||||
// if (recvMsg.event == "update_epg") {
|
||||
// if (recvMsg.ret === "OK") {
|
||||
// HotelTV.epg = recvMsg.data;
|
||||
// HotelTV.ui_appfull.UpdateEpg();
|
||||
// }
|
||||
// } else if (recvMsg.event == "update_news") {
|
||||
// if (recvMsg.ret === "OK") {
|
||||
// HotelTV.news = recvMsg.data;
|
||||
// }
|
||||
// } else if (recvMsg.event == "update_flight") {
|
||||
// if (recvMsg.ret === "OK") {
|
||||
// let x2js = new X2JS();
|
||||
// _rspJson = x2js.xml2json($.parseXML(recvMsg.data));
|
||||
// HotelTV.flight = { "count": Number(_rspJson.response.body.totalCount), "info": _rspJson.response.body.items.item };
|
||||
// }
|
||||
// } 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}`);
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
console.log('Your browser doesn\'t support web workers.')
|
||||
}
|
||||
|
||||
//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://' + _mqttSvcInfo.host + ':' + _mqttSvcInfo.port, {
|
||||
clean: true, // retain session
|
||||
connectTimeout: 4000, // Timeout period
|
||||
username: _mqttSvcInfo.username,
|
||||
password: _mqttSvcInfo.password,
|
||||
clientId: 'mqtt_sid_' + HotelTV.devinfo.serial_number.substring(0, 12)
|
||||
}
|
||||
);
|
||||
|
||||
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}]`);
|
||||
} else {
|
||||
console.log(`Success to subscribe::TOPIC[${_mqttSvcInfo.topic}]`);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
client.on('message', function(topic, message) {
|
||||
let szMsg = message.toString();
|
||||
HotelTV.ui_appfull.MqttEvent(szMsg);
|
||||
//MQTT메시지 종료 하려면 아래 end호출
|
||||
//client.end()
|
||||
})
|
||||
|
||||
client.on('error', function(error) {
|
||||
// message is Buffer
|
||||
console.log(error.toString());
|
||||
//client.end()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
HotelTV.hcap.Test();
|
||||
}
|
||||
|
||||
HotelTV.UnloadAppFull = async function() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
HotelTV.Deinit = function() {
|
||||
console.log("Start De-Initialization:: ");
|
||||
//HotelTV.service.Deinit();
|
||||
}
|
||||
291
procentric/application/lib/hoteltv.service.js
Executable file
291
procentric/application/lib/hoteltv.service.js
Executable file
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* Copyright (c) 2020
|
||||
*
|
||||
* CENTIRM HotelTV Background service module javascript.
|
||||
*
|
||||
* @summary short description for the file
|
||||
* @author Joel <joel.kim@centirm.com>
|
||||
*
|
||||
* Created at : 2020-11-26 02:21:56
|
||||
* Last modified : 2020-11-26 15:31:40
|
||||
*/
|
||||
// importScripts('./lib/hoteltv.js');
|
||||
// importScripts('./lib/hoteltv.api.js');
|
||||
|
||||
const g_config = {};
|
||||
var g_port = null;
|
||||
var g_tmrHndl = null;
|
||||
var g_tm_prev = {
|
||||
"news": null,
|
||||
"epg": null,
|
||||
"weather": null,
|
||||
"flight": null,
|
||||
"report": null,
|
||||
};
|
||||
|
||||
//// 비공개 매써드
|
||||
/**
|
||||
* API Wrapper Function::>
|
||||
*/
|
||||
function __svcfxn_get_base_url() {
|
||||
var sz_base_url = "http://" + g_config.svrinfo.ipaddr + ":" + g_config.svrinfo.port;
|
||||
return sz_base_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* API Wrapper Function::>
|
||||
* @param {string} api_type api type.
|
||||
* @param {callback} callback is callback object
|
||||
*/
|
||||
function __svcfxn_get_api_url(api_type) {
|
||||
var dic_api_url = {
|
||||
"get_news": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/news",
|
||||
"get_epg": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/epg",
|
||||
"get_weather": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/weather",
|
||||
"get_flight": __svcfxn_get_base_url() + "/api/" + g_config.token.version + "/assets/" + g_config.dev_family + "/" + g_config.dev_snum + "/flight",
|
||||
}
|
||||
|
||||
if (api_type in dic_api_url) {
|
||||
return dic_api_url[api_type];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* API Wrapper Function::> HOTELTV API
|
||||
* @param {string} sz_url is API URL
|
||||
* @param {string} api_type is API TYPE
|
||||
* @param {dictionary} dic_param is PARAMETERs
|
||||
*/
|
||||
function __svcfxn_CallCmsApi(sz_url, api_type, dic_param) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let isPostMsg = false;
|
||||
let xhr = new XMLHttpRequest();
|
||||
let formData = new FormData();
|
||||
let _ret = { type: api_type, error: true, reason: null, data: null };
|
||||
|
||||
//xhr.timeout = 500;
|
||||
if (dic_param !== null) {
|
||||
isPostMsg = true;
|
||||
for (_key in dic_param) {
|
||||
formData.append(_key.toString(), dic_param[_key]);
|
||||
}
|
||||
}
|
||||
|
||||
xhr.onload = function() {
|
||||
if (xhr.status === 200 || xhr.status === 201) {
|
||||
_ret.error = false;
|
||||
_ret.data = xhr.response;
|
||||
resolve(_ret);
|
||||
} else {
|
||||
reject(_ret);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.ontimeout = function(e) {
|
||||
// XMLHttpRequest timed out. Do something here.
|
||||
_ret.reason = "TIMEOUT";
|
||||
reject(_ret);
|
||||
};
|
||||
|
||||
xhr.onerror = function() {
|
||||
_ret.reason = "FATAL";
|
||||
reject(_ret);
|
||||
}
|
||||
|
||||
|
||||
if (isPostMsg) {
|
||||
//console.log("Given api url is POST message")
|
||||
xhr.open('POST', sz_url);
|
||||
xhr.setRequestHeader("Accept", "application/json");
|
||||
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
xhr.setRequestHeader("Authorization", "Bearer " + g_config.token.apikey);
|
||||
xhr.send(formData); // 폼 데이터 객체 전송
|
||||
} else {
|
||||
//console.log("Given api url is GET message")
|
||||
xhr.open('GET', sz_url, true);
|
||||
xhr.setRequestHeader("Accept", "application/json");
|
||||
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
xhr.setRequestHeader("Authorization", "Bearer " + g_config.token.apikey);
|
||||
xhr.send(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* HCAP Wrapper Function::> Get Device Properties(Realted HCAP API:hcap.property.getProperty)
|
||||
* @param {string} sz_key property key name.
|
||||
* @param {callback} callback is callback object
|
||||
*/
|
||||
async function sworker_service(args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let _bNeed_Update = {
|
||||
"epg": false,
|
||||
"news": false,
|
||||
"flight": false,
|
||||
"weather": false,
|
||||
"report": false,
|
||||
};
|
||||
let _tm_cur = new Date();
|
||||
|
||||
// CHECK EPG INFORMATION UPDATE
|
||||
if (g_tm_prev.epg == null) {
|
||||
g_tm_prev.epg = new Date();
|
||||
_bNeed_Update.epg = true;
|
||||
} else {
|
||||
let _tm_diff_ms = _tm_cur.getTime() - g_tm_prev.epg.getTime();
|
||||
let _tm_diff_s = Math.floor(_tm_diff_ms / 1000);
|
||||
|
||||
//EPG정보는 매 30분 마다 한번씩 업데이트
|
||||
if (_tm_diff_s > 1800) {
|
||||
//if (_tm_diff_s > 60) {
|
||||
g_tm_prev.epg = _tm_cur;
|
||||
_bNeed_Update.epg = true;
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK NEWS INFORMATION UPDATE
|
||||
if (g_tm_prev.news == null) {
|
||||
g_tm_prev.news = new Date();
|
||||
_bNeed_Update.news = true;
|
||||
} else {
|
||||
let _tm_diff_ms = _tm_cur.getTime() - g_tm_prev.news.getTime();
|
||||
let _tm_diff_s = Math.floor(_tm_diff_ms / 1000);
|
||||
|
||||
//NEWS정보는 매 20분 마다 한번씩 업데이트
|
||||
if (_tm_diff_s > 1200) {
|
||||
g_tm_prev.news = _tm_cur;
|
||||
_bNeed_Update.news = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CHECK FLIGHT INFORMATION UPDATE
|
||||
if (g_tm_prev.flight == null) {
|
||||
g_tm_prev.flight = new Date();
|
||||
_bNeed_Update.flight = true;
|
||||
} else {
|
||||
let _tm_diff_ms = _tm_cur.getTime() - g_tm_prev.flight.getTime();
|
||||
let _tm_diff_s = Math.floor(_tm_diff_ms / 1000);
|
||||
|
||||
//FLIGHT정보는 매 60분 마다 한번씩 업데이트
|
||||
if (_tm_diff_s > 3600) {
|
||||
g_tm_prev.flight = _tm_cur;
|
||||
_bNeed_Update.flight = true;
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK WEATHER INFORMATION UPDATE
|
||||
if (g_tm_prev.weather == null) {
|
||||
g_tm_prev.weather = new Date();
|
||||
_bNeed_Update.weather = true;
|
||||
} else {
|
||||
let _tm_diff_ms = _tm_cur.getTime() - g_tm_prev.weather.getTime();
|
||||
let _tm_diff_s = Math.floor(_tm_diff_ms / 1000);
|
||||
|
||||
//NEWS정보는 매 2시간 마다 한번씩 업데이트
|
||||
if (_tm_diff_s > 7200) {
|
||||
g_tm_prev.weather = _tm_cur;
|
||||
_bNeed_Update.weather = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CHECK REPORT INFORMATION UPDATE
|
||||
if (g_tm_prev.report == null) {
|
||||
g_tm_prev.report = new Date();
|
||||
_bNeed_Update.report = true;
|
||||
} else {
|
||||
let _tm_diff_ms = _tm_cur.getTime() - g_tm_prev.report.getTime();
|
||||
let _tm_diff_s = Math.floor(_tm_diff_ms / 1000);
|
||||
|
||||
//REPORT는 매 5초 마다 한번씩 업데이트
|
||||
if (_tm_diff_s > 5) {
|
||||
g_tm_prev.report = _tm_cur;
|
||||
_bNeed_Update.report = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 후처리(실제 데이터 가져오고 부모에세 메시지로 안내)
|
||||
if (_bNeed_Update.epg === true) {
|
||||
let sz_api_url = __svcfxn_get_api_url("get_epg");
|
||||
__svcfxn_CallCmsApi(sz_api_url, "GetEpg", null).then(_result => {
|
||||
g_port.postMessage({ "event": "update_epg", "ret": "OK", "data": JSON.parse(_result.data) });
|
||||
}).catch(_error => {
|
||||
g_port.postMessage({ "event": "update_epg", "ret": "ERROR", "data": null });
|
||||
});
|
||||
}
|
||||
|
||||
if (_bNeed_Update.news === true) {
|
||||
let sz_api_url = __svcfxn_get_api_url("get_news");
|
||||
__svcfxn_CallCmsApi(sz_api_url, "GetNews", null).then(_result => {
|
||||
g_port.postMessage({ "event": "update_news", "ret": "OK", "data": JSON.parse(_result.data) });
|
||||
}).catch(_error => {
|
||||
g_port.postMessage({ "event": "update_news", "ret": "ERROR", "data": null });
|
||||
});
|
||||
}
|
||||
|
||||
if (_bNeed_Update.flight == true) {
|
||||
let sz_api_url = __svcfxn_get_api_url("get_flight");
|
||||
__svcfxn_CallCmsApi(sz_api_url, "GetFlight", null).then(_result => {
|
||||
g_port.postMessage({ "event": "update_flight", "ret": "OK", "data": JSON.parse(_result.data) });
|
||||
}).catch(_error => {
|
||||
g_port.postMessage({ "event": "update_flight", "ret": "ERROR", "data": null });
|
||||
});
|
||||
}
|
||||
|
||||
if (_bNeed_Update.weather == true) {
|
||||
g_port.postMessage({ "event": "update_weather", "ret": "OK", "data": _bNeed_Update.weather });
|
||||
}
|
||||
|
||||
if (_bNeed_Update.report == true) {
|
||||
g_port.postMessage({ "event": "update_report", "ret": "OK", "data": _bNeed_Update.report });
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
onconnect = function(e) {
|
||||
if (g_port != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_port = e.ports[0];
|
||||
|
||||
g_port.addEventListener('message', function(e) {
|
||||
let recvMsg = e.data;
|
||||
if (recvMsg.cmd === "start_service") {
|
||||
let _param = recvMsg.param;
|
||||
g_config.token = _param.token;
|
||||
g_config.dev_family = _param.dev_family;
|
||||
g_config.dev_snum = _param.dev_snum;
|
||||
g_config.svrinfo = _param.svrinfo;
|
||||
|
||||
//Periodic polling HotelTV API service
|
||||
if (g_tmrHndl == null) {
|
||||
g_tmrHndl = setTimeout(async function svcTask() {
|
||||
await sworker_service();
|
||||
g_tmrHndl = setTimeout(svcTask, 1000);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
g_port.start(); // Required when using addEventListener. Otherwise called implicitly by onmessage setter.
|
||||
}
|
||||
4198
procentric/application/lib/hoteltv.ui_appfull.js
Executable file
4198
procentric/application/lib/hoteltv.ui_appfull.js
Executable file
File diff suppressed because it is too large
Load Diff
187
procentric/application/lib/hoteltv.ui_utils.js
Executable file
187
procentric/application/lib/hoteltv.ui_utils.js
Executable file
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* Copyright (c) 2020
|
||||
*
|
||||
* CENTIRM HotelTV UI-UTILS module javascript.
|
||||
*
|
||||
* @summary short description for the file
|
||||
* @author Joel <joel.kim@centirm.com>
|
||||
*
|
||||
* Created at : 2020-11-26 02:21:56
|
||||
* Last modified : 2020-11-26 15:31:40
|
||||
*/
|
||||
|
||||
HotelTV.namespace('HotelTV.ui_utils');
|
||||
HotelTV.ui_utils = (function() {
|
||||
//// 의존 관계 선언
|
||||
|
||||
//// 비공개 프로퍼티
|
||||
let g_uiTbl_imgPath_Brochure_buttons = {
|
||||
'ko-KR': "./images/brochure/bt_brochure_ko.png",
|
||||
'en-US': "./images/brochure/bt_brochure_en.png",
|
||||
'zh-CN': "./images/brochure/bt_brochure_ch01.png",
|
||||
'zh-TW': "./images/brochure/bt_brochure_ch02.png",
|
||||
'ja-JP': "./images/brochure/bt_brochure_jp.png"
|
||||
};
|
||||
|
||||
let g_uiTbl_imgPath_InRoomDining_buttons = {
|
||||
'ko-KR': "./images/IRD/bt_inroom_ko.png",
|
||||
'en-US': "./images/IRD/bt_inroom_en.png",
|
||||
'zh-CN': "./images/IRD/bt_inroom_ch01.png",
|
||||
'zh-TW': "./images/IRD/bt_inroom_ch02.png",
|
||||
'ja-JP': "./images/IRD/bt_inroom_jp.png"
|
||||
};
|
||||
|
||||
let g_uiTbl_String = {
|
||||
// //Words & Sentance for Menu & Contents
|
||||
|
||||
|
||||
|
||||
// 'guide_flightschedule': {
|
||||
// 'kr': '화살표를 사용하여 제주국제공항 출발, 도착하는 항공 스케줄을 확인하세요.',
|
||||
// 'en': 'Use the arrows to check flight schedules arriving and leaving from Jeju International Airport.',
|
||||
// 'ch': '请用箭头查看济州国际机场出发、到达航班的时刻表。',
|
||||
// 'tw': '請用箭頭查看濟州國際機場出發、到達航班的時刻表。',
|
||||
// 'jp': '矢印を使って済州国際空港出発便、到着便の航空スケジュールをご確認ください。'
|
||||
// },
|
||||
|
||||
// //EPG
|
||||
// 'epg_none': {
|
||||
// 'kr': "프로그램 정보가 없습니다",
|
||||
// 'en': "No program information",
|
||||
// 'ch': "没有节目信息",
|
||||
// 'tw': "沒有節目信息",
|
||||
// 'jp': "プログラム情報はありません"
|
||||
// },
|
||||
};
|
||||
|
||||
var g_uiVar_Clock = {
|
||||
time: '',
|
||||
date: ''
|
||||
};
|
||||
|
||||
|
||||
/// 초기화 루틴
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//// 비공개 매써드
|
||||
/**
|
||||
* HotelTV UI Wrapper Function::> Show(Build) Busy(loading) animation
|
||||
* @param {boolean} enable enable/disable
|
||||
*/
|
||||
function __uiFxn_MiscZeroPadding(num, digit) {
|
||||
var zero = '';
|
||||
for (var i = 0; i < digit; i++) {
|
||||
zero += '0';
|
||||
}
|
||||
return (zero + num).slice(-digit);
|
||||
}
|
||||
|
||||
/**
|
||||
* HotelTV UI Wrapper Function::> Show(Build) Busy(loading) animation
|
||||
* @param {boolean} enable enable/disable
|
||||
*/
|
||||
function __uifxn_BusyAnimation(enable) {
|
||||
if (enable) {
|
||||
//$('#busy_animation').css("background-image", "url('./images/icons/icon_loading_256x256')");
|
||||
$('.busy-frame').fadeIn(200, function() {
|
||||
$('.busy-frame #busy_animation').show();
|
||||
});
|
||||
} else {
|
||||
$('.busy-frame #busy_animation').fadeOut(300, function() {
|
||||
$('.busy-frame').fadeOut(500);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// 공개 API
|
||||
return {
|
||||
SetBusy: function(show) {
|
||||
__uifxn_BusyAnimation(show);
|
||||
},
|
||||
|
||||
ShowErrMsg: function(_show, _title, _msg) {
|
||||
if (_show) {
|
||||
$('.error').css("background-color", "rgb(255,0,0)");
|
||||
$('.error').fadeIn(500);
|
||||
} else {
|
||||
$('.error').fadeOut(500, function() {
|
||||
$(this).css("background-image", "None");
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
GetCur_DateTime: function() {
|
||||
let week = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];
|
||||
let cd = new Date();
|
||||
g_uiVar_Clock.time = __uiFxn_MiscZeroPadding(cd.getHours(), 2) + ':' + __uiFxn_MiscZeroPadding(cd.getMinutes(), 2) + ':' + __uiFxn_MiscZeroPadding(cd.getSeconds(), 2);
|
||||
g_uiVar_Clock.date = __uiFxn_MiscZeroPadding(cd.getFullYear(), 4) + '-' + __uiFxn_MiscZeroPadding(cd.getMonth() + 1, 2) + '-' + __uiFxn_MiscZeroPadding(cd.getDate(), 2) + ' ' + week[cd.getDay()];
|
||||
return g_uiVar_Clock;
|
||||
},
|
||||
|
||||
Get_String: function(_key, _lang) {
|
||||
return g_uiTbl_String[_key][_lang];
|
||||
},
|
||||
|
||||
Brochure_GetBtn: function(_lang) {
|
||||
return g_uiTbl_imgPath_Brochure_buttons[_lang];
|
||||
},
|
||||
|
||||
IRD_GetBtn: function(_lang) {
|
||||
return g_uiTbl_imgPath_InRoomDining_buttons[_lang];
|
||||
},
|
||||
|
||||
Get_Airline: function(_obj, _airline, _lang) {
|
||||
if (_obj) {
|
||||
if (_obj[_airline]) {
|
||||
return _obj[_airline][_lang] || _airline;
|
||||
}
|
||||
}
|
||||
return _airline;
|
||||
},
|
||||
|
||||
Get_Airport: function(_obj, _airport, _lang) {
|
||||
if (_obj) {
|
||||
if (_obj[_airport]) {
|
||||
return _obj[_airport][_lang] || _airport;
|
||||
}
|
||||
}
|
||||
return _airport;
|
||||
},
|
||||
|
||||
Get_FlightStatus: function(_obj, _status, _lang) {
|
||||
if (_obj) {
|
||||
if (_status && _status != "") {
|
||||
return _obj[_status][_lang] || _status;
|
||||
}
|
||||
}
|
||||
return _status;
|
||||
},
|
||||
|
||||
Weather_GetWindReport: function(_str, _speed, _direction, _lang) {
|
||||
let _cvt_speed = parseFloat((_speed * 1000 / 3600)).toFixed(2);
|
||||
let _szDir = null;
|
||||
if (_direction >= 345 && _direction < 22) {
|
||||
_szDir = _str[4][_lang];
|
||||
} else if (_direction >= 23 && _direction < 68) {
|
||||
_szDir = _str[14][_lang];
|
||||
} else if (_direction >= 69 && _direction < 114) {
|
||||
_szDir = _str[1][_lang];
|
||||
} else if (_direction >= 115 && _direction < 160) {
|
||||
_szDir = _str[13][_lang];
|
||||
} else if (_direction >= 161 && _direction < 206) {
|
||||
_szDir = _str[3][_lang];
|
||||
} else if (_direction >= 207 && _direction < 252) {
|
||||
_szDir = _str[12][_lang];
|
||||
} else if (_direction >= 253 && _direction < 298) {
|
||||
_szDir = _str[2][_lang];
|
||||
} else {
|
||||
_szDir = _str[15][_lang];
|
||||
}
|
||||
return _cvt_speed.toString() + " " + _szDir;
|
||||
},
|
||||
}
|
||||
})();
|
||||
396
procentric/application/lib/hoteltv.ui_welcome.js
Executable file
396
procentric/application/lib/hoteltv.ui_welcome.js
Executable file
@@ -0,0 +1,396 @@
|
||||
/**
|
||||
* Copyright (c) 2020
|
||||
*
|
||||
* CENTIRM HotelTV UI-WELCOME module javascript.
|
||||
*
|
||||
* @summary short description for the file
|
||||
* @author Joel <joel.kim@centirm.com>
|
||||
*
|
||||
* Created at : 2020-11-26 02:21:56
|
||||
* Last modified : 2020-11-26 15:31:40
|
||||
*/
|
||||
|
||||
HotelTV.namespace('HotelTV.ui_welcome');
|
||||
HotelTV.ui_welcome = (function() {
|
||||
//// 의존 관계 선언
|
||||
let hndl_langSel = null;
|
||||
let _media_status = null;
|
||||
|
||||
//// 비공개 프로퍼티
|
||||
|
||||
/// 초기화 루틴
|
||||
/**
|
||||
* HotelTV UI Wrapper Function::> received event handling function
|
||||
* @param {boolean} e event
|
||||
*/
|
||||
function __uifxn_WC_OnMediaEvt(e) {
|
||||
let _state = HotelTV.state;
|
||||
console.log("media_event_received = " + e.eventType);
|
||||
let _stateMedia = e.eventType;
|
||||
switch (_stateMedia) {
|
||||
case 'play_start':
|
||||
_media_status = 'playing';
|
||||
HotelTV.hcap.VideoWinSize(null);
|
||||
|
||||
//Hide welcome page
|
||||
__uifxn_WC_Show(null, function() {
|
||||
_state.menu.stage = "playWelcomeMovie";
|
||||
|
||||
$('#lst_langsel').off('changed.owl.carousel');
|
||||
$('#lst_langsel').owlCarousel('destroy');
|
||||
$('.welcome #lst_langsel div').remove();
|
||||
|
||||
if ($(".control .skip_video").css('display') == 'none') {
|
||||
$(".control .skip_video").fadeIn(1000);
|
||||
setTimeout(() => {
|
||||
$(".control .skip_video").fadeOut(1000);
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'play_end':
|
||||
_media_status = 'stopped';
|
||||
HotelTV.hcap.MediaShutdown(
|
||||
function() {
|
||||
$(".control .skip_video").hide();
|
||||
console.log("Media Desory::Done");
|
||||
HotelTV.UnloadWelCome();
|
||||
},
|
||||
function() {
|
||||
console.log("Media Desory::Fail");
|
||||
$(".control .skip_video").hide();
|
||||
HotelTV.UnloadWelCome();
|
||||
});
|
||||
break;
|
||||
case 'play_end_need_destory':
|
||||
HotelTV.hcap.MediaShutdown(
|
||||
function() {
|
||||
$(".control .skip_video").hide();
|
||||
console.log("Media Desory::Done");
|
||||
HotelTV.UnloadWelCome();
|
||||
},
|
||||
function() {
|
||||
console.log("Media Desory::Fail");
|
||||
$(".control .skip_video").hide();
|
||||
HotelTV.UnloadWelCome();
|
||||
});
|
||||
break;
|
||||
case 'error_in_playing':
|
||||
break;
|
||||
case 'buffer_full':
|
||||
break;
|
||||
case 'file_not_found':
|
||||
break;
|
||||
case 'network_disconnected':
|
||||
break;
|
||||
case 'network_busy':
|
||||
break;
|
||||
case 'seek_done':
|
||||
break;
|
||||
|
||||
case 'play_stop_requtested':
|
||||
_media_status = 'stopped';
|
||||
HotelTV.hcap.MediaShutdown(
|
||||
function() {
|
||||
$(".control .skip_video").hide();
|
||||
console.log("Media Desory::Done");
|
||||
HotelTV.UnloadWelCome();
|
||||
},
|
||||
function() {
|
||||
console.log("Media Desory::Fail");
|
||||
$(".control .skip_video").hide();
|
||||
HotelTV.UnloadWelCome();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HotelTV UI Wrapper Function::> received event handling function
|
||||
* @param {dictionary} _evt event information
|
||||
*/
|
||||
function __uifxn_WC_OnNetEvt(_evt) {
|
||||
let _state = HotelTV.state;
|
||||
console.log("network_event_received = " + _evt.eventType);
|
||||
let _typeNetEvt = _evt.eventType;
|
||||
|
||||
switch (_typeNetEvt) {
|
||||
case hcap.network.NetworkEventType.ABLE_REACH_DNS:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.ABLE_REACH_GATEWAY:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.ABLE_REACH_INTERNET:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.DHCP_FAIL:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.DHCP_SUCCESS:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.ETHERNET_PLUGGED:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.ETHERNET_UNPLUGGED:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.IP_CONFLICT:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.IP_NOT_CONFLICT:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.UNABLE_REACH_DNS:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.UNABLE_REACH_GATEWAY:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.UNABLE_REACH_INTERNET:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.UNKNOWN:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.WIFI_AP_SEARCH_COMPLETE:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.WIFI_CONNECT_FAIL:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.WIFI_CONNECTED:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.WIFI_DONGLE_PLUGGED:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.WIFI_DONGLE_UNPLUGGED:
|
||||
break;
|
||||
case hcap.network.NetworkEventType.WIFI_LINK_DROPPED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HotelTV UI Wrapper Function::> Show Welcome Hotel Logo
|
||||
* @param {boolean} uri_img background image url
|
||||
*/
|
||||
function __uifxn_WC_SetHotelLogo(uri_img) {
|
||||
let _elmnt_img_hotellogo = $(".welcome > .frame > .msgwin #hotellogo");
|
||||
if (uri_img != null) {
|
||||
_elmnt_img_hotellogo.css({
|
||||
"background-image": "url(" + uri_img + ")",
|
||||
"background-size": "100% 100%"
|
||||
});
|
||||
} else {
|
||||
_elmnt_img_hotellogo.css({ "background": "none" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HotelTV UI Wrapper Function::> Fillup welcome contents
|
||||
* @param {boolean} sz_name Guest Name
|
||||
* * @param {boolean} sz_msg Greeting Message
|
||||
*/
|
||||
function __uifxn_WC_SetCtz(sz_name, sz_msg) {
|
||||
let _state = HotelTV.state;
|
||||
let _trTbl = HotelTV.translation;
|
||||
let _elmnt_guest_name = $(".welcome > .frame > .msgwin #guestname");
|
||||
let _elmnt_welcomemsg = $(".welcome > .frame > .msgwin #welcomemsg");
|
||||
let _elmnt_img_guide = $(".welcome > .frame > .guide#langsel");
|
||||
|
||||
if (sz_name != null) {
|
||||
_elmnt_guest_name.html(sz_name + '<br />');
|
||||
} else {
|
||||
_elmnt_guest_name.html('<br />');
|
||||
}
|
||||
|
||||
if (sz_msg[_state.lang] != null) {
|
||||
_elmnt_welcomemsg.html(sz_msg[_state.lang] + '<br />');
|
||||
} else {
|
||||
_elmnt_welcomemsg.html('<br />');
|
||||
}
|
||||
_elmnt_img_guide.text(_trTbl.ui.welcome.guide_wc_langsel[_state.lang]);
|
||||
}
|
||||
|
||||
/**
|
||||
* HotelTV UI Wrapper Function::> build welcome Main UI
|
||||
* @param {boolean} uri_img background image url
|
||||
*/
|
||||
function __uifxn_WC_BldPage() {
|
||||
let _ctzOpening = HotelTV.opening;
|
||||
let _ctzWc = _ctzOpening.welcome;
|
||||
let _state = HotelTV.state;
|
||||
|
||||
|
||||
//Supported Language Count
|
||||
let _langCnt = Object.keys(_ctzOpening.languages).length;
|
||||
let _SupportedLang = _ctzOpening.languages;
|
||||
|
||||
//Add html elements for language selection
|
||||
let _div_langsel = document.querySelector('.welcome #lst_langsel');
|
||||
for (let __lang in _SupportedLang) {
|
||||
let _div_lang_btn = document.createElement('div');
|
||||
let _sz_styleOpt = null;
|
||||
|
||||
_div_lang_btn.className = 'item';
|
||||
_div_lang_btn.id = 'wc_eit_langsel_' + __lang;
|
||||
_div_lang_btn.textContent = _SupportedLang[__lang].name;
|
||||
_div_lang_btn.setAttribute("lang", __lang);
|
||||
_sz_styleOpt = "--btn_focus:url(./images/bt_language_tab_focus.png); --btn_unfocus:url(./images/bt_language_tab_unfocus.png);";
|
||||
_div_lang_btn.setAttribute("style", _sz_styleOpt);
|
||||
_div_langsel.appendChild(_div_lang_btn);
|
||||
}
|
||||
|
||||
//
|
||||
let _start_pos = 0;
|
||||
for (let __lang in _SupportedLang) {
|
||||
if (_state.lang == __lang) {
|
||||
break;
|
||||
}
|
||||
_start_pos++;
|
||||
}
|
||||
hndl_langSel = $('#lst_langsel');
|
||||
hndl_langSel.owlCarousel({
|
||||
center: true,
|
||||
items: Number(_langCnt - 1), //Number of Items on Screen what you want
|
||||
loop: true,
|
||||
margin: 0,
|
||||
smartSpeed: 700,
|
||||
autoWidth: false,
|
||||
mouseDrag: false,
|
||||
touchDrag: false,
|
||||
pullDrag: false,
|
||||
freeDrag: false,
|
||||
startPosition: _start_pos,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* HotelTV UI Wrapper Function::> show welcome Main UI
|
||||
* @param {boolean} uri_img background image url
|
||||
*/
|
||||
function __uifxn_WC_Show(uri_img, _callback) {
|
||||
if (uri_img != null) {
|
||||
//Decision fist displyed language
|
||||
let _state = HotelTV.state;
|
||||
let _ctzOpening = HotelTV.opening;
|
||||
let _ctzWc = _ctzOpening.welcome;
|
||||
let _ctzGst = HotelTV.guestinfo;
|
||||
let _ctzHotel = HotelTV.hotelinfo;
|
||||
|
||||
hndl_langSel = $('#lst_langsel');
|
||||
$(".welcome").show();
|
||||
$(".welcome > .frame").css("background-image", "url(" + uri_img + ")");
|
||||
$(".welcome > .frame").fadeIn(500, function() {
|
||||
hndl_langSel.show();
|
||||
//배경 출력후 1.5초 뒤에 호텔 로그와 웰컴 메시지 출력하도록 타임아웃 적용
|
||||
setTimeout(function() {
|
||||
__uifxn_WC_SetHotelLogo(_ctzHotel.mainLogo.download);
|
||||
setTimeout(function() {
|
||||
$('.welcome .frame .msgwin #welcomemsg').fadeIn(500, function() {
|
||||
$('.welcome .frame .msgwin #guestname').fadeIn(500, function() {
|
||||
_state.menu.stage = "langSel"
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
}, 500);
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).on('keydown', function(_evt) { //attach event listener
|
||||
console.log("LANGSEL KEY EVENT::> " + _evt.keyCode);
|
||||
if (_state.menu.stage == "langSel") {
|
||||
if (_evt.keyCode == 37) {
|
||||
$('#lst_langsel').trigger('prev.owl')
|
||||
} else if (_evt.keyCode == 39) {
|
||||
$('#lst_langsel').trigger('next.owl')
|
||||
} else if (_evt.keyCode == 13) {
|
||||
// SET PLATFORM LANGUAGE
|
||||
// HotelTV.hcap.SetPlatformLanguage(_state.lang);
|
||||
|
||||
// LANGUAGE 선택
|
||||
if (_ctzWc.intro == 'image') {
|
||||
/** Play slide shows */
|
||||
|
||||
} else if (_ctzWc.intro == 'video') {
|
||||
|
||||
/** Play movie clip */
|
||||
HotelTV.hcap.MediaPlay(
|
||||
HotelTV.api.GetBaseUrl() + _ctzWc.videos[_state.lang].download,
|
||||
null,
|
||||
"video/mp4",
|
||||
1,
|
||||
() => {
|
||||
console.log("STARTUP Done CB.");
|
||||
//Shows up skip button
|
||||
let _elmnt_btn_skip = $(".control .skip_video");
|
||||
_elmnt_btn_skip.css({
|
||||
"background-image": "url(" + "./images/bt_skip_en.png" + ")",
|
||||
"background-size": "100% 100%"
|
||||
});
|
||||
},
|
||||
() => {
|
||||
console.log("STARTUP Fail CB.");
|
||||
HotelTV.UnloadWelCome();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
console.log("No welcome post contents");
|
||||
}
|
||||
}
|
||||
} else if (_state.menu.stage == "playWelcomeMovie") {
|
||||
if (_evt.keyCode == 413) {
|
||||
// STOP KEY Event
|
||||
if (_media_status == 'playing') {
|
||||
_media_status = 'preparing_stop_playing';
|
||||
var _evt = new Event('media_event_received');
|
||||
_evt.eventType = "play_end_need_destory";
|
||||
_evt.command_id = "event";
|
||||
document.dispatchEvent(_evt);
|
||||
}
|
||||
} else {
|
||||
console.log(">>");
|
||||
if (_media_status == 'playing') {
|
||||
if ($(".control .skip_video").css('display') == 'none') {
|
||||
$(".control .skip_video").fadeIn(1000);
|
||||
setTimeout(() => {
|
||||
$(".control .skip_video").fadeOut(1000);
|
||||
}, 3000);
|
||||
} else {
|
||||
const _evt = new Event('media_event_received');
|
||||
_evt['command_id'] = "media_event_received";
|
||||
_evt['eventType'] = "play_stop_requtested";
|
||||
document.dispatchEvent(_evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
hndl_langSel.on('changed.owl.carousel', function(event) {
|
||||
// Update Language
|
||||
console.log("LANG SEL[CHANGED]::>" + event.page.index);
|
||||
_state.lang = Object.keys(_ctzOpening.languages)[event.page.index];
|
||||
__uifxn_WC_SetCtz(_ctzGst.name, _ctzWc.message);
|
||||
});
|
||||
} else {
|
||||
//Hide welcome main frame
|
||||
if (_callback != null) {
|
||||
$(".welcome").fadeOut(1000, _callback); // display 속성을 none 으로 바꾼다.
|
||||
} else {
|
||||
$(".welcome").fadeOut(1000); // display 속성을 none 으로 바꾼다.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// 공개 API
|
||||
return {
|
||||
Init: function(width, height) {
|
||||
//ADD Media related event handler
|
||||
document.addEventListener("media_event_received", __uifxn_WC_OnMediaEvt, false);
|
||||
//ADD Network related event handler
|
||||
document.addEventListener("network_event_received", __uifxn_WC_OnNetEvt, false);
|
||||
|
||||
// Build up Welcome Page
|
||||
__uifxn_WC_BldPage();
|
||||
},
|
||||
|
||||
Show: function() {
|
||||
let _ctzWc = HotelTV.opening.welcome;
|
||||
__uifxn_WC_Show(_ctzWc.background.file.download, null);
|
||||
},
|
||||
|
||||
Close: function() {
|
||||
SpatialNavigation.clear();
|
||||
},
|
||||
}
|
||||
})();
|
||||
9814
procentric/application/lib/jquery-2.2.4.js
vendored
Executable file
9814
procentric/application/lib/jquery-2.2.4.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
2
procentric/application/lib/jquery-3.5.1.min.js
vendored
Executable file
2
procentric/application/lib/jquery-3.5.1.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
2
procentric/application/lib/jquery-3.6.0.min.js
vendored
Executable file
2
procentric/application/lib/jquery-3.6.0.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
2
procentric/application/lib/jquery.color-2.1.2.min.js
vendored
Normal file
2
procentric/application/lib/jquery.color-2.1.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
55
procentric/application/lib/jquery.webticker.min copy.js
Executable file
55
procentric/application/lib/jquery.webticker.min copy.js
Executable file
@@ -0,0 +1,55 @@
|
||||
! function(i) {
|
||||
function t(t) { var e = 0; return t.children("li").each(function() { e += i(this).outerWidth(!0) }), e }
|
||||
|
||||
function e(t) { return Math.max.apply(Math, t.children().map(function() { return i(this).width() }).get()) }
|
||||
|
||||
function s(i) { var t = i.data("settings") || { direction: "left", speed: 50 },
|
||||
e = i.children().first(),
|
||||
s = Math.abs(-i.css(t.direction).replace("px", "").replace("auto", "0") - e.outerWidth(!0)),
|
||||
n = 1e3 * s / t.speed,
|
||||
r = {}; return r[t.direction] = i.css(t.direction).replace("px", "").replace("auto", "0") - s, { css: r, time: n } }
|
||||
|
||||
function n(i) { var t = i.data("settings") || { direction: "left" };
|
||||
i.css("transition-duration", "0s").css(t.direction, "0"); var e = i.children().first();
|
||||
e.hasClass("webticker-init") ? e.remove() : i.children().last().after(e) }
|
||||
|
||||
function r(i, t) { var e = i.data("settings") || { direction: "left" }; "undefined" == typeof t && (t = !1), t && n(i); var a = s(i);
|
||||
i.animate(a.css, a.time, "linear", function() { i.css(e.direction, "0"), r(i, !0) }) }
|
||||
|
||||
function a(i, t) { "undefined" == typeof t && (t = !1), t && n(i); var e = s(i),
|
||||
r = e.time / 1e3;
|
||||
r += "s", i.css(e.css).css("transition-duration", r) }
|
||||
|
||||
function c(t, e, s) { var n = [];
|
||||
i.get(t, function(t) { var r = i(t);
|
||||
r.find("item").each(function() { var t = i(this),
|
||||
e = { title: t.find("title").text(), link: t.find("link").text() },
|
||||
s = '<li><a href="' + e.link + '"">' + e.title + "</a></li>";
|
||||
n += s }), s.webTicker("update", n, e) }) }
|
||||
|
||||
function l(s, n) { if (s.children("li").length < 1) return window.console, !1; var r = s.data("settings");
|
||||
r.duplicateLoops = r.duplicateLoops || 0, s.width("auto"); var a = 0;
|
||||
s.children("li").each(function() { a += i(this).outerWidth(!0) }); var c, l = s.find("li:first").height(); if (r.duplicate) { c = e(s); for (var o = 0; a - c < s.parent().width() || 1 === s.children().length || o < r.duplicateLoops;) { var d = s.children().clone();
|
||||
s.append(d), a = 0, a = t(s), c = e(s), o++ }
|
||||
r.duplicateLoops = o } else { var h = s.parent().width() - a;
|
||||
h += s.find("li:first").width(), s.find(".ticker-spacer").length > 0 ? s.find(".ticker-spacer").width(h) : s.append('<li class="ticker-spacer" style="float: ' + r.direction + ";width:" + h + "px;height:" + l + 'px;"></li>') }
|
||||
r.startEmpty && n && s.prepend('<li class="webticker-init" style="float: ' + r.direction + ";width:" + s.parent().width() + "px;height:" + l + 'px;"></li>'), a = 0, a = t(s), s.width(a + 200); var f = 0; for (f = t(s); f >= s.width();) s.width(s.width() + 200), f = 0, f = t(s); return !0 } var o = function() { var i = document.createElement("p").style,
|
||||
t = ["ms", "O", "Moz", "Webkit"]; if ("" === i.transition) return !0; for (; t.length;)
|
||||
if (t.pop() + "Transition" in i) return !0;
|
||||
return !1 }(),
|
||||
d = { init: function(t) { return t = jQuery.extend({ speed: 50, direction: "left", moving: !0, startEmpty: !0, duplicate: !1, rssurl: !1, hoverpause: !0, rssfrequency: 0, updatetype: "reset", transition: "linear", height: "30px", maskleft: "", maskright: "", maskwidth: 0 }, t), this.each(function() { jQuery(this).data("settings", t); var e = jQuery(this),
|
||||
s = e.wrap('<div class="mask"></div>');
|
||||
s.after('<span class="tickeroverlay-left"> </span><span class="tickeroverlay-right"> </span>'); var n, d = e.parent().wrap('<div class="tickercontainer"></div>'); if (i(window).resize(function() { clearTimeout(n), n = setTimeout(function() { console.log("window was resized"), l(e, !1) }, 500) }), e.children("li").css("white-space", "nowrap"), e.children("li").css("float", t.direction), e.children("li").css("padding", "0 7px"), e.children("li").css("line-height", t.height), s.css("position", "relative"), s.css("overflow", "hidden"), e.closest(".tickercontainer").css("height", t.height), e.closest(".tickercontainer").css("overflow", "hidden"), e.css("float", t.direction), e.css("position", "relative"), e.css("font", "bold 10px Verdana"), e.css("list-style-type", "none"), e.css("margin", "0"), e.css("padding", "0"), "" !== t.maskleft && "" !== t.maskright) { var h = 'url("' + t.maskleft + '")';
|
||||
d.find(".tickeroverlay-left").css("background-image", h), d.find(".tickeroverlay-left").css("display", "block"), d.find(".tickeroverlay-left").css("pointer-events", "none"), d.find(".tickeroverlay-left").css("position", "absolute"), d.find(".tickeroverlay-left").css("z-index", "30"), d.find(".tickeroverlay-left").css("height", t.height), d.find(".tickeroverlay-left").css("width", t.maskwidth), d.find(".tickeroverlay-left").css("top", "0"), d.find(".tickeroverlay-left").css("left", "-2px"), h = 'url("' + t.maskright + '")', d.find(".tickeroverlay-right").css("background-image", h), d.find(".tickeroverlay-right").css("display", "block"), d.find(".tickeroverlay-right").css("pointer-events", "none"), d.find(".tickeroverlay-right").css("position", "absolute"), d.find(".tickeroverlay-right").css("z-index", "30"), d.find(".tickeroverlay-right").css("height", t.height), d.find(".tickeroverlay-right").css("width", t.maskwidth), d.find(".tickeroverlay-right").css("top", "0"), d.find(".tickeroverlay-right").css("right", "-2px") } else d.find(".tickeroverlay-left").css("display", "none"), d.find(".tickeroverlay-right").css("display", "none");
|
||||
e.children("li").last().addClass("last"); var f = l(e, !0);
|
||||
t.rssurl && (c(t.rssurl, t.type, e), t.rssfrequency > 0 && window.setInterval(function() { c(t.rssurl, t.type, e) }, 1e3 * t.rssfrequency * 60)), o ? (e.css("transition-timing-function", t.transition), e.css("transition-duration", "0s").css(t.direction, "0"), f && a(e, !1), e.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend", function(t) { return !!e.is(t.target) && void a(i(this), !0) })) : f && r(i(this)), t.hoverpause && e.hover(function() { if (o) { var e = i(this).css(t.direction);
|
||||
i(this).css("transition-duration", "0s").css(t.direction, e) } else jQuery(this).stop() }, function() { jQuery(this).data("settings").moving && (o ? a(i(this), !1) : r(e)) }) }) }, stop: function() { var t = i(this).data("settings"); if (t.moving) return t.moving = !1, this.each(function() { if (o) { var e = i(this).css(t.direction);
|
||||
i(this).css("transition-duration", "0s").css(t.direction, e) } else i(this).stop() }) }, cont: function() { var t = i(this).data("settings"); if (!t.moving) return t.moving = !0, this.each(function() { o ? a(i(this), !1) : r(i(this)) }) }, transition: function(t) { var e = i(this);
|
||||
o && e.css("transition-timing-function", t) }, update: function(e, s, n, r) { s = s || "reset", "undefined" == typeof n && (n = !0), "undefined" == typeof r && (r = !1), "string" == typeof e && (e = i(e)); var a = i(this);
|
||||
a.webTicker("stop"); var c = i(this).data("settings"); if ("reset" === s) a.html(e), l(a, !0);
|
||||
else if ("swap" === s) { var o, d, h, f; if (window.console, a.children("li").length < 1) a.html(e), a.css(c.direction, "0"), l(a, !0);
|
||||
else if (c.duplicate === !0) { a.children("li").addClass("old"); for (var p = e.length - 1; p >= 0; p--) o = i(e[p]).data("update"), d = a.find('[data-update="' + o + '"]'), d.length < 1 ? n && (0 === a.find(".ticker-spacer:first-child").length && a.find(".ticker-spacer").length > 0 ? a.children("li.ticker-spacer").before(e[p]) : (h = i(e[p]), p === e.length - 1 && h.addClass("last"), a.find("last").after(h), a.find("last").removeClass("last"))) : a.find('[data-update="' + o + '"]').replaceWith(e[p]);
|
||||
a.children("li.webticker-init, li.ticker-spacer").removeClass("old"), r && a.children("li").remove(".old"), f = 0, f = t(a), a.width(f + 200), a.find("li.webticker-init").length < 1 && (c.startEmpty = !1), a.html(e), a.children("li").css("white-space", "nowrap"), a.children("li").css("float", c.direction), a.children("li").css("padding", "0 7px"), a.children("li").css("line-height", c.height), l(a, !0) } else { a.children("li").addClass("old"); for (var u = 0; u < e.length; u++) o = i(e[u]).data("update"), d = a.find('[data-update="' + o + '"]'), d.length < 1 ? n && (0 === a.find(".ticker-spacer:first-child").length && a.find(".ticker-spacer").length > 0 ? a.children("li.ticker-spacer").before(e[u]) : (h = i(e[u]), u === e.length - 1 && h.addClass("last"), a.find(".old.last").after(h), a.find(".old.last").removeClass("last"))) : a.find('[data-update="' + o + '"]').replaceWith(e[u]);
|
||||
a.children("li.webticker-init, li.ticker-spacer").removeClass("old"), a.children("li").css("white-space", "nowrap"), a.children("li").css("float", c.direction), a.children("li").css("padding", "0 7px"), a.children("li").css("line-height", c.height), r && a.children("li").remove(".old"), f = 0, f = t(a), a.width(f + 200) } }
|
||||
a.webTicker("cont") } };
|
||||
i.fn.webTicker = function(t) { return d[t] ? d[t].apply(this, Array.prototype.slice.call(arguments, 1)) : "object" != typeof t && t ? void i.error("Method " + t + " does not exist on jQuery.webTicker") : d.init.apply(this, arguments) } }(jQuery);
|
||||
1
procentric/application/lib/jquery.webticker.min.js
vendored
Normal file
1
procentric/application/lib/jquery.webticker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1145
procentric/application/lib/lightslider.js
Executable file
1145
procentric/application/lib/lightslider.js
Executable file
File diff suppressed because it is too large
Load Diff
1
procentric/application/lib/mqtt.min.js
vendored
Executable file
1
procentric/application/lib/mqtt.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
BIN
procentric/application/lib/mqtt.min.js.zip
Executable file
BIN
procentric/application/lib/mqtt.min.js.zip
Executable file
Binary file not shown.
3461
procentric/application/lib/owl.carousel.js
Executable file
3461
procentric/application/lib/owl.carousel.js
Executable file
File diff suppressed because it is too large
Load Diff
7
procentric/application/lib/owl.carousel.min.js
vendored
Executable file
7
procentric/application/lib/owl.carousel.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
2203
procentric/application/lib/sly.js
Executable file
2203
procentric/application/lib/sly.js
Executable file
File diff suppressed because it is too large
Load Diff
1266
procentric/application/lib/spatial_navigation.js
Executable file
1266
procentric/application/lib/spatial_navigation.js
Executable file
File diff suppressed because it is too large
Load Diff
2
procentric/application/lib/tiny-slider.helper.ie8.js
Executable file
2
procentric/application/lib/tiny-slider.helper.ie8.js
Executable file
@@ -0,0 +1,2 @@
|
||||
Array.prototype.forEach||(Array.prototype.forEach=function(e,t){for(var n=this.length>>>0,r=0;r<n;r++)r in this&&e.call(t,this[r],r,this)}),Array.prototype.map||(Array.prototype.map=function(e){var t=this.length>>>0;if("function"!=typeof e)throw new TypeError;for(var n=new Array(t),r=arguments[1],o=0;o<t;o++)o in this&&(n[o]=e.call(r,this[o],o,this));return n}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var t=this.length;if(!t)return-1;var n=arguments[1]||0;if(t<=n)return-1;for(n<0&&(n+=t);n<t;n++)if(Object.prototype.hasOwnProperty.call(this,n)&&e===this[n])return n;return-1}),function(){if(!Element.prototype.addEventListener){var p=[],e=function(e,t){var n=this,r=function(e){e.target=e.srcElement,e.currentTarget=n,void 0!==t.handleEvent?t.handleEvent(e):t.call(n,e)};if("DOMContentLoaded"==e){var o=function(e){"complete"==document.readyState&&r(e)};if(document.attachEvent("onreadystatechange",o),p.push({object:this,type:e,listener:t,wrapper:o}),"complete"==document.readyState){var i=new Event;i.srcElement=window,o(i)}}else this.attachEvent("on"+e,r),p.push({object:this,type:e,listener:t,wrapper:r})},t=function(e,t){for(var n=0;n<p.length;){var r=p[n];if(r.object==this&&r.type==e&&r.listener==t){"DOMContentLoaded"==e?this.detachEvent("onreadystatechange",r.wrapper):this.detachEvent("on"+e,r.wrapper),p.splice(n,1);break}++n}};Element.prototype.addEventListener=e,Element.prototype.removeEventListener=t,HTMLDocument&&(HTMLDocument.prototype.addEventListener=e,HTMLDocument.prototype.removeEventListener=t),Window&&(Window.prototype.addEventListener=e,Window.prototype.removeEventListener=t)}}(),"firstElementChild"in document.documentElement||Object.defineProperty(Element.prototype,"firstElementChild",{get:function(){for(var e,t=this.children,n=0,r=t.length;n<r;++n)if(1===(e=t[n]).nodeType)return e;return null}}),"previousElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"previousElementSibling",{get:function(){for(var e=this.previousSibling;e&&1!==e.nodeType;)e=e.previousSibling;return e}}),"nextElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"nextElementSibling",{get:function(){for(var e=this.nextSibling;e&&1!==e.nodeType;)e=e.nextSibling;return e}}),window.getComputedStyle||(window.getComputedStyle=function(e){if(!e)return null;var t=e.currentStyle,n=e.getBoundingClientRect(),r=document.createElement("div").style;for(var o in t)r[o]=t[o];return r.cssFloat=r.styleFloat,"auto"===r.width&&(r.width=n.right-n.left+"px"),"auto"===r.height&&(r.height=n.bottom-n.top+"px"),r});
|
||||
//# sourceMappingURL=../sourcemaps/tiny-slider.helper.ie8.js.map
|
||||
3219
procentric/application/lib/tiny-slider.js
Executable file
3219
procentric/application/lib/tiny-slider.js
Executable file
File diff suppressed because it is too large
Load Diff
2
procentric/application/lib/tiny-slider.js.min
Executable file
2
procentric/application/lib/tiny-slider.js.min
Executable file
File diff suppressed because one or more lines are too long
585
procentric/application/lib/xml2json.js
Normal file
585
procentric/application/lib/xml2json.js
Normal file
@@ -0,0 +1,585 @@
|
||||
/*
|
||||
Copyright 2011-2013 Abdulla Abdurakhmanov
|
||||
Original sources are available at https://code.google.com/p/x2js/
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define([], factory);
|
||||
} else if (typeof exports === "object") {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
root.X2JS = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
return function (config) {
|
||||
'use strict';
|
||||
|
||||
var VERSION = "1.2.0";
|
||||
|
||||
config = config || {};
|
||||
initConfigDefaults();
|
||||
initRequiredPolyfills();
|
||||
|
||||
function initConfigDefaults() {
|
||||
if(config.escapeMode === undefined) {
|
||||
config.escapeMode = true;
|
||||
}
|
||||
|
||||
config.attributePrefix = config.attributePrefix || "_";
|
||||
config.arrayAccessForm = config.arrayAccessForm || "none";
|
||||
config.emptyNodeForm = config.emptyNodeForm || "text";
|
||||
|
||||
if(config.enableToStringFunc === undefined) {
|
||||
config.enableToStringFunc = true;
|
||||
}
|
||||
config.arrayAccessFormPaths = config.arrayAccessFormPaths || [];
|
||||
if(config.skipEmptyTextNodesForObj === undefined) {
|
||||
config.skipEmptyTextNodesForObj = true;
|
||||
}
|
||||
if(config.stripWhitespaces === undefined) {
|
||||
config.stripWhitespaces = true;
|
||||
}
|
||||
config.datetimeAccessFormPaths = config.datetimeAccessFormPaths || [];
|
||||
|
||||
if(config.useDoubleQuotes === undefined) {
|
||||
config.useDoubleQuotes = false;
|
||||
}
|
||||
|
||||
config.xmlElementsFilter = config.xmlElementsFilter || [];
|
||||
config.jsonPropertiesFilter = config.jsonPropertiesFilter || [];
|
||||
|
||||
if(config.keepCData === undefined) {
|
||||
config.keepCData = false;
|
||||
}
|
||||
}
|
||||
|
||||
var DOMNodeTypes = {
|
||||
ELEMENT_NODE : 1,
|
||||
TEXT_NODE : 3,
|
||||
CDATA_SECTION_NODE : 4,
|
||||
COMMENT_NODE : 8,
|
||||
DOCUMENT_NODE : 9
|
||||
};
|
||||
|
||||
function initRequiredPolyfills() {
|
||||
}
|
||||
|
||||
function getNodeLocalName( node ) {
|
||||
var nodeLocalName = node.localName;
|
||||
if(nodeLocalName == null) // Yeah, this is IE!!
|
||||
nodeLocalName = node.baseName;
|
||||
if(nodeLocalName == null || nodeLocalName=="") // =="" is IE too
|
||||
nodeLocalName = node.nodeName;
|
||||
return nodeLocalName;
|
||||
}
|
||||
|
||||
function getNodePrefix(node) {
|
||||
return node.prefix;
|
||||
}
|
||||
|
||||
function escapeXmlChars(str) {
|
||||
if(typeof(str) == "string")
|
||||
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
||||
else
|
||||
return str;
|
||||
}
|
||||
|
||||
function unescapeXmlChars(str) {
|
||||
return str.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&');
|
||||
}
|
||||
|
||||
function checkInStdFiltersArrayForm(stdFiltersArrayForm, obj, name, path) {
|
||||
var idx = 0;
|
||||
for(; idx < stdFiltersArrayForm.length; idx++) {
|
||||
var filterPath = stdFiltersArrayForm[idx];
|
||||
if( typeof filterPath === "string" ) {
|
||||
if(filterPath == path)
|
||||
break;
|
||||
}
|
||||
else
|
||||
if( filterPath instanceof RegExp) {
|
||||
if(filterPath.test(path))
|
||||
break;
|
||||
}
|
||||
else
|
||||
if( typeof filterPath === "function") {
|
||||
if(filterPath(obj, name, path))
|
||||
break;
|
||||
}
|
||||
}
|
||||
return idx!=stdFiltersArrayForm.length;
|
||||
}
|
||||
|
||||
function toArrayAccessForm(obj, childName, path) {
|
||||
switch(config.arrayAccessForm) {
|
||||
case "property":
|
||||
if(!(obj[childName] instanceof Array))
|
||||
obj[childName+"_asArray"] = [obj[childName]];
|
||||
else
|
||||
obj[childName+"_asArray"] = obj[childName];
|
||||
break;
|
||||
/*case "none":
|
||||
break;*/
|
||||
}
|
||||
|
||||
if(!(obj[childName] instanceof Array) && config.arrayAccessFormPaths.length > 0) {
|
||||
if(checkInStdFiltersArrayForm(config.arrayAccessFormPaths, obj, childName, path)) {
|
||||
obj[childName] = [obj[childName]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fromXmlDateTime(prop) {
|
||||
// Implementation based up on http://stackoverflow.com/questions/8178598/xml-datetime-to-javascript-date-object
|
||||
// Improved to support full spec and optional parts
|
||||
var bits = prop.split(/[-T:+Z]/g);
|
||||
|
||||
var d = new Date(bits[0], bits[1]-1, bits[2]);
|
||||
var secondBits = bits[5].split("\.");
|
||||
d.setHours(bits[3], bits[4], secondBits[0]);
|
||||
if(secondBits.length>1)
|
||||
d.setMilliseconds(secondBits[1]);
|
||||
|
||||
// Get supplied time zone offset in minutes
|
||||
if(bits[6] && bits[7]) {
|
||||
var offsetMinutes = bits[6] * 60 + Number(bits[7]);
|
||||
var sign = /\d\d-\d\d:\d\d$/.test(prop)? '-' : '+';
|
||||
|
||||
// Apply the sign
|
||||
offsetMinutes = 0 + (sign == '-'? -1 * offsetMinutes : offsetMinutes);
|
||||
|
||||
// Apply offset and local timezone
|
||||
d.setMinutes(d.getMinutes() - offsetMinutes - d.getTimezoneOffset())
|
||||
}
|
||||
else
|
||||
if(prop.indexOf("Z", prop.length - 1) !== -1) {
|
||||
d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()));
|
||||
}
|
||||
|
||||
// d is now a local time equivalent to the supplied time
|
||||
return d;
|
||||
}
|
||||
|
||||
function checkFromXmlDateTimePaths(value, childName, fullPath) {
|
||||
if(config.datetimeAccessFormPaths.length > 0) {
|
||||
var path = fullPath.split("\.#")[0];
|
||||
if(checkInStdFiltersArrayForm(config.datetimeAccessFormPaths, value, childName, path)) {
|
||||
return fromXmlDateTime(value);
|
||||
}
|
||||
else
|
||||
return value;
|
||||
}
|
||||
else
|
||||
return value;
|
||||
}
|
||||
|
||||
function checkXmlElementsFilter(obj, childType, childName, childPath) {
|
||||
if( childType == DOMNodeTypes.ELEMENT_NODE && config.xmlElementsFilter.length > 0) {
|
||||
return checkInStdFiltersArrayForm(config.xmlElementsFilter, obj, childName, childPath);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
function parseDOMChildren( node, path ) {
|
||||
if(node.nodeType == DOMNodeTypes.DOCUMENT_NODE) {
|
||||
var result = new Object;
|
||||
var nodeChildren = node.childNodes;
|
||||
// Alternative for firstElementChild which is not supported in some environments
|
||||
for(var cidx=0; cidx <nodeChildren.length; cidx++) {
|
||||
var child = nodeChildren.item(cidx);
|
||||
if(child.nodeType == DOMNodeTypes.ELEMENT_NODE) {
|
||||
var childName = getNodeLocalName(child);
|
||||
result[childName] = parseDOMChildren(child, childName);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else
|
||||
if(node.nodeType == DOMNodeTypes.ELEMENT_NODE) {
|
||||
var result = new Object;
|
||||
result.__cnt=0;
|
||||
|
||||
var nodeChildren = node.childNodes;
|
||||
|
||||
// Children nodes
|
||||
for(var cidx=0; cidx <nodeChildren.length; cidx++) {
|
||||
var child = nodeChildren.item(cidx); // nodeChildren[cidx];
|
||||
var childName = getNodeLocalName(child);
|
||||
|
||||
if(child.nodeType!= DOMNodeTypes.COMMENT_NODE) {
|
||||
var childPath = path+"."+childName;
|
||||
if (checkXmlElementsFilter(result,child.nodeType,childName,childPath)) {
|
||||
result.__cnt++;
|
||||
if(result[childName] == null) {
|
||||
result[childName] = parseDOMChildren(child, childPath);
|
||||
toArrayAccessForm(result, childName, childPath);
|
||||
}
|
||||
else {
|
||||
if(result[childName] != null) {
|
||||
if( !(result[childName] instanceof Array)) {
|
||||
result[childName] = [result[childName]];
|
||||
toArrayAccessForm(result, childName, childPath);
|
||||
}
|
||||
}
|
||||
(result[childName])[result[childName].length] = parseDOMChildren(child, childPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attributes
|
||||
for(var aidx=0; aidx <node.attributes.length; aidx++) {
|
||||
var attr = node.attributes.item(aidx); // [aidx];
|
||||
result.__cnt++;
|
||||
result[config.attributePrefix+attr.name]=attr.value;
|
||||
}
|
||||
|
||||
// Node namespace prefix
|
||||
var nodePrefix = getNodePrefix(node);
|
||||
if(nodePrefix!=null && nodePrefix!="") {
|
||||
result.__cnt++;
|
||||
result.__prefix=nodePrefix;
|
||||
}
|
||||
|
||||
if(result["#text"]!=null) {
|
||||
result.__text = result["#text"];
|
||||
if(result.__text instanceof Array) {
|
||||
result.__text = result.__text.join("\n");
|
||||
}
|
||||
//if(config.escapeMode)
|
||||
// result.__text = unescapeXmlChars(result.__text);
|
||||
if(config.stripWhitespaces)
|
||||
result.__text = result.__text.trim();
|
||||
delete result["#text"];
|
||||
if(config.arrayAccessForm=="property")
|
||||
delete result["#text_asArray"];
|
||||
result.__text = checkFromXmlDateTimePaths(result.__text, childName, path+"."+childName);
|
||||
}
|
||||
if(result["#cdata-section"]!=null) {
|
||||
result.__cdata = result["#cdata-section"];
|
||||
delete result["#cdata-section"];
|
||||
if(config.arrayAccessForm=="property")
|
||||
delete result["#cdata-section_asArray"];
|
||||
}
|
||||
|
||||
if( result.__cnt == 0 && config.emptyNodeForm=="text" ) {
|
||||
result = '';
|
||||
}
|
||||
else
|
||||
if( result.__cnt == 1 && result.__text!=null ) {
|
||||
result = result.__text;
|
||||
}
|
||||
else
|
||||
if( result.__cnt == 1 && result.__cdata!=null && !config.keepCData ) {
|
||||
result = result.__cdata;
|
||||
}
|
||||
else
|
||||
if ( result.__cnt > 1 && result.__text!=null && config.skipEmptyTextNodesForObj) {
|
||||
if( (config.stripWhitespaces && result.__text=="") || (result.__text.trim()=="")) {
|
||||
delete result.__text;
|
||||
}
|
||||
}
|
||||
delete result.__cnt;
|
||||
|
||||
if( config.enableToStringFunc && (result.__text!=null || result.__cdata!=null )) {
|
||||
result.toString = function() {
|
||||
return (this.__text!=null? this.__text:'')+( this.__cdata!=null ? this.__cdata:'');
|
||||
};
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
else
|
||||
if(node.nodeType == DOMNodeTypes.TEXT_NODE || node.nodeType == DOMNodeTypes.CDATA_SECTION_NODE) {
|
||||
return node.nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
function startTag(jsonObj, element, attrList, closed) {
|
||||
var resultStr = "<"+ ( (jsonObj!=null && jsonObj.__prefix!=null)? (jsonObj.__prefix+":"):"") + element;
|
||||
if(attrList!=null) {
|
||||
for(var aidx = 0; aidx < attrList.length; aidx++) {
|
||||
var attrName = attrList[aidx];
|
||||
var attrVal = jsonObj[attrName];
|
||||
if(config.escapeMode)
|
||||
attrVal=escapeXmlChars(attrVal);
|
||||
resultStr+=" "+attrName.substr(config.attributePrefix.length)+"=";
|
||||
if(config.useDoubleQuotes)
|
||||
resultStr+='"'+attrVal+'"';
|
||||
else
|
||||
resultStr+="'"+attrVal+"'";
|
||||
}
|
||||
}
|
||||
if(!closed)
|
||||
resultStr+=">";
|
||||
else
|
||||
resultStr+="/>";
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
function endTag(jsonObj,elementName) {
|
||||
return "</"+ (jsonObj.__prefix!=null? (jsonObj.__prefix+":"):"")+elementName+">";
|
||||
}
|
||||
|
||||
function endsWith(str, suffix) {
|
||||
return str.indexOf(suffix, str.length - suffix.length) !== -1;
|
||||
}
|
||||
|
||||
function jsonXmlSpecialElem ( jsonObj, jsonObjField ) {
|
||||
if((config.arrayAccessForm=="property" && endsWith(jsonObjField.toString(),("_asArray")))
|
||||
|| jsonObjField.toString().indexOf(config.attributePrefix)==0
|
||||
|| jsonObjField.toString().indexOf("__")==0
|
||||
|| (jsonObj[jsonObjField] instanceof Function) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function jsonXmlElemCount ( jsonObj ) {
|
||||
var elementsCnt = 0;
|
||||
if(jsonObj instanceof Object ) {
|
||||
for( var it in jsonObj ) {
|
||||
if(jsonXmlSpecialElem ( jsonObj, it) )
|
||||
continue;
|
||||
elementsCnt++;
|
||||
}
|
||||
}
|
||||
return elementsCnt;
|
||||
}
|
||||
|
||||
function checkJsonObjPropertiesFilter(jsonObj, propertyName, jsonObjPath) {
|
||||
return config.jsonPropertiesFilter.length == 0
|
||||
|| jsonObjPath==""
|
||||
|| checkInStdFiltersArrayForm(config.jsonPropertiesFilter, jsonObj, propertyName, jsonObjPath);
|
||||
}
|
||||
|
||||
function parseJSONAttributes ( jsonObj ) {
|
||||
var attrList = [];
|
||||
if(jsonObj instanceof Object ) {
|
||||
for( var ait in jsonObj ) {
|
||||
if(ait.toString().indexOf("__")== -1 && ait.toString().indexOf(config.attributePrefix)==0) {
|
||||
attrList.push(ait);
|
||||
}
|
||||
}
|
||||
}
|
||||
return attrList;
|
||||
}
|
||||
|
||||
function parseJSONTextAttrs ( jsonTxtObj ) {
|
||||
var result ="";
|
||||
|
||||
if(jsonTxtObj.__cdata!=null) {
|
||||
result+="<![CDATA["+jsonTxtObj.__cdata+"]]>";
|
||||
}
|
||||
|
||||
if(jsonTxtObj.__text!=null) {
|
||||
if(config.escapeMode)
|
||||
result+=escapeXmlChars(jsonTxtObj.__text);
|
||||
else
|
||||
result+=jsonTxtObj.__text;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseJSONTextObject ( jsonTxtObj ) {
|
||||
var result ="";
|
||||
|
||||
if( jsonTxtObj instanceof Object ) {
|
||||
result+=parseJSONTextAttrs ( jsonTxtObj );
|
||||
}
|
||||
else
|
||||
if(jsonTxtObj!=null) {
|
||||
if(config.escapeMode)
|
||||
result+=escapeXmlChars(jsonTxtObj);
|
||||
else
|
||||
result+=jsonTxtObj;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getJsonPropertyPath(jsonObjPath, jsonPropName) {
|
||||
if (jsonObjPath==="") {
|
||||
return jsonPropName;
|
||||
}
|
||||
else
|
||||
return jsonObjPath+"."+jsonPropName;
|
||||
}
|
||||
|
||||
function parseJSONArray ( jsonArrRoot, jsonArrObj, attrList, jsonObjPath ) {
|
||||
var result = "";
|
||||
if(jsonArrRoot.length == 0) {
|
||||
result+=startTag(jsonArrRoot, jsonArrObj, attrList, true);
|
||||
}
|
||||
else {
|
||||
for(var arIdx = 0; arIdx < jsonArrRoot.length; arIdx++) {
|
||||
result+=startTag(jsonArrRoot[arIdx], jsonArrObj, parseJSONAttributes(jsonArrRoot[arIdx]), false);
|
||||
result+=parseJSONObject(jsonArrRoot[arIdx], getJsonPropertyPath(jsonObjPath,jsonArrObj));
|
||||
result+=endTag(jsonArrRoot[arIdx],jsonArrObj);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseJSONObject ( jsonObj, jsonObjPath ) {
|
||||
var result = "";
|
||||
|
||||
var elementsCnt = jsonXmlElemCount ( jsonObj );
|
||||
|
||||
if(elementsCnt > 0) {
|
||||
for( var it in jsonObj ) {
|
||||
|
||||
if(jsonXmlSpecialElem ( jsonObj, it) || (jsonObjPath!="" && !checkJsonObjPropertiesFilter(jsonObj, it, getJsonPropertyPath(jsonObjPath,it))) )
|
||||
continue;
|
||||
|
||||
var subObj = jsonObj[it];
|
||||
|
||||
var attrList = parseJSONAttributes( subObj )
|
||||
|
||||
if(subObj == null || subObj == undefined) {
|
||||
result+=startTag(subObj, it, attrList, true);
|
||||
}
|
||||
else
|
||||
if(subObj instanceof Object) {
|
||||
|
||||
if(subObj instanceof Array) {
|
||||
result+=parseJSONArray( subObj, it, attrList, jsonObjPath );
|
||||
}
|
||||
else if(subObj instanceof Date) {
|
||||
result+=startTag(subObj, it, attrList, false);
|
||||
result+=subObj.toISOString();
|
||||
result+=endTag(subObj,it);
|
||||
}
|
||||
else {
|
||||
var subObjElementsCnt = jsonXmlElemCount ( subObj );
|
||||
if(subObjElementsCnt > 0 || subObj.__text!=null || subObj.__cdata!=null) {
|
||||
result+=startTag(subObj, it, attrList, false);
|
||||
result+=parseJSONObject(subObj, getJsonPropertyPath(jsonObjPath,it));
|
||||
result+=endTag(subObj,it);
|
||||
}
|
||||
else {
|
||||
result+=startTag(subObj, it, attrList, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
result+=startTag(subObj, it, attrList, false);
|
||||
result+=parseJSONTextObject(subObj);
|
||||
result+=endTag(subObj,it);
|
||||
}
|
||||
}
|
||||
}
|
||||
result+=parseJSONTextObject(jsonObj);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
this.parseXmlString = function(xmlDocStr) {
|
||||
var isIEParser = window.ActiveXObject || "ActiveXObject" in window;
|
||||
if (xmlDocStr === undefined) {
|
||||
return null;
|
||||
}
|
||||
var xmlDoc;
|
||||
if (window.DOMParser) {
|
||||
var parser=new window.DOMParser();
|
||||
var parsererrorNS = null;
|
||||
// IE9+ now is here
|
||||
if(!isIEParser) {
|
||||
try {
|
||||
parsererrorNS = parser.parseFromString("INVALID", "text/xml").getElementsByTagName("parsererror")[0].namespaceURI;
|
||||
}
|
||||
catch(err) {
|
||||
parsererrorNS = null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
xmlDoc = parser.parseFromString( xmlDocStr, "text/xml" );
|
||||
if( parsererrorNS!= null && xmlDoc.getElementsByTagNameNS(parsererrorNS, "parsererror").length > 0) {
|
||||
//throw new Error('Error parsing XML: '+xmlDocStr);
|
||||
xmlDoc = null;
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
xmlDoc = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// IE :(
|
||||
if(xmlDocStr.indexOf("<?")==0) {
|
||||
xmlDocStr = xmlDocStr.substr( xmlDocStr.indexOf("?>") + 2 );
|
||||
}
|
||||
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
|
||||
xmlDoc.async="false";
|
||||
xmlDoc.loadXML(xmlDocStr);
|
||||
}
|
||||
return xmlDoc;
|
||||
};
|
||||
|
||||
this.asArray = function(prop) {
|
||||
if (prop === undefined || prop == null)
|
||||
return [];
|
||||
else
|
||||
if(prop instanceof Array)
|
||||
return prop;
|
||||
else
|
||||
return [prop];
|
||||
};
|
||||
|
||||
this.toXmlDateTime = function(dt) {
|
||||
if(dt instanceof Date)
|
||||
return dt.toISOString();
|
||||
else
|
||||
if(typeof(dt) === 'number' )
|
||||
return new Date(dt).toISOString();
|
||||
else
|
||||
return null;
|
||||
};
|
||||
|
||||
this.asDateTime = function(prop) {
|
||||
if(typeof(prop) == "string") {
|
||||
return fromXmlDateTime(prop);
|
||||
}
|
||||
else
|
||||
return prop;
|
||||
};
|
||||
|
||||
this.xml2json = function (xmlDoc) {
|
||||
return parseDOMChildren ( xmlDoc );
|
||||
};
|
||||
|
||||
this.xml_str2json = function (xmlDocStr) {
|
||||
var xmlDoc = this.parseXmlString(xmlDocStr);
|
||||
if(xmlDoc!=null)
|
||||
return this.xml2json(xmlDoc);
|
||||
else
|
||||
return null;
|
||||
};
|
||||
|
||||
this.json2xml_str = function (jsonObj) {
|
||||
return parseJSONObject ( jsonObj, "" );
|
||||
};
|
||||
|
||||
this.json2xml = function (jsonObj) {
|
||||
var xmlDocStr = this.json2xml_str (jsonObj);
|
||||
return this.parseXmlString(xmlDocStr);
|
||||
};
|
||||
|
||||
this.getVersion = function () {
|
||||
return VERSION;
|
||||
};
|
||||
}
|
||||
}))
|
||||
Reference in New Issue
Block a user