FrontPage ›  SamsungSmartTvSdkInstall
Difference between r1.30 and the current
@@ -190,7 +190,6 @@
 		<!-- 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>
1.1. Samsung SDK download ¶
- download Samsung Smart TV SDK 
 - Go http://www.samsungdforum.com/ and register yourself. 
 
- Click on ![[http]](/imgs/http.png) SDK and Click on SDK and Click on![[http]](/imgs/http.png) SDK Download SDK Download
  [PNG image (8.84 KB)] [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)] [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)] [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)] [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 .
 ![[http]](/imgs/http.png) Java SDK | Java SDK |![[http]](/imgs/http.png) JRE JRE
 
![[http]](/imgs/http.png) Python 2.7 choose version 2.7 not 3. Python 2.7 choose version 2.7 not 3.
 
![[https]](/imgs/https.png) VurtualBox is needed to installed. 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 
 
 
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>













