Namespace hcap.key
hcap.key
- Defined in: hcap-1.24.6.5901.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
Method Summary
Namespace Detail
hcap.key
Method Detail
-
<static> hcap.key.addKeyItem(param)Add/Modify a key item in the key table.
- Add : If keycode is not in the key table, the key item will be added to the key table.
- Modify : If keycode is in the key table, but its virtual_keycode or attribute is different, the key item in the key table will be modified.
Keycode not in the key table is delivered to application as the keycode itself.// add custom keycode as MENU with attribue 2 and change the attribute of LG GUIDE key to attribute 0 hcap.key.addKeyItem({ "keycode" : 0x12345678, "virtualKeycode" : hcap.key.Code.MENU, "attribute" : 2, "onSuccess" : function() { console.log("onSuccess"); hcap.key.addKeyItem({ "keycode" : 0, "virtualKeycode" : hcap.key.Code.GUIDE, "attribute" : 0, "onSuccess" : function() { console.log("onSuccess"); }, "onFailure" : function(f) { console.log("onFailure : errorMessage = " + f.errorMessage); } }); }, "onFailure" : function(f) { console.log("onFailure : errorMessage = " + f.errorMessage); } });- Parameters:
- {Object} param
- {Number} param.keycode [Required] - custom RCU raw data (4 bytes). 0x00000000 for all LG RCU reserved keycode.
- {Number} param.virtualKeycode [Required] - virtual keycode defined by LG in hcap.key.Code.
- {Number} param.attribute [Required] - attribute of the key item.
Attribute Action 0 Processed by TV (LG firmware). For Portal key (hcap.key.Code.PORTAL) when its attribute is 0, TV will launch the initial HCAP page. 1 Processed according to HCAP Mode defined in hcap.mode.getHcapMode(). 2 Processed by application. 3 Processed by browser and application on browser while browser is running. Otherwise, processed by TV (LG firmware). HCAP Key Attribute & Action - {Function} param.onSuccess [Optional] - success callback function.
Setting to the same setting as before will invoke this callback function.param.onSuccess = function() { // No parameter. } - {Function} param.onFailure [Optional] - failure callback function.
param.onFailure = function (param) { // {String} param.errorMessage - in case of failure, this message provides the details. }
- Since:
- 1.3.1
-
<static> hcap.key.clearKeyTable(param)Clear the key table and restore it to the factory default.
hcap.key.clearKeyTable({ "onSuccess" : function() { console.log("onSuccess"); }, "onFailure" : function(f) { console.log("onFailure : errorMessage = " + f.errorMessage); } });- Parameters:
- {Object} param
- {Function} param.onSuccess [Optional] - success callback function.
param.onSuccess = function() { // No parameter. } - {Function} param.onFailure [Optional] - failure callback function.
param.onFailure = function (param) { // {String} param.errorMessage - in case of failure, this message provides the details. }
- {Function} param.onSuccess [Optional] - success callback function.
- Since:
- 1.3.1
-
<static> hcap.key.removeKeyItem(param)Remove a key item in the key table.
hcap.key.removeKeyItem({ "keycode" : 0x12345678, "onSuccess" : function() { console.log("onSuccess"); }, "onFailure" : function(f) { console.log("onFailure : errorMessage = " + f.errorMessage); } });- Parameters:
- {Object} param
- {Number} param.keycode [Required] - custom RCU raw data (4 bytes) to remove. If the keycode is 0x00000000 (reserved keycode for LG RCU), param.onFailure is invoked.
- {Function} param.onSuccess [Optional] - success callback function.
Remove for the keycode not in the key table will invoke this callback function.param.onSuccess = function() { // No parameter. } - {Function} param.onFailure [Optional] - failure callback function.
param.onFailure = function (param) { // {String} param.errorMessage - in case of failure, this message provides the details. }
- Since:
- 1.3.1
-
<static> hcap.key.sendKey(param)Deliver a virtual keycode from application to TV.
virtual_keycode is defined by LG and is processed like a key from LG RCU.
Therefore the delivered virtual_keycode is mapped to a key item [keycode = 0x00000000, virtual_keycode] in the key table.
Application should be cautious not to come into the infinite loop because the sent key to TV can come back to the application again according to the key table setting.
Also using modifers can combine keyshcap.key.sendKey({ "virtualKeycode" : hcap.key.Code.MENU, "onSuccess" : function() { console.log("onSuccess"); }, "onFailure" : function(f) { console.log("onFailure : errorMessage = " + f.errorMessage); } }); hcap.key.sendKey({ "virtualKeycode" : hcap.key.Code.NUM_1, "modifier" : hcap.key.Code.CS1, "onSuccess" : function() { console.log("onSuccess"); }, "onFailure" : function(f) { console.log("onFailure : errorMessage = " + f.errorMessage); } });- Parameters:
- {Object} param
- {Number} param.virtualKeycode [Required] - virtual keycode defined in hcap.key.Code.
- {Number} param.modifier [Required] - modifier key / virtual keycode defined in hcap.key.Code.
- {Function} param.onSuccess [Optional] - success callback function.
param.onSuccess = function() { // No parameter. } - {Function} param.onFailure [Optional] - failure callback function.
param.onFailure = function (param) { // {String} param.errorMessage - in case of failure, this message provides the details. }
- Since:
- 1.3.1