FrontPage › SamsungSmartTvSdkInstall
Difference between r1.4 and the current
@@ -1,32 +1,216 @@
[[TableOfContents]]== Preparation ==
=== Samsung SDK download ===
1. download Samsung Smart TV SDK 1. Go http://www.samsungdforum.com/ and register yourself.
1. Click on [http://www.samsungdforum.com/Devtools/index SDK] and Click on [http://www.samsungdforum.com/Devtools/SdkDownload SDK Download]
1. Select one of the SDK packages and download it:
[[Attachment(temp5.png,width=600,selflink)]]
1. Select one of the SDK packages and download it: 4.5
1. SDK IDE Download for Windows 32bit 1. SDK IDE Download for Windows 64bit . . .
1. Select SDK Emulator Image for Virtual Box <---- 6th row of the download files list.
[[Attachment(temp6.png,width=600,selflink)]]
1. Once downloaded, 1. download other stuff
=== WAMP ===
1. download WAMP : Windows, Apache, Mysql, Php
1. WAMP: go to http://www.wampserver.com/en/ and download one of the WAMPSERVERs (Apache 32bit vs 64bit | Apache 2.4 vs. 2.2).1. Install the package -> this will install at c:/Wamp :
1. Apache
1. PHP
1. Mysql
1. Apache: World Wide Web server
1. PHP: Interactive programing language
1. Mysql: database tool
1. Some utilities like PhpMyAdmin. . . . 1. Take a note that the default www directory is c:/wamp/www
1. Or you can change them. -->
* Edit the FILE: C:\Wamp\bin\apache\Apache2.4.4\conf\httpd.conf
* eg.,
{{{
DocumentRoot "c:/Wamp/www"
<Directory "c:/Wamp/www">
}}}
To {{{
# DocumentRoot "c:/Wamp/www"
# <Directory "c:/Wamp/www">
DocumentRoot "d:/htdocs"
<Directory "d:/htdocs">
}}}
* restart the apache service
[[Attachment(temp7.png)]]
1. Check the server with web browser enter the local server address, {{{ http://localhost/ }}}, then, hit enter key.
[[Attachment(temp8.png,width=600,selflink)]]
1. Open a text file in the html directory
{{{#!php
<?php
phpinfo();
?>
}}} then, save the file as "phpinfo.php"
{{{ http://localhost/phpinfo.php }}} Check the version of PHP . . . .
1. Interaction . . .
ask.php {{{#!php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
</head>
<body>
<form method="post" action="catchName.php">
<input type="text" name = "name">
<input type="text" name = "email">
<input type="submit" name = "submit" value="전송합니다" />
</form>
</body>
</html>
}}}
catchName.php {{{#!php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
</head>
<body>
<?php
echo $_POST['name'];
echo "<br />";
echo $_POST['email'];
?>
</body>
</html>
}}}
=== Java, JRE, Oracle Virtualbox, etc ===
1. Java, Virtualbox, etc. stuff: Install them into c:/Bin .
1. [http://www.oracle.com/technetwork/java/javase/downloads/index.html Java SDK] | [http://www.oracle.com/technetwork/java/javase/downloads/index.html JRE]1. [http://www.python.org/download/ Python 2.7] choose version 2.7 not 3.
1. [https://www.virtualbox.org/ VurtualBox] is needed to installed.
1. Once Virtualbox installed, see http://www.samsungdforum.com/Guide/d11/index.html to load the Samsung Smart TV emulator.
1. Unzip Samusung Smart TV SDK onto your hard disk drive: c:\bin\SamsungSmartTvSdk
1. execute eclipse.exe as an administrator
== Hello world ==
1. Click on "Samsung Smart TV SDK" menu
1. Pick Samsung Smart TV SDK Javascript App Project
1. Project Name - HelloTV
1. Resolution - 1280 x 720
=== Main.js ===
{{{
var widgetAPI = new Common.API.Widget();
widgetAPI.sendReadyEvent(); // Send "ready" message to app manager
var tvKey = new Common.API.TVKeyValue();
var Main =
{
};
Main.onLoad = function()
{
// Enable key event processing
this.enableKeys();
widgetAPI.sendReadyEvent();
};
Main.onUnload = function()
{
};
Main.enableKeys = function()
{
document.getElementById("anchor").focus();
};
Main.keyDown = function()
{
var keyCode = event.keyCode;
alert("Key pressed: " + keyCode);
switch(keyCode)
{
case tvKey.KEY_RETURN:
case tvKey.KEY_PANEL_RETURN:
alert("RETURN");
widgetAPI.sendReturnEvent();
break;
case tvKey.KEY_LEFT:
// alert("LEFT");
document.getElementById("hello").innerHTML = "LEFT";
break;
case tvKey.KEY_RIGHT:
// alert("RIGHT");
document.getElementById("hello").innerHTML = "RIGHT";
break;
case tvKey.KEY_UP:
alert("UP");
break;
case tvKey.KEY_DOWN:
alert("DOWN");
break;
case tvKey.KEY_ENTER:
case tvKey.KEY_PANEL_ENTER:
// alert("ENTER");
document.getElementById("hello").innerHTML = "Here we go. Enter!";
break;
default:
alert("Unhandled key");
break;
}
};
}}}
=== Main.css ===
{{{
*
{
padding: 0;
margin: 0;
border: 0;
}
/* Layout */
body
{
width: 1280px;
height: 720px;
background-color: #FFF;
}
#hello {
font-size:250px;
}
}}}
=== index.html ===
{{{
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>HelloTV</title>
<!-- TODO : Common API -->
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>
<!-- TODO : Javascript code -->
<script language="javascript" type="text/javascript" src="app/javascript/Main.js"></script>
<!-- TODO : Style sheets code -->
<link rel="stylesheet" href="app/stylesheets/Main.css" type="text/css">
<!-- TODO: Plugins -->
</head>
<body onload="Main.onLoad();" onunload="Main.onUnload();">
<!-- Dummy anchor as focus for key events -->
<a href="javascript:void(0);" id="anchor" onkeydown="Main.keyDown();"></a>
<!-- TODO: your code here -->
<label id="hello">Hello TV</label>
</body>
</html>
}}}
1.1. Samsung SDK download ¶
- download Samsung Smart TV SDK
- Go http://www.samsungdforum.com/ and register yourself.
- Click on SDK and Click on SDK Download
[PNG image (8.84 KB)]
- Select one of the SDK packages and download it: 4.5
- SDK IDE Download for Windows 32bit
- SDK IDE Download for Windows 64bit . . .
- SDK IDE Download for Windows 32bit
- Select SDK Emulator Image for Virtual Box <---- 6th row of the download files list.
[PNG image (69.15 KB)]
- Once downloaded,
- Go http://www.samsungdforum.com/ and register yourself.
1.2. WAMP ¶
- download WAMP : Windows, Apache, Mysql, Php
- WAMP: go to http://www.wampserver.com/en/ and download one of the WAMPSERVERs (Apache 32bit vs 64bit | Apache 2.4 vs. 2.2).
- Install the package -> this will install at c:/Wamp :
- Apache: World Wide Web server
- PHP: Interactive programing language
- Mysql: database tool
- Some utilities like PhpMyAdmin. . . .
- Take a note that the default www directory is c:/wamp/www
- Or you can change them. -->
- Edit the FILE: C:\Wamp\bin\apache\Apache2.4.4\conf\httpd.conf
- eg.,
DocumentRoot "c:/Wamp/www" <Directory "c:/Wamp/www">
To
# DocumentRoot "c:/Wamp/www" # <Directory "c:/Wamp/www"> DocumentRoot "d:/htdocs" <Directory "d:/htdocs">
- restart the apache service
[PNG image (21.72 KB)]
- Edit the FILE: C:\Wamp\bin\apache\Apache2.4.4\conf\httpd.conf
- Apache: World Wide Web server
- WAMP: go to http://www.wampserver.com/en/ and download one of the WAMPSERVERs (Apache 32bit vs 64bit | Apache 2.4 vs. 2.2).
- Check the server with web browser enter the local server address, http://localhost/ , then, hit enter key.
[PNG image (37.79 KB)]
- Open a text file in the html directory
then, save the file as "phpinfo.php" http://localhost/phpinfo.php Check the version of PHP . . . .<?php
phpinfo();
?>
- Interaction . . .
ask.php
catchName.php<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
</head>
<body>
<form method="post" action="catchName.php">
<input type="text" name = "name">
<input type="text" name = "email">
<input type="submit" name = "submit" value="전송합니다" />
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
</head>
<body>
<?php
echo $_POST['name'];
echo "<br />";
echo $_POST['email'];
?>
</body>
</html>
1.3. Java, JRE, Oracle Virtualbox, etc ¶
- Java, Virtualbox, etc. stuff: Install them into c:/Bin .
- Java SDK | JRE
- Python 2.7 choose version 2.7 not 3.
- VurtualBox is needed to installed.
- Once Virtualbox installed, see http://www.samsungdforum.com/Guide/d11/index.html to load the Samsung Smart TV emulator.
- Unzip Samusung Smart TV SDK onto your hard disk drive: c:\bin\SamsungSmartTvSdk
- execute eclipse.exe as an administrator
- Java SDK | JRE
2. Hello world ¶
- Click on "Samsung Smart TV SDK" menu
- Pick Samsung Smart TV SDK Javascript App Project
- Project Name - HelloTV
- Resolution - 1280 x 720
2.1. Main.js ¶
var widgetAPI = new Common.API.Widget(); widgetAPI.sendReadyEvent(); // Send "ready" message to app manager var tvKey = new Common.API.TVKeyValue(); var Main = { }; Main.onLoad = function() { // Enable key event processing this.enableKeys(); widgetAPI.sendReadyEvent(); }; Main.onUnload = function() { }; Main.enableKeys = function() { document.getElementById("anchor").focus(); }; Main.keyDown = function() { var keyCode = event.keyCode; alert("Key pressed: " + keyCode); switch(keyCode) { case tvKey.KEY_RETURN: case tvKey.KEY_PANEL_RETURN: alert("RETURN"); widgetAPI.sendReturnEvent(); break; case tvKey.KEY_LEFT: // alert("LEFT"); document.getElementById("hello").innerHTML = "LEFT"; break; case tvKey.KEY_RIGHT: // alert("RIGHT"); document.getElementById("hello").innerHTML = "RIGHT"; break; case tvKey.KEY_UP: alert("UP"); break; case tvKey.KEY_DOWN: alert("DOWN"); break; case tvKey.KEY_ENTER: case tvKey.KEY_PANEL_ENTER: // alert("ENTER"); document.getElementById("hello").innerHTML = "Here we go. Enter!"; break; default: alert("Unhandled key"); break; } };
2.2. Main.css ¶
* { padding: 0; margin: 0; border: 0; } /* Layout */ body { width: 1280px; height: 720px; background-color: #FFF; } #hello { font-size:250px; }
2.3. index.html ¶
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>HelloTV</title> <!-- TODO : Common API --> <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script> <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script> <!-- TODO : Javascript code --> <script language="javascript" type="text/javascript" src="app/javascript/Main.js"></script> <!-- TODO : Style sheets code --> <link rel="stylesheet" href="app/stylesheets/Main.css" type="text/css"> <!-- TODO: Plugins --> </head> <body onload="Main.onLoad();" onunload="Main.onUnload();"> <!-- Dummy anchor as focus for key events --> <a href="javascript:void(0);" id="anchor" onkeydown="Main.keyDown();"></a> <!-- TODO: your code here --> <label id="hello">Hello TV</label> </body> </html>