issue #11 Add IDCAP API. Support mirroring PIN NUM option feature.
This commit is contained in:
@@ -422,6 +422,7 @@
|
|||||||
|
|
||||||
<!-- LG HCAP Library -->
|
<!-- LG HCAP Library -->
|
||||||
<script src="/procentric/application/lib/hcap.js"></script>
|
<script src="/procentric/application/lib/hcap.js"></script>
|
||||||
|
<script src="/procentric/application/lib/idcap.js"></script>
|
||||||
|
|
||||||
<!-- CENTIRM HOTELTV Library -->
|
<!-- CENTIRM HOTELTV Library -->
|
||||||
<script src="/procentric/application/lib/hoteltv.js"></script>
|
<script src="/procentric/application/lib/hoteltv.js"></script>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" href="hoteltv.ui_utils.css">
|
<link rel="stylesheet" href="/procentric/application/theme/hoteltv.ui_utils.css">
|
||||||
<link rel="stylesheet" href="hoteltv.error.css">
|
<link rel="stylesheet" href="/procentric/application/theme/hoteltv.error.css">
|
||||||
<title>CENTIRM LG-PROCENTRIC HOTEL SERVICE</title>
|
<title>CENTIRM LG-PROCENTRIC HOTEL SERVICE</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
|
|
||||||
<!-- LG HCAP Library -->
|
<!-- LG HCAP Library -->
|
||||||
<script src="./lib/hcap.js"></script>
|
<script src="./lib/hcap.js"></script>
|
||||||
|
<script src="./lib/idcap.js"></script>
|
||||||
|
|
||||||
<!-- CENTIRM HOTELTV Library -->
|
<!-- CENTIRM HOTELTV Library -->
|
||||||
<script src="./lib/hoteltv.js"></script>
|
<script src="./lib/hoteltv.js"></script>
|
||||||
|
|||||||
@@ -40,8 +40,12 @@ HotelTV.hcap = (function() {
|
|||||||
'network_info',
|
'network_info',
|
||||||
'tv_channel_ui', "mute_on_tv_input",
|
'tv_channel_ui', "mute_on_tv_input",
|
||||||
'soft_ap_ui', "soft_ap", "soft_ap_password",
|
'soft_ap_ui', "soft_ap", "soft_ap_password",
|
||||||
|
'picture',
|
||||||
'end_of_item'
|
'end_of_item'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const g_media = {
|
const g_media = {
|
||||||
'hndl': null,
|
'hndl': null,
|
||||||
'status': 'stop',
|
'status': 'stop',
|
||||||
@@ -49,7 +53,7 @@ HotelTV.hcap = (function() {
|
|||||||
'tm_lststat': null,
|
'tm_lststat': null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const g_hcap_info = {
|
const g_nativApps_info = {
|
||||||
'preapp': null,
|
'preapp': null,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,8 +66,6 @@ HotelTV.hcap = (function() {
|
|||||||
//// 비공개 매써드
|
//// 비공개 매써드
|
||||||
/**
|
/**
|
||||||
* HCAP Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.power.reboot)
|
* HCAP Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.power.reboot)
|
||||||
* @param {string} sz_key property key name.
|
|
||||||
* @param {callback} callback is callback object
|
|
||||||
*/
|
*/
|
||||||
function __hcapfxn_Reboot() {
|
function __hcapfxn_Reboot() {
|
||||||
hcap.power.reboot({
|
hcap.power.reboot({
|
||||||
@@ -78,8 +80,7 @@ HotelTV.hcap = (function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* HCAP Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.system.setBrowserDebugMode)
|
* HCAP Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.system.setBrowserDebugMode)
|
||||||
* @param {string} sz_key property key name.
|
* @param {Boolean} enable enable/disable flag.
|
||||||
* @param {callback} callback is callback object
|
|
||||||
*/
|
*/
|
||||||
function __hcapfxn_setBrowserDebugMode(enable) {
|
function __hcapfxn_setBrowserDebugMode(enable) {
|
||||||
hcap.system.setBrowserDebugMode({
|
hcap.system.setBrowserDebugMode({
|
||||||
@@ -96,7 +97,6 @@ HotelTV.hcap = (function() {
|
|||||||
/**
|
/**
|
||||||
* HCAP Wrapper Function::> Get Device Properties(Realted HCAP API:hcap.property.getProperty)
|
* HCAP Wrapper Function::> Get Device Properties(Realted HCAP API:hcap.property.getProperty)
|
||||||
* @param {string} sz_key property key name.
|
* @param {string} sz_key property key name.
|
||||||
* @param {callback} callback is callback object
|
|
||||||
*/
|
*/
|
||||||
function __hcapfxn_get_property(sz_key) {
|
function __hcapfxn_get_property(sz_key) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -113,7 +113,7 @@ HotelTV.hcap = (function() {
|
|||||||
/**
|
/**
|
||||||
* HCAP Wrapper Function::> Get Device Properties(Realted HCAP API:hcap.property.setProperty)
|
* HCAP Wrapper Function::> Get Device Properties(Realted HCAP API:hcap.property.setProperty)
|
||||||
* @param {string} sz_key property key name.
|
* @param {string} sz_key property key name.
|
||||||
* @param {callback} callback is callback object
|
* @param {object} value is object to setting property
|
||||||
*/
|
*/
|
||||||
function __hcapfxn_set_property(sz_key, value) {
|
function __hcapfxn_set_property(sz_key, value) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -128,8 +128,63 @@ HotelTV.hcap = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HCAP Wrapper Function::> Get Device Networn Information(Realted HCAP API:hcap.network.getNetworkInformation)
|
* IDCAP Wrapper Function::> Get Device Configuration(Properties)(Realted IDCAP API:idcap://configuration/property/get)
|
||||||
* @param {string} sz_key property key name.
|
* @param {string} sz_key property key name.
|
||||||
|
*/
|
||||||
|
function __idcapfxn_get_property(sz_key) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
idcap.request( "idcap://configuration/property/get" , {
|
||||||
|
"parameters": {
|
||||||
|
"key" : sz_key
|
||||||
|
},
|
||||||
|
"onSuccess": function (s) {
|
||||||
|
console.log("onSuccess cbObject = " + JSON.stringify(s));
|
||||||
|
resolve({ "key": sz_key, "value": s.value })
|
||||||
|
},
|
||||||
|
"onFailure": function (err) {
|
||||||
|
console.log("onFailure : errorMessage = " + err.errorMessage);
|
||||||
|
resolve({ "key": sz_key, "value": "unknown" })
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDCAP Wrapper Function::> Get Device Configuration(Properties)(Realted IDCAP API:idcap://configuration/property/set)
|
||||||
|
* @param {string} sz_key property key name.
|
||||||
|
* @param {object} value is object to setting property
|
||||||
|
*/
|
||||||
|
function __idcapfxn_set_property(sz_key, value) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// let param = {
|
||||||
|
// "key": sz_key,
|
||||||
|
// "value": value.toString(),
|
||||||
|
// "onSuccess": function(s) { resolve({ "key": sz_key, "value": value }) },
|
||||||
|
// "onFailure": function(f) { resolve({ "key": sz_key, "value": "unknown" }) }
|
||||||
|
// };
|
||||||
|
// hcap.property.setProperty(param);
|
||||||
|
|
||||||
|
idcap.request( "idcap://configuration/property/set" , {
|
||||||
|
"parameters": {
|
||||||
|
"key" : sz_key,
|
||||||
|
"value" : value.toString()
|
||||||
|
},
|
||||||
|
"onSuccess": function () {
|
||||||
|
resolve({ "key": sz_key, "value": value });
|
||||||
|
},
|
||||||
|
"onFailure": function (err) {
|
||||||
|
resolve({ "key": sz_key, "value": "unknown" })
|
||||||
|
console.log("onFailure : errorMessage = " + err.errorMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HCAP Wrapper Function::> Get Device Networn Information(Realted HCAP API:hcap.network.getNetworkInformation)
|
||||||
|
* @param {string} sz_key network property key name.
|
||||||
* @param {callback} callback is callback object
|
* @param {callback} callback is callback object
|
||||||
*/
|
*/
|
||||||
function __hcapfxn_get_netinfo(sz_key, callback) {
|
function __hcapfxn_get_netinfo(sz_key, callback) {
|
||||||
@@ -184,9 +239,26 @@ HotelTV.hcap = (function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HCAP Wrapper Function::> Get Device Picture Property Information(Realted HCAP API:hcap.property.getPictureProperty)
|
||||||
|
* @param {string} sz_key picture property key name.
|
||||||
|
*/
|
||||||
|
function __hcapfxn_get_picproperty(sz_key, callback) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let param = {
|
||||||
|
"key": sz_key,
|
||||||
|
"onSuccess": function(s) { resolve({ "key": sz_key, "value": s.value }) },
|
||||||
|
//"onFailure": function(f) { reject({ "key": sz_key, "value": "unknown" }) }
|
||||||
|
"onFailure": function(f) { resolve({ "key": sz_key, "value": "unknown" }) }
|
||||||
|
};
|
||||||
|
hcap.property.getProperty(param);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HCAP Wrapper Function::> Get Device Locale List
|
* HCAP Wrapper Function::> Get Device Locale List
|
||||||
* @param {string} sz_key property key name.
|
* @param {string} sz_key locale key name.
|
||||||
* @param {callback} callback is callback object
|
* @param {callback} callback is callback object
|
||||||
*/
|
*/
|
||||||
function __hcapfxn_get_dev_locale_info(sz_key, callback) {
|
function __hcapfxn_get_dev_locale_info(sz_key, callback) {
|
||||||
@@ -201,7 +273,7 @@ HotelTV.hcap = (function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* HCAP Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.system.getProcentricServer)
|
* HCAP Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.system.getProcentricServer)
|
||||||
* @param {string} sz_key property key name.
|
* @param {string} sz_key procentric server property key name.
|
||||||
* @param {callback} callback is callback object
|
* @param {callback} callback is callback object
|
||||||
*/
|
*/
|
||||||
function __hcapfxn_get_pctrsvrinfo(sz_key, callback) {
|
function __hcapfxn_get_pctrsvrinfo(sz_key, callback) {
|
||||||
@@ -216,7 +288,6 @@ HotelTV.hcap = (function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* HCAP Wrapper Function::> Get ProCentric Server Info(Realted HCAP API:hcap.system.getHotelMode)
|
* 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
|
* @param {callback} callback is callback object
|
||||||
*/
|
*/
|
||||||
function __hcapfxn_get_pctrhotelmodeinfo(callback) {
|
function __hcapfxn_get_pctrhotelmodeinfo(callback) {
|
||||||
@@ -516,9 +587,7 @@ HotelTV.hcap = (function() {
|
|||||||
Init: function() {
|
Init: function() {
|
||||||
hcap.channel.stopCurrentChannel({
|
hcap.channel.stopCurrentChannel({
|
||||||
"onSuccess": null,
|
"onSuccess": null,
|
||||||
"onFailure": function(f) {
|
"onFailure": null
|
||||||
console.log("onFailure : errorMessage = " + f.errorMessage);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -561,6 +630,11 @@ HotelTV.hcap = (function() {
|
|||||||
if (hcap_property_key[i] != 'end_of_item') {
|
if (hcap_property_key[i] != 'end_of_item') {
|
||||||
if (hcap_property_key[i] == 'network_info') {
|
if (hcap_property_key[i] == 'network_info') {
|
||||||
_pmFxnArProperty.push(__hcapfxn_get_netinfo(hcap_property_key[i]));
|
_pmFxnArProperty.push(__hcapfxn_get_netinfo(hcap_property_key[i]));
|
||||||
|
} else if (hcap_property_key[i] == 'picture') {
|
||||||
|
|
||||||
|
} else if (hcap_property_key[i] == "wifi_screen_share"){
|
||||||
|
// HCAP대신 IDCAP API호출
|
||||||
|
_pmFxnArProperty.push(__idcapfxn_get_property(hcap_property_key[i]));
|
||||||
} else {
|
} else {
|
||||||
_pmFxnArProperty.push(__hcapfxn_get_property(hcap_property_key[i]));
|
_pmFxnArProperty.push(__hcapfxn_get_property(hcap_property_key[i]));
|
||||||
}
|
}
|
||||||
@@ -935,15 +1009,27 @@ HotelTV.hcap = (function() {
|
|||||||
|
|
||||||
} else if (_cfg == 'audio') {
|
} else if (_cfg == 'audio') {
|
||||||
// TV Default Volume
|
// TV Default Volume
|
||||||
hcap.volume.setVolumeLevel({
|
// 현재 오디오 볼륨과 같은 값으로 설정 시도시 에러: Kknow issue
|
||||||
"level": Number(_devconfig[_cfg].defaultVolume.display),
|
hcap.volume.getVolumeLevel({
|
||||||
"onSuccess": function() {
|
"onSuccess" : function(s) {
|
||||||
console.log("onSuccess Set to TV default volume set as " + _devconfig[_cfg].defaultVolume.display);
|
if ( Number(_devconfig[_cfg].defaultVolume.display)!=Number(s.level) ){
|
||||||
|
hcap.volume.setVolumeLevel({
|
||||||
|
"level": Number(_devconfig[_cfg].defaultVolume.display),
|
||||||
|
"onSuccess": function() {
|
||||||
|
console.log("onSuccess Set to TV default volume set as " + _devconfig[_cfg].defaultVolume.display);
|
||||||
|
},
|
||||||
|
"onFailure": function(__err) {
|
||||||
|
console.log("onFailure : errorMessage = " + __err.errorMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log("onSuccess : no need default volume changing");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"onFailure": function(f) {
|
"onFailure" : function(__err) {
|
||||||
console.log("onFailure : errorMessage = " + f.errorMessage);
|
console.log("onFailure : errorMessage = " + __err.errorMessage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -984,8 +1070,13 @@ HotelTV.hcap = (function() {
|
|||||||
|
|
||||||
// WIFI SCREEN SHARE
|
// WIFI SCREEN SHARE
|
||||||
if (_devinfo["wifi_screen_share"] !== undefined) {
|
if (_devinfo["wifi_screen_share"] !== undefined) {
|
||||||
if (_devinfo["wifi_screen_share"] != 1) {
|
// if (_devinfo["wifi_screen_share"] != 1) {
|
||||||
_pmFxnArProperty.push(__hcapfxn_set_property('wifi_screen_share', 1));
|
// _pmFxnArProperty.push(__hcapfxn_set_property('wifi_screen_share', 1));
|
||||||
|
// }
|
||||||
|
// PIN 번호를 이용한 screen share는 IDCAP API에서만 지원
|
||||||
|
// 일부 모바일 폰에서 연동 안되는 문제 있음.
|
||||||
|
if (_devinfo["wifi_screen_share"] != 2) {
|
||||||
|
_pmFxnArProperty.push(__idcapfxn_set_property('wifi_screen_share', 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1081,6 +1172,7 @@ HotelTV.hcap = (function() {
|
|||||||
.then(_ret => {
|
.then(_ret => {
|
||||||
for (let i = 0; i < _ret.length; i++) {
|
for (let i = 0; i < _ret.length; i++) {
|
||||||
let _set_item = _ret[i];
|
let _set_item = _ret[i];
|
||||||
|
//리부팅을 하지 않아도 되는 항목들 no_need_reboot_param을 필터링
|
||||||
let no_need_reboot_param = ["wifi_screen_share", "soft_ap", "soft_ap_ui", "osd_layer_id"];
|
let no_need_reboot_param = ["wifi_screen_share", "soft_ap", "soft_ap_ui", "osd_layer_id"];
|
||||||
if (no_need_reboot_param.indexOf(_set_item.key) == -1) {
|
if (no_need_reboot_param.indexOf(_set_item.key) == -1) {
|
||||||
//Needed reboot the system
|
//Needed reboot the system
|
||||||
@@ -1278,7 +1370,7 @@ HotelTV.hcap = (function() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
PreAppGetInfo: function(_en_show_msg) {
|
PreAppGetInfo: function(_en_show_msg) {
|
||||||
// if (g_hcap_info.preapp == null) {
|
// if (g_nativApps_info.preapp == null) {
|
||||||
// hcap.preloadedApplication.getPreloadedApplicationList({
|
// hcap.preloadedApplication.getPreloadedApplicationList({
|
||||||
// "onSuccess": function(s) {
|
// "onSuccess": function(s) {
|
||||||
// if (_en_show_msg == true) {
|
// if (_en_show_msg == true) {
|
||||||
@@ -1292,7 +1384,7 @@ HotelTV.hcap = (function() {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// if (s.result == true) {
|
// if (s.result == true) {
|
||||||
// g_hcap_info.preapp = s.list;
|
// g_nativApps_info.preapp = s.list;
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
// "onFailure": function(f) {
|
// "onFailure": function(f) {
|
||||||
@@ -1315,8 +1407,8 @@ HotelTV.hcap = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s.result == true) {
|
if (s.result == true) {
|
||||||
g_hcap_info.preapp = s.list;
|
g_nativApps_info.preapp = s.list;
|
||||||
resolve({ "error": 0, "applist": g_hcap_info.preapp });
|
resolve({ "error": 0, "applist": g_nativApps_info.preapp });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"onFailure": function(f) {
|
"onFailure": function(f) {
|
||||||
@@ -1328,9 +1420,9 @@ HotelTV.hcap = (function() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
LaunchPreApp: function(_name, _param) {
|
LaunchPreApp: function(_name, _param) {
|
||||||
if (g_hcap_info.preapp != null) {
|
if (g_nativApps_info.preapp != null) {
|
||||||
if (_name == "youtube") {
|
if (_name == "youtube") {
|
||||||
for (const [key, item] of Object.entries(g_hcap_info.preapp)) {
|
for (const [key, item] of Object.entries(g_nativApps_info.preapp)) {
|
||||||
if (item.title == 'YouTube') {
|
if (item.title == 'YouTube') {
|
||||||
hcap.preloadedApplication.launchPreloadedApplication({
|
hcap.preloadedApplication.launchPreloadedApplication({
|
||||||
"id": item.id, // YOUTUBE
|
"id": item.id, // YOUTUBE
|
||||||
@@ -1344,7 +1436,7 @@ HotelTV.hcap = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_name == "netflix") {
|
} else if (_name == "netflix") {
|
||||||
for (const [key, item] of Object.entries(g_hcap_info.preapp)) {
|
for (const [key, item] of Object.entries(g_nativApps_info.preapp)) {
|
||||||
if (item.title == 'Netflix') {
|
if (item.title == 'Netflix') {
|
||||||
hcap.preloadedApplication.launchPreloadedApplication({
|
hcap.preloadedApplication.launchPreloadedApplication({
|
||||||
"id": item.id, // NETFLIX
|
"id": item.id, // NETFLIX
|
||||||
@@ -1359,7 +1451,7 @@ HotelTV.hcap = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_name == "screenmirroring") {
|
} else if (_name == "screenmirroring") {
|
||||||
for (const [key, item] of Object.entries(g_hcap_info.preapp)) {
|
for (const [key, item] of Object.entries(g_nativApps_info.preapp)) {
|
||||||
if (item.id == '144115188075855880') {
|
if (item.id == '144115188075855880') {
|
||||||
hcap.preloadedApplication.launchPreloadedApplication({
|
hcap.preloadedApplication.launchPreloadedApplication({
|
||||||
"id": item.id, // SCREEN SHARE
|
"id": item.id, // SCREEN SHARE
|
||||||
@@ -1373,7 +1465,7 @@ HotelTV.hcap = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_name == "BLUETOOTHAUDIO") {
|
} else if (_name == "BLUETOOTHAUDIO") {
|
||||||
for (const [key, item] of Object.entries(g_hcap_info.preapp)) {
|
for (const [key, item] of Object.entries(g_nativApps_info.preapp)) {
|
||||||
if (item.id == '244115188075859015') {
|
if (item.id == '244115188075859015') {
|
||||||
hcap.preloadedApplication.launchPreloadedApplication({
|
hcap.preloadedApplication.launchPreloadedApplication({
|
||||||
"id": item.id, // SCREEN SHARE
|
"id": item.id, // SCREEN SHARE
|
||||||
|
|||||||
21
procentric/application/lib/idcap.js
Executable file
21
procentric/application/lib/idcap.js
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
============================================================================
|
||||||
|
Web Solution Project, ID SW Development Department, LG ELECTRONICS INC., SEOUL, KOREA
|
||||||
|
Copyright(c) 2021 by LG Electronics Inc.
|
||||||
|
idcap version : 5
|
||||||
|
============================================================================
|
||||||
|
*/
|
||||||
|
var extIDCAPSecure,extRegisterIDCAPCloseHandler,extDisableIdcapConsoleLog,extWebWorker,isSubscribeParam,retry_count,idcap;
|
||||||
|
if(void 0===idcap)if("object"===typeof window)(function(){function c(a){1==idcap.isLogEnabled&&(a=1024<a.length?a.substring(0,1024):a,!0!==extWebWorker&&console.log(a))}function m(a,d){if(!0!==extWebWorker){var e="",h=document.createEvent("HTMLEvents");c(n("event received, ",d));h.initEvent(a,!0,!1);for(e in d)d.hasOwnProperty(e)&&(h[e]=d[e]);document.dispatchEvent(h)}}idcap={API_VERSION:"5",isRemoteInitialize:!1,isRemote:!1,remote_ip:"",isLogEnabled:!1,isMaxCount:4};var g=0,b=[{command_id:"0",param_text:'{"command_id" : "0", "command" : "notify_sdk_version","parameters":{"idcap_js_extension_version" : "5"}}'}],
|
||||||
|
k=[{command:"0",param_text:'{"command" : "0", "command" : "notify_sdk_version", "parameters":{"idcap_js_extension_version" : "5"}}'}],l=null,p=!1,v=!1,q=!1,A=null,w=null,E=null,B=!1,n=null,C=!1,z=!1,D=0,x="127.0.0.1";!0!==idcap.isLogEnabled?!0!==extWebWorker&&console.log("ID - console log is disabled"):!0!==extWebWorker&&console.log("ID - console log is enabled");c("check external value : extDisableIdcapConsoleLog = "+extDisableIdcapConsoleLog+", extIDCAPSecure = "+extIDCAPSecure+", extRegisterIDCAPCloseHandler = "+
|
||||||
|
extRegisterIDCAPCloseHandler);B=function(){var a=navigator.userAgent;a.match(/Windows/);a.match(/Macintosh/);a.match(/Mac OS X/);var d=a.match(/Web0S/),e=a.match(/SmartTV/),h=a.match(/WebAppManager/);c("UA = '"+a+"'");return d||e||h?(z=!1,idcap.isRemote=!1):z=idcap.isRemote=!0}();n=function(a,d){var e="";var h=[],r="";for(e in d)d.hasOwnProperty(e)&&h.push(e);h.sort();for(e=0;e<h.length;e+=1){var u=e,f=h,t="",y="";var F=f[u];try{t=d[F],y=typeof t}catch(G){t="<unknown value>",y="unknown"}"function"===
|
||||||
|
y?t="{/*function*/}":"object"===y?t=n("",t):"string"===y&&(t='"'+t+'"');r+='"'+F+'" : '+t;u<f.length-1&&(r+=", ")}return a+"{"+r+"}"};A=function(){c("initialize_idcap_websocket");v?c("websocket : connection is in progress"):(v=!0,0==z?!0!==extIDCAPSecure?(c("default idcap connection"),l=new WebSocket("ws://127.0.0.1:8153/hcap_command")):(c("secure idcap connection"),l=new WebSocket("wss://localhost:8154/idcap_command")):(c("remote connection"),l="https:"===location.protocol?new WebSocket("wss://"+
|
||||||
|
x+":8154/idcap_command"):new WebSocket("ws://"+x+":8153/idcap_command")),l.onopen=function(){c("websocket : onopen");v=!1;p=!0;setTimeout(w,5)},l.onmessage=function(a){a=JSON.parse(a.data);var d=a.command_id,e=a.command,h=a.result;delete a.command_id;delete a.command;c("ws.onmessage : "+JSON.stringify(a));"event"!==d&&delete a.result;if("event"===d)"debug_event_received"===e?(a.enable_log?!0!==extWebWorker&&console.log("idcap console log is enabled"):!0!==extWebWorker&&console.log("idcap console log is disabled"),
|
||||||
|
extDisableIdcapConsoleLog=!a.enable_log):m(e,a);else{if(0<b.length&&b[0].command_id===d){c(n("command_id = "+d+" received, ",a));if(h){if(b[0].onSuccess)try{b[0].onSuccess(a)}catch(f){c(n("exception : onSuccess : "+f))}}else if(b[0].onFailure)try{b[0].onFailure(a)}catch(f){c(n("exception : onFailure : "+f))}b.splice(0,1)}else{var r=0,u=!1;k.forEach(function(f){null!==f&&void 0!==f.command&&f.command===e&&(r=k.indexOf(f),u=!0)});if(u){if(k[r].onSuccess)try{k[r].onSuccess(a)}catch(f){c(n("exception : onSuccess : "+
|
||||||
|
f))}}else c(n("invalid response from server ",a))}q=!1;w()}},l.onclose=function(){c("websocket : onclose");q=p=v=!1;D+=1;c("retry-count",D);!z&&D<idcap.isMaxCount?setTimeout(w,50):c("Max retry - stop websocket connection try")},"onbeforeunload"===extRegisterIDCAPCloseHandler?window.onbeforeunload=function(){c("close idcap websocket in onbeforeunload handler");l.onclose=function(){};l.close()}:"onunload"===extRegisterIDCAPCloseHandler&&(window.onunload=function(){c("close idcap websocket in onunload handler");
|
||||||
|
l.onclose=function(){};l.close()}))};w=function(){c("start_cmd_loop");if(!q){q=!0;if(p){if(0<b.length){c("webSocket sending");c(n("command_id = "+b[0].command_id+" sent, ",JSON.parse(b[0].param_text)));l.send(b[0].param_text);return}}else A();q=!1}};E=function(a,d){if(null===a||""===a||void 0===a)c("[ERROR] Command should not be null.");else if(!1===a.toLowerCase().startsWith("idcap://"))c("[ERROR] wrong IDCAP command.");else if(Array.isArray(d))c("[ERROR] Command Parameter Error. param is Array type or not defined.");
|
||||||
|
else{B&&c("[ERROR] IDCAP is unavailable on this browser.");g=1024<g?0:g+1;var e=g.toString(),h="";d.command_id=e;d.command=a;h=JSON.stringify(d,null);c("param_text : "+h);for(name in d)"subscribe"===name&&d.hasOwnProperty("subscribe")&&!0===d.subscribe&&(C=!0);if(C)k.forEach(function(f){null!==f&&void 0!==f.command&&f.command===d.command?c("already registered. : "+a):k[k.length]={command:a,param_text:h,onSuccess:d.onSuccess,onFailure:d.onFailure}}),C=!1;else{var r=0,u=!1;k.forEach(function(f){null!==
|
||||||
|
f&&void 0!==f.command&&f.command===d.command&&(r=k.indexOf(f),u=!0)});u?k.splice(r,1):!1}b[b.length]={command_id:e,param_text:h,onSuccess:d.onSuccess,onFailure:d.onFailure};c(n("command_id = "+e+" added, ",b[b.length-1]));w()}};B||setTimeout(w,200);idcap.remoteInitialize=function(a){c("remoteInitialize");x=a;c("remote = "+x);idcap.remote_ip=x;A();idcap.isRemoteInitialize=!0};idcap.remoteFinalize=function(){c("remoteFinalize");l.close();l=null;idcap.remote_ip="";idcap.isRemoteInitialize=!1};idcap.request=
|
||||||
|
{};idcap.request=function(a,d){a=a.toLowerCase();E(a,d)}})();else{var ev=require("events").EventEmitter;class c extends ev{constructor(m){super();let g=this;this.service=m;this.service.Request=function(b,k){"/"!=b.charAt(b.length-1)&&(b+="/");b+=k.method;var l={};!0===k.hasOwnProperty("parameters")&&(l=k.parameters);var p={},v=function(q){!0===q.payload.returnValue?(p=q.payload,k.onSuccess(p)):(p.returnValue=!1,p.errorCode=q.payload.errorCode,p.errorText=q.payload.errorText,k.onFailure(p))};g.service&&
|
||||||
|
g.service.call(b,l,v)};this.subsForEvents=this.service.subscribe("luna://com.webos.service.idcapmw.mwcommand/getAllEvents",{subscribe:!0});this.subsForEvents.on("response",function(b){b=b.payload;if("event"===b.command_id)g.on_event_received(b.command,b)})}on_event_received(m,g){this.emit(m,g)}request(m,g){null!==m&&""!==m&&void 0!==m&&(Array.isArray(g)||void 0===g||g.onSuccess&&"function"===typeof g.onSuccess&&g.onFailure&&"function"===typeof g.onFailure&&this.service.Request("luna://com.webos.service.idcapmw.mwcommand",
|
||||||
|
{method:"/callidcap",parameters:{command:m,parameters:g.parameters},onSuccess:function(b){b.result?(delete b.returnValue,delete b.result,delete b.command_id,g.onSuccess(b)):(delete b.returnValue,delete b.result,delete b.command_id,g.onFailure(b))},onFailure:function(b){delete b.returnValue;delete b.result;delete b.command_id;g.onFailure(b)}}))}}module.exports=c};
|
||||||
@@ -73,6 +73,7 @@
|
|||||||
|
|
||||||
<!-- LG HCAP Library -->
|
<!-- LG HCAP Library -->
|
||||||
<script src="/procentric/application/lib/hcap.js"></script>
|
<script src="/procentric/application/lib/hcap.js"></script>
|
||||||
|
<script src="/procentric/application/lib/idcap.js"></script>
|
||||||
|
|
||||||
<!-- CENTIRM HOTELTV Library -->
|
<!-- CENTIRM HOTELTV Library -->
|
||||||
<script src="/procentric/application/lib/hoteltv.js"></script>
|
<script src="/procentric/application/lib/hoteltv.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user