ImportantDue to NaCl deprecation by the Chromium project, Tizen TV will continue its support for NaCl only until 2021-year products. Meanwhile, Tizen TV will start focusing on high-performance, cross-browser WebAssembly from 2020-year products.
This topic describes how you can use the Message Template Generator in the Tizen Studio to help you implement messaging between the JavaScript and Native Client components in a Native Client application.
In a Native Client (NaCl) application, the NaCl module and the JavaScript component must be able to communicate with each other. The JavaScript component uses the JavaScript messaging API, while the NaCl module uses the PostMessage() function to send messages and the HandleMessage() function to receive them.
The Tizen Studio can generate and insert code stubs for messaging functions, so you can focus on implementing the communication logic. For information on implementing messaging in NaCl applications, see Messaging System.
To generate message handling code templates:
In the "Project Explorer" view, right-click the TV application project or NaCl project, and select "NaCl > Add Messages".
Define the NaCl module name, and the NaCl and JavaScript source files to add code templates to.
NoteThe NaCl module name must correspond to the id attribute of the <embed> element for the NaCl module.
To define a new message:
Click "Add".
Define the message name and whether the message is sent from the NaCl or the JavaScript component. The message name must be unique among all defined messages.
To manage message parameters:
To add a parameter, define the parameter name, type, and description, and click "Add".
To modify a parameter, select it from the list, modify the parameter values as needed, and click "Update".
To delete a parameter, select it from the list, and click "Delete".
To save the parameters and create the message, click "OK".
The created message is shown in the "Messages" list.
To delete a message, select it from the list, and click "Delete".
To generate and insert the message code templates into the source code, click "Generate".
For each defined message, the Message Template Generator creates the following code:
Code for sending messages
The PostMessage_<message_name>() function is created in the native code, and the send_<message_name>() method is created in the JavaScript code. The function and method can be used in your application logic.
Code for handling received messages
The HandleMessage_<message_name>() function stub is created in the native code, and the onReceive_<message_name>() method stub is created in the JavaScript code. Code is also added to call the function and method. You only need to implement the logic required for handling the received messages.
Data structure
A data structure is generated for the message, defining the message parameters.
The generated code also includes stubs for documentation in Doxygen and JSDoc styles.
Manage Your Cookies
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.