This topic describes how to embed an existing Native Client module in a Smart TV application.
The Native Client (NaCl) technology and the Tizen Studio allow you to embed an existing NaCl module in your application. A previously-compiled Native Client module can be needed in a project for various reasons, for example due to security requirements, when the module's source code is already compiled and cannot be modified.
To embed an existing NaCl module, you need the following files:
You also need information on the module's functionality and API.
To embed a module, you must implement the following parts in the JavaScript/HTML5 component of the application:
embed
The following steps use the Hello World in C++ tutorial module. When the module is successfully loaded, it waits for incoming messages and, when it receives one, sends back the text "Echo from NaCl:" along with the original message text.
In the Tizen Studio, create an empty NaCl project.
Build the project to create the makefile definitions needed to package the application.
makefile
When implementing an existing NaCl module, the source files and build result from the empty project are not needed. Delete the built ".nexe", ".pexe", and ".nmf" files from the "CurrentBin" folder, and the existing C++ source files from the "src" folder.
Copy the ".nexe" file you want to implement to the project's "CurrentBin" folder.
In the "CurrentBin" folder, create a ".nmf" manifest file pointing to the module location.
{ "files": {}, "program": { "arm": { "url": "hello_world_module.nexe" }, } }
Implement communication with the NaCl module in the "project.js" file.
exampleSpecificActionAfterNaclLoad()
postMessage()
document.getElementById("nacl_module").postMessage("Hello World from JS");
var uses_logging = true;
handleNaClMessage()
logs.value += message; logs.scrollTop = logs.scrollHeight;
Build and launch the package.