diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..753842b --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. \ No newline at end of file diff --git a/config.xml b/config.xml new file mode 100644 index 0000000..323c2b0 --- /dev/null +++ b/config.xml @@ -0,0 +1,13 @@ + + + + + + + SystemCommandTizen65 + + + + + + diff --git a/css/SamsungOneUI-400.ttf b/css/SamsungOneUI-400.ttf new file mode 100644 index 0000000..d69483c Binary files /dev/null and b/css/SamsungOneUI-400.ttf differ diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..c5116bf --- /dev/null +++ b/css/style.css @@ -0,0 +1,101 @@ +/* ! Copyright (c) 2021, Samsung Electronics Co., Ltd + + +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: + + +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. + + +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + + +@font-face { + font-family: SamsungOneUI; + src: url('../css/SamsungOneUI-400.ttf'); +} + +body { + margin: 50px auto; + background-color: #ffffff; +} + +header h1 { + font-size: 108px; + margin: 0px; +} + +header h2 { + font-size: 54px; + margin: 0px; + color: #888; + font-style: italic; +} + +nav ul { + list-style: none; + padding: 20px; + display: block; + clear: right; + background-color: #666; + padding-left: 4px; + height: 48px; +} + +nav ul li { + display: inline; + padding: 0px 20px 5px 10px; + border-right: 1px solid #ccc; +} + +nav ul li a { + color: #EFD3D3; + text-decoration: none; + font-size: 39px; + font-weight: bold; +} + +nav ul li a:hover { + color: #fff; +} + +article > header h1 { + font-size: 60px; + margin-left: 14px; +} + +article > header h1 a { + color: #993333; +} + +article > header h1 img { + vertical-align:middle; +} + +article > section header h1 { + font-size: 48px; +} + +article p { + clear: both; +} + +footer p { + text-align: center; + font-size: 36px; + color: #888; + margin-top: 30px; +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..953d649 --- /dev/null +++ b/index.html @@ -0,0 +1,77 @@ + + + + + + + + + + + + System Command Sample Application + + + + + + + + + + + +

PEPPER webapis.systemcontrol: System Command Sample application

+ +

+ +

+

LOG EVENTS ::
+ + diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..7f69455 --- /dev/null +++ b/js/main.js @@ -0,0 +1,543 @@ +/* + ! Copyright (c) 2021, Samsung Electronics Co., Ltd + + +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: + + +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. + + +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + + +var checkTime; +//var tvKey = new LIB.TizenKeyValue(); +var log; +//Initialize function +var init = function () { + console.log('init() called'); + log = document.getElementById('log'); + registerkeys(); + document.addEventListener('visibilitychange', function() { + if(document.hidden){ + // Something you want to do when hide or exit. + } else { + // Something you want to do when resume. + } + }); + + // add eventListener for keydown + document.addEventListener('keydown', function(e) { + switch(e.keyCode){ + case 412://rewind + setPcConnection('RJ45'); + getPcConnection(); + break; + case 413: //stop + setMessageDisplay('ON'); + getMessageDisplay(); + break; + case 415: //play + setSafetyLock('OFF'); + getMessageDisplay(); + break; + case 19: //pause + clearResult(); + break; + case 417: //fastforward + setPcConnection('RS232'); + getPcConnection(); + break; + case 49: //1 + getControlVersion(); + break; + case 50: //2 + powerReboot(); + break; + case 51: //3 + getScreenCapture(); + break; + case 52: //4 + getDeviceSWVersion(); + break; + case 53: //5 + getSerialNumber(); + break; + case 54: //6 + setLampSchedule(); + getLampSchedule(); + break; + case 55: //7 + setPanelMute('ON'); + getPanelMute(); + setTimeout(setPanelMute('OFF'), 1000); + getPanelMute(); + break; + case 56: //8 + setSafetyLock("ON") + getSafetyLockStatus(); + break; + case 57: //9 + setSafetyLock("OFF") + getSafetyLockStatus(); + break; + case 48: //0 + setFirmwareUpdateListener(); + break; + case 37: //LEFT arrow + updateFirmware(); + break; + case 38: //UP arrow + unsetFirmwareUpdateListener(); + break; + case 39: //RIGHT arrow + getOnScreenMenuOrientation(); + break; + case 40: //DOWN arrow + getSourceOrientation(); + break; + case 13: //OK button + break; + case 10009: //RETURN button + tizen.application.getCurrentApplication().exit(); + break; + default: + console.log('Key code : ' + e.keyCode); + break; + } + }); +}; + +//=========== logging function =========== + +function clearResult() { + log.innerHTML = ''; +} + +function addResult(data) { + log.innerHTML += data + '
'; +} + +//=========== get systemcontrol module version function =========== + +function getControlVersion(){ + var Version = null; + try { + Version = webapis.systemcontrol.getVersion(); + } catch (e) { + console.log("[getVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if (null !== Version) { + console.log("[getVersion] call syncFunction type: " + Version); + addResult("[getVersion] call syncFunction type: " + Version); + } +} + +//=========== Reboot function =========== + +function powerReboot() { + console.log("[powerReboot] function call"); + try{ + webapis.systemcontrol.rebootDevice(); + console.log("[powerReboot] success "); + addResult("[powerReboot] success "); + } + catch(e){ + console.log("[rebootDevice] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[rebootDevice] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } +} + +//=========== monitor CPU usage function =========== + +function getCPUUsage() { + console.log("[getCPUUsage] function call"); + function onSuccess(cpu) + { + console.log("The Load on device is " + cpu.load); + addResult("The Load on device is " + cpu.load); + } + function onError(error) + { + console.log("Not supported: " + error.message); + addResult("Not supported: " + error.message); + } + tizen.systeminfo.getPropertyValue("CPU", onSuccess, onError); +} + +//=========== monitor RAM usage function =========== + +function getRamUsage() { + console.log("[getRAMUsage] function call"); + var TotalMemory = tizen.systeminfo.getTotalMemory(); + var AvailableRamUsage = tizen.systeminfo.getAvailableMemory() ; + + console.log("The available memory size is " + AvailableRamUsage + " bytes."); + addResult(" available memory " + AvailableRamUsage+ " bytes."); + + console.log("The TotalMemory size is " + TotalMemory + " bytes."); + addResult("TotalMemory " + TotalMemory+ " bytes."); +} + +//=========== get Screen Capture function (Saved path: /opt/share/magicinfo/ScreenCapture.jpg) /opt/usr/home/owner/share/magicinfo/PepperAPIScreenCapture.jpg=========== + +function getScreenCapture() { + console.log("[getScreenCapture] function call"); + try { + webapis.systemcontrol.captureScreen(); + console.log("[getScreenCapture]success to call asyncFunction"); + addResult("[getScreenCapture]success to call asyncFunction"); + }catch(e){ + console.log("[captureScreen] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[captureScreen] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.messag); + } +} + +//=========== get firmware version ================ + +function getDeviceSWVersion() { + console.log("[getDeviceSWVersion] function call"); + var firmwareVersion = null; + + try { + firmwareVersion = webapis.systemcontrol.getFirmwareVersion(); + } catch (e) { + console.log("[getFirmwareVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getFirmwareVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + + if (null !== firmwareVersion) { + console.log("[getFirmwareVersion] call syncFunction type: " + firmwareVersion); + } +} + +//=========== get Model name function =========== + +function getModel() { + var getModel = null; + try { + getModel = webapis.productinfo.getModel(); + } catch (e) { + console.log("[getModel] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getModel] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if(null !== getModel){ + console.log("[getModel] call syncFunction type: " + getModel); + addResult("[getModel] call syncFunction type: " + getModel); + } +} + +//=========== get DUID function =========== + +function getDuid() { + var getDuid = null; + try { + getDuid = webapis.productinfo.getDuid(); + } catch (e) { + console.log("[getDuid] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getDuid] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if(null !== getDuid){ + console.log("[getDuid] call syncFunction type: " + getDuid); + addResult("[getDuid] call syncFunction type: " + getDuid); + } +} + +//=========== get serial number function =========== + +function getSerialNumber(){ + var SerialNumber = null; + try { + SerialNumber = webapis.systemcontrol.getSerialNumber(); + } catch (e) { + console.log("[getSerialNumber] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getSerialNumber] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if (null !== SerialNumber) { + console.log("[getSerialNumber] call syncFunction type: " + SerialNumber); + addResult("[getSerialNumber] call syncFunction type: " + SerialNumber); + } +} + +//=========== set brightness Schedule function =========== + +function setLampSchedule(){ + var info = { + "use" : "ON", + "firstTime" : "08:55", + "level1" : 30, + "secondTime" : "16:50", + "level2" : 80 + }; + try { + webapis.systemcontrol.setScreenLampSchedule(info); + console.log("[setScreenLampSchedule] success"); + addResult("[setScreenLampSchedule] success"); + } catch (e) { + console.log("[setScreenLampSchedule] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[setScreenLampSchedule] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } +} + +//=========== get brightness Schedule function =========== + +function getLampSchedule(){ + var ScreenLampSchedule = null; + try { + ScreenLampSchedule = webapis.systemcontrol.getScreenLampSchedule(); + } catch (e) { + console.log("[getScreenLampSchedule] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getScreenLampSchedule] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if (null !== ScreenLampSchedule) { + console.log("[getScreenLampSchedule] call syncFunction type: " + ScreenLampSchedule); + addResult("[getScreenLampSchedule] call syncFunction type: " + ScreenLampSchedule); + } +} + +//=========== set Panel mute function state = "ON" || "OFF" =========== + +function setPanelMute(state){ + try { + webapis.systemcontrol.setPanelMute(state); + } catch (e) { + console.log("[setPanelMute] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } +} + +//=========== get Panel mute info function =========== + +function getPanelMute(){ + var PanelMuteOnOff = null; + try { + PanelMuteOnOff = webapis.systemcontrol.getPanelMute(); + } catch (e) { + console.log("[getPanelMute] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getPanelMute] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if (null !== PanelMuteOnOff) { + console.log("[getPanelMute] call syncFunction type: " + PanelMuteOnOff); + addResult("[getPanelMute] call syncFunction type: " + PanelMuteOnOff); + } +} + +//=========== set Safety Lock function lockstate = "ON" || "OFF" =========== + +function setSafetyLock(lockState){ + try { + webapis.systemcontrol.setSafetyLock(lockState); + console.log("[setSafetyLock] call success"); + addResult("[setSafetyLock] call success"); + } catch (e) { + console.log("[setSafetyLock] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[setSafetyLock] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } +} + +//=========== get Safety Lock function =========== + +function getSafetyLockStatus(){ + var SafetyLock = null; + try { + SafetyLock = webapis.systemcontrol.getSafetyLock(); + } catch (e) { + console.log("[getSafetyLock] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getSafetyLock] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if (null !== SafetyLock) { + console.log("[getSafetyLock] call syncFunction type: " + SafetyLock); + addResult("[getSafetyLock] call syncFunction type: " + SafetyLock); + } +} + + +//=========== get onScreen menu orientation function =========== + +function getOnScreenMenuOrientation(){ + var onScreenMenuOrientation = null; + try { + onScreenMenuOrientation = webapis.systemcontrol.getOnScreenMenuOrientation(); + } catch (e) { + console.log("[getOnScreenMenuOrientation] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getOnScreenMenuOrientation] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if (null !== onScreenMenuOrientation) { + console.log("[getOnScreenMenuOrientation] call syncFunction type: " + onScreenMenuOrientation); + addResult("[getOnScreenMenuOrientation] call syncFunction type: " + onScreenMenuOrientation); + } +} + + +//=========== get content orientation function =========== + +function getSourceOrientation(){ + var Result = null; + try { + Result = webapis.systemcontrol.getSourceOrientation(); + } catch (e) { + console.log("[getSourceOrientation] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if(null !== Result){ + console.log("[getSourceOrientation] call syncFunction type: " + Result); + } +} + +//=========== set PC connection function RJ45 or RS232 =========== + +function setPcConnection(PCConnection){ + + try { + webapis.systemcontrol.setPCConnection(PCConnection); + console.log("[setPCConnection] call syncFunction: Success"); + addResult("[setPCConnection] call syncFunction: Success"); + } catch (e) { + console.log("[setPCConnection] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[setPCConnection] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } +} + +//=========== get PC connection function =========== + +function getPcConnection(){ + var PCConnection = null; + try { + PCConnection = webapis.systemcontrol.getPCConnection(); + } catch (e) { + console.log("[getPCConnection] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getPCConnection] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if (null !== PCConnection) { + console.log("[getPCConnection] call syncFunction type: " + PCConnection); + addResult("[getPCConnection] call syncFunction type: " + PCConnection); + } +} + +//=========== set message display functionstate = 'ON' || 'OFF' =========== + +function setMessageDisplay(state){ + try { + webapis.systemcontrol.setMessageDisplay(state); + console.log("[setMessageDisplay] call syncFunction: Success"); + addResult("[setMessageDisplay] call syncFunction: Success"); + } catch (e) { + console.log("[setMessageDisplay] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[setMessageDisplay] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } +} + +//=========== get message display function =========== + +function getMessageDisplay(){ + var MessageDisplay = null; + try { + MessageDisplay = webapis.systemcontrol.getMessageDisplay(); + } catch (e) { + console.log("[getMessageDisplay] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("[getMessageDisplay] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } + if (null !== MessageDisplay) { + console.log("[getMessageDisplay] call syncFunction type: " + MessageDisplay); + addResult("[getMessageDisplay] call syncFunction type: " + MessageDisplay); + } +} + +//=========== set firmware Update listener function =========== + +function setFirmwareUpdateListener(){ + var onchange = function(data) { + console.log("[UpdateCallback] progress :" + data + " changed"); + addResult("[UpdateCallback] progress :" + data + " changed"); + }; + try { + webapis.systemcontrol.setUpdateFirmwareListener(onchange); + } catch (e) { + console.log("setUpdateFirmwareListener exception [" + e.code + "] name: " + e.name + " message: " + e.message); + addResult("setUpdateFirmwareListener exception [" + e.code + "] name: " + e.name + " message: " + e.message); + } +} + +//=========== unset firmware Update listener function =========== +function unsetFirmwareUpdateListener(){ + try { + console.log("begin unsetUpdateFirmwareListener"); + webapis.systemcontrol.unsetUpdateFirmwareListener(); + } catch (e) { + console.log("unsetUpdateFirmwareListener exception [" + e.code + "] name: " + e.name + " message: " + e.message); + return; + } +} + + +//=========== Update Firmware function =========== + +function updateFirmware(){ + var SoftwareID = "0"; + var SWUFileName = "upgrade.bem"; + var SWVersion = "T-HKMLAKUC 0227.20"; + var SWURL = "http://10.88.43.36:8080/New2016/Saurabh/swupdate/T-HKMLAKUC_0227_20/image/upgrade.bem"; + var SWTotalBytes = 1007396825; + + webapis.systemcontrol.updateFirmware(SoftwareID, SWUFileName, SWVersion, SWURL, SWTotalBytes); + setFirmwareUpdateListener(); +} + +// window.onload can work without + +function startTime() { + var today = new Date(); + var h = today.getHours(); + var m = today.getMinutes(); + var s = today.getSeconds(); + m = checkTime(m); + s = checkTime(s); + document.getElementById('divbutton1').innerHTML='Current time: ' + h + ':' + m + ':' + s; + setTimeout(startTime, 10); +} + +function checkTime(i) { + if (i < 10) { + i='0' + i; + } + return i; +} +function show_image(src, width, height, alt) { + var img = document.createElement("img"); + img.src = src; + img.width = width; + img.height = height; + img.alt = alt; + img.style.position = 'absolute'; + img.style.right = 0; + img.style.top = 0; + + // This next line will just add it to the tag + document.body.appendChild(img); +} +function registerkeys(){ + + console.log('register keys function called'); + var usedKeys=['1','2', '3', '4', '5', '6', '7', '8', '9','0',"MediaPlay","MediaPause","MediaStop", "MediaRewind", "MediaFastForward"]; + + usedKeys.forEach ( + + function (keyName){ + + tizen.tvinputdevice.registerKey(keyName); + }); +} +window.onload = init; \ No newline at end of file