<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
- <head>
- <script type="text/javascript" src="html/scripts/snippet.js"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href="html/css/styles.css" rel="StyleSheet" type="text/css" />
- <link href="html/css/snippet.css" rel="StyleSheet" type="text/css" />
- <title>About This Content</title>
- </head>
- <body onload="prettyPrint()">
-
- <h1><a name="Creating2" id="Creating2">About This Content</a></h1>
- <p>Tizen 3.0.0</p>
+ <head>
+ <script type="text/javascript" src="html/scripts/snippet.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link href="html/css/styles.css" rel="StyleSheet" type="text/css" />
+ <link href="html/css/snippet.css" rel="StyleSheet" type="text/css" />
+ <title>About This Content</title>
+ </head>
+ <body onload="prettyPrint()">
- <h1>License</h1>
+ <h1><a name="Creating2" id="Creating2">About This Content</a></h1>
+ <p>Tizen 3.0.0</p>
+
+ <h1>License</h1>
<p>Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
- <head>
- <script type="text/javascript" src="html/scripts/snippet.js"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href="html/css/styles.css" rel="StyleSheet" type="text/css" />
- <link href="html/css/snippet.css" rel="StyleSheet" type="text/css" />
- <title>About This Content</title>
- </head>
- <body onload="prettyPrint()">
-
- <h1><a name="Creating2" id="Creating2">About This Content</a></h1>
- <p>Tizen 3.0.0</p>
+ <head>
+ <script type="text/javascript" src="html/scripts/snippet.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link href="html/css/styles.css" rel="StyleSheet" type="text/css" />
+ <link href="html/css/snippet.css" rel="StyleSheet" type="text/css" />
+ <title>About This Content</title>
+ </head>
+ <body onload="prettyPrint()">
- <h1>License</h1>
+ <h1><a name="Creating2" id="Creating2">About This Content</a></h1>
+ <p>Tizen 3.0.0</p>
+
+ <h1>License</h1>
<p>Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
</body>
</html>
\ No newline at end of file
<li><a href="install/extension_sdks.htm">Extension SDKs</a></li>
<li><a href="install/sdk_hardware_accelerated_execution_manager.htm">Hardware Accelerated Execution Manager</a></li>
<li><a href="install/sdk_troubleshooting.htm">Troubleshooting</a></li>
- </ul>
+ </ul>
</li>
<li><a href="install/advanced_configuration.htm">Advanced Configuration</a></li>
<li><a href="install/uninstalling_sdk.htm">Uninstalling the SDK</a></li>
<body onload="prettyPrint()" style="overflow: auto;">
<div id="toc-navigation">
-
+
<div id="profile"><p><img alt="Mobile" src="../images/mobile_s_wn.png"/> <img alt="Wearable" src="../images/wearable_s_wn.png"/></p></div>
-
+
<div id="toc_border"><div id="toc">
<p class="toc-title">Content</p>
<ul class="toc">
<p>To set the <strong>Package Server</strong> option in the <strong>Install Option</strong> tab:</p>
-<ol>
+<ol>
<li>Run the <strong>Update Manager</strong> by clicking the following shortcut:
- <ul>
- <li>On Ubuntu, go to <strong>Dashboard Home > Update Manager</strong>.</li>
- <li>On Windows®, go to <strong>Start > All Programs > Tizen SDK > Update Manager</strong>.</li>
- <li>On Mac OS® X, go to <strong>Launchpad > Update Manager</strong>.</li>
+ <ul>
+ <li>On Ubuntu, go to <strong>Dashboard Home > Update Manager</strong>.</li>
+ <li>On Windows®, go to <strong>Start > All Programs > Tizen SDK > Update Manager</strong>.</li>
+ <li>On Mac OS® X, go to <strong>Launchpad > Update Manager</strong>.</li>
</ul>
</li>
- <li>Select the <strong>All Packages</strong> tab.</li>
+ <li>Select the <strong>All Packages</strong> tab.</li>
<li>Click <strong>Configuration</strong>.</li>
- <li>Select the <strong>Install Option</strong> tab (selected by default).</li>
+ <li>Select the <strong>Install Option</strong> tab (selected by default).</li>
<li>In the combo box at the top, select <strong>Package Server</strong>.</li>
<li>In the combo box below <strong>Package Server</strong>, select an available repository. (The Tizen SDK is distributed through the Amazon S3. If you select the nearby repository in the Alternative locations, you can speed up the SDK download.)</li>
<li>Click <strong>Refresh</strong>.</li>
<li>In the <strong>Distribution</strong> box, select the distribution you want to download.</li>
<li>Click <strong>Confirm</strong>.</li>
</ol>
-
- <table class="note">
- <tbody>
- <tr>
- <th class="note">Note</th>
- </tr>
- <tr>
- <td class="note">If the <strong>Auto update</strong> check box is selected, the Update Manager automatically updates the latest version of the Tizen SDK.</td>
- </tr>
- </tbody>
- </table>
-
+
+ <table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">If the <strong>Auto update</strong> check box is selected, the Update Manager automatically updates the latest version of the Tizen SDK.</td>
+ </tr>
+ </tbody>
+ </table>
+
<h3>Setting the SDK Image</h3>
-
+
<p class="figure">Figure: Configuring the SDK image</p>
<p align="center"><img src="../images/adv_config_sdk_image.png" alt="Configuring the SDK image" /></p>
-
+
<p>To set the <strong>SDK Image</strong> option in the <strong>Install Option</strong> tab:</p>
-
- <ol>
+
+ <ol>
<li>Run the <strong>Update Manager</strong> by clicking the following shortcut:
- <ul>
- <li>On Ubuntu, go to <strong>Dashboard Home > Update Manager</strong>.</li>
- <li>On Windows®, go to <strong>Start > All Programs > Tizen SDK > Update Manager</strong>.</li>
- <li>On Mac OS® X, go to <strong>Launchpad > Update Manager</strong>.</li>
+ <ul>
+ <li>On Ubuntu, go to <strong>Dashboard Home > Update Manager</strong>.</li>
+ <li>On Windows®, go to <strong>Start > All Programs > Tizen SDK > Update Manager</strong>.</li>
+ <li>On Mac OS® X, go to <strong>Launchpad > Update Manager</strong>.</li>
</ul>
</li>
- <li>Select the <strong>All Packages</strong> tab.</li>
+ <li>Select the <strong>All Packages</strong> tab.</li>
<li>Click <strong>Configuration</strong>.</li>
- <li>Select the <strong>Install Option</strong> tab (selected by default).</li>
+ <li>Select the <strong>Install Option</strong> tab (selected by default).</li>
<li>In the combo box at the top, select <strong>SDK Image</strong>.</li>
<li>Click the <strong>Folder</strong> icon button, browse to the SDK image file, and click <strong>OK</strong>.</li>
<li>Click <strong>Confirm</strong>.</li>
</ol>
-
+
<h2 id="set_proxy">Configuring the Proxy</h2>
-
+
<p class="figure">Figure: Configuring the proxy</p>
<p align="center"><img src="../images/adv_config_proxy.png" alt="Configuring the proxy" /></p>
-
+
<p>You can configure a proxy to connect to a repository server:</p>
-
- <ol>
+
+ <ol>
<li>Run the <strong>Update Manager</strong> by clicking the following shortcut:
- <ul>
- <li>On Ubuntu, go to <strong>Dashboard Home > Update Manager</strong>.</li>
- <li>On Windows®, go to <strong>Start > All Programs > Tizen SDK > Update Manager</strong>.</li>
- <li>On Mac OS® X, go to <strong>Launchpad > Update Manager</strong>.</li>
+ <ul>
+ <li>On Ubuntu, go to <strong>Dashboard Home > Update Manager</strong>.</li>
+ <li>On Windows®, go to <strong>Start > All Programs > Tizen SDK > Update Manager</strong>.</li>
+ <li>On Mac OS® X, go to <strong>Launchpad > Update Manager</strong>.</li>
</ul>
</li>
- <li>Select the <strong>All Packages</strong> tab.</li>
+ <li>Select the <strong>All Packages</strong> tab.</li>
<li>Click <strong>Configuration</strong>.</li>
- <li>Select the <strong>Proxy Settings</strong> tab.</li>
+ <li>Select the <strong>Proxy Settings</strong> tab.</li>
<li>Select the configuration you want to use. If you select <strong>Manual Proxy Configuration</strong>, enter <strong>HTTP Proxy</strong> and <strong>Port</strong> values.</li>
<li>Click <strong>Confirm</strong>.</li>
</ol>
-
-
+
+
<h2 id="set_extra">Configuring the Extra Repository</h2>
-
+
<p class="figure">Figure: Configuring the extra repository</p>
<p align="center"><img src="../images/adv_config_extra.png" alt="Configuring the extra repository" /></p>
-
+
<p>The Tizen SDK supports downloading extension packages from extra repositories, which are managed by external developers and companies.</p>
<p>For more information, see <a href="extension_sdks.htm">Extension SDKs</a>.</p>
<li><p>On Microsoft Windows®, double-click the installer icon.</p></li>
<li><p>On Mac OS® X, double-click the .dmg file to mount, and double-click the installer icon.</p></li>
</ul>
-<p align="center"><img alt="GUI installer" src="../images/install_gui.png" /></p>
+<p align="center"><img alt="GUI installer" src="../images/install_gui.png" /></p>
</li>
<li><p>If you agree to the license terms, select the <strong>Accept</strong> check box to enable the <strong>Install</strong> icon button.</p>
<p>To install, you must agree to the license terms.</p></li>
<li><p>Click the <strong>Install</strong> icon button.</p>
<p>The GUI installer begins to install the Web App SDK on your computer.</p></li>
<li><p>When the installation is complete, click <strong>Done</strong>.</p>
-<p align="center"><img alt="Installation complete" src="../images/install_complete.png" /></p>
- <table class="note">
- <tbody>
- <tr>
- <th class="note">Note</th>
- </tr>
- <tr>
- <td class="note">If you want to develop a native application, you must install the Native App SDK using the Update Manager. See <a href="updating_sdk.htm">Updating the Tizen SDK</a>.</td>
- </tr>
- </tbody>
- </table>
+<p align="center"><img alt="Installation complete" src="../images/install_complete.png" /></p>
+ <table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">If you want to develop a native application, you must install the Native App SDK using the Update Manager. See <a href="updating_sdk.htm">Updating the Tizen SDK</a>.</td>
+ </tr>
+ </tbody>
+ </table>
</li>
</ol>
</tbody>
</table>
<p>The CLI installer opens.</p>
-<p align="center"><img alt="CLI installer" src="../images/install_cli.png" /></p>
+<p align="center"><img alt="CLI installer" src="../images/install_cli.png" /></p>
</li>
</ul>
</li>
<li><p>Enter the SDK installation location.</p>
<p>The CLI installer begins to install the Web App SDK on your computer.</p>
- <table class="note">
- <tbody>
- <tr>
- <th class="note">Note</th>
- </tr>
- <tr>
- <td class="note">If you want to develop a native application on the CLI, you must install the Native App SDK using the CLI Update Manager. See <a href="updating_sdk.htm">Updating the Tizen SDK</a>.</td>
- </tr>
- </tbody>
- </table>
+ <table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">If you want to develop a native application on the CLI, you must install the Native App SDK using the CLI Update Manager. See <a href="updating_sdk.htm">Updating the Tizen SDK</a>.</td>
+ </tr>
+ </tbody>
+ </table>
</li>
</ol>
<p><strong>Hardware requirements:</strong></p>
-<ul>
- <li>Intel processor with support for VT-x, EM64T, and Execute Disable Bit</li>
- <li>At least 1GB of available memory (2GB or more is preferred)</li>
-</ul>
-
- <table class="note">
- <tbody>
- <tr>
- <th class="note">Important</th>
- </tr>
- <tr>
- <td class="note">Intel® HAXM can only be used on systems with an Intel processor which supports the Intel VT.</td>
- </tr>
- </tbody>
- </table>
+<ul>
+ <li>Intel processor with support for VT-x, EM64T, and Execute Disable Bit</li>
+ <li>At least 1GB of available memory (2GB or more is preferred)</li>
+</ul>
+
+ <table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Important</th>
+ </tr>
+ <tr>
+ <td class="note">Intel® HAXM can only be used on systems with an Intel processor which supports the Intel VT.</td>
+ </tr>
+ </tbody>
+ </table>
<h2 id="windows">Installing Intel® HAXM on Windows®</h2>
<p><strong>Supported Windows® versions:</strong></p>
-<ul>
- <li>Windows 8.1/8/7 (32/64-bit)</li>
- <li>Windows Vista (32/64-bit)</li>
+<ul>
+ <li>Windows 8.1/8/7 (32/64-bit)</li>
+ <li>Windows Vista (32/64-bit)</li>
<li>Windows XP SP2 or later (32-bit only)</li>
</ul>
<p align="center"><img src="../images/sdk2_0-haxm-win1.png" alt="Install manager" /></p>
-<p>You can access the documentation at any time by clicking <strong>Intel® HAXM Documentation</strong>.</p>
+<p>You can access the documentation at any time by clicking <strong>Intel® HAXM Documentation</strong>.</p>
</li>
<li>Adjust the amount of RAM to be allocated to Intel® HAXM.
<p align="center"><img src="../images/sdk2_0-haxm-win3.png" alt="Memory setup" /></p>
-<p>The installer also functions as a configuration tool for Intel® HAXM. To change the memory settings later on, run the installer again.</p>
+<p>The installer also functions as a configuration tool for Intel® HAXM. To change the memory settings later on, run the installer again.</p>
</li>
<li>
<p>Confirm your Intel® HAXM memory allocation settings and click <strong>Install</strong>.</p>
</ol>
-<p>To verify that Intel® HAXM is running, open the Command Prompt window and execute the following command:</p>
+<p>To verify that Intel® HAXM is running, open the Command Prompt window and execute the following command:</p>
<pre class="prettyprint">sc query intelhaxm</pre>
-<p>If Intel® HAXM is working, the command displays a status message indicating that the state is "4Â RUNNING".</p>
+<p>If Intel® HAXM is working, the command displays a status message indicating that the state is "4Â RUNNING".</p>
<p align="center"><img src="../images/sdk2_0-haxm-cmd.png" alt="HAXM command" /></p>
<p>To start or stop Intel® HAXM, open the Command Prompt window <strong>with administrator privileges</strong> and execute one of the following commands:</p>
<p>Start HAXM:</p>
<pre class="prettyprint">sc start intelhaxm </pre>
-<p>Stop HAXM:</p>
-<pre class="prettyprint">sc stop intelhaxm </pre>
+<p>Stop HAXM:</p>
+<pre class="prettyprint">sc stop intelhaxm </pre>
<h3>Adjusting Intel® HAXM Memory Allocation</h3>
<p>To change the amount of memory allocated to Intel® HAXM, run the installer again.</p>
- <table class="note">
- <tbody>
- <tr>
- <th class="note">Note</th>
- </tr>
- <tr>
- <td class="note">If you change the Intel® HAXM memory settings for the emulator, you must restart the Intel® HAXM and the emulator. Currently running emulator continues to use the previous memory setting.</td>
- </tr>
- </tbody>
- </table>
+ <table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">If you change the Intel® HAXM memory settings for the emulator, you must restart the Intel® HAXM and the emulator. Currently running emulator continues to use the previous memory setting.</td>
+ </tr>
+ </tbody>
+ </table>
<h3>Removing Intel® HAXM</h3>
- <table class="note">
- <tbody>
- <tr>
- <th class="note">Warning</th>
- </tr>
- <tr>
- <td class="note">Close all instances of the Tizen emulator before removing the Intel® HAXM.</td>
- </tr>
- </tbody>
- </table>
+ <table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Warning</th>
+ </tr>
+ <tr>
+ <td class="note">Close all instances of the Tizen emulator before removing the Intel® HAXM.</td>
+ </tr>
+ </tbody>
+ </table>
<p>To uninstall the Intel® HAXM, run the installer again or use the Control Panel.</p>
- <table class="note">
- <tbody>
- <tr>
- <th class="note">Important</th>
- </tr>
- <tr>
- <td class="note">If you remove the Intel® HAXM, the acceleration of all Tizen emulators is disabled, but the Tizen emulator still works. If you install the Intel® HAXM again, the acceleration is re-enabled.</td>
- </tr>
- </tbody>
- </table>
+ <table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Important</th>
+ </tr>
+ <tr>
+ <td class="note">If you remove the Intel® HAXM, the acceleration of all Tizen emulators is disabled, but the Tizen emulator still works. If you install the Intel® HAXM again, the acceleration is re-enabled.</td>
+ </tr>
+ </tbody>
+ </table>
<h3>Troubleshooting</h3>
<td>1bad18cd50b700bfb6673cdaebdc7955</td>
</tr>
</tbody></table>
-
+
<p>To install Intel® HAXM:</p>
<ol>
<li>Open the downloaded DMG file and run the installer inside it.</li>
<td class="note">
<ul>
<li>If the host machine is using the Nvidia Optimus™ technology, the emulator works with the on-board graphics card. To prevent this, either disable the Nvidia Optimus™ technology, or set the emulator to run with the external Nvidia graphics card.</li>
- <li>Integrated graphic cards inside Intel's Q33/Q35/Q43/Q45 motherboards are not supported.</li>
+ <li>Integrated graphic cards inside Intel's Q33/Q35/Q43/Q45 motherboards are not supported.</li>
<li>First generation Intel HD Graphics is not supported.</li>
</ul>
</td>
</tr>
<tr>
<td>Webcam</td>
- <td>To use the emulator with your computer's webcam, the webcam must support the USB Video Class (UVC) driver. The following table lists the image format requirements for each OS.
+ <td>To use the emulator with your computer's webcam, the webcam must support the USB Video Class (UVC) driver. The following table lists the image format requirements for each OS.
<table>
<caption>Table: Webcam image formats</caption>
<tbody>
<p>If you see the following message, your Java libraries are not suitable to Java executables:</p>
-<p><strong>Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion' has value 'XXX', but 'XXX' is required.</strong></p>
+<p><strong>Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion' has value 'XXX', but 'XXX' is required.</strong></p>
<p>The cause is that the Java files in the System32 directory do not match what is listed for the Java Runtime Environment in the Windows registry.</p>
<ul><li>Release Date: February 18, 2013</li></ul>
-<h2 id="intro">Introduction</h2>
+<h2 id="intro">Introduction</h2>
<p>Welcome to the Tizen SDK.</p>
<p>Tizen is an open source, standards-based software platform supported by leading mobile operators, device manufacturers, and chip suppliers for multiple device categories, including smartphones, tablets, netbooks, in-vehicle infotainment devices, and smart TVs.</p>
<ul><li>This high-level JavaScript API is used to process and synthesize audio in Web applications.</li>
</ul></li>
<li>HTML Media Capture
-<ul><li>This HTML form extension enables users to access a device's media capture mechanism, such as a camera or microphone, from a file upload control.</li>
+<ul><li>This HTML form extension enables users to access a device's media capture mechanism, such as a camera or microphone, from a file upload control.</li>
</ul></li>
</ul></li>
<li>UI
<li>Web UI Framework
<ul><li>jQuery and jQuery Mobile (jQM) versions are upgraded to jQuery 1.8.2 and jQM 1.2.0.</li>
<li>Theme
-<ul><li>The "tizen-black" theme has been removed.</li>
-<li>The "tizen-white" theme has been changed to a new UX style.</li>
+<ul><li>The "tizen-black" theme has been removed.</li>
+<li>The "tizen-white" theme has been changed to a new UX style.</li>
</ul></li>
<li>Widget
-<ul><li>The automatic footer generation feature has been removed. (<div data-role="footer"/;> needs to be specified.)</li>
+<ul><li>The automatic footer generation feature has been removed. (<div data-role="footer"/;> needs to be specified.)</li>
<li>The optionheader, nocontents, controlgroup, pagecontrol, colorselector, dayselector widgets are removed.</li>
-<li>The image slider widget has been renamed as "gallery".</li>
-<li>The shortcut scroll widget has been renamed as "fast scroll".</li>
+<li>The image slider widget has been renamed as "gallery".</li>
+<li>The shortcut scroll widget has been renamed as "fast scroll".</li>
<li>The swipe list widget has been refactored to a new style.</li>
-<li>The control bar widget has been refactored to "tab bar".</li>
-<li>The multi-button entry widget has been refactored to "token text area".</li>
-<li>The context popup has been replaced with "popup" as in jQM 1.2.0.</li>
-<li>The toggle switch has been replaced with "flip toggle switch" as in jQM 1.2.0.</li>
-<li>The popup has been replaced with "popup with data-position-to='window' attribute" as in jQM 1.2.0.</li>
-<li>The expandable list has been replaced with "collapsible list" as in jQM 1.2.0.</li>
-<li>The auto divider has been replaced with "auto-divider" as in jQM 1.2.0.</li>
+<li>The control bar widget has been refactored to "tab bar".</li>
+<li>The multi-button entry widget has been refactored to "token text area".</li>
+<li>The context popup has been replaced with "popup" as in jQM 1.2.0.</li>
+<li>The toggle switch has been replaced with "flip toggle switch" as in jQM 1.2.0.</li>
+<li>The popup has been replaced with "popup with data-position-to='window' attribute" as in jQM 1.2.0.</li>
+<li>The expandable list has been replaced with "collapsible list" as in jQM 1.2.0.</li>
+<li>The auto divider has been replaced with "auto-divider" as in jQM 1.2.0.</li>
<li>The search bar supports additional data-* attributes.</li>
</ul></li>
<li>Viewport meta tag
-<ul><li>The "data-framework-viewport-scale" attribute of the web-ui-fw script tag has been changed to "data-frame-viewport-width = 'device-width' | 'screen-width' | '[number]'".</li>
+<ul><li>The "data-framework-viewport-scale" attribute of the web-ui-fw script tag has been changed to "data-frame-viewport-width = 'device-width' | 'screen-width' | '[number]'".</li>
</ul></li>
</ul></li>
<li>Tizen Web APIs
<ul><li>Privilege
-<ul><li>The feature for API access has been replaced with "privilege". The changed names are included in the API specification.</li>
+<ul><li>The feature for API access has been replaced with "privilege". The changed names are included in the API specification.</li>
</ul></li>
<li>WebAPIException
<ul><li>The WebAPIException interface is used by APIs to throw errors synchronously. The WebAPIError interface is only used for asynchronous error handling.</li>
<ul><li>This API has been refactored for better usability.</li>
</ul></li>
<li>Contact
-<ul><li>The "person" concept that is used to group a number of contacts has been added.</li>
+<ul><li>The "person" concept that is used to group a number of contacts has been added.</li>
</ul></li>
<li>Content
<ul><li>The Media Content API has been refactored to Content to cover non-media content.</li>
<li>Certificate management
<ul><li>This feature provides:
<ul><li>X.509 certificates</li>
-<li>X.509 certificate chain validation from an "entity" certificate to a trusted CA certificate</li>
+<li>X.509 certificate chain validation from an "entity" certificate to a trusted CA certificate</li>
<li>DER and PEM formats</li>
</ul></li>
</ul></li>
<li>The front camera is not working in specific reference targets.
<ul><li>The front camera is not working in the specific target device. (Ref.Device-PQ)</li>
<li>The camera flash is not working in the specific target device. (Ref.Device-210)</li>
-<li>The camera's NV12 capture format is not working in the specific target device. (Ref.Device-PQ)</li>
+<li>The camera's NV12 capture format is not working in the specific target device. (Ref.Device-PQ)</li>
<li>The GPU enabled Emulator has performance degradation in Camera previewing and Player rendering.</li>
</ul></li>
<li>There are performance issues when decoding large scale images in the Emulator.</li>
<ul><li>Reference Kernel
<ul><li>The rear-camera is not supported. (Ref.Device-PQ)</li>
-<li>The front-camera's flash is not supported. (Ref.Device-210)</li>
+<li>The front-camera's flash is not supported. (Ref.Device-210)</li>
</ul></li>
<li>Core applications
<ul><li>Internet is not supported in this version.</li>
</ul></li>
</ul>
-<h2 id="ide_tools">IDE and Tools</h2>
+<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
<ul><li>If a system does not support a network, the Install Manager can show components trees.</li>
</ul></li>
<li>Support for advanced extra package control:
-<ul><li>You can find extra package information at 'tizen-sdk-data/extra'.</li>
+<ul><li>You can find extra package information at 'tizen-sdk-data/extra'.</li>
<li>An extra repository can be added even if there are no packages which can be updated.</li>
<li>Extra repository and packages can be removed.</li>
</ul></li>
<ul><li>Support for a widget palette including 29 Tizen UI widgets and 12 HTML widgets</li>
<li>Support for drag-and-drop creation, moving, and deletion of widgets</li>
<li>Support for multiple selection, copy, cut, and paste actions</li>
-<li>Support for viewport scaling mode that is similar to the Emulator's</li>
+<li>Support for viewport scaling mode that is similar to the Emulator's</li>
</ul></li>
<li>Outline view
<ul><li>Support for deleting and renaming widgets</li>
<ul><li>Windows XP/7 with Intel motherboard integrated card</li>
<li>Ubuntu 11.10 with Intel CPU/motherboard integrated card</li>
</ul>
-<p>If this occurs, turn off the HW GL acceleration in the Emulator Manager. The HW GL acceleration can be disabled due to host capability, even though you select 'HW GL Acceleration supported' in the Emulator Manager.</p>
+<p>If this occurs, turn off the HW GL acceleration in the Emulator Manager. The HW GL acceleration can be disabled due to host capability, even though you select 'HW GL Acceleration supported' in the Emulator Manager.</p>
</li>
-<li>When you launch the Emulator on Windows®, you can get a "failed to allocate memory" error. In that case, try the following:
-<ul><li>Increase the user area of the virtual memory in the system to 3 GB by running the "bcdedit /set increaseuserva 3072" command on the console with administrator rights (Windows® 7 only).</li>
+<li>When you launch the Emulator on Windows®, you can get a "failed to allocate memory" error. In that case, try the following:
+<ul><li>Increase the user area of the virtual memory in the system to 3 GB by running the "bcdedit /set increaseuserva 3072" command on the console with administrator rights (Windows® 7 only).</li>
<li>Close some other programs and try to launch the Emulator again.</li>
<li>If you have set the RAM size as 768 or 1024 MB for the VM in the Emulator Manager, change the RAM size to 512 MB.</li>
</ul></li>
<li>If a dialog displays that the Install Manager is damaged on Mac OS, please see <a href="http://support.apple.com/kb/HT5290" target="_blank">http://support.apple.com/kb/HT5290</a>.
</li></ul></li></ul>
-<h2 id="next">Next Release</h2>
+<h2 id="next">Next Release</h2>
<p>The next version, Tizen 2.1, will be released in the second quarter of 2013. As a minor release, it will only contain several new features and performance enhancement without API modifications or removal. The main features of Tizen 2.1 include account management, application installing service, livebox support, performance optimization, and a security enhancement.</p>
<ul><li>Release Date: May 18, 2013</li>
</ul>
-<h2 id="intro">Introduction</h2>
+<h2 id="intro">Introduction</h2>
<p>Welcome to Tizen.</p>
<p>Tizen is an open source, standards-based software platform supported by leading mobile operators, device manufacturers, and chip suppliers for multiple device categories, including smartphones, tablets, netbooks, in-vehicle infotainment devices, and smart TVs.</p>
<p>The Tizen Platform consists of the Web framework (APIs), native framework (APIs), and core system.</p>
<p>The Tizen Software Development Kit (SDK) is a comprehensive set of tools for developing Web applications, native applications, and the platform component for Tizen. The SDK contains an install manager, IDE, tools, documents, samples, and a platform image.</p>
-<h2 id="platform">Tizen Platform</h2>
+<h2 id="platform">Tizen Platform</h2>
<h3>Web Framework</h3>
<li>Web Dynamic Box execution and life-cycle management</li>
</ul></li>
<li>Configuration extension updates
-<ul><li>The "package" attribute in the <tizen:application> element to specify the package ID</li>
+<ul><li>The "package" attribute in the <tizen:application> element to specify the package ID</li>
</ul></li>
</ul></li>
</ul>
</ul></li>
<li>Tizen::Security
<ul><li>Key
-<ul><li>Supports "X509" and "PKCS#1" format for public keys and "PKCS#8" and "PKCS#1" format for private keys</li>
+<ul><li>Supports "X509" and "PKCS#1" format for public keys and "PKCS#8" and "PKCS#1" format for private keys</li>
<li>Supports changing the format of the RSA key and encoding</li>
</ul></li>
<li>PKCS
-<ul><li>Supports "PKCS#5" (Password-based Encryption Standard) and "PKCS#8" (Private-key Information Syntax Standard)</li>
+<ul><li>Supports "PKCS#5" (Password-based Encryption Standard) and "PKCS#8" (Private-key Information Syntax Standard)</li>
</ul></li>
<li>Cert
<ul><li>Supports .p12 and .pfx certificate installation</li>
<li>The height of the Tizen::Ui::Controls::MessageBox and Tizen::Ui::Controls::ProgressPopup controls is no longer variable according to the length of the body text</li>
<li>Indicator height is reduced in the landscape mode to provide more content area. Therefore, client bounds of the Tizen::Ui::Controls::Form control changes in the landscape mode. When the indicator is made translucent while in the landscape mode, it becomes completely transparent. The indicator and Form behavior for the portrait orientation has not changed.</li>
<li>The UI control deleting order has changed. UI controls were being deleted from parent to child, but in Tizen version 2.1, they are deleted from child to parent.</li>
-<li>It is recommended to use ".#.png" for extension of a 9-patch image. If the extension is not ".#.png", a bitmap which is loaded by the GetBitmapN() method and the UI Builder tool is not represented as a 9-patch.</li>
+<li>It is recommended to use ".#.png" for extension of a 9-patch image. If the extension is not ".#.png", a bitmap which is loaded by the GetBitmapN() method and the UI Builder tool is not represented as a 9-patch.</li>
<li>Scene management
<ul><li>User input is disabled on scene transition animations</li>
<li>The RegisterScene() method returns the exception to prevent duplicated form IDs on different form scenes</li>
<li>Tizen::Web
<ul><li>Web
<ul><li>The UI for the auto-complete feature does not work</li>
-<li>To use a site supporting geolocation feature, enable the "Remember Preference" check box when a confirm popup appears</li>
+<li>To use a site supporting geolocation feature, enable the "Remember Preference" check box when a confirm popup appears</li>
</ul></li>
<li>JSON
<ul><li>The JSON parser is currently locale-dependent. It will be changed in a later revision to be locale-independent.</li>
<li>Parallelized service activation, on-demand socket and D-Bus activation for starting services and daemons, managing the service processes as a group using Linux cgroup, supporting automount points, snapshotting, and restoring of services are newly added</li>
<li>systemd coredump handler is disabled as the Tizen platform has its own crash debugging module</li>
<li>Supports SMACK labeling of FIFO and UNIX domain sockets used by systemd at runtime</li>
-<li>In order to support backward compatibility of System V init, necessary features, such as "reboot parameter passing" are added into systemd</li>
+<li>In order to support backward compatibility of System V init, necessary features, such as "reboot parameter passing" are added into systemd</li>
</ul></li>
<li>Device-node
<ul><li>New module to control hardware devices. A tunnel between system framework and OAL (OEM Adaptation Layer), which accesses real device nodes. In addition, this module decides the permission of device nodes with which user can access.</li>
<h3>Licenses</h3>
<ul><li>The following changes have been made in the licenses:
-<ul><li>The term "Compatibility Definition Document" in the Flora license and Tizen SDK License has been changed to "Tizen Compliance Specification"</li>
-<li>The term "Compatibility Test Suites" in the Flora license and Tizen SDK License has been changed to "Tizen Compliance Tests"</li>
-<li>The Flora License 4.4 condition has been clarified regarding the licensee's own copyright to derivative works or modifications</li>
+<ul><li>The term "Compatibility Definition Document" in the Flora license and Tizen SDK License has been changed to "Tizen Compliance Specification"</li>
+<li>The term "Compatibility Test Suites" in the Flora license and Tizen SDK License has been changed to "Tizen Compliance Tests"</li>
+<li>The Flora License 4.4 condition has been clarified regarding the licensee's own copyright to derivative works or modifications</li>
</ul></li>
</ul>
<li>A new delightful color scheme for icons, textures, and shapes has been applied</li>
<li>The application icon size has been increased from 108 to 117</li>
</ul></li>
-<li>"Keyboard Shortcuts" menu added: a user can download Tizen IDE shortcuts in PDF format
+<li>"Keyboard Shortcuts" menu added: a user can download Tizen IDE shortcuts in PDF format
<ul><li>Menu with a link to Tizen Web site added</li>
</ul></li>
</ul></li>
</ul></li>
<li>Install Manager
<ul><li>Supports command line interface (CLI) for installing or removing the SDK</li>
-<li>Separates the "Minimal" installation type into "Web Minimal" and "Native Minimal"</li>
+<li>Separates the "Minimal" installation type into "Web Minimal" and "Native Minimal"</li>
<li>Shows the installed size of the SDK packages</li>
<li>Supports styling scripting tags for component description</li>
</ul></li>
<ul><li>Supports NPPlugin packaging</li>
<li>Checks application ID validation during launch</li>
<li>Checks the architecture for a hybrid app before launch</li>
-<li>Launching the application is canceled in case of existing errors in the "config.xml" file</li>
+<li>Launching the application is canceled in case of existing errors in the "config.xml" file</li>
</ul></li>
<li>Application signing
<ul><li>Application signing is mandatory for launching</li>
<li>Running and debugging
<ul><li>Supports attach debugging</li>
<li>Supports Smart Launch</li>
-<li>Supports "Enable update" mode to test the Tizen Store update</li>
+<li>Supports "Enable update" mode to test the Tizen Store update</li>
<li>Detailed error messages shown when the package is installed</li>
</ul></li>
<li>Tools
</ul></li>
<li>Native CLI supports multi-project application packaging</li>
<li>SDB
-<ul><li>sdbd has the "developer" privilege, so a user requiring root permission must use the "sdb root on" command</li>
-<li>The "sdb install" command supports the Web package (*.wgt)</li>
+<ul><li>sdbd has the "developer" privilege, so a user requiring root permission must use the "sdb root on" command</li>
+<li>The "sdb install" command supports the Web package (*.wgt)</li>
</ul></li>
<li>Rootstrap Manager removed (use the Platform SDK)</li>
</ul></li>
<li>Platform IDE
<ul><li>Supports local package repository</li>
<li>SDK Development Tools</li>
-<li>The "build-cli changelog" command for querying the change log is added</li>
+<li>The "build-cli changelog" command for querying the change log is added</li>
<li>Supports the project lock preventing building</li>
<li>Shows the progress when registering packages</li>
-<li>Supports the remote build option ("--save") of the "build-cli" command to save build results in a local storage</li>
+<li>Supports the remote build option ("--save") of the "build-cli" command to save build results in a local storage</li>
<li>Shows detailed log of remote jobs on DIBS WEB</li>
</ul></li></ul>
<ul><li>Web IDE
<ul><li>JSDT
-<ul><li>Alerting the keyword error for "continue" and "delete" used as a property name of an object is fixed</li>
+<ul><li>Alerting the keyword error for "continue" and "delete" used as a property name of an object is fixed</li>
<li>Malfunction of the open declaration feature (for the position of creating an object with a constructor which has a declaration with parameters) is fixed</li>
</ul></li>
<li>NPE at relaunching application after the first launch succeeded is fixed</li>
<li>Web-hybrid app CLI bug is fixed</li>
<li>Including generated signature files into deltaInfoList is fixed</li>
<li>Duplicated project location is checked when creating a new project</li>
-<li>The "Google Chrome® settings in preferences" problem is fixed</li>
+<li>The "Google Chrome® settings in preferences" problem is fixed</li>
</ul></li>
</ul>
<li>Modules not supported: DataControl, MessagePort, SecureElement, Bookmark, and DataSynchronization</li>
<li>Daylight saving time-related methods are not supported in the Time module</li>
</ul></li>
-<li>The "could not delete resources" problem while building is fixed</li>
+<li>The "could not delete resources" problem while building is fixed</li>
<li>An error can occur in the Web UI Builder template when you try to perform the clean and build action. This is a bug in the JavaScript Validator in Eclipse, and can be resolved as follows:
<ol><li>Uncheck JavaScript Validator in the Builders section of the application properties.</li>
<li>Delete errors in the Problems view.</li>
<li>Ubuntu 11.10 with Intel CPU/motherboard integrated card</li>
</ul><p>If this occurs, you can launch the Emulator by switching off the HW GL acceleration in the Emulator Manager. However, you cannot use any GL-related applications, such as a Web browser.</p>
</li>
-<li>When you launch the Emulator on Windows®, you can get a "failed to allocate memory" error. In that case, try the following:
-<ul><li>Increase the user area of the virtual memory in the system to 3 GB by running the "bcdedit /set increaseuserva 3072" command on the console with administrator rights (Windows® 7 only)</li>
+<li>When you launch the Emulator on Windows®, you can get a "failed to allocate memory" error. In that case, try the following:
+<ul><li>Increase the user area of the virtual memory in the system to 3 GB by running the "bcdedit /set increaseuserva 3072" command on the console with administrator rights (Windows® 7 only)</li>
<li>Close some other programs and try to launch the Emulator again</li>
<li>If you have set the RAM size as 768 or 1024 MB for the VM in the Emulator Manager, change the RAM size to 512 MB</li>
</ul></li>
<li>Release Date: November 9, 2013</li>
</ul>
-<h2 id="intro">Introduction</h2>
+<h2 id="intro">Introduction</h2>
<p>Welcome to Tizen.</p>
<p>Tizen is an open source, standards-based software platform supported by leading mobile operators, device manufacturers, and chip suppliers for multiple device categories, including smartphones, tablets, netbooks, in-vehicle infotainment devices, and smart TVs.</p>
<li>The issue with the Contains() method blocking the operation for a long time with a very long string has been fixed.</li>
</ul></li>
<li>Tizen::Base::Utility
-<ul><li>The issue of failing to get the host of the Uri having only the "?" character without a query has been fixed.</li>
+<ul><li>The issue of failing to get the host of the Uri having only the "?" character without a query has been fixed.</li>
<li>Memory leak of the Scanner class has been fixed. The elements in the IList were not removed internally.</li>
</ul></li>
<li>Tizen::Content
</ul></li>
</ul>
-<h2 id="ide_tools">IDE and Tools</h2>
+<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
<li>Release Date: July 21, 2013</li>
</ul>
-<h2 id="intro">Introduction</h2>
+<h2 id="intro">Introduction</h2>
<p>Welcome to Tizen.</p>
<p>Tizen is an open source, standards-based software platform supported by leading mobile operators, device manufacturers, and chip suppliers for multiple device categories, including smartphones, tablets, netbooks, in-vehicle infotainment devices, and smart TVs.</p>
<p>The Tizen Platform consists of the Web framework (APIs), native framework (APIs), and core system.</p>
<p>The Tizen Software Development Kit (SDK) is a comprehensive set of tools for developing Web applications, native applications, and the platform component for Tizen. The SDK contains an install manager, IDE, tools, documents, samples, and a platform image.</p>
-<h2 id="platform">Tizen Platform</h2>
+<h2 id="platform">Tizen Platform</h2>
<h3>Web Framework</h3>
<pre class="prettyprint">
{
- readonly attribute WebSettingManager websetting;
+ readonly attribute WebSettingManager websetting;
}
</pre>
</li>
<pre class="prettyprint">
{
- void setUserAgentString(DOMString userAgent,
- optional SuccessCallback? successCallback,
- optional ErrorCallback? errorCallback);
- void removeAllCookies(optional SuccessCallback? successCallback,
- optional ErrorCallback? errorCallback);
+ void setUserAgentString(DOMString userAgent,
+ optional SuccessCallback? successCallback,
+ optional ErrorCallback? errorCallback);
+ void removeAllCookies(optional SuccessCallback? successCallback,
+ optional ErrorCallback? errorCallback);
}
</pre>
</li>
</ul></li>
</ul></li>
<li>Tizen Web APIs
-<ul><li>Power : enum "SCREEN_BRIGHT" is deprecated.
-<ul><li>enum PowerScreenState {"SCREEN_OFF", "SCREEN_DIM", "SCREEN_NORMAL"};</li>
+<ul><li>Power : enum "SCREEN_BRIGHT" is deprecated.
+<ul><li>enum PowerScreenState {"SCREEN_OFF", "SCREEN_DIM", "SCREEN_NORMAL"};</li>
</ul></li>
</ul></li>
</ul>
</ul></li>
</ul>
-<h2 id="ide_tools">IDE and Tools</h2>
+<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
<li>Common Tools
<ul><li>Emulator
<ul><li>In General Purpose Skin type, the Key window can be docked not only to the right side but also to the left side of the Emulator window.</li>
-<li>Emulator provides the "3btn Emulator Skin" type for Menu and Back HW key.</li>
+<li>Emulator provides the "3btn Emulator Skin" type for Menu and Back HW key.</li>
</ul></li>
<li>Emulator Manager
<ul><li>Reflects a new user interface</li>
<h3>Known Issues</h3>
<ul><li>Common IDE
-<ul><li>Target might not be displayed in Connection Explorer after a target reboot. To fix this issue, run 'sdb kill-server' and 'sdb start-server'.</li>
+<ul><li>Target might not be displayed in Connection Explorer after a target reboot. To fix this issue, run 'sdb kill-server' and 'sdb start-server'.</li>
</ul></li>
<li>Web IDE
<ul><li>Tizen Device API does not work in live editing on an Emulator</li>
</ul></li>
<li>Native IDE
<ul><li>LLVM-Bitcode/ARM(Experimental) feature is not supported in Windows 64-bit environments</li>
-<li>Tizen IDE provides 'native-gen makefile' command for some limited cases. So you may need to modify the generated makefile manually.
-<ul><li>It does not support the subfolders in 'src'; for example, 'Model/file2.cpp'</li>
-<li>It only supports the default Tizen IDE "Debug" build configuration</li>
+<li>Tizen IDE provides 'native-gen makefile' command for some limited cases. So you may need to modify the generated makefile manually.
+<ul><li>It does not support the subfolders in 'src'; for example, 'Model/file2.cpp'</li>
+<li>It only supports the default Tizen IDE "Debug" build configuration</li>
</ul></li>
</ul></li>
<li>Emulator
<li>Release Date: November 13, 2015</li>
</ul>
-<h2 id="introduction">Introduction</h2>
+<h2 id="introduction">Introduction</h2>
<p>Welcome to Tizen!</p>
<p>Tizen is an open source, standards-based software platform supported by leading mobile operators, device manufacturers, and chip suppliers for multiple device categories, including smartphones, tablets, netbooks, in-vehicle infotainment devices, and smart TVs.</p>
<p>The Tizen Software Development Kit (SDK) is a comprehensive set of tools for developing Web and native applications for Tizen. The SDK contains an install manager, IDE, tools, documents, samples, and platform images for wearable and mobile profiles.</p>
- <table class="note">
- <tbody>
- <tr>
- <th class="note">Note</th>
- </tr>
- <tr>
- <td class="note">The Tizen 2.3.1 rev1 SDK only supports the Tizen 2.3.1 Platform. The upcoming Tizen 2.4 rev1 SDK will support both the Tizen 2.3.1 and 2.4 Platforms. The Tizen 2.3.1 rev1 SDK will be available until the Tizen 2.4 rev1 SDK is released.</td>
- </tr>
- </tbody>
- </table>
-
+ <table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">The Tizen 2.3.1 rev1 SDK only supports the Tizen 2.3.1 Platform. The upcoming Tizen 2.4 rev1 SDK will support both the Tizen 2.3.1 and 2.4 Platforms. The Tizen 2.3.1 rev1 SDK will be available until the Tizen 2.4 rev1 SDK is released.</td>
+ </tr>
+ </tbody>
+ </table>
+
<h2 id="rev1">Tizen 2.3.1_Rev1</h2>
<h3>IDE and Tools</h3>
<li>To use the Tizen Emulator, you should install an Intel VTx supported by the CPU, and the latest version of the graphic card driver provided by the vendor. Check the prerequisites for the Tizen Emulator from:
<ul>
<li><a href="../install/sdk_prerequisites.htm#emulator">Emulator Requirements</a>.</li>
-<li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. If you use Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, you should select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+<li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. If you use Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, you should select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
<li>On Ubuntu, if the graphics driver is outdated, your Ubuntu desktop session may be occasionally logged out when launching the Emulator Manager. Or the Emulator skin may be drawn improperly. Please check the prerequisites and upgrade the latest graphics driver.</li>
</ul>
</li>
</li>
</ul>
-<h2 id="Tizen_2_3_1">Tizen 2.3.1</h2>
+<h2 id="Tizen_2_3_1">Tizen 2.3.1</h2>
<h3>Tizen Platform Wearable Profile</h3>
<p>The wearable profile provides a complete implementation of the Web APIs optimized for wearable devices. It includes WebKit, a layout engine designed to enable Web browsers to render Web pages. It also provides a runtime for Web applications. From Tizen 2.3.1, it provides native APIs for wearable native applications.</p>
-<p>The wearable profile's features include:</p>
+<p>The wearable profile's features include:</p>
<h4>Web Framework</h4>
</li>
<li>Documents and samples have been updated.
<ul>
-<li>The "Support for Circular UI" section has been added. It includes descriptions for the new UI components and migration guides for users who want to make their TAU-using applications work on a circular screen.</li>
+<li>The "Support for Circular UI" section has been added. It includes descriptions for the new UI components and migration guides for users who want to make their TAU-using applications work on a circular screen.</li>
<li>Samples for the new UI components and information on how to use rotary events have been added.</li>
</ul>
</li>
<li>Using the ninja build instead of make</li>
</ul>
</li>
-<li>"Archive Generator" has been added:
+<li>"Archive Generator" has been added:
<ul>
<li>Merging static objects from one library into another static library</li>
</ul>
</li>
<li>Tools
<ul>
-<li>CLI (Common Line Interface) supports 'post-certification' of packaged binaries from native (.tpk), Web (.wgt), and hybrid (.tpk + .wgt) applications.</li>
+<li>CLI (Common Line Interface) supports 'post-certification' of packaged binaries from native (.tpk), Web (.wgt), and hybrid (.tpk + .wgt) applications.</li>
</ul>
</li>
<li>Emulator
<ul>
<li>Web IDE and tools
<ul>
-<li>'app-widget' element has been removed from the config.xml editor.</li>
-<li>'tau' keyword has been added to the CSS validation.</li>
+<li>'app-widget' element has been removed from the config.xml editor.</li>
+<li>'tau' keyword has been added to the CSS validation.</li>
<li>Web UI Builder has been deprecated.</li>
-<li>Some 'widget' terms have been changed to 'Web application'.</li>
+<li>Some 'widget' terms have been changed to 'Web application'.</li>
<li>Default-installed user templates are no longer provided. However, the user template feature is still supported (only for Web applications).</li>
-<li>Tizen Import Wizards, such as "Web Projects and Widget file", have been replaced with an integrated Import Wizard named "Tizen Project or Package". This is intended for multi-platform changeable support.</li>
+<li>Tizen Import Wizards, such as "Web Projects and Widget file", have been replaced with an integrated Import Wizard named "Tizen Project or Package". This is intended for multi-platform changeable support.</li>
</ul>
</li>
</ul>
<ul>
<li>Web IDE and tools
<ul>
-<li>False error message when using 'flex' in the CSS file has been fixed.</li>
+<li>False error message when using 'flex' in the CSS file has been fixed.</li>
</ul>
</li>
<li>Emulator
<ul>
-<li>Bug, which caused the "Always on Top" feature to sometimes not work correctly on Ubuntu, has been fixed.</li>
+<li>Bug, which caused the "Always on Top" feature to sometimes not work correctly on Ubuntu, has been fixed.</li>
<li>Bug, which caused the emulator to sometimes not display the screen on Ubuntu and Radeon graphics cards, has been fixed.</li>
</ul>
</li>
<li>Emulator
<ul>
<li>In Mac OS, some files transferred to the emulator using an SDB push command cannot be accessed due to a file permission problem. To solve this problem, the file permission for other users must be changed at the host side.</li>
-<li>If you already installed an Android HAX driver, the Tizen HAX driver is not installed. This causes you to encounter the "No accelerator found" error while launching the emulator. Uninstall the Android HAX driver and install the Tizen HAX driver manually as follows:
+<li>If you already installed an Android HAX driver, the Tizen HAX driver is not installed. This causes you to encounter the "No accelerator found" error while launching the emulator. Uninstall the Android HAX driver and install the Tizen HAX driver manually as follows:
<ul>
<li>MS Windows
<ul>
-<li>Uninstall the Android HAX driver by going to the Windows control panel > "Programs and Features" > "Intel(R) Hardware Accelerated Execution Manager".</li>
-<li>Install the Tizen HAX driver by executing the driver installer, whose path is "<TIZEN_SDK_HOME>\tools\emulator\etc\IntelHaxmTizen.exe" and proceeding with the installation process.</li>
+<li>Uninstall the Android HAX driver by going to the Windows control panel > "Programs and Features" > "Intel(R) Hardware Accelerated Execution Manager".</li>
+<li>Install the Tizen HAX driver by executing the driver installer, whose path is "<TIZEN_SDK_HOME>\tools\emulator\etc\IntelHaxmTizen.exe" and proceeding with the installation process.</li>
</ul>
</li>
<li>Mac OS X 10.10
<ul>
-<li>​Uninstall the Android HAX driver by opening a terminal, changing the directory to "/System/Library/Extensions/intelhaxm.kext/Contents/Resources", and entering the "sudo ./uninstall.sh" command.</li>
-<li>Install the Tizen HAX driver by executing the driver installer, whose path is "<TIZEN_SDK_HOME>/tools/emulator/etc/IntelHaxmTizen_for_10.10.dmg" and proceeding with the installation process.</li>
+<li>​Uninstall the Android HAX driver by opening a terminal, changing the directory to "/System/Library/Extensions/intelhaxm.kext/Contents/Resources", and entering the "sudo ./uninstall.sh" command.</li>
+<li>Install the Tizen HAX driver by executing the driver installer, whose path is "<TIZEN_SDK_HOME>/tools/emulator/etc/IntelHaxmTizen_for_10.10.dmg" and proceeding with the installation process.</li>
</ul>
</li>
<li>​Mac OS X 10.9 and under
<ul>
-<li>Uninstall the Android HAX driver by opening a terminal, changing the directory to "/System/Library/Extensions/intelhaxm.kext/Contents/Resources", and entering the "sudo ./uninstall.sh" command.</li>
-<li>Install the Tizen HAX driver by executing the driver installer, whose path is "<TIZEN_SDK_HOME>/tools/emulator/etc/IntelHaxmTizen.dmg" and proceeding with the installation process. </li>
+<li>Uninstall the Android HAX driver by opening a terminal, changing the directory to "/System/Library/Extensions/intelhaxm.kext/Contents/Resources", and entering the "sudo ./uninstall.sh" command.</li>
+<li>Install the Tizen HAX driver by executing the driver installer, whose path is "<TIZEN_SDK_HOME>/tools/emulator/etc/IntelHaxmTizen.dmg" and proceeding with the installation process. </li>
</ul>
</li>
</ul>
<h1>Tizen 2.3.1 Rev1 SDK Release Notes</h1>
-<ul>
- <li>Release Date: November 13, 2015</li>
+<ul>
+ <li>Release Date: November 13, 2015</li>
</ul>
-
-<table class="note">
- <tbody>
- <tr>
- <th class="note">Note</th>
- </tr>
- <tr>
- <td class="note">The Tizen 2.3.1 rev1 SDK only supports the Tizen 2.3.1 Platform. The upcoming Tizen 2.4 rev1 SDK will support both the Tizen 2.3.1 and 2.4 Platforms. The Tizen 2.3.1 rev1 SDK will be available until the Tizen 2.4 rev1 SDK is released.</td>
- </tr>
- </tbody>
- </table>
-
-<h2 id="ide_tools">IDE and Tools</h2>
+
+<table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note">The Tizen 2.3.1 rev1 SDK only supports the Tizen 2.3.1 Platform. The upcoming Tizen 2.4 rev1 SDK will support both the Tizen 2.3.1 and 2.4 Platforms. The Tizen 2.3.1 rev1 SDK will be available until the Tizen 2.4 rev1 SDK is released.</td>
+ </tr>
+ </tbody>
+ </table>
+
+<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
<li>To use the Tizen Emulator, you should install an Intel VTx supported by the CPU, and the latest version of the graphic card driver provided by the vendor. Check the prerequisites for the Tizen Emulator from:
<ul>
<li><a href="../install/sdk_prerequisites.htm#emulator">Emulator Requirements</a>.</li>
-<li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. If you use Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, you should select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+<li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. If you use Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, you should select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
<li>On Ubuntu, if the graphics driver is outdated, your Ubuntu desktop session may be occasionally logged out when launching the Emulator Manager. Or the Emulator skin may be drawn improperly. Please check the prerequisites and upgrade the latest graphics driver.</li>
</ul>
</li>
</li>
</ul>
-
+
<script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
<script type="text/javascript" src="../scripts/showhide.js"></script>
<li>Release Date: July 6, 2015</li>
</ul>
-<h2 id="intro">Introduction</h2>
+<h2 id="intro">Introduction</h2>
<p>Welcome to Tizen.</p>
<p>Tizen is an open source, standards-based software platform supported by leading mobile operators, device manufacturers, and chip suppliers for multiple device categories, including smartphones, tablets, netbooks, in-vehicle infotainment devices, and smart TVs.</p>
<p>The Tizen Platform consists of the Web framework (APIs) and Native framework (APIs).</p>
<p>The Tizen Software Development Kit (SDK) is a comprehensive set of tools for developing Web and Native applications for Tizen. The SDK contains an install manager, IDE, tools, documents, samples and platform images for mobile and wearable profiles.</p>
-<h2 id="rev3">Tizen 2.3.0_Rev3</h2>
+<h2 id="rev3">Tizen 2.3.0_Rev3</h2>
<h3>IDE and Tools</h3>
</ul></li>
</ul>
-<h2 id="rev2">Tizen 2.3.0_Rev2</h2>
+<h2 id="rev2">Tizen 2.3.0_Rev2</h2>
<h3>IDE and Tools</h3>
</ul></li>
</ul>
-<h2 id="rev1">Tizen 2.3.0_Rev1</h2>
+<h2 id="rev1">Tizen 2.3.0_Rev1</h2>
<h3>Tizen Platform Mobile Profile</h3>
<ul><li>Web UI Builder
<ul><li>Page Designer
<ul><li>Added page combo in toolbar.</li>
-<li>Added "Set position" in context menu.</li>
+<li>Added "Set position" in context menu.</li>
</ul></li>
<li>Pages View
<ul><li>Changed page template wizard. (create, import, export template wizard).</li>
-<li>Changed context menu("Add Basic Page" From "Add Empty Page").</li>
+<li>Changed context menu("Add Basic Page" From "Add Empty Page").</li>
<li>The position of page name was changed to the top of the page in pages view.</li>
</ul></li>
<li>DataBinding view
-<ul><li>Added "Set Target" in toolbar of Data Model panel.</li>
+<ul><li>Added "Set Target" in toolbar of Data Model panel.</li>
</ul></li>
<li>N-Screen
<ul><li>Changed devices list.</li>
<li>Changed timeline icon.</li>
</ul></li>
</ul><ul><li>Tools
-<ul><li>Added "—strip" option to native "package" command.</li>
+<ul><li>Added "—strip" option to native "package" command.</li>
<li>Removed Default Author Certificate.</li>
<li>Added web privilege <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/internet</span>.</li>
</ul></li>
<h4>Fixed Bugs</h4>
-<ul><li>Fixed less compiler's bug that cannot compile less resources.</li>
-<li>Removed xwalk's launch command and option page.</li>
+<ul><li>Fixed less compiler's bug that cannot compile less resources.</li>
+<li>Removed xwalk's launch command and option page.</li>
<li>Fixed to show logs normally for the service applications.</li>
</ul><ul><li>Emulator
-<ul><li>In Ubuntu, added warning message if host's graphic driver is invalid for emulator.(Gallium driver). Pop-up dialog is showed when.
+<ul><li>In Ubuntu, added warning message if host's graphic driver is invalid for emulator.(Gallium driver). Pop-up dialog is showed when.
<ul><li>Emulator is installed.</li>
<li>Launch emulator with emulator-manager.</li>
</ul></li>
<li>Fixed rootstrap bug that causes some compile error.</li>
</ul></li>
<li>Web UI builder
-<ul><li>Fixed UI Builder's bug that occurred tool exception sometimes.</li>
+<ul><li>Fixed UI Builder's bug that occurred tool exception sometimes.</li>
</ul></li>
</ul>
</ul></li>
</ul>
-<h2 id="Tizen_2_3_0">Tizen 2.3.0</h2>
+<h2 id="Tizen_2_3_0">Tizen 2.3.0</h2>
<h3>Tizen Platform Mobile Profile</h3>
<ul><li>Creates an archive file and operates on it. For example, applications can use this API to extract files from an archive or add a file to an archive.</li>
</ul></li>
<li>Badge API (tizen.badge)
-<ul><li>Overlays an image with the number of unread notifications for an application on the application's Home screen icon. The image is known as a badge.</li>
+<ul><li>Overlays an image with the number of unread notifications for an application on the application's Home screen icon. The image is known as a badge.</li>
</ul></li>
<li>Bluetooth API
-<ul><li>Manages Bluetooth connections. An application must now request permission from the user to use Bluetooth. Previously, you were able to enable Bluetooth without user consent, but that API is to be deprecated soon. To request permission, you must now launch the Bluetooth settings option from within your application so that the user can choose to enable Bluetooth. Similarly, applications must no longer change a device's Bluetooth visibility, as this API is also to be deprecated.</li>
+<ul><li>Manages Bluetooth connections. An application must now request permission from the user to use Bluetooth. Previously, you were able to enable Bluetooth without user consent, but that API is to be deprecated soon. To request permission, you must now launch the Bluetooth settings option from within your application so that the user can choose to enable Bluetooth. Similarly, applications must no longer change a device's Bluetooth visibility, as this API is also to be deprecated.</li>
</ul></li>
<li>Exif API (tizen.exif)
<ul><li>Manipulates exchangeable image file format (Exif) metadata.</li>
<ul><li>Manages FM radio operations, such as switching the FM radio on or off, scanning frequencies, and tuning up or down.</li>
</ul></li>
<li>Human Activity Monitor API (tizen.humanactivitymonitor)
-<ul><li>Provides support for pedometers, heart rate monitors (HRMs), and GPS tracking features to determine the device's geographical location and changes, such as velocity changes. It also supports the detection of "wrist-up" motions. For example, if a smartwatch user rotates their wrist to look at their watch screen, the application can detect this and present content on the screen.</li>
+<ul><li>Provides support for pedometers, heart rate monitors (HRMs), and GPS tracking features to determine the device's geographical location and changes, such as velocity changes. It also supports the detection of "wrist-up" motions. For example, if a smartwatch user rotates their wrist to look at their watch screen, the application can detect this and present content on the screen.</li>
<li>Only HRMs are supported on the Tizen 2.3 mobile and wearable Emulator.</li>
</ul></li>
<li>MediaKey API (tizen.mediakey)
<ul><li>The feature to use calendars from multiple accounts has been added. This is useful because you can create, add, or remove calendars from different accounts by using their account ID.</li>
</ul></li>
<li>CallHistory API
-<ul><li>The device's local phone number (calling party) attribute can now be added to the call history information. This is particularly useful in dual SIM devices.</li>
+<ul><li>The device's local phone number (calling party) attribute can now be added to the call history information. This is particularly useful in dual SIM devices.</li>
</ul></li>
<li>Contact API
<ul><li>The feature to use contacts from multiple accounts has been added. This is useful because you can create, add, or remove contacts from different accounts by using their account ID.</li>
<li>The following attributes (among others) have been added for individual contacts: relationship, messenger address, contact message alert setting, and contact vibration pattern URL.</li>
</ul></li>
<li>Content API
-<ul><li>The 'isFavorite' attribute has been added to the Content interface to mark favorite content.</li>
+<ul><li>The 'isFavorite' attribute has been added to the Content interface to mark favorite content.</li>
<li>The playlist feature has been added so that you can add, remove, and update your favorite media content.</li>
</ul></li>
<li>Data Synchronization API
<ul><li>From Tizen 2.3, this API is optional for Tizen mobile devices.</li>
</ul></li>
<li>Filesystem API
-<ul><li>The 'camera' virtual path has been added to make it easier to access the pictures and videos taken by a device.</li>
+<ul><li>The 'camera' virtual path has been added to make it easier to access the pictures and videos taken by a device.</li>
</ul></li>
<li>Messaging API
<ul><li>The feature to select which SIM card to use when sending an SMS had been added to support devices that can use multiple SIM cards.</li>
</ul></li>
<li>Web UI Framework (TAU)
<ul><li>The navigation bar winset has been added.
-<ul><li>The navigation bar with a history can be used through the <nav data-role="navigation"> element.</li>
+<ul><li>The navigation bar with a history can be used through the <nav data-role="navigation"> element.</li>
</ul></li>
<li>The select menu winset has been added.
-<ul><li>The select menu with the tizen theme can be used through the <select name="select-custom-1" data-native-menu="false"> element.</li>
+<ul><li>The select menu with the tizen theme can be used through the <select name="select-custom-1" data-native-menu="false"> element.</li>
</ul></li>
</ul></li>
</ul>
<h5>Fixed Bugs</h5>
<ul><li>Web UI Framework (TAU)
-<ul><li>The issue of the 'refresh' method of the listview winset not working properly has been fixed.</li>
+<ul><li>The issue of the 'refresh' method of the listview winset not working properly has been fixed.</li>
<li>The broken button style has been fixed.</li>
</ul></li>
</ul>
<li>Removing individual notifications.</li>
</ul></li>
<li>Badge
-<ul><li>Overlaying an image with the number of unread notifications for that application on the application's icon.</li>
+<ul><li>Overlaying an image with the number of unread notifications for that application on the application's icon.</li>
<li>Setting and getting the value and visibility of the badge.</li>
</ul></li>
<li>Bundle
<li>Security API Module
<ul><li>Supporting a wide range of cryptographic algorithms, certificate handling mechanisms, hash functions, and key management algorithms covered by the openSSL open source library</li>
<li>Key manager
-<ul><li>The secure repository (protected by a user's password) for keys, certificates, and sensitive data of the users and their applications.</li>
+<ul><li>The secure repository (protected by a user's password) for keys, certificates, and sensitive data of the users and their applications.</li>
</ul></li>
<li>Privilege info
<ul><li>Reading information of a given privilege name.</li>
<ul><li>Web Device API</li>
</ul><ul><li>The following Wearable Web Device APIs have been added in this release to allow a richer variety of features to be implemented in wearable Web applications:Â
<ul><li>Badge API (tizen.badge)
-<ul><li>Overlays an image with the number of unread notifications for an application on the application's Home screen icon. The image is known as a badge.</li>
+<ul><li>Overlays an image with the number of unread notifications for an application on the application's Home screen icon. The image is known as a badge.</li>
</ul></li>
<li>Human Activity Monitor API (tizen.humanactivitymonitor)
-<ul><li>Provides support for pedometers, heart rate monitors (HRMs), and GPS tracking features to determine the device's geographical location and changes, such as velocity changes. It also supports the detection of "wrist-up" motions. For example, if a smartwatch user rotates their wrist to look at their watch screen, the application can detect this and present content on the screen.</li>
+<ul><li>Provides support for pedometers, heart rate monitors (HRMs), and GPS tracking features to determine the device's geographical location and changes, such as velocity changes. It also supports the detection of "wrist-up" motions. For example, if a smartwatch user rotates their wrist to look at their watch screen, the application can detect this and present content on the screen.</li>
<li>Only HRMs are supported on the Tizen 2.3 mobile and wearable Emulator.</li>
</ul></li>
<li>MediaKey API (tizen.mediakey)
</ul></li>
<li>The following features have been added to the existing Wearable Web Device APIs in this release, in addition to new features in the Alarm, Application, Package, Download, Message port, Power, and System setting API modules:
<ul><li>Content API
-<ul><li>The 'isFavorite' attribute has been added to the Content interface to mark favorite content.</li>
+<ul><li>The 'isFavorite' attribute has been added to the Content interface to mark favorite content.</li>
<li>The playlist feature has been added so that you can add, remove, and update your favorite media content.</li>
</ul></li>
<li>Filesystem API
-<ul><li>The 'camera' virtual path has been added to make it easier to access the pictures and videos taken by a device.</li>
+<ul><li>The 'camera' virtual path has been added to make it easier to access the pictures and videos taken by a device.</li>
</ul></li>
<li>System Information API
<ul><li>The new profile name enum values (MOBILE, WEARABLE) have been added to be used in the application manifest (config.xml) to indicate which device types your application can support. Note that the previous enum values (MOBILE_FULL and MOBILE_WEB in SystemInfoProfile) have been deprecated.</li>
<ul><li><tizen:service></li>
</ul></li>
<li>The ClockWidget application type is provided to customize the Home screen. The following configuration element has been added to support the ClockWidget application:
-<ul><li><tizen:category name="<span style="font-family: Courier New,Courier,monospace">http://tizen.org/category/wearable_clock</span>" /></li>
+<ul><li><tizen:category name="<span style="font-family: Courier New,Courier,monospace">http://tizen.org/category/wearable_clock</span>" /></li>
</ul></li>
</ul></li>
<li>The Web Dynamic Box has been added to provide content on the Home screen:
<li>Performance: Web Worker (Partial) and Page visibility API.</li>
</ul></li>
<li>Changes in W3C APIs:
-<ul><li>Page visibility API: the "webkit" prefix has been removed: webkitvisibilitychange -> visibilitychange</li>
+<ul><li>Page visibility API: the "webkit" prefix has been removed: webkitvisibilitychange -> visibilitychange</li>
<li>File Reader API: BlobBuilder has been deprecated and replaced by the Blob object</li>
<li>The indexed DB flag change: multientry -> multiEntry</li>
</ul></li>
<li>Supports message synchronization between the ECP (UI and CLI tools) and Emulator.</li>
<li>Adds the feature to enable/disable host directory sharing in runtime.</li>
<li>Adds sensors: pressure, ultraviolet, and heart rate monitor.</li>
-<li>Adds the "altitude" and "horizontal accuracy" location input values on the manual event injection settings.</li>
+<li>Adds the "altitude" and "horizontal accuracy" location input values on the manual event injection settings.</li>
</ul></li>
<li>Adds the EventCast tool enabling you to inject sensor and touch events more intuitively by means of a real target.</li>
</ul></li>
</ul></li>
<li>Build and packaging
<ul><li>Separates the packaging process from the build process.</li>
-<li>Provides the context menu of 'Build Package'.</li>
-<li>Provides the 'package' property and removes the 'Build' property.</li>
-<li>Optimizes Web resources (html, js, css, png) when the 'Build Package' command is executed.</li>
+<li>Provides the context menu of 'Build Package'.</li>
+<li>Provides the 'package' property and removes the 'Build' property.</li>
+<li>Optimizes Web resources (html, js, css, png) when the 'Build Package' command is executed.</li>
</ul></li>
<li>Web UI Builder
<ul><li>Changes the programming model for the new UI FW TAU.</li>
</li>
</ul>
-<h2 id="ide_tools">IDE and Tools</h2>
+<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
<li>Page Designer
<ul>
<li>Added page combo in toolbar.</li>
-<li>Added "Set position" in context menu.</li>
+<li>Added "Set position" in context menu.</li>
</ul>
</li>
<li>Pages View
<ul>
<li>Changed page template wizard. (create, import, export template wizard).</li>
-<li>Changed context menu("Add Basic Page" From "Add Empty Page").</li>
+<li>Changed context menu("Add Basic Page" From "Add Empty Page").</li>
<li>The position of page name was changed to the top of the page in pages view.</li>
</ul>
</li>
<li>DataBinding view
<ul>
-<li>Added "Set Target" in toolbar of Data Model panel.</li>
+<li>Added "Set Target" in toolbar of Data Model panel.</li>
</ul>
</li>
<li>N-Screen
<ul>
<li>Tools
<ul>
-<li>Added "—strip" option to native "package" command.</li>
+<li>Added "—strip" option to native "package" command.</li>
<li>Removed Default Author Certificate.</li>
<li>Added web privilege <span style="font-family: Courier New,Courier,monospace">http://tizen.org/privilege/internet</span>.</li>
</ul>
<h3>Fixed Bugs</h3>
<ul>
-<li>Fixed less compiler's bug that cannot compile less resources.</li>
-<li>Removed xwalk's launch command and option page.</li>
+<li>Fixed less compiler's bug that cannot compile less resources.</li>
+<li>Removed xwalk's launch command and option page.</li>
<li>Fixed to show logs normally for the service applications.</li>
</ul>
<ul>
<li>Emulator
<ul>
-<li>In Ubuntu, added warning message if host's graphic driver is invalid for emulator.(Gallium driver). Pop-up dialog is showed when.
+<li>In Ubuntu, added warning message if host's graphic driver is invalid for emulator.(Gallium driver). Pop-up dialog is showed when.
<ul>
<li>Emulator is installed.</li>
<li>Launch emulator with emulator-manager.</li>
</li>
<li>Web UI builder
<ul>
-<li>Fixed UI Builder's bug that occurred tool exception sometimes.</li>
+<li>Fixed UI Builder's bug that occurred tool exception sometimes.</li>
</ul>
</li>
</ul>
<h1>Tizen 2.3 Rev3 SDK Release Notes</h1>
-<ul>
- <li>Release Date: July 6, 2015</li>
+<ul>
+ <li>Release Date: July 6, 2015</li>
</ul>
-
- <h2 id="ide_tools">IDE and Tools</h2>
-
+
+ <h2 id="ide_tools">IDE and Tools</h2>
+
<h3>Fixed Bugs</h3>
-
- <ul>
+
+ <ul>
<li>Native IDE
- <ul>
- <li>The compression library issue making the tpk size too big due to the defective compression has been fixed.</li>
- <li>Invalid file permission issue when unzip the tpk has been fixed. This issue can cause the application is rejected due to signing failure from Tizen seller site.</li>
+ <ul>
+ <li>The compression library issue making the tpk size too big due to the defective compression has been fixed.</li>
+ <li>Invalid file permission issue when unzip the tpk has been fixed. This issue can cause the application is rejected due to signing failure from Tizen seller site.</li>
</ul>
- </li>
+ </li>
</ul>
-
+
<script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
<script type="text/javascript" src="../scripts/showhide.js"></script>
<p>Release Date: December 23, 2015</p>
-<h2 id="rev2">Tizen 2.4_Rev2</h2>
+<h2 id="rev2">Tizen 2.4_Rev2</h2>
<h3>IDE and Tools</h3>
-<h4>Fixed bugs</h4>
+<h4>Fixed bugs</h4>
-<ul>
+<ul>
<li>Web IDE
- <ul>
- <li>The bug, which the installing and launching of wgt was failed after installing TV extension, has been fixed.</li>
- <li>The web debugging failure caused by the invalid reference of external library after installing TV extension, has been fixed.</li>
+ <ul>
+ <li>The bug, which the installing and launching of wgt was failed after installing TV extension, has been fixed.</li>
+ <li>The web debugging failure caused by the invalid reference of external library after installing TV extension, has been fixed.</li>
</ul>
- </li>
+ </li>
<li>Web Inspector
- <ul>
+ <ul>
<li>The bug, the socket connection with the web inspector was failed sometimes, has been fixed.</li>
</ul>
- </li>
+ </li>
</ul>
-
- <h2 id="rev1">Tizen 2.4_Rev1</h2>
-
+
+ <h2 id="rev1">Tizen 2.4_Rev1</h2>
+
<h3>IDE and Tools</h3>
-<h4>New Features</h4>
+<h4>New Features</h4>
-<ul>
+<ul>
<li>Common
- <ul>
- <li>Tizen 2.4 Rev1 SDK supports developing an application on multi-platform environments. In the 2.4 Rev1 SDK, you can also develop 2.3.1 based applications.</li>
+ <ul>
+ <li>Tizen 2.4 Rev1 SDK supports developing an application on multi-platform environments. In the 2.4 Rev1 SDK, you can also develop 2.3.1 based applications.</li>
<li>From Tizen 2.4 Rev1, the SDK image installation is not officially supported. Use the Tizen package server for installation.</li>
- <li>From Tizen 2.4 Rev1, the Update Manager supports the package server mirroring. Without uninstalling the Tizen SDK, you can enhance the installation speed of the new SDK version by changing the target repository address to an alternative repository that exists in your country or region.</li>
+ <li>From Tizen 2.4 Rev1, the Update Manager supports the package server mirroring. Without uninstalling the Tizen SDK, you can enhance the installation speed of the new SDK version by changing the target repository address to an alternative repository that exists in your country or region.</li>
</ul>
- </li>
- <li>CLI<ul>
- <li>Support has been added for the package/install/run/uninstall features for the 2.3.0 projects.</li>
+ </li>
+ <li>CLI<ul>
+ <li>Support has been added for the package/install/run/uninstall features for the 2.3.0 projects.</li>
</ul>
- </li>
+ </li>
<li>Native UIB and Enventor
- <ul>
+ <ul>
<li>Supports the following host operating systems:
- <ul>
- <li>Tizen 2.3.1 (Mobile/Wearable): Ubuntu 12.04/14.04 32-bit/64-bit</li>
- <li>Tizen 2.4 (Mobile): Ubuntu 12.04/14.04 32-bit/64-bit, Windows® 7/8 32-bit/64bit</li>
+ <ul>
+ <li>Tizen 2.3.1 (Mobile/Wearable): Ubuntu 12.04/14.04 32-bit/64-bit</li>
+ <li>Tizen 2.4 (Mobile): Ubuntu 12.04/14.04 32-bit/64-bit, Windows® 7/8 32-bit/64bit</li>
</ul>
</li>
</ul>
- </li>
+ </li>
</ul>
-
- <h4>Changed Features</h4>
-
- <ul>
+
+ <h4>Changed Features</h4>
+
+ <ul>
<li>Common
- <ul>
+ <ul>
<li>The Project wizard has been enhanced to be opened and closed faster than in the 2.4 official version.</li>
<li>To improve the security of a connected Tizen device, the execute permission has been changed from the root/administrator to the developer in some features that control the device, such as the dynamic analyzer and SDBD.</li>
<li>The IDE has been changed to hold the settings (filter, log level, category) of the Log view after the device is disconnected.</li>
<li>The default value for the log level property of the Log view has been changed from Verbose to Error.</li>
</ul>
- </li>
+ </li>
<li>Installer and Update Manager
- <ul>
+ <ul>
<li>A combo box has been added to the Update Manager to easily change the URL of the target repository.</li>
</ul>
</li>
- <li>Web IDE<ul>
- <li>The Localize wizard has been replaced with the Localization view.</li>
- <li>You can localize your resource files and strings.</li>
- <li>You can export or import a localized string as a CSV (comma-separated value) file.</li>
- </ul>
- </li>
- <li>Native IDE<ul>
- <li>The content/code assist feature has been added for the i18n_get_text() function. After you complete the i18n_get_text() function on the C/C++ source file editor by pressing Ctrl + Space, you can see a candidate parameter list which consists of original untranslated strings you added to the PO file.</li>
+ <li>Web IDE<ul>
+ <li>The Localize wizard has been replaced with the Localization view.</li>
+ <li>You can localize your resource files and strings.</li>
+ <li>You can export or import a localized string as a CSV (comma-separated value) file.</li>
+ </ul>
+ </li>
+ <li>Native IDE<ul>
+ <li>The content/code assist feature has been added for the i18n_get_text() function. After you complete the i18n_get_text() function on the C/C++ source file editor by pressing Ctrl + Space, you can see a candidate parameter list which consists of original untranslated strings you added to the PO file.</li>
<li>When you develop a multi-project packaged application (such as a combination of UI and service projects, or UI and shared library projects), the res.xml files of the projects are automatically merged. If a project has no res.xml file, a res.xml is automatically generated for that project and merged with the other res.xml files. </li>
- <li>The "Export to CLI" menu has been added, and appears when multiple projects are selected.</li>
- <li>The Resource Explorer view has been added. It appears only for Tizen 2.4-based projects, not Tizen 2.3.1.</li>
- <li>Multi-project packaging policy has been updated.<ul>
- <li>A Web UI project can be packaged with several native-widget type projects.</li>
- <li>A native IME project can be packaged with several UI application type projects.</li>
- </ul></li>
+ <li>The "Export to CLI" menu has been added, and appears when multiple projects are selected.</li>
+ <li>The Resource Explorer view has been added. It appears only for Tizen 2.4-based projects, not Tizen 2.3.1.</li>
+ <li>Multi-project packaging policy has been updated.<ul>
+ <li>A Web UI project can be packaged with several native-widget type projects.</li>
+ <li>A native IME project can be packaged with several UI application type projects.</li>
+ </ul></li>
</ul></li>
</ul>
<h4>Fixed Bugs</h4>
-
- <ul>
+
+ <ul>
<li>Common
- <ul>
- <li>The Apple JDK dependency issue, which appeared when starting the Tizen IDE and dynamic analyzer, has been fixed.</li>
+ <ul>
+ <li>The Apple JDK dependency issue, which appeared when starting the Tizen IDE and dynamic analyzer, has been fixed.</li>
</ul>
- </li>
- <li>Native<ul>
- <li>The bug, which caused unnecessary files (such as .EDC file) to be included when native modules were packaged into the .tpk file, has been fixed.</li>
+ </li>
+ <li>Native<ul>
+ <li>The bug, which caused unnecessary files (such as .EDC file) to be included when native modules were packaged into the .tpk file, has been fixed.</li>
</ul></li>
- <li>CLI<ul>
- <li>The bug, which caused the native CLI to return success codes even though a build failed, has been fixed.</li>
+ <li>CLI<ul>
+ <li>The bug, which caused the native CLI to return success codes even though a build failed, has been fixed.</li>
</ul></li>
</ul>
-
+
<h4>Known issues</h4>
-
- <ul>
+
+ <ul>
<li>Installer and Update Manager
- <ul>
- <li>If there is a multibyte character in the installation path of the Tizen SDK, some development packages cannot find the installed SDK's location when they are working.</li>
+ <ul>
+ <li>If there is a multibyte character in the installation path of the Tizen SDK, some development packages cannot find the installed SDK's location when they are working.</li>
<li>When you install packages by using the All Packages tab in the Update Manager, the number of the progress indicator is only changed each time a package in dependency is downloaded. While downloading, the number of the progress indicator is not changed.</li>
<li>When you run the dynamic analyzer on Mac OS, the SDK Update Notification does not appear though there are available SDK updates.</li>
- <li>If the SDK Update Notification appears when you start the Tizen IDE or Emulator on Mac OS, a terminal (shell.exec) icon can appear on the dock for a few seconds.</li>
+ <li>If the SDK Update Notification appears when you start the Tizen IDE or Emulator on Mac OS, a terminal (shell.exec) icon can appear on the dock for a few seconds.</li>
</ul>
- </li>
- <li>Native IDE<ul>
- <li>When you import some projects generated from Tizen 2.3 Rev2, the import can take some time.</li>
- <li>The Restore Defaults feature in the Native project's properties > C/C++ Build, does not work properly.</li>
+ </li>
+ <li>Native IDE<ul>
+ <li>When you import some projects generated from Tizen 2.3 Rev2, the import can take some time.</li>
+ <li>The Restore Defaults feature in the Native project's properties > C/C++ Build, does not work properly.</li>
</ul>
</li>
<li>Emulator
- <ul>
- <li>Ubuntu sometimes stops responding for a few seconds after closing the Emulator Manager. This issue is related to a bug of IBus (Intelligent Input Bus). When the issue occurs, restart the ibus-daemon by typing ibus-daemon –drx at the command prompt, and use another framework, such as uim and fcitx, for multilingual input.</li>
+ <ul>
+ <li>Ubuntu sometimes stops responding for a few seconds after closing the Emulator Manager. This issue is related to a bug of IBus (Intelligent Input Bus). When the issue occurs, restart the ibus-daemon by typing ibus-daemon –drx at the command prompt, and use another framework, such as uim and fcitx, for multilingual input.</li>
<li>To use the Tizen Emulator, install an Intel VTx supported by the CPU, and the latest version of the graphic card driver provided by the vendor.
- <ul>
- <li>Check the prerequisites for the Tizen Emulator from: <a href="../install/sdk_prerequisites.htm#emulator">Emulator Requirements</a>.</li>
- <li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. If you use Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
- <li>On Ubuntu, if the graphics driver is outdated, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
+ <ul>
+ <li>Check the prerequisites for the Tizen Emulator from: <a href="../install/sdk_prerequisites.htm#emulator">Emulator Requirements</a>.</li>
+ <li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. If you use Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>On Ubuntu, if the graphics driver is outdated, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
- <li>On Ubuntu 14.04, the shortcut menu can sometimes appear transparently.</li>
+ <li>On Ubuntu 14.04, the shortcut menu can sometimes appear transparently.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered by another window. If you click the Emulator window, the display surface runs correctly again.</li>
<li>On Windows®, if a memory allocation error occurs while executing the Emulator, try the following:
- <ul>
- <li>Close some other programs and try to launch the Emulator again.</li>
+ <ul>
+ <li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set as 768 or 1024 MB for the VM in the Emulator Manager, change the RAM size to 512 MB.</li>
- <li>Increase the user area of the virtual memory in the system to 3 GB by typing bcdedit /set increaseuserva 3072 on the console with administrator rights (Windows® 7 only) and reboot.</li>
+ <li>Increase the user area of the virtual memory in the system to 3 GB by typing bcdedit /set increaseuserva 3072 on the console with administrator rights (Windows® 7 only) and reboot.</li>
</ul>
- </li>
- <li>If you use a MacBook Pro which has both Intel HD and NVidia GPUs, the Emulator may be unexpectedly terminated when you execute with the OpenGL ES ver. v1.1 & v2.0 option. Use the OpenGL ES ver. v2.0 & v3.0 option.</li>
+ </li>
+ <li>If you use a MacBook Pro which has both Intel HD and NVidia GPUs, the Emulator may be unexpectedly terminated when you execute with the OpenGL ES ver. v1.1 & v2.0 option. Use the OpenGL ES ver. v2.0 & v3.0 option.</li>
</ul>
</li>
<li>SDB
- <ul>
- <li>​To use the SDB bash completion feature, type the source .sdb-complete.bash command on the bash shell. The feature runs manually from the Tizen 2.4 official version due to the Installer and Update Manager issue.</li>
+ <ul>
+ <li>​To use the SDB bash completion feature, type the source .sdb-complete.bash command on the bash shell. The feature runs manually from the Tizen 2.4 official version due to the Installer and Update Manager issue.</li>
</ul>
</li>
- <li>Native UIB<ul>
- <li>The Native UIB does not support the storyboard for the Tizen 2.3.1 platforms.</li>
- </ul></li>
+ <li>Native UIB<ul>
+ <li>The Native UIB does not support the storyboard for the Tizen 2.3.1 platforms.</li>
+ </ul></li>
</ul>
-
- <h2 id="Tizen_2_4">Tizen 2.4</h2>
-
+
+ <h2 id="Tizen_2_4">Tizen 2.4</h2>
+
<h3>IDE and Tools</h3>
-<h4>New Features</h4>
+<h4>New Features</h4>
-<ul>
- <li>Web IDE and Tools
- <ul>
- <li>Rest Viewer has been added.</li>
- <li>Multi Package preference panel has been added to <strong>Project Properties > Tizen SDK > Package</strong>. You must refer projects to other projects in this panel, not in the Project Reference panel. The hybrid project referencing feature is removed from the Project Reference panel.</li>
+<ul>
+ <li>Web IDE and Tools
+ <ul>
+ <li>Rest Viewer has been added.</li>
+ <li>Multi Package preference panel has been added to <strong>Project Properties > Tizen SDK > Package</strong>. You must refer projects to other projects in this panel, not in the Project Reference panel. The hybrid project referencing feature is removed from the Project Reference panel.</li>
</ul>
- </li>
+ </li>
<li>Native IDE
- <ul>
- <li>New project template types (IME, widget, and watch) have been added.</li>
- <li>Project migration wizard, which imports 2.3-based projects for making 2.4-based projects, has been added.</li>
- <li>Resource Manager View, which places application resources to support specific device configurations, such as different screen densities and locales, has been added.</li>
- <li>Select Emulator Wizard, which calls a previously run emulator automatically while 'Run As' is called and Emulator Manager is not running, has been added.</li>
- <li>Ninja build system for enhancing the application build time has been added.</li>
- <li>LLVM-3.6 and GCC-4.9 toolchains have been added.</li>
- <li>New function generating author signatures to support App slicing has been added.</li>
- <li>New function exporting an IDE project to a CLI project has been added.</li>
- </ul>
- </li>
+ <ul>
+ <li>New project template types (IME, widget, and watch) have been added.</li>
+ <li>Project migration wizard, which imports 2.3-based projects for making 2.4-based projects, has been added.</li>
+ <li>Resource Manager View, which places application resources to support specific device configurations, such as different screen densities and locales, has been added.</li>
+ <li>Select Emulator Wizard, which calls a previously run emulator automatically while 'Run As' is called and Emulator Manager is not running, has been added.</li>
+ <li>Ninja build system for enhancing the application build time has been added.</li>
+ <li>LLVM-3.6 and GCC-4.9 toolchains have been added.</li>
+ <li>New function generating author signatures to support App slicing has been added.</li>
+ <li>New function exporting an IDE project to a CLI project has been added.</li>
+ </ul>
+ </li>
<li>Native UI Builder
- <ul>
+ <ul>
<li>Supports the following host operating systems:
- <ul>
- <li>Windows 7 32-bit/64-bit and Windows 8 32-bit/64-bit</li>
- <li>Ubuntu 12.04 32-bit/64-bit and Ubuntu 14.04 32-bit/64-bit</li>
+ <ul>
+ <li>Windows 7 32-bit/64-bit and Windows 8 32-bit/64-bit</li>
+ <li>Ubuntu 12.04 32-bit/64-bit and Ubuntu 14.04 32-bit/64-bit</li>
</ul>
- </li>
+ </li>
<li>Supports the making of a custom UI component by combining ready-made UI components.</li>
- <li>Provides a storyboard, which represents a transition from one view to the next.</li>
+ <li>Provides a storyboard, which represents a transition from one view to the next.</li>
</ul>
- </li>
+ </li>
<li>Enventor
- <ul>
+ <ul>
<li>Supports the following host operating systems:
- <ul>
- <li>Windows 7 32-bit/64-bit and Windows 8 32-bit/64-bit</li>
- <li>Ubuntu 12.04 32-bit/64-bit and Ubuntu 14.04 32-bit/64-bit</li>
+ <ul>
+ <li>Windows 7 32-bit/64-bit and Windows 8 32-bit/64-bit</li>
+ <li>Ubuntu 12.04 32-bit/64-bit and Ubuntu 14.04 32-bit/64-bit</li>
</ul>
- </li>
+ </li>
</ul>
</li>
<li>Emulator
- <ul>
- <li>SMP with CPU VT acceleration is enabled for enhancing performance.</li>
+ <ul>
+ <li>SMP with CPU VT acceleration is enabled for enhancing performance.</li>
<li>OpenGL ES 3.0 is supported.</li>
- <li>Virtual camera is supported. Applications which use a camera can be developed without a Webcam.</li>
+ <li>Virtual camera is supported. Applications which use a camera can be developed without a Webcam.</li>
<li>Multi-touch simulation has been added. Multi-touch drag and pinch-zoom gestures are also supported.</li>
- <li>H.264 video compression format is supported.</li>
- <li>Bridged networking feature is enabled. It can connect the emulator to the PC's Ethernet adapter directly.</li>
- <li>Proxy setting is enabled in the Emulator Manager. It allows the emulator to get a proxy network separated from the PC network.</li>
- <li>Sharing host PC's directories with the emulator is supported. The shared directory can be added or removed in the ECP (Emulator Control Panel) while the emulator is running.</li>
- <li>Low-memory event in the ECP has been added.</li>
- <li>Shortcut keys for Windows and Ubuntu have been added. <strong>Ctrl + Shift + S</strong> or <strong>Ctrl + F6</strong> can be used to open the sdb shell when the emulator is focused.</li>
- </ul>
- </li>
+ <li>H.264 video compression format is supported.</li>
+ <li>Bridged networking feature is enabled. It can connect the emulator to the PC's Ethernet adapter directly.</li>
+ <li>Proxy setting is enabled in the Emulator Manager. It allows the emulator to get a proxy network separated from the PC network.</li>
+ <li>Sharing host PC's directories with the emulator is supported. The shared directory can be added or removed in the ECP (Emulator Control Panel) while the emulator is running.</li>
+ <li>Low-memory event in the ECP has been added.</li>
+ <li>Shortcut keys for Windows and Ubuntu have been added. <strong>Ctrl + Shift + S</strong> or <strong>Ctrl + F6</strong> can be used to open the sdb shell when the emulator is focused.</li>
+ </ul>
+ </li>
<li>Dynamic Analyzer
- <ul>
- <li>Checkpoint analysis has been added. It displays the checked variable value of the application in real time.</li>
+ <ul>
+ <li>Checkpoint analysis has been added. It displays the checked variable value of the application in real time.</li>
<li>App startup analysis has been added. It displays information both before and after the application starts.</li>
- <li>UI gesture event chart has been added. It displays the UI application's gesture events.</li>
+ <li>UI gesture event chart has been added. It displays the UI application's gesture events.</li>
</ul>
</li>
<li>T-trace
- <ul>
- <li>Profiling tool has been added to optimize the application performance by measuring and visualizing instrumented function calls in the Tizen platform.</li>
+ <ul>
+ <li>Profiling tool has been added to optimize the application performance by measuring and visualizing instrumented function calls in the Tizen platform.</li>
</ul>
- </li>
- <li>Stale Object Checker
- <ul>
- <li>Dynamic analysis tool has been added to examine whether JavaScript objects of a Web application can cause possible memory leaks.</li>
+ </li>
+ <li>Stale Object Checker
+ <ul>
+ <li>Dynamic analysis tool has been added to examine whether JavaScript objects of a Web application can cause possible memory leaks.</li>
</ul>
</li>
<li>CLI
- <ul>
- <li>Certificate management named 'Security Profiles' has been added, to enable developer certificates to sign Tizen applications.</li>
+ <ul>
+ <li>Certificate management named 'Security Profiles' has been added, to enable developer certificates to sign Tizen applications.</li>
</ul>
</li>
</ul>
-
- <h4>Changed Features</h4>
-
- <ul>
+
+ <h4>Changed Features</h4>
+
+ <ul>
<li>Web IDE and tools
- <ul>
- <li>Various sample projects can be downloaded in the Online Sample of the New Project Wizard.</li>
- <li>Localization Wizard has been changed to Localization View. If you click Localization in the project shortcut menu, the Localization View opens.</li>
+ <ul>
+ <li>Various sample projects can be downloaded in the Online Sample of the New Project Wizard.</li>
+ <li>Localization Wizard has been changed to Localization View. If you click Localization in the project shortcut menu, the Localization View opens.</li>
</ul>
- </li>
+ </li>
<li>Native IDE
- <ul>
- <li>PO editor's UX has been improved.</li>
+ <ul>
+ <li>PO editor's UX has been improved.</li>
</ul>
- </li>
+ </li>
<li>Native UI Builder
- <ul>
- <li>Some "widget" terms have been changed to "UI component".</li>
+ <ul>
+ <li>Some "widget" terms have been changed to "UI component".</li>
<li>WYSIWYG UX has been improved.
- <ul>
- <li>Z-order index (back, backward, front, frontward) of the UI components arranged on the canvas can be changed.</li>
+ <ul>
+ <li>Z-order index (back, backward, front, frontward) of the UI components arranged on the canvas can be changed.</li>
<li>UI components can overlap each other.</li>
- <li>UI components can be handled outside the canvas.</li>
+ <li>UI components can be handled outside the canvas.</li>
<li>UX of selecting a container UI component (box) has been improved.</li>
- <li>UX of Direct Text Editing has been added.</li>
+ <li>UX of Direct Text Editing has been added.</li>
</ul>
- </li>
- <li>View template category has been removed.</li>
+ </li>
+ <li>View template category has been removed.</li>
<li>Method for selecting a view in the Navigation view has been changed from a single-click to double-click.</li>
</ul>
- </li>
- <li>TEP (Tizen Expansion Package) feature will be supported in the later version.</li>
+ </li>
+ <li>TEP (Tizen Expansion Package) feature will be supported in the later version.</li>
</ul>
-
- <h4>Fixed Bugs</h4>
-
- <ul>
+
+ <h4>Fixed Bugs</h4>
+
+ <ul>
<li>Web IDE and tools
- <ul>
+ <ul>
<li>The bug, where a wrong hyperlink appears when the log message at the JavaScript console contains a number, has been fixed.</li>
</ul>
- </li>
+ </li>
<li>Emulator
- <ul>
- <li>The bug, which appears while installing the Tizen HAX driver on a computer where Android HAX driver is already installed, has been fixed. The Tizen HAX driver overwrites the Android HAX driver.</li>
- <li>The bug, where the emulator is terminated abnormally due to the misconfiguration of SOCKS (SOCKet Secure) proxy on Mac OS® X, has been fixed.</li>
+ <ul>
+ <li>The bug, which appears while installing the Tizen HAX driver on a computer where Android HAX driver is already installed, has been fixed. The Tizen HAX driver overwrites the Android HAX driver.</li>
+ <li>The bug, where the emulator is terminated abnormally due to the misconfiguration of SOCKS (SOCKet Secure) proxy on Mac OS® X, has been fixed.</li>
</ul>
- </li>
+ </li>
</ul>
-
- <h4>Known Issues</h4>
-
- <ul>
+
+ <h4>Known Issues</h4>
+
+ <ul>
<li>Install Manager and Update Manager
- <ul>
- <li>If there is a multibyte character in the installation path of the Tizen SDK, some development packages cannot find the installed SDK's location when they are working.</li>
- <li>When you install packages by using the All Packages tab in the Update Manager, the number of the progress indicator is changed only each time a package in dependency is downloaded. While downloading, the number of the progress indicator is not changed.</li>
+ <ul>
+ <li>If there is a multibyte character in the installation path of the Tizen SDK, some development packages cannot find the installed SDK's location when they are working.</li>
+ <li>When you install packages by using the All Packages tab in the Update Manager, the number of the progress indicator is changed only each time a package in dependency is downloaded. While downloading, the number of the progress indicator is not changed.</li>
</ul>
- </li>
+ </li>
<li>Native IDE
- <ul>
- <li>Generating the res.xml file in Multi-Packaged projects is not available.</li>
- <li>When you import some projects generated from the Tizen 2.3 Rev2 SDK, the importing can take some time.</li>
+ <ul>
+ <li>Generating the res.xml file in Multi-Packaged projects is not available.</li>
+ <li>When you import some projects generated from the Tizen 2.3 Rev2 SDK, the importing can take some time.</li>
</ul>
- </li>
+ </li>
<li>Emulator
- <ul>
+ <ul>
<li>To use the Tizen Emulator, you must install an Intel VTx supported by the CPU, and the latest version of the graphic card driver which the vendor provides. Check the prerequisites for the Tizen Emulator from:
- <ul>
- <li><a href="../install/sdk_prerequisites.htm#emulator">Emulator Requirements</a></li>
- <li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
- <li>On Ubuntu, if the graphics driver is out-of-date, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager. Or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
+ <ul>
+ <li><a href="../install/sdk_prerequisites.htm#emulator">Emulator Requirements</a></li>
+ <li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>On Ubuntu, if the graphics driver is out-of-date, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager. Or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
- <li>On Ubuntu 14.04, the shortcut menu can sometimes appear transparently.</li>
+ <li>On Ubuntu 14.04, the shortcut menu can sometimes appear transparently.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered by another window. If you click the Emulator window, the display surface runs correctly again.</li>
- <li>On Windows®, if 'failed to allocate memory' error occurs while executing the Emulator, try the following:
- <ul>
- <li>Close some other programs and try to launch the Emulator again.</li>
+ <li>On Windows®, if 'failed to allocate memory' error occurs while executing the Emulator, try the following:
+ <ul>
+ <li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set as 768 or 1024 MB for the VM in the Emulator Manager, change the RAM size to 512 MB.</li>
- <li>Increase the user area of the virtual memory in the system to 3 GB by typing bcdedit /set increaseuserva 3072 on the console with administrator rights (Windows® 7 only) and reboot.</li>
+ <li>Increase the user area of the virtual memory in the system to 3 GB by typing bcdedit /set increaseuserva 3072 on the console with administrator rights (Windows® 7 only) and reboot.</li>
</ul>
- </li>
- <li>If you use a MacBook Pro which has both Intel HD and NVidia GPUs, when you execute with the OpenGL ES ver. v1.1 & v2.0 option, the Emulator may be unexpectedly terminated. Use the OpenGL ES ver. v2.0 & v3.0 option.</li>
+ </li>
+ <li>If you use a MacBook Pro which has both Intel HD and NVidia GPUs, when you execute with the OpenGL ES ver. v1.1 & v2.0 option, the Emulator may be unexpectedly terminated. Use the OpenGL ES ver. v2.0 & v3.0 option.</li>
</ul>
</li>
<li>SDB
- <ul>
- <li>​To use the SDB bash completion feature, you must type the source .sdb-complete.bash command on the bash shell. The feature runs manually from the Tizen 2.4 due to the Installer and Update Manager issue.</li>
+ <ul>
+ <li>​To use the SDB bash completion feature, you must type the source .sdb-complete.bash command on the bash shell. The feature runs manually from the Tizen 2.4 due to the Installer and Update Manager issue.</li>
</ul>
- </li>
+ </li>
</ul>
-
+
<h3>UI FW</h3>
-
+
<h4>New Features</h4>
-
- <ul>
- <li>Tizen 2015 UX support has been added (new winset and style).</li>
+
+ <ul>
+ <li>Tizen 2015 UX support has been added (new winset and style).</li>
<li>Vector winset support has been added.</li>
- <li>Unicode 6.1 Colored Emoticons have been added.</li>
+ <li>Unicode 6.1 Colored Emoticons have been added.</li>
<li>Gamepad support has been added.</li>
- <li>Cancel Event support has been added.</li>
- <li>ATK has been integrated.</li>
+ <li>Cancel Event support has been added.</li>
+ <li>ATK has been integrated.</li>
<li>Ecore Buffer has been added.
- <ul>
- <li>New API abstracts the graphic buffer and allows you to share it between processes.</li>
+ <ul>
+ <li>New API abstracts the graphic buffer and allows you to share it between processes.</li>
</ul>
- </li>
+ </li>
</ul>
-
+
<h4>Change Notes</h4>
-
- <ul>
+
+ <ul>
<li>Open source upgrade
- <ul>
- <li>EFL version has been upgraded from 1.7 to 1.13.</li>
+ <ul>
+ <li>EFL version has been upgraded from 1.7 to 1.13.</li>
</ul>
- </li>
+ </li>
<li>API changes
- <ul>
- <li>Eina_Bool edje_text_class_get (const char *text_class, char **font, Evas_Font_Size *size) has been changed to Eina_Bool edje_text_class_get (const char *text_class, const char **font, Evas_Font_Size *size).</li>
- <li>â—¦void elm_win_wm_rotation_preferred_rotation_set(Evas_Object *obj, const int rotation) has been changed to void elm_win_wm_rotation_preferred_rotation_set(const Evas_Object *obj, int rotation).</li>
- </ul></li>
+ <ul>
+ <li>Eina_Bool edje_text_class_get (const char *text_class, char **font, Evas_Font_Size *size) has been changed to Eina_Bool edje_text_class_get (const char *text_class, const char **font, Evas_Font_Size *size).</li>
+ <li>â—¦void elm_win_wm_rotation_preferred_rotation_set(Evas_Object *obj, const int rotation) has been changed to void elm_win_wm_rotation_preferred_rotation_set(const Evas_Object *obj, int rotation).</li>
+ </ul></li>
</ul>
-
+
<h3>Network Connectivity</h3>
-
+
<h4>New Features</h4>
-
- <ul>
+
+ <ul>
<li>NFC
- <ul>
- <li>New HCE (Host Card Emulation) APIs for NFC has been added.</li>
+ <ul>
+ <li>New HCE (Host Card Emulation) APIs for NFC has been added.</li>
</ul>
- </li>
+ </li>
<li>Smartcard
- <ul>
- <li>New APIs for smartcards (Smartcard API) have been added.</li>
+ <ul>
+ <li>New APIs for smartcards (Smartcard API) have been added.</li>
</ul>
</li>
<li>Bluetooth
- <ul>
- <li>New APIs for AVRCP have been added.</li>
- <li>SDK extension APIs have been moved into bluetooth_extension.h.</li>
+ <ul>
+ <li>New APIs for AVRCP have been added.</li>
+ <li>SDK extension APIs have been moved into bluetooth_extension.h.</li>
</ul>
- </li>
- <li>Connection Manager
- <ul>
- <li>New API to get MAC address has been added.</li>
- <li>New APIs for Ethernet cable state have been added.</li>
+ </li>
+ <li>Connection Manager
+ <ul>
+ <li>New API to get MAC address has been added.</li>
+ <li>New APIs for Ethernet cable state have been added.</li>
</ul>
</li>
- <li>Wi-Fi
- <ul>
+ <li>Wi-Fi
+ <ul>
<li>New APIs for a specific scan have been added.</li>
<li>New APIs for Wi-Fi configuration have been added.</li>
</ul>
- </li>
+ </li>
<li>Wi-Fi direct
- <ul>
- <li>New APIs for a Wi-Fi display have been added.</li>
+ <ul>
+ <li>New APIs for a Wi-Fi display have been added.</li>
</ul>
</li>
- <li>Telephony
- <ul>
- <li>New APIs for a call status have been added.</li>
+ <li>Telephony
+ <ul>
+ <li>New APIs for a call status have been added.</li>
<li>New APIs for a modem power status have been added.</li>
- <li>New APIs for SIM application lists have been added.</li>
- <li>New APIs for a network have been added.</li>
- </ul></li>
+ <li>New APIs for SIM application lists have been added.</li>
+ <li>New APIs for a network have been added.</li>
+ </ul></li>
</ul>
-
+
<h4>Change Notes</h4>
-
- <ul>
+
+ <ul>
<li>Open source upgrade
- <ul>
- <li>ConnMan has been upgraded from 1.3.313 to 1.29.15.</li>
- <li>Bluez has been upgraded from 5.27 to 5.28.</li>
- <li>libsoup has been upgraded from 2.38.1 to 2.46.0, gnutls from 2.12.20 to 3.3.5, and glib-networking from 2.32.3 to 2.38.0.</li>
+ <ul>
+ <li>ConnMan has been upgraded from 1.3.313 to 1.29.15.</li>
+ <li>Bluez has been upgraded from 5.27 to 5.28.</li>
+ <li>libsoup has been upgraded from 2.38.1 to 2.46.0, gnutls from 2.12.20 to 3.3.5, and glib-networking from 2.32.3 to 2.38.0.</li>
</ul>
- </li>
+ </li>
<li>Notice of deprecated APIs
- <ul>
+ <ul>
<li>Bluetooth
- <ul>
- <li>Legacy LE discovery APIs have been deprecated.</li>
- <li>Legacy GATT client APIs have been deprecated.</li>
+ <ul>
+ <li>Legacy LE discovery APIs have been deprecated.</li>
+ <li>Legacy GATT client APIs have been deprecated.</li>
</ul>
- </li>
- <li>Wi-Fi Direct</li>
+ </li>
+ <li>Wi-Fi Direct</li>
<li>Telephony
- <ul>
- <li>Call status API has been deprecated. </li>
+ <ul>
+ <li>Call status API has been deprecated. </li>
</ul>
- </li>
+ </li>
</ul>
- </li>
+ </li>
</ul>
-
+
<h3>Contact and Calendar Service</h3>
-
+
<h4>New Features</h4>
- <ul>
- <li>New APIs for the phonenumber-utils module (phone number location, formatting, location data replace) have been added.</li>
- <li>Lunar calendar has been added in the Event schedule.</li>
- </ul>
-
+ <ul>
+ <li>New APIs for the phonenumber-utils module (phone number location, formatting, location data replace) have been added.</li>
+ <li>Lunar calendar has been added in the Event schedule.</li>
+ </ul>
+
<h4>Change Notes</h4>
-
- <ul>
- <li>PIMS-ipc abnormal disconnection recovery feature has been added.</li>
+
+ <ul>
+ <li>PIMS-ipc abnormal disconnection recovery feature has been added.</li>
<li>_contacts_event.is_leap_month property has been deprecated.</li>
- <li>On-demand launching has been applied.</li>
+ <li>On-demand launching has been applied.</li>
</ul>
-
+
<h3>Multimedia FW</h3>
-
+
<h4>New Features</h4>
-
+
<ul>
<li>Media Content
<ul>
<h4>Change Notes</h4>
<ul>
-<li>vconf-keys have been moved from the spec file into 'vconf-internal-keys'.</li>
+<li>vconf-keys have been moved from the spec file into 'vconf-internal-keys'.</li>
<li>Unused vconf-keys have been removed.</li>
</ul>
<li>ProgressBar has been renamed to Progress.</li>
<li>SelectMenu has been renamed to DropdownMenu.</li>
<li>TokenTextArea has been renamed to TextEnveloper.</li>
-<li>A plugin, "support-2.3", is provided for backward compatibility.</li>
+<li>A plugin, "support-2.3", is provided for backward compatibility.</li>
</ul>
</li>
<li>Deprecated APIs
<li>New tizen locale (ckb_IR, ckb_IQ, raj_IN, ce_RU) has been added.</li>
<li>XML-based configuration tool has been adopted for all modules (vconf-internal-keys).
<ul>
-<li>Content in vconf-keys.h has been moved from 'vconf' into 'vconf-internal-keys' (refactoring).</li>
+<li>Content in vconf-keys.h has been moved from 'vconf' into 'vconf-internal-keys' (refactoring).</li>
<li>All unused keys have been removed.</li>
<li>All un-initialized keys have been removed.</li>
</ul>
<li>Application API
<ul>
<li>Application interface provides application event broadcasting and listening features. The application can broadcast user events to other listening applications.</li>
-<li>"GROUP" mode has been added to the Application API, and used to set an application group before launching an application using the Application Control. Specifies the application launch mode when the application is launched by the launchAppControl() method.</li>
+<li>"GROUP" mode has been added to the Application API, and used to set an application group before launching an application using the Application Control. Specifies the application launch mode when the application is launched by the launchAppControl() method.</li>
</ul>
</li>
<li>SystemInformation API
</li>
<li>Â Web Runtime
<ul>
-<li>In the tizen:application element in the config.xml file, "launch_mode" is added to set the launch mode to "single", "caller", or "group". For more information, see Guides > Native Application > Application Framework > Application Group.</li>
-<li>In the tizen:app-control element in the config.xml file, "reload" is added to enable or disable a page reload when an application control request is received.</li>
+<li>In the tizen:application element in the config.xml file, "launch_mode" is added to set the launch mode to "single", "caller", or "group". For more information, see Guides > Native Application > Application Framework > Application Group.</li>
+<li>In the tizen:app-control element in the config.xml file, "reload" is added to enable or disable a page reload when an application control request is received.</li>
<li>Feature for restricting CPU resources for a background application process according to the background categories that are specified in the config.xml file has been added.</li>
</ul>
</li>
<ul>
<li>Layout (WebCore) changes (open source adaptation)
<ul>
-<li>"-webkit-calc": <a href="https://bugs.webkit.org/show_bug.cgi?id=91951" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=91951</a></li>
+<li>"-webkit-calc": <a href="https://bugs.webkit.org/show_bug.cgi?id=91951" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=91951</a></li>
<li>flexbox: <a href="https://bugs.webkit.org/show_bug.cgi?id=110389" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=110389</a></li>
<li>flexbox: <a href="https://bugs.webkit.org/show_bug.cgi?id=81809" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=81809</a></li>
<li>flexbox: <a href="https://bugs.webkit.org/show_bug.cgi?id=7077" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=7077</a></li>
<ul>
<li>Enforce security
<ul>
-<li>Number of root daemons has been reduced and non-root daemons are mostly running as "system(200)" user.</li>
+<li>Number of root daemons has been reduced and non-root daemons are mostly running as "system(200)" user.</li>
<li>-fpie build options have been applied to system services to achieve ASLR (Address Space Layout Randomization).</li>
<li>Smack labels have been dramatically reduced for vconf keys.</li>
</ul>
</li>
<li>User Certificate Management has been changed
<ul>
-<li>User's trusted certificates have been categorized into e-mail, VPN, and Wi-Fi.</li>
+<li>User's trusted certificates have been categorized into e-mail, VPN, and Wi-Fi.</li>
<li>User can add, remove, enable, and disable their certificates for each category.</li>
</ul>
</li>
<li>New API to manage access control rules efficiently (kmc_set_permission function) has been added.</li>
<li>New API that deletes data in the database using an alias (ckmc_remove_alias) has been added.</li>
<li>New error code (CKMC_ERROR_AUTHENTICATION_FAILED) for per-row password mismatched error has been added.</li>
-<li>Platform level privilege from key-manager's control APIs has been deleted.</li>
+<li>Platform level privilege from key-manager's control APIs has been deleted.</li>
<li>Getting a certificate chain with aliases API has been deprecated.</li>
</ul>
</li>
<h4>Event</h4>
<ul>
-<li>[Added] New state definition of the battery charger has been added to clarify "discharging":
+<li>[Added] New state definition of the battery charger has been added to clarify "discharging":
<ul>
<li>EVENT_KEY_BATTERY_CHARGER_STATUS</li>
</ul>
<h1>Tizen 2.4 Rev1 Release Notes</h1>
-<ul>
- <li>Release Date: December 1, 2015</li>
+<ul>
+ <li>Release Date: December 1, 2015</li>
</ul>
-
+
<h2 id="ide_tools">IDE and Tools</h2>
-
+
<h3>New Features</h3>
-
- <ul>
+
+ <ul>
<li>Common
- <ul>
- <li><strong>Tizen 2.4 Rev1 SDK supports developing an application on multi-platform environments. In the 2.4 Rev1 SDK, you can also develop 2.3.1 based applications.</strong></li>
+ <ul>
+ <li><strong>Tizen 2.4 Rev1 SDK supports developing an application on multi-platform environments. In the 2.4 Rev1 SDK, you can also develop 2.3.1 based applications.</strong></li>
<li><strong>From Tizen 2.4 Rev1, the SDK image installation is not officially supported. Use the Tizen package server for installation.</strong></li>
<li>From Tizen 2.4 Rev1, the Update Manager supports the package server mirroring. Without uninstalling the Tizen SDK, you can enhance the installation speed of the new SDK version by changing the target repository address to an alternative repository that exists in your country or region.</li>
</ul>
- </li>
+ </li>
<li>CLI
- <ul>
+ <ul>
<li>Support has been added for the package/install/run/uninstall features for the 2.3.0 projects.</li>
</ul>
</li>
- <li>Native UIB and Enventor<ul>
+ <li>Native UIB and Enventor<ul>
<li>Supports the following host operating systems:
- <ul>
- <li>Tizen 2.3.1 (Mobile/Wearable): Ubuntu 12.04/14.04 32-bit/64-bit</li>
- <li>Tizen 2.4 (Mobile): Ubuntu 12.04/14.04 32-bit/64-bit, Windows® 7/8 32-bit/64bit</li>
+ <ul>
+ <li>Tizen 2.3.1 (Mobile/Wearable): Ubuntu 12.04/14.04 32-bit/64-bit</li>
+ <li>Tizen 2.4 (Mobile): Ubuntu 12.04/14.04 32-bit/64-bit, Windows® 7/8 32-bit/64bit</li>
</ul>
- </li>
+ </li>
</ul>
</li>
</ul>
-
+
<h3>Changed Features</h3>
-
- <ul>
+
+ <ul>
<li>Common
- <ul>
+ <ul>
<li>The Project wizard has been enhanced to be opened and closed faster than in the 2.4 official version.</li>
<li>To improve the security of a connected Tizen device, the execute permission has been changed from the root/administrator to the developer in some features that control the device, such as the dynamic analyzer and SDBD.</li>
<li>The IDE has been changed to hold the settings (<strong>filter</strong>, <strong>log level</strong>, <strong>category</strong>) of the Log view after the device is disconnected.</li>
<li>The default value for the <strong>log level</strong> property of the Log view has been changed from <strong>Verbose</strong> to <strong>Error</strong>.</li>
</ul>
- </li>
+ </li>
<li>Installer and Update Manager
- <ul>
+ <ul>
<li>A combo box has been added to the Update Manager to easily change the URL of the target repository.</li>
</ul>
</li>
- <li>Web IDE<ul>
- <li>The Localize wizard has been replaced with the Localization view.</li>
- <li>You can localize your resource files and strings.</li>
- <li>You can export or import a localized string as a CSV (comma-separated value) file.</li>
- </ul>
- </li>
- <li>Native IDE<ul>
- <li>The content/code assist feature has been added for the <strong>i18n_get_text()</strong> function. After you complete the <strong>i18n_get_text()</strong> function on the C/C++ source file editor by pressing <strong>Ctrl + Space</strong>, you can see a candidate parameter list which consists of original untranslated strings you added to the PO file.</li>
+ <li>Web IDE<ul>
+ <li>The Localize wizard has been replaced with the Localization view.</li>
+ <li>You can localize your resource files and strings.</li>
+ <li>You can export or import a localized string as a CSV (comma-separated value) file.</li>
+ </ul>
+ </li>
+ <li>Native IDE<ul>
+ <li>The content/code assist feature has been added for the <strong>i18n_get_text()</strong> function. After you complete the <strong>i18n_get_text()</strong> function on the C/C++ source file editor by pressing <strong>Ctrl + Space</strong>, you can see a candidate parameter list which consists of original untranslated strings you added to the PO file.</li>
<li>When you develop a multi-project packaged application (such as a combination of UI and service projects, or UI and shared library projects), the res.xml files of the projects are automatically merged. If a project has no res.xml file, a res.xml is automatically generated for that project and merged with the other res.xml files. </li>
- <li>The "Export to CLI" menu has been added, and appears when multiple projects are selected.</li>
- <li>The Resource Explorer view has been added. It appears only for Tizen 2.4-based projects, not Tizen 2.3.1.</li>
- <li>Multi-project packaging policy has been updated.<ul>
- <li>A Web UI project can be packaged with several native-widget type projects.</li>
- <li>A native IME project can be packaged with several UI application type projects.</li>
- </ul></li>
+ <li>The "Export to CLI" menu has been added, and appears when multiple projects are selected.</li>
+ <li>The Resource Explorer view has been added. It appears only for Tizen 2.4-based projects, not Tizen 2.3.1.</li>
+ <li>Multi-project packaging policy has been updated.<ul>
+ <li>A Web UI project can be packaged with several native-widget type projects.</li>
+ <li>A native IME project can be packaged with several UI application type projects.</li>
+ </ul></li>
</ul></li>
</ul>
-
+
<h3>Fixed Bugs</h3>
-
- <ul>
+
+ <ul>
<li>Common
- <ul>
- <li>The Apple JDK dependency issue, which appeared when starting the Tizen IDE and dynamic analyzer, has been fixed.</li>
+ <ul>
+ <li>The Apple JDK dependency issue, which appeared when starting the Tizen IDE and dynamic analyzer, has been fixed.</li>
</ul>
- </li>
- <li>Native<ul>
- <li>The bug, which caused unnecessary files (such as .EDC file) to be included when native modules were packaged into the .tpk file, has been fixed.</li>
+ </li>
+ <li>Native<ul>
+ <li>The bug, which caused unnecessary files (such as .EDC file) to be included when native modules were packaged into the .tpk file, has been fixed.</li>
</ul></li>
- <li>CLI<ul>
- <li>The bug, which caused the native CLI to return success codes even though a build failed, has been fixed.</li>
+ <li>CLI<ul>
+ <li>The bug, which caused the native CLI to return success codes even though a build failed, has been fixed.</li>
</ul></li>
</ul>
-
+
<h3>Known issues</h3>
-
- <ul>
+
+ <ul>
<li>Installer and Update Manager
- <ul>
- <li>If there is a multibyte character in the installation path of the Tizen SDK, some development packages cannot find the installed SDK's location when they are working.</li>
+ <ul>
+ <li>If there is a multibyte character in the installation path of the Tizen SDK, some development packages cannot find the installed SDK's location when they are working.</li>
<li>When you install packages by using the All Packages tab in the Update Manager, the number of the progress indicator is only changed each time a package in dependency is downloaded. While downloading, the number of the progress indicator is not changed.</li>
<li>When you run the dynamic analyzer on Mac OS, the SDK Update Notification does not appear though there are available SDK updates.</li>
- <li>If the SDK Update Notification appears when you start the Tizen IDE or Emulator on Mac OS, a terminal (shell.exec) icon can appear on the dock for a few seconds.</li>
+ <li>If the SDK Update Notification appears when you start the Tizen IDE or Emulator on Mac OS, a terminal (shell.exec) icon can appear on the dock for a few seconds.</li>
</ul>
- </li>
- <li>Native IDE<ul>
- <li>When you import some projects generated from Tizen 2.3 Rev2, the import can take some time.</li>
- <li>The <strong>Restore Defaults</strong> feature in the Native project's <strong>properties > C/C++ Build</strong>, does not work properly.</li>
+ </li>
+ <li>Native IDE<ul>
+ <li>When you import some projects generated from Tizen 2.3 Rev2, the import can take some time.</li>
+ <li>The <strong>Restore Defaults</strong> feature in the Native project's <strong>properties > C/C++ Build</strong>, does not work properly.</li>
</ul>
</li>
<li>Emulator
- <ul>
- <li>Ubuntu sometimes stops responding for a few seconds after closing the Emulator Manager. This issue is related to a bug of IBus (Intelligent Input Bus). When the issue occurs, restart the ibus-daemon by typing <strong>ibus-daemon –drx</strong> at the command prompt, and use another framework, such as uim and fcitx, for multilingual input.</li>
+ <ul>
+ <li>Ubuntu sometimes stops responding for a few seconds after closing the Emulator Manager. This issue is related to a bug of IBus (Intelligent Input Bus). When the issue occurs, restart the ibus-daemon by typing <strong>ibus-daemon –drx</strong> at the command prompt, and use another framework, such as uim and fcitx, for multilingual input.</li>
<li>To use the Tizen Emulator, install an Intel VTx supported by the CPU, and the latest version of the graphic card driver provided by the vendor.
- <ul>
- <li>Check the prerequisites for the Tizen Emulator from: <a href="../install/sdk_prerequisites.htm#emulator">Emulator Requirements</a>.</li>
- <li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. If you use Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
- <li>On Ubuntu, if the graphics driver is outdated, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
+ <ul>
+ <li>Check the prerequisites for the Tizen Emulator from: <a href="../install/sdk_prerequisites.htm#emulator">Emulator Requirements</a>.</li>
+ <li>If the host machine is using the Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. If you use Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). If you use Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>On Ubuntu, if the graphics driver is outdated, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
- <li>On Ubuntu 14.04, the shortcut menu can sometimes appear transparently.</li>
+ <li>On Ubuntu 14.04, the shortcut menu can sometimes appear transparently.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered by another window. If you click the Emulator window, the display surface runs correctly again.</li>
<li>On Windows®, if a memory allocation error occurs while executing the Emulator, try the following:
- <ul>
- <li>Close some other programs and try to launch the Emulator again.</li>
+ <ul>
+ <li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set as 768 or 1024 MB for the VM in the Emulator Manager, change the RAM size to 512 MB.</li>
- <li>Increase the user area of the virtual memory in the system to 3 GB by typing <strong>bcdedit /set increaseuserva 3072</strong> on the console with administrator rights (Windows® 7 only) and reboot.</li>
+ <li>Increase the user area of the virtual memory in the system to 3 GB by typing <strong>bcdedit /set increaseuserva 3072</strong> on the console with administrator rights (Windows® 7 only) and reboot.</li>
</ul>
- </li>
- <li>If you use a MacBook Pro which has both Intel HD and NVidia GPUs, the Emulator may be unexpectedly terminated when you execute with the OpenGL ES ver. v1.1 & v2.0 option. Use the OpenGL ES ver. v2.0 & v3.0 option.</li>
+ </li>
+ <li>If you use a MacBook Pro which has both Intel HD and NVidia GPUs, the Emulator may be unexpectedly terminated when you execute with the OpenGL ES ver. v1.1 & v2.0 option. Use the OpenGL ES ver. v2.0 & v3.0 option.</li>
</ul>
</li>
<li>SDB
- <ul>
- <li>​To use the SDB bash completion feature, type the <strong>source .sdb-complete.bash</strong> command on the bash shell. The feature runs manually from the Tizen 2.4 official version due to the Installer and Update Manager issue.</li>
+ <ul>
+ <li>​To use the SDB bash completion feature, type the <strong>source .sdb-complete.bash</strong> command on the bash shell. The feature runs manually from the Tizen 2.4 official version due to the Installer and Update Manager issue.</li>
</ul>
</li>
- <li>Native UIB<ul>
- <li>The Native UIB does not support the storyboard for the Tizen 2.3.1 platforms.</li>
- </ul></li>
+ <li>Native UIB<ul>
+ <li>The Native UIB does not support the storyboard for the Tizen 2.3.1 platforms.</li>
+ </ul></li>
</ul>
<script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
<h1>Tizen 2.4 Rev2 Release Notes </h1>
-<ul>
+<ul>
<li>Release Date: December 23, 2015</li>
</ul>
-
+
<h2 id="ide_tools">IDE and Tools</h2>
-
+
<h3>Fixed Bugs</h3>
-
- <ul>
+
+ <ul>
<li>Web IDE
- <ul>
- <li>The bug, which caused the TV-Extension-installed SDK to fail to install and launch a TV application on the target, such as the Tizen emulator, has been fixed.</li>
- <li>The library conflict between the TV-Extension and the SDK, which occurs when the TV-Extension-installed SDK debugs an application, has been fixed.</li>
+ <ul>
+ <li>The bug, which caused the TV-Extension-installed SDK to fail to install and launch a TV application on the target, such as the Tizen emulator, has been fixed.</li>
+ <li>The library conflict between the TV-Extension and the SDK, which occurs when the TV-Extension-installed SDK debugs an application, has been fixed.</li>
</ul>
- </li>
+ </li>
<li>Web Inspector
- <ul>
- <li>The bug, which caused the socket connection between the Web Inspector and the Tizen emulator to close, has been fixed.</li>
+ <ul>
+ <li>The bug, which caused the socket connection between the Web Inspector and the Tizen emulator to close, has been fixed.</li>
</ul>
- </li>
+ </li>
</ul>
<script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
<h1>Tizen 2.4 Rev3 Release Notes</h1>
-<ul>
+<ul>
<li>Release Date: Feb. 5, 2016</li>
</ul>
-
+
<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
<li>The Update Manager has been upgraded. With the 2.4 and 2.3.1 SDKs, you can also install the 2.3.0 SDK by using the new Update Manager.</li>
<li>The remote device manager in the Connection Explorer supports the scanning of the remote targets, such as the emulator and devices connected through Wi-Fi.</li>
</ul>
-</li>
+</li>
<li>Installer and Update Manager
<ul>
- <li>The Update Manager is automatically updated. In addition, it supports the Uninstaller instead of the 'uninstall all' feature of the earlier Update Manager.</li>
+ <li>The Update Manager is automatically updated. In addition, it supports the Uninstaller instead of the 'uninstall all' feature of the earlier Update Manager.</li>
<li>On the <strong>Progress</strong> tab of the Update Manager, you can cancel an ongoing installation and update of the packages individually.</li>
</ul>
-</li>
+</li>
<li>Web IDE
<ul>
<li>The Select Emulator Wizard has been added. When you launch a project without the emulator, the Wizard helps you to start the emulator which the application runs on and develop the application seamlessly.</li>
<li>You can select the highlight color in the Live Editing preferences.</li>
</ul>
-</li>
+</li>
<li>Native IDE
<ul>
<li>Unit testing for the library project has been updated.</li>
</ul>
-</li>
+</li>
<li>Supports the automatic test discovery and XML test report generation, based on the Google test framework.
<ul>
<li>Platform IDE has been enabled:
<li>Through the <strong>Problems</strong> view, you can go to the source code of the .edj file that is causing compile errors. The code highlighting is supported.</li>
<li>By using the Migration Wizard, you can convert the profile of an imported project from wearable to mobile (or vice versa).</li>
</ul>
-</li>
+</li>
<li>CLI and SDB
<ul>
<li>Parallel builds for the native application are supported.</li>
<li>Application slicing for re-signing the packages has been added.</li>
<li>Significant performance improvements for SDB push/pull over the Bluetooth have been added.</li>
</ul>
-</li>
+</li>
<li>Dynamic Analyzer
<ul>
<li>The UI hierarchy analysis has been added (supports 2.4 mobile applications only). It shows the information of the EFL UI objects (Evas, Elementary, and Edje). It also provides the hierarchy relationship of all UI objects and detailed information of each UI object.</li>
<li>Common
<ul>
<li>A new filtering option, Required Version, has been added to the Text filter in the Project Wizard. You can look up the samples built on the version you have entered in the new option.</li>
- <li>You can type the dot (".") in the project name when you create a project.</li>
+ <li>You can type the dot (".") in the project name when you create a project.</li>
</ul>
</li>
<li>Native IDE
</ul>
</li>
</ul>
-
+
<h3>Known Issues</h3>
<li>At the prompt, enter the <span style="font-family: Courier New,Courier,monospace">update-manager-cli_2.4_patch_{OS}{bit}.{bin|exe}</span> command to install the patch.</li>
</ul>
</li>
- <li>If there is a multibyte character in the Tizen SDK installation path, some development packages have a difficulty in finding the installed SDK's location when they are working.</li>
+ <li>If there is a multibyte character in the Tizen SDK installation path, some development packages have a difficulty in finding the installed SDK's location when they are working.</li>
<li>When you run the dynamic analyzer on Mac OS® X, the SDK Update Notification does not appear though there are available SDK updates.</li>
<li>If the SDK Update Notification appears when you start the Tizen IDE or Emulator on Mac OS® X, a terminal (shell.exec) icon can appear on the dock for a few seconds.</li>
</ul>
<li>Native IDE
<ul>
<li>When you import some projects generated from Tizen 2.3 Rev2, the importing can take some time.</li>
- <li>The <strong>Restore Defaults</strong> feature in the <strong>native project's properties > C/C++ Build</strong> does not work properly.</li>
+ <li>The <strong>Restore Defaults</strong> feature in the <strong>native project's properties > C/C++ Build</strong> does not work properly.</li>
<li>When you run some filtered test cases with the native Unit Test tool, the test application can crash.</li>
</ul>
</li>
<li>To use the Tizen Emulator, install an Intel VTx supported by the CPU, and the latest version of the graphic card driver which the vendor provides. Check the prerequisites for the Tizen Emulator from:
<ul>
<li><a href="../install/sdk_prerequisites.htm">Prerequisites for the Tizen SDK</a>.</li>
- <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
<li>On Ubuntu, if the graphics driver is out-of-date, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
<li>On Ubuntu 14.04, a shortcut menu can appear transparently sometimes.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered with another window. If you click the Emulator window, the display surface runs correctly again.</li>
- <li>On Windows®, if a 'failed to allocate memory' error occurred while executing the Emulator, try the following:
+ <li>On Windows®, if a 'failed to allocate memory' error occurred while executing the Emulator, try the following:
<ul>
<li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set to 768 or 1024 MB for the VM in the Emulator Manager, change it to 512 MB.</li>
</ul>
</li>
</ul>
-
+
<h2 id="platform_24">Tizen 2.4.0 Platform</h2>
<h3>Changed Features</h3>
</ul>
</li>
</ul>
-
+
<h2 id="platform_231">Tizen 2.3.1 Platform</h2>
<h3>New Features</h3>
<h1>Tizen 2.4 Rev4 Release Notes</h1>
-<ul>
+<ul>
<li>Release Date: Mar 4, 2016</li>
</ul>
-
+
<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
<li>Installer and Update Manager
<ul>
- <li>The GUI installer's version information, which was displayed on the title bar, has been moved behind an exclamation mark icon at the bottom-left corner. If you click the icon, a dialog box opens and shows the version information.</li>
+ <li>The GUI installer's version information, which was displayed on the title bar, has been moved behind an exclamation mark icon at the bottom-left corner. If you click the icon, a dialog box opens and shows the version information.</li>
<li>A prerequisite step to check the free disk space has been added. If there is not enough free disk space, the installation of the Tizen SDK cannot proceed.</li>
- <li> The CLI installer for Ubuntu allows the tilde character ('~'). When you specify the installation path, you can use the tilde character (it generally refers to the user's home directory).</li>
+ <li> The CLI installer for Ubuntu allows the tilde character ('~'). When you specify the installation path, you can use the tilde character (it generally refers to the user's home directory).</li>
<li>The Manager for Windows uses the SHA256 code signing certificate.</li>
</ul>
-</li>
+</li>
<li>Native UI Builder
<ul>
<li>The native UI Builder supports Windows 8/7 (64/32-bit) in Tizen 2.3.</li>
</ul>
-</li>
+</li>
<li>CLI and SDB
<ul>
<li>A new <span style="font-family: Courier New,Courier,monospace;">-r, --rootstrap</span> option has been added to the tizen build-native CLI command. You can build a native application using a rootstrap name.</li>
</ul>
-</li>
+</li>
<li>Dynamic Analyzer
<ul>
<li>The UI hierarchy analysis supports the Tizen 2.3.1-based devices.</li>
</ul>
-</li>
+</li>
</ul>
<h3>Changed Features</h3>
<ul>
<li>Web IDE
<ul>
- <li>Error dialog box, which appears when you launch a project, has been changed to show an original raw message instead of the 'Unknown' message.</li>
+ <li>Error dialog box, which appears when you launch a project, has been changed to show an original raw message instead of the 'Unknown' message.</li>
</ul>
</li>
</ul>
</ul>
</li>
</ul>
-
+
<h3>Known Issues</h3>
<li>At the prompt, enter the <span style="font-family: Courier New,Courier,monospace">update-manager-cli_2.4_patch update_{OS}_{bit}.{bin|exe}</span> command to install the patch.</li>
</ul>
</li>
- <li>If there is a multibyte character in the Tizen SDK installation path, some development packages have a difficulty in finding the installed SDK's location when they are working.</li>
+ <li>If there is a multibyte character in the Tizen SDK installation path, some development packages have a difficulty in finding the installed SDK's location when they are working.</li>
<li>When you run the dynamic analyzer on Mac OS® X, the SDK Update Notification does not appear though there are available SDK updates.</li>
<li>If the SDK Update Notification appears when you start the Tizen IDE or Emulator on Mac OS® X, a terminal (<span style="font-family: Courier New,Courier,monospace">shell.exec</span>) icon can appear on the dock for a few seconds.</li>
</ul>
<li>Native IDE
<ul>
<li>When you import some projects generated from Tizen 2.3 Rev2, the importing can take some time.</li>
- <li>The <strong>Restore Defaults</strong> feature in the <strong>native project's properties > C/C++ Build</strong> does not work properly.</li>
+ <li>The <strong>Restore Defaults</strong> feature in the <strong>native project's properties > C/C++ Build</strong> does not work properly.</li>
</ul>
</li>
<li>Native UI Builder
<ul>
<li>When the WYSIWYG editor of the native UI Builder for Windows is running, project deletion does not work properly. To deal with this problem, close the editor.</li>
- <li>If the WYSIWYG editor of the native UI Builder for Windows runs over 12 hours, your computer slows down because of the editor's high memory usage. To deal with this problem, restart the Tizen IDE.</li>
+ <li>If the WYSIWYG editor of the native UI Builder for Windows runs over 12 hours, your computer slows down because of the editor's high memory usage. To deal with this problem, restart the Tizen IDE.</li>
</ul>
</li>
<li>Emulator
<li>To use the Tizen Emulator, install an Intel VTx supported by the CPU, and the latest version of the graphic card driver which the vendor provides. Check the prerequisites for the Tizen Emulator from:
<ul>
<li><a href="../install/sdk_prerequisites.htm">Prerequisites for the Tizen SDK</a>.</li>
- <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
<li>On Ubuntu, if the graphics driver is out-of-date, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
<li>On Ubuntu 14.04, a shortcut menu can appear transparently sometimes.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered with another window. If you click the Emulator window, the display surface runs correctly again.</li>
- <li>On Windows®, if a 'failed to allocate memory' error occurred while executing the Emulator, try the following:
+ <li>On Windows®, if a 'failed to allocate memory' error occurred while executing the Emulator, try the following:
<ul>
<li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set to 768 or 1024 MB for the VM in the Emulator Manager, change it to 512 MB.</li>
<h1>Tizen 2.4 Rev5 Release Notes</h1>
-<ul>
+<ul>
<li>Release Date: Apr 4, 2016</li>
</ul>
-
+
<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
<li>The Update Manager supports one-click removal of the entire profile and its related packages.</li>
<li>On the <strong>All Packages</strong> tab of the Update Manager, the profile filter icon changes to be unclickable when the related profile and packages do not exist in the repository.</li>
</ul>
-</li>
+</li>
<li>Native IDE
<ul>
<li>The native IDE supports unit testing for UI and service applications.</li>
</ul>
-</li>
+</li>
<li>Native UI Builder
<ul>
<li>Supported operating systems are updated. You can also use the Native UI Builder on the Mac OS® X 10.10 (Yosemite) / 10.9 (Mavericks) / 10.8 (Mountain Lion).</li>
<li>The <strong>Preview</strong> tab has been moved to the <strong>Source</strong> tab as an internal pane. The pane shows a read-only preview of the <span style="font-family: Courier New,Courier,monospace">layout.xml</span> file.</li>
</ul>
</li>
- <li>The app development environment named M-Screen has been added to help you develop an app compatible with supported various screen configurations (resolution, DPI, and orientation).
+ <li>The app development environment named M-Screen has been added to help you develop an app compatible with supported various screen configurations (resolution, DPI, and orientation).
<ul>
<li>The M-Screen supports UI layouting for the selected screen configuration.</li>
<li>By using alternative resources in the M-Screen, you can localize text strings and optimize images and layouts. </li>
</ul>
</li>
</ul>
-</li>
+</li>
<li>Emulator
<ul>
<li>New features and enhancements have been added and applied to the Emulator Manager. The Emulator Manager supports new device templates and the customization of a platform.</li>
<li>The <span style="font-family: Courier New,Courier,monospace">list-template</span> command has been added to the Emulator Manager CLI.</li>
</ul>
-</li>
+</li>
<li>Enventor
<ul>
<li>Supported operating systems are updated. You can also use the Enventor on the Mac OS® X 10.10 (Yosemite) / 10.9 (Mavericks) / 10.8 (Mountain Lion).</li>
<li>The statusbar supports the live view zooming function.</li>
<li>The statusbar supports the view size setting for various resolutions.</li>
<li>The EDC Navigator is newly introduced.</li>
- <li>The Editor contextual popup supports a color selector GUI for "color" keywords.</li>
+ <li>The Editor contextual popup supports a color selector GUI for "color" keywords.</li>
<li>The error detector marks the corresponding lines and guides to the related source code which contains errors in the EDC editor.</li>
<li>The Live view supports displaying a dummy spacer.</li>
</ul>
<li>Installer and Update Manager
<ul>
<li>If a 32-bit version of the JRE/JDK is installed on a 64-bit OS, the Installer/Update Manager displays a message leading to install the 64bit version of the JRE/JDK.</li>
- <li>The CLI Update Manager commands and options have been changed.
+ <li>The CLI Update Manager commands and options have been changed.
<ul>
<li>The <span style="font-family: Courier New,Courier,monospace">show-info</span> command displays equivalent information to the GUI Update Manager.</li>
<li>The <span style="font-family: Courier New,Courier,monospace">show-pkgs</span> with <span style="font-family: Courier New,Courier,monospace">--tree</span> option displays packages information in the tree structure.</li>
</li>
<li>Native IDE
<ul>
- <li>You can use the underscore "_", the dash "-", and the period "." in the project name when creating a native project.</li>
+ <li>You can use the underscore "_", the dash "-", and the period "." in the project name when creating a native project.</li>
</ul>
</li>
<li>Native UI Builder
<li>When you open an older project version than 2.4 Rev5, the <strong>Resource</strong> view still remains in the perspective. To update to the <strong>Resource Manager</strong> view, click <strong>Tizen Native</strong> on the Perspective toolbar, open the context menu, and click <strong>Reset</strong>.</li>
</ul>
</li>
- <li>The drag-and-drop method of the resource file has been changed.
+ <li>The drag-and-drop method of the resource file has been changed.
<ul>
<li>If you drag an image file from the <strong>Project Explorer</strong> view and drop it to the UI component which has an image property (such as image or layout), the path of image file is automatically set to the image property in the <strong>Design</strong> tab.</li>
<li>You can drag the resource file from the <strong>Resource Manager</strong> view only in a Tizen 2.4 based project.</li>
<li>UI Component
<ul>
<li>The View Container in the Palette has been removed. The naviframe component in the View Container is also removed.</li>
- <li>Instead of the removed naviframe, which worked as the background and navigation for the app's views, the Native UI Builder offers simple view-transition methods, such as clicking a component (if its link property is set) on the view object and double-clicking the reference to the view object in the <strong>Navigation</strong> view.</li>
+ <li>Instead of the removed naviframe, which worked as the background and navigation for the app's views, the Native UI Builder offers simple view-transition methods, such as clicking a component (if its link property is set) on the view object and double-clicking the reference to the view object in the <strong>Navigation</strong> view.</li>
<li>The icon component has been removed.</li>
</ul>
</li>
<li>Native UI Builder project resources
<ul>
- <li>The name of the layout meta file has been changed from <span style="font-family: Courier New,Courier,monospace">"layout.tuml"</span> to <span style="font-family: Courier New,Courier,monospace">"layout.xml"</span>.</li>
+ <li>The name of the layout meta file has been changed from <span style="font-family: Courier New,Courier,monospace">"layout.tuml"</span> to <span style="font-family: Courier New,Courier,monospace">"layout.xml"</span>.</li>
<li>The <span style="font-family: Courier New,Courier,monospace">app.xml</span> file has been removed.</li>
</ul>
</li>
<li>Installer and Update Manager
<ul>
<li>The SDK update and installation failure from the image file has been fixed.</li>
- <li>On Mac OS®, the installer does not work properly if there are several mounted installers. This bug has been fixed by setting the volume name of the installer in the <span style="font-family: Courier New,Courier,monospace">'RELEASE_NAME'</span> format.</li>
- <li>When a user stopped the old installer while installing, the older installer did not delete the installation directory, such as 'tizen-sdk' (default installation directory). This bug has been fixed. The new installer deletes the installation directory if the installation is canceled.</li>
+ <li>On Mac OS®, the installer does not work properly if there are several mounted installers. This bug has been fixed by setting the volume name of the installer in the <span style="font-family: Courier New,Courier,monospace">'RELEASE_NAME'</span> format.</li>
+ <li>When a user stopped the old installer while installing, the older installer did not delete the installation directory, such as 'tizen-sdk' (default installation directory). This bug has been fixed. The new installer deletes the installation directory if the installation is canceled.</li>
</ul>
</li>
<li>Web IDE
</ul>
</li>
</ul>
-
+
<h3>Known Issues</h3>
</ul>
<p>You can also upgrade your CLI Installer to the 2.4 rev3 at the <a href="../cover_page.htm">Tizen SDK Download page</a>.</p>
</li>
- <li>If there is a multibyte character in the Tizen SDK installation path, some development packages have a difficulty in finding the installed SDK's location when they are working.</li>
+ <li>If there is a multibyte character in the Tizen SDK installation path, some development packages have a difficulty in finding the installed SDK's location when they are working.</li>
<li>When you run the dynamic analyzer on Mac OS® X, the SDK Update Notification does not appear even though there are available SDK updates.</li>
<li>If the SDK Update Notification appears when you start the Tizen IDE or Emulator on Mac OS® X, a terminal (<span style="font-family: Courier New,Courier,monospace">shell.exec</span>) icon can appear on the dock for a few seconds.</li>
</ul>
<li>Native IDE
<ul>
<li>When you import some projects generated from Tizen 2.3 Rev2, the importing can take some time.</li>
- <li>The <strong>Restore Defaults</strong> feature in the native project's <strong>Properties > C/C++ Build</strong> does not work properly.</li>
+ <li>The <strong>Restore Defaults</strong> feature in the native project's <strong>Properties > C/C++ Build</strong> does not work properly.</li>
</ul>
</li>
<li>Native UI Builder
<ul>
<li>When the WYSIWYG editor of the Native UI Builder for Windows® is running, project deletion does not work properly. To deal with this problem, close the editor.</li>
- <li>If the WYSIWYG editor of the Native UI Builder for Windows® runs for more than 12 hours, your computer slows down because of the editor's high memory usage. To free from this situation, restart the Tizen IDE.</li>
+ <li>If the WYSIWYG editor of the Native UI Builder for Windows® runs for more than 12 hours, your computer slows down because of the editor's high memory usage. To free from this situation, restart the Tizen IDE.</li>
</ul>
</li>
<li>Emulator
<li>Ubuntu sometimes stops responding for a few seconds after closing the Emulator Manager. This issue is related to an IBus (Intelligent Input Bus) bug. When the issue occurs, restart the ibus-daemon by entering the <span style="font-family: Courier New,Courier,monospace">ibus-daemon –drx</span> command at the command prompt, and use another framework, such as uim and fcitx, for multilingual input.</li>
<li>To use the Tizen Emulator, install an Intel VTx supported by the CPU, and the latest version of the graphic card driver provided by the vendor. Check the prerequisites for the Tizen Emulator from <a href="../install/sdk_prerequisites.htm">Prerequisites for the Tizen SDK</a>.
<ul>
- <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
<li>On Ubuntu, if the graphics driver is out-of-date, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
<li>On Ubuntu 14.04, a shortcut menu can sometimes appear transparent.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered with another window. If you click the Emulator window, the display surface runs correctly again.</li>
- <li>On Windows®, if a 'failed to allocate memory' error occurred while executing the Emulator, try the following:
+ <li>On Windows®, if a 'failed to allocate memory' error occurred while executing the Emulator, try the following:
<ul>
<li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set to 768 or 1024 MB for the VM in the Emulator Manager, change it to 512 MB.</li>
</ul>
-
+
<script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
<script type="text/javascript" src="../scripts/showhide.js"></script>
<h1>Tizen 2.4 Rev6 Release Notes</h1>
-<ul>
+<ul>
<li>Release Date: May 19, 2016</li>
</ul>
-
+
<h2 id="ide_tools">IDE and Tools</h2>
<h3>Changed Features</h3>
</li>
<li>CLI/SDB
<ul>
- <li>When you copy a file or directory by using the SDB's push command, a <strong>WARNING: Your data is to be sent over an unencrypted connection and could be read by others.</strong> security warning message appears to inform you what risk exists in the push command.</li>
- <li>If you use the SDB's forward command, the remote port "0" is disabled.</li>
+ <li>When you copy a file or directory by using the SDB's push command, a <strong>WARNING: Your data is to be sent over an unencrypted connection and could be read by others.</strong> security warning message appears to inform you what risk exists in the push command.</li>
+ <li>If you use the SDB's forward command, the remote port "0" is disabled.</li>
</ul>
</li>
</ul>
-
+
<h3>Fixed Bugs</h3>
<ul>
</ul>
</li>
</ul>
-
+
<h3>Known Issues</h3>
<ul>
<li>Native IDE
<ul>
<li>When you import some projects generated from Tizen 2.3 Rev2, the importing can take some time.</li>
- <li>The <strong>Restore Defaults</strong> feature in the native project's <strong>Properties > C/C++ Build</strong> does not work properly.</li>
+ <li>The <strong>Restore Defaults</strong> feature in the native project's <strong>Properties > C/C++ Build</strong> does not work properly.</li>
</ul>
</li>
<li>Native UI Builder
<ul>
<li>When the WYSIWYG editor of the Native UI Builder for Windows® is running, a project deletion does not work properly. To solve the problem, close the editor.</li>
- <li>If the WYSIWYG editor of the Native UI Builder for Windows® runs over 12 hours, your computer slows down because of the editor's high memory usage. To solve the problem, restart the Tizen IDE.</li>
+ <li>If the WYSIWYG editor of the Native UI Builder for Windows® runs over 12 hours, your computer slows down because of the editor's high memory usage. To solve the problem, restart the Tizen IDE.</li>
</ul>
</li>
<li>Emulator
<li>Ubuntu sometimes stops responding for a few seconds after closing the Emulator Manager. This issue is related to an IBus (Intelligent Input Bus) bug. When the issue occurs, restart the ibus-daemon by entering the <span style="font-family: Courier New,Courier,monospace">ibus-daemon –drx</span> command at the command prompt, and use another framework, such as uim and fcitx, for multilingual input.</li>
<li>To use the Tizen Emulator, install an Intel VTx supported by the CPU, and the latest version of the graphic card driver provided by the vendor. Check the prerequisites for the Tizen Emulator from <a href="../install/sdk_prerequisites.htm">Prerequisites for the Tizen SDK</a>.
<ul>
- <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
<li>On Ubuntu, if the graphics driver is out-of-date, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
<li>On Ubuntu 14.04, a shortcut menu can sometimes appear transparent.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered with another window. If you click the Emulator window, the display surface runs correctly again.</li>
- <li>On Windows®, if a 'failed to allocate memory' error occurs while executing the Emulator, try the following:
+ <li>On Windows®, if a 'failed to allocate memory' error occurs while executing the Emulator, try the following:
<ul>
<li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set to 768 or 1024 MB for the VM in the Emulator Manager, change it to 512 MB.</li>
</ul>
</li>
</ul>
-
+
<h2 id="platform_231">Tizen 2.3.1 Platform</h2>
<h3>Changed Features</h3>
<h1>Tizen 2.4 Rev7 Release Notes</h1>
-<ul>
+<ul>
<li>Release Date: Jun 30, 2016</li>
</ul>
-
+
<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
</ul>
</li>
</ul>
-
+
<h3>Fixed Bugs</h3>
<ul>
</ul>
</li>
</ul>
-
+
<h3>Known Issues</h3>
<ul>
</li>
<li>Web and Native IDE
<ul>
- <li>If JRE 1.8 is installed on your computer and you select in the IDE menu <strong>Help > Help Contents</strong>, the "HTTP ERROR:500" message can appear in the Help page due to an Eclipse Kepler bug. To see the Help page, see <a href="https://developer.tizen.org/development" target="_blank">https://developer.tizen.org/development</a> or use JRE 1.7.</li>
+ <li>If JRE 1.8 is installed on your computer and you select in the IDE menu <strong>Help > Help Contents</strong>, the "HTTP ERROR:500" message can appear in the Help page due to an Eclipse Kepler bug. To see the Help page, see <a href="https://developer.tizen.org/development" target="_blank">https://developer.tizen.org/development</a> or use JRE 1.7.</li>
</ul>
</li>
<li>Web IDE
<li>Native UI Builder
<ul>
<li>When the WYSIWYG editor of the Native UI Builder for Windows® is running, a project deletion does not work properly. To solve the problem, close the editor.</li>
- <li>If the WYSIWYG editor of the Native UI Builder for Windows® runs over 12 hours, your computer slows down because of the editor's high memory usage. To solve the problem, restart the Tizen IDE.</li>
+ <li>If the WYSIWYG editor of the Native UI Builder for Windows® runs over 12 hours, your computer slows down because of the editor's high memory usage. To solve the problem, restart the Tizen IDE.</li>
<li>If you develop a wearable circular application using the Native UI Builder, it is impossible to register the application to the Tizen Store due to some blacklist APIs. This issue will be solved in the next release.</li>
</ul>
</li>
<li>Ubuntu sometimes stops responding for a few seconds after closing the Emulator Manager. This issue is related to an IBus (Intelligent Input Bus) bug. When the issue occurs, restart the ibus-daemon by entering the <span style="font-family: Courier New,Courier,monospace">ibus-daemon –drx</span> command at the command prompt, and use another framework, such as uim and fcitx, for multilingual input.</li>
<li>To use the Tizen Emulator, install an Intel VTx supported by the CPU, and the latest version of the graphic card driver provided by the vendor. Check the prerequisites for the Tizen Emulator from <a href="../install/sdk_prerequisites.htm">Prerequisites for the Tizen SDK</a>.
<ul>
- <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
<li>On Ubuntu, if the graphics driver is out-of-date, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
<li>On Ubuntu 14.04, a shortcut menu can sometimes appear transparent.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered with another window. If you click the Emulator window, the display surface runs correctly again.</li>
- <li>On Windows®, if a 'failed to allocate memory' error occurs while executing the Emulator, try the following:
+ <li>On Windows®, if a 'failed to allocate memory' error occurs while executing the Emulator, try the following:
<ul>
<li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set to 768 or 1024 MB for the VM in the Emulator Manager, change it to 512 MB.</li>
<h1>Tizen 2.4 Rev8 Release Notes</h1>
-<ul>
+<ul>
<li>Release Date: Aug 2, 2016</li>
</ul>
-
+
<h2 id="ide_tools">IDE and Tools</h2>
<h3>New Features</h3>
</ul>
</li>
</ul>
-
+
<h3>Known Issues</h3>
<ul>
<li>Installer and Update Manager
<ul>
<li>If the SDK Update Notification appears when you start the Tizen IDE or Emulator on Mac OS® X, a terminal (<span style="font-family: Courier New,Courier,monospace">shell.exec</span>) icon can appear on the dock for a few seconds.</li>
- <li>If there is a multibyte character in the Tizen SDK installation path, some development packages cannot find the installed SDK's location when they are running.</li>
+ <li>If there is a multibyte character in the Tizen SDK installation path, some development packages cannot find the installed SDK's location when they are running.</li>
</ul>
</li>
<li>Web and Native IDE
<ul>
- <li>If JRE 1.8 is installed on your computer and you select in the IDE menu <strong>Help > Help Contents</strong>, the "HTTP ERROR:500" message can appear in the Help page due to an Eclipse Kepler bug. To see the Help page, see <a href="https://developer.tizen.org/development" target="_blank">https://developer.tizen.org/development</a> or use JRE 1.7.</li>
+ <li>If JRE 1.8 is installed on your computer and you select in the IDE menu <strong>Help > Help Contents</strong>, the "HTTP ERROR:500" message can appear in the Help page due to an Eclipse Kepler bug. To see the Help page, see <a href="https://developer.tizen.org/development" target="_blank">https://developer.tizen.org/development</a> or use JRE 1.7.</li>
<li>On Windows®, if there is a file name in the project containing a non-ASCII character, the project packaging can fail. This issue does not occur on Ubuntu or Mac OS® X.</li>
</ul>
</li>
<li>Native UI Builder
<ul>
<li>When the WYSIWYG editor of the Native UI Builder for Windows® is running, a project deletion does not work properly. To solve the problem, close the editor.</li>
- <li>If the WYSIWYG editor of the Native UI Builder for Windows® runs over 12 hours, your computer slows down because of the editor's high memory usage. To solve the problem, restart the Tizen IDE.</li>
+ <li>If the WYSIWYG editor of the Native UI Builder for Windows® runs over 12 hours, your computer slows down because of the editor's high memory usage. To solve the problem, restart the Tizen IDE.</li>
</ul>
</li>
<li>Emulator
<li>Ubuntu sometimes stops responding for a few seconds after closing the Emulator Manager. This issue is related to an IBus (Intelligent Input Bus) bug. When the issue occurs, restart the ibus-daemon by entering the <span style="font-family: Courier New,Courier,monospace">ibus-daemon –drx</span> command at the command prompt, and use another framework, such as uim and fcitx, for multilingual input.</li>
<li>To use the Tizen Emulator, install an Intel VTx supported by the CPU, and the latest version of the graphic card driver provided by the vendor. Check the prerequisites for the Tizen Emulator from <a href="../install/sdk_prerequisites.htm">Prerequisites for the Tizen SDK</a>.
<ul>
- <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
+ <li>If the host machine is using Nvidia Optimus™ technology on either Ubuntu or Windows®, you must set the Tizen Emulator to run with your Nvidia® graphics card. In case of Ubuntu, check the bumblebee project (<a href="https://wiki.ubuntu.com/Bumblebee" target="_blank">https://wiki.ubuntu.com/Bumblebee</a>). In case of Windows®, select "High Speed NVIDIA Processor" as "Preferred Graphics processor" in the Nvidia® control panel.</li>
<li>On Ubuntu, if the graphics driver is out-of-date, your Ubuntu desktop session can be occasionally logged out when launching the Emulator Manager, or the Emulator skin can be drawn improperly. Check the prerequisites and upgrade to the latest graphics driver.</li>
</ul>
</li>
<li>On Ubuntu 14.04, a shortcut menu can sometimes appear transparent.</li>
<li>On Windows®, depending on your OS theme (such as Non-Aero themes and Windows XP themes), a display surface can be erased for a while if the Emulator window is covered with another window. If you click the Emulator window, the display surface runs correctly again.</li>
- <li>On Windows®, if a 'failed to allocate memory' error occurs while executing the Emulator, try the following:
+ <li>On Windows®, if a 'failed to allocate memory' error occurs while executing the Emulator, try the following:
<ul>
<li>Close some other programs and try to launch the Emulator again.</li>
<li>If the RAM size is set to 768 or 1024 MB for the VM in the Emulator Manager, change it to 512 MB.</li>
<h2 id="notes">Tizen SDK Release Notes</h2>
-<ul>
- <li><a href="2_4_rev8_release_notes.htm">Tizen 2.4 Rev8 SDK Release Notes</a></li>
+<ul>
+ <li><a href="2_4_rev8_release_notes.htm">Tizen 2.4 Rev8 SDK Release Notes</a></li>
</ul>
<script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
- <head>
- <script type="text/javascript" src="html/scripts/snippet.js"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href="html/css/styles.css" rel="StyleSheet" type="text/css" />
- <link href="html/css/snippet.css" rel="StyleSheet" type="text/css" />
- <title>About This Content</title>
- </head>
- <body onload="prettyPrint()">
-
- <h1><a name="Creating2" id="Creating2">About This Content</a></h1>
- <p>Tizen Studio 1.0.0</p>
+ <head>
+ <script type="text/javascript" src="html/scripts/snippet.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link href="html/css/styles.css" rel="StyleSheet" type="text/css" />
+ <link href="html/css/snippet.css" rel="StyleSheet" type="text/css" />
+ <title>About This Content</title>
+ </head>
+ <body onload="prettyPrint()">
- <h1>License</h1>
+ <h1><a name="Creating2" id="Creating2">About This Content</a></h1>
+ <p>Tizen Studio 1.0.0</p>
+
+ <h1>License</h1>
<p>Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
- <head>
- <script type="text/javascript" src="html/scripts/snippet.js"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href="html/css/styles.css" rel="StyleSheet" type="text/css" />
- <link href="html/css/snippet.css" rel="StyleSheet" type="text/css" />
- <title>About This Content</title>
- </head>
- <body onload="prettyPrint()">
-
- <h1><a name="Creating2" id="Creating2">About This Content</a></h1>
- <p>Tizen 2.3.0</p>
+ <head>
+ <script type="text/javascript" src="html/scripts/snippet.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link href="html/css/styles.css" rel="StyleSheet" type="text/css" />
+ <link href="html/css/snippet.css" rel="StyleSheet" type="text/css" />
+ <title>About This Content</title>
+ </head>
+ <body onload="prettyPrint()">
- <h1>License</h1>
+ <h1><a name="Creating2" id="Creating2">About This Content</a></h1>
+ <p>Tizen 2.3.0</p>
+
+ <h1>License</h1>
<p>Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
</body>
</html>
\ No newline at end of file
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<link rel="stylesheet" type="text/css" href="css/snippet.css" />
- <script type="text/javascript" src="scripts/snippet.js"></script>
+ <script type="text/javascript" src="scripts/snippet.js"></script>
<script type="text/javascript" src="scripts/jquery.util.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/common.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/core.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/search.js" charset="utf-8"></script>
- <title>Tizen API References</title>
+ <title>Tizen API References</title>
</head>
<body onload="prettyPrint()" style="overflow: auto;">
<p>Click the application type you want:</p>
-<p><a href="web_api_reference.htm"><img alt="Web Application" src="images/w_division.png"/></a> <a href="https://developer.tizen.org/dev-guide/latest/org.tizen.native.mobile.apireference/index.html"><img alt="Native Application" src="images/n_division.png"/></a></p>
-
+<p><a href="web_api_reference.htm"><img alt="Web Application" src="images/w_division.png"/></a> <a href="https://developer.tizen.org/dev-guide/latest/org.tizen.native.mobile.apireference/index.html"><img alt="Native Application" src="images/n_division.png"/></a></p>
+
<script type="text/javascript" src="scripts/jquery.zclip.min.js"></script>
<script type="text/javascript" src="scripts/showhide.js"></script>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<link rel="stylesheet" type="text/css" href="../css/styles.css" />
<link rel="stylesheet" type="text/css" href="../css/snippet.css" />
- <script type="text/javascript" src="../scripts/snippet.js"></script>
+ <script type="text/javascript" src="../scripts/snippet.js"></script>
<script type="text/javascript" src="../scripts/jquery.util.js" charset="utf-8"></script>
<script type="text/javascript" src="../scripts/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../scripts/core.js" charset="utf-8"></script>
<h1>Tizen Web Device API Reference</h1>
-
+
<p>Click the profile you want:</p>
<p><a href="mobile/index.html"><img alt="Mobile Web" src="../images/mw_division.png"/></a> <a href="wearable/index.html"><img alt="Wearable Web" src="../images/ww_division.png"/></a></p>
</ul>
<p>
To use <em>add(), remove(), and update()</em> methods of AccountManager can be invoked only
-by account provider application. A web application is an account provider when its <em>config.xml </em>contains <a href="https://developer.tizen.org/development/tools/web-tools/configuration-editor#mw_account">Account provider section</a>. For example:<br><tizen:account multiple-account-support="true"><br> <tizen:icon section="Account">icon.png</tizen:icon><br> <tizen:icon section="AccountSmall">icon.png</tizen:icon><br> <tizen:display-name xml:lang="en-gb">Test</tizen:display-name><br> <tizen:capability>http://tizen.org/account/capability/contact</tizen:capability><br></tizen:account>
+by account provider application. A web application is an account provider when its <em>config.xml </em>contains <a href="https://developer.tizen.org/development/tools/web-tools/configuration-editor#mw_account">Account provider section</a>. For example:<br><tizen:account multiple-account-support="true"><br> <tizen:icon section="Account">icon.png</tizen:icon><br> <tizen:icon section="AccountSmall">icon.png</tizen:icon><br> <tizen:display-name xml:lang="en-gb">Test</tizen:display-name><br> <tizen:capability>http://tizen.org/account/capability/contact</tizen:capability><br></tizen:account>
</p>
<p>
For more information about how to use Account API, see <a href="https://developer.tizen.org/development/guides/web-application/tizen-features/account">Account Guide</a>.
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- var key = 'nickname';
- var value = 'nickname of anonymous user';
- account.setExtendedData(key, value);
- console.log(account.getExtendedData(key)); /* 'Nickname of anonymous user' */
-
- account.setExtendedData(key, 'nickname updated');
- console.log(account.getExtendedData(key)); /* 'Nickname updated' */
- }
+ var account = accounts[0];
+ if (account)
+ {
+ var key = 'nickname';
+ var value = 'nickname of anonymous user';
+ account.setExtendedData(key, value);
+ console.log(account.getExtendedData(key)); /* 'Nickname of anonymous user' */
+
+ account.setExtendedData(key, 'nickname updated');
+ console.log(account.getExtendedData(key)); /* 'Nickname updated' */
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- var key = 'accessToken';
- var value = account.getExtendedData(key);
- console.log(account.userName + "'s accessToken is " + value);
- }
+ var account = accounts[0];
+ if (account)
+ {
+ var key = 'accessToken';
+ var value = account.getExtendedData(key);
+ console.log(account.userName + "'s accessToken is " + value);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- account.getExtendedData(function(extendedData)
- {
- for (var i = 0; i < extendedData.length; i++)
- {
- var key = extendedData.key;
- var value = extendedData.value;
- console.log(key + ": " + value);
- }
- }, function(e)
- {
- console.log("Error: " + e.message);
- });
- }
+ var account = accounts[0];
+ if (account)
+ {
+ account.getExtendedData(function(extendedData)
+ {
+ for (var i = 0; i < extendedData.length; i++)
+ {
+ var key = extendedData.key;
+ var value = extendedData.value;
+ console.log(key + ": " + value);
+ }
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- tizen.account.remove(account.id);
- }
+ var account = accounts[0];
+ if (account)
+ {
+ tizen.account.remove(account.id);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- account.userName = 'abc';
- tizen.account.update(account);
- }
+ var account = accounts[0];
+ if (account)
+ {
+ account.userName = 'abc';
+ tizen.account.update(account);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.account.getAccounts(function(accounts)
{
- /* accounts is an array whose members are all registered accounts in this device */
+ /* accounts is an array whose members are all registered accounts in this device */
}, function(e)
{
- console.log("Error: " + e.message);
+ console.log("Error: " + e.message);
});
</pre>
</div>
var provider = tizen.account.getProvider(appId);
if (!provider)
{
- console.log('current application is not account provider.');
+ console.log('current application is not account provider.');
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.account.getProviders(function(providers)
{
- /*
- providers is an array whose members are account providers
- which have contact capability
- */
+ /*
+ providers is an array whose members are account providers
+ which have contact capability
+ */
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, "http://tizen.org/account/capability/contact");
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.account.addAccountListener(
{
- onadded: function(account)
- {
- /* Callback function which will be called when account is added */
- },
- onremoved: function(accountId)
- {
- /* Callback function which will be called when account is removed */
- },
- onupdated: function(account)
- {
- /* Callback function which will be called when account is updated */
- }
+ onadded: function(account)
+ {
+ /* Callback function which will be called when account is added */
+ },
+ onremoved: function(accountId)
+ {
+ /* Callback function which will be called when account is removed */
+ },
+ onupdated: function(account)
+ {
+ /* Callback function which will be called when account is updated */
+ }
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var watchId = tizen.account.addAccountListener(
{
- onadded: function(account)
- {
- /* Callback function which will be called when account is added */
- },
- onremoved: function(accountId)
- {
- /* Callback function which will be called when account is removed */
- },
- onupdated: function(account)
- {
- /* Callback function which will be called when account is updated */
- }
+ onadded: function(account)
+ {
+ /* Callback function which will be called when account is added */
+ },
+ onremoved: function(accountId)
+ {
+ /* Callback function which will be called when account is removed */
+ },
+ onupdated: function(account)
+ {
+ /* Callback function which will be called when account is updated */
+ }
});
tizen.account.removeAccountListener(watchId);
</pre>
<div class="description">
<p>
Sets an alarm with the application ID to be run. You should definitely provide the application ID to run
-and the <a href="https://developer.tizen.org/development/guides/web-application/tizen-features/application/application#controls">application control</a>information if it is necessary.
+and the <a href="https://developer.tizen.org/development/guides/web-application/tizen-features/application/application#controls">application control</a>information if it is necessary.
For more information about the application control, see <a href="application.html">The Application API</a>.
</p>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">alarm</span>:
+<span class="name">alarm</span>:
An alarm to add. It can be either <em>AlarmRelative </em> or <em>AlarmAbsolute</em>.
</li>
<li class="param">
-<span class="name">applicationId</span>:
+<span class="name">applicationId</span>:
The application ID to run when the alarm is triggered.
</li>
<li class="param">
-<span class="name">appControl</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">appControl</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The data structure describing application control details.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">alarm</span>:
+<span class="name">alarm</span>:
An alarm to add. It can be either <em>AlarmRelative</em> or <em>AlarmAbsolute</em>.
</li>
<li class="param">
-<span class="name">notification</span>:
+<span class="name">notification</span>:
Notification to be added to the alarm.
</li>
</ul>
var alarm = new tizen.AlarmAbsolute(new Date(2017, 10, 4, 8, 0));
var notificationDict =
{
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3"
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3"
};
var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the alarm to remove
</li>
</ul>
/* Removes the first alarm */
if (alarms.length > 0)
{
- try
- {
- tizen.alarm.remove(alarms[0].id);
- console.log("Successfully removed the first alarm.");
- }
- catch (error)
- {
- console.log("Failed to remove the first alarm.");
- }
+ try
+ {
+ tizen.alarm.remove(alarms[0].id);
+ console.log("Successfully removed the first alarm.");
+ }
+ catch (error)
+ {
+ console.log("Failed to remove the first alarm.");
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The alarm ID to retrieve.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
ID which uniquely identifies a scheduled alarm.
</li>
</ul>
var notificationDict =
{
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3"
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3"
};
var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
tizen.alarm.add(alarm2, appId);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AlarmRelative::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AlarmRelative(long delay, optional long? period);</pre></dl>
tizen.alarm.add(alarm3, appId);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AlarmAbsolute::constructor">Constructors</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contextId</span>:
+<span class="name">contextId</span>:
The identifier of the application to kill
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an application is killed successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onKillSuccess()
{
- console.log("Application terminated successfully");
+ console.log("Application terminated successfully");
}
function onRunningAppsContext(contexts)
{
- /* Let's assume that the application "targetApp0.main" has been installed */
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++)
- {
- if (contexts[i].appId == targetId)
- {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
}
tizen.application.getAppsContext(onRunningAppsContext);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
A unique string representing the application ID
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess()
{
- console.log("The application has launched successfully");
+ console.log("The application has launched successfully");
}
/* Let's assume that application "targetApp0.main" has been installed */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
The data structure describing application control details
</li>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An identifier of the application to be launched. If the ID is <var>null </var>or not specified, then the system tries to find the application to be launched for the requested application control
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
<li class="param">
-<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the application gets back results from the launched application
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
-var appControlReplyCallback =
+var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
A data structure describing application control details
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call that returns a list of application information
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onRunningAppsContext(contexts)
{
- for (var i = 0; i < contexts.length; i++)
- console.log("ID: " + contexts[i].id);
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
}
tizen.application.getAppsContext(onRunningAppsContext);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contextId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">contextId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application context ID<br>If the ID is not provided, the application context of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID<br>If the ID is not provided, the application information of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the application certificate of the calling application is returned.
</li>
</ul>
for (var i = 0; i < appCerts.length; i++)
{
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the shared directory URI of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the application metadata array of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">eventCallback</span>:
+<span class="name">eventCallback</span>:
The method to call when a change on the installed applications is made
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var appEventCallback =
+var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
An ID that identifies the listener
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var appEventCallback =
+var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
tizen.application.removeAppInfoEventListener(watchId);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
-if (reqAppControl)
+if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Event which will invoke the callback
</li>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback function to be invoked when the event occurs
</li>
</ul>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- });
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Listener identifier
</li>
</ul>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- if (watchId)
- {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Event to broadcast
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
User defined event data to broadcast
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var myCustomData =
+var myCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Trusted event to broadcast
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
User defined trusted event data to broadcast
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var myTrustedCustomData =
+var myTrustedCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
- null, "image/jpeg", null,
- [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
</pre>
</div>
<div class="constructors">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An array of ApplicationControlData objects
</li>
</ul>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
}
</pre>
</div>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- reqAppControl.replyFailure();
- }
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed applications
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed applications
</li>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
The application control that is passed to <em>ApplicationManager.findAppControl()</em> </li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* FindAppControlSuccessCallback instance */
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contexts</span>:
+<span class="name">contexts</span>:
A list of running applications
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* ApplicationControlDataArrayReplyCallback instance */
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
<div class="methods">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An array of <em>ApplicationControlData</em> objects
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The application information of the installed application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The application information of the updated application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the uninstalled application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Broadcasted event which invokes this callback
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Broadcasted event data
</li>
</ul>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- };
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
File to open
</li>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
File mode for the opened archive. Determines which operations are available
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when archive is opened successfully
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Additional options for initializing the ArchiveFile instance
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCallback(archive)
{
- console.log("Success, can now read from archive " + archive);
+ console.log("Success, can now read from archive " + archive);
}
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">operationIdentifier</span>:
+<span class="name">operationIdentifier</span>:
Task ID returned by an asynchronous function from this module
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function openSuccess(archive)
{
- operationId = archive.extractAll("downloads/extracted");
- tizen.archive.abort(operationId);
+ operationId = archive.extractAll("downloads/extracted");
+ tizen.archive.abort(operationId);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">sourceFile</span>:
+<span class="name">sourceFile</span>:
File or directory to be added to archive
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when this operation is completed successfully
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked to notify about operation progress <br>It is called every time a single source file has been completely added.
If the source file is big then the callback can also be called while the file is being processed.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Additional options used to control how the sourceFile will be compressed and stored in the archive
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function successCallback()
{
- console.log("done");
+ console.log("done");
}
function progressCallback(opId, val, name)
{
- console.log("opId: " + opId + " with progress val: " + val);
+ console.log("opId: " + opId + " with progress val: " + val);
}
function createSuccess(archive)
{
- archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
+ archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
}
tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">destinationDirectory</span>:
+<span class="name">destinationDirectory</span>:
Directory where extracted files will be stored <br>Specified as a virtual path or a <em>File</em> object representing a directory.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an archive is extracted successfully
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked while the extracting is in progress <br>The onprogress callback is called at least once. It will be invoked for every extracted file.
</li>
<li class="param">
-<span class="name">overwrite</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">overwrite</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag indicating whether to overwrite or keep the existing files with the same name in the <var>destinationDirectory</var> location when extracting an archive <br>By default, this attribute is set to <var>false</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function successCallback()
{
- console.log("done");
+ console.log("done");
}
function progressCallback(opId, val, name)
{
- console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
+ console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
}
function openSuccess(archive)
{
- archive.extractAll("music", successCallback, errorCallback, progressCallback);
+ archive.extractAll("music", successCallback, errorCallback, progressCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when information about all the files in the archive is successfully retrieved
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function getEntriesSuccess(entries)
{
- console.log("Entries length: " + entries.length);
- for (var i = 0; i < entries.length; i++)
- {
- console.log(entries[i].name);
- }
+ console.log("Entries length: " + entries.length);
+ for (var i = 0; i < entries.length; i++)
+ {
+ console.log(entries[i].name);
+ }
}
function openSuccess(archive)
{
- archive.getEntries(getEntriesSuccess, errorCallback);
+ archive.getEntries(getEntriesSuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name of <em>ArchiveFileEntry</em> to extract
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a file matched with the given name is found
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function getEntrySuccess(entry)
{
- console.log("Entry: " + entry.name + " size: " + entry.size);
+ console.log("Entry: " + entry.name + " size: " + entry.size);
}
function openSuccess(archive)
{
- archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
+ archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">destinationDirectory</span>:
+<span class="name">destinationDirectory</span>:
Directory where extracted files will be stored <br>Given as a virtual path or a <em>File</em> object representing a directory.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an extract operation is completed
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked while the extracting is in progress <br>The onprogress callback is called at least once. It will be invoked for every extracted file.
</li>
<li class="param">
-<span class="name">stripName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">stripName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag which determines if directory name part of <em>ArchiveFileEntry</em> should be removed or preserved <br>The default value is <var>false</var>. If it is <var>true</var>, use only base name (part after last slash) as a target path.
</li>
<li class="param">
-<span class="name">overwrite</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">overwrite</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag which determines if it possible to overwrite files when the decompressed file already exists in this destination location <br>The default value is <var>false</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function extractSuccessCallback()
{
- console.log("done");
+ console.log("done");
}
function getEntrySuccess(entry)
{
- entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
+ entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
}
function openSuccess(archive)
{
- archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
+ archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">archive</span>:
+<span class="name">archive</span>:
Archive file object
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entry</span>:
+<span class="name">entry</span>:
ArchiveFileEntry object representing the file found in ArchiveFile
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entries</span>:
+<span class="name">entries</span>:
List of ArchiveFileEntry objects found in ArchiveFile
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">operationIdentifier</span>:
+<span class="name">operationIdentifier</span>:
Operation identifier for which progress is reported
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
Progress of the operation, value between 0.0 and 1.0 where 1.0 is 100% progress
</li>
<li class="param">
-<span class="name">filename</span>:
+<span class="name">filename</span>:
Name of the compressed or extracted file
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the application to update the badge
</li>
<li class="param">
-<span class="name">count</span>:
+<span class="name">count</span>:
Number to display as the badge on the application icon<br>To remove the badge, set the value of this param to 0.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the designated application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appIdList</span>:
+<span class="name">appIdList</span>:
Array of the ID of the designated application
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method to be invoked when a badge number change notification is received
</li>
</ul>
function onListInstalledApps(appsInfo)
{
- function watcher(appId, count)
- {
- console.log(appId + ' badge number were updated: ' + count);
- }
+ function watcher(appId, count)
+ {
+ console.log(appId + ' badge number were updated: ' + count);
+ }
- /* Registers to be notified when the badge number changes */
- tizen.badge.addChangeListener([appsInfo[0].id, [appsInfo[1].id], watcher);
+ /* Registers to be notified when the badge number changes */
+ tizen.badge.addChangeListener([appsInfo[0].id, [appsInfo[1].id], watcher);
}
tizen.application.getAppsInfo(onListInstalledApps);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appIdList</span>:
+<span class="name">appIdList</span>:
Array of the ID of the designated application
</li>
</ul>
function onListInstalledApps(appsInfo)
{
- function watcher(appId, count)
- {
- console.log(appId + ' badge number were updated: ' + count);
- }
+ function watcher(appId, count)
+ {
+ console.log(appId + ' badge number were updated: ' + count);
+ }
- /* Registers to be notified when the badge number changes */
- tizen.badge.addChangeListener([appsInfo[0].id, [appsInfo[1].id], watcher);
+ /* Registers to be notified when the badge number changes */
+ tizen.badge.addChangeListener([appsInfo[0].id, [appsInfo[1].id], watcher);
- /* Cancels the watch operation */
- tizen.badge.removeChangeListener([appsInfo[0].id, [appsInfo[1].id]);
+ /* Cancels the watch operation */
+ tizen.badge.removeChangeListener([appsInfo[0].id, [appsInfo[1].id]);
}
tizen.application.getAppsInfo(onListInstalledApps);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the designated application
</li>
<li class="param">
-<span class="name">count</span>:
+<span class="name">count</span>:
Count of the badge
</li>
</ul>
/* Logs the number of badge changes */
function watcher(appId, count)
{
- console.log(appId + ' -> badge number updates: ' + count);
+ console.log(appId + ' -> badge number updates: ' + count);
}
/* Gets Application's ID */
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var advertData =
+var advertData =
{
- includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
- appearance: 192, includeTxPowerLevel: false
+ includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
+ appearance: 192, includeTxPowerLevel: false
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var advertData =
{
- includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
- appearance: 192, includeTxPowerLevel: false
+ includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
+ appearance: 192, includeTxPowerLevel: false
}
var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
</pre>
http://tizen.org/privilege/bluetooth
</p>
<p class="warning"><b>Warning:</b>
- <em>http://tizen.org/privilege/bluetooth.gap</em> <em>(public level)</em> has been deprecated since 2.4.
+ <em>http://tizen.org/privilege/bluetooth.gap</em> <em>(public level)</em> has been deprecated since 2.4.
Instead, use <em>http://tizen.org/privilege/bluetooth</em>.
</p>
<div class="returntype">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter = tizen.bluetooth.getDefaultAdapter();
+ var adapter = tizen.bluetooth.getDefaultAdapter();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
http://tizen.org/privilege/bluetooth
</p>
<p class="warning"><b>Warning:</b>
- <em>http://tizen.org/privilege/bluetooth.admin</em> <em>(public level)</em> has been deprecated since 2.4.
+ <em>http://tizen.org/privilege/bluetooth.admin</em> <em>(public level)</em> has been deprecated since 2.4.
Instead, use <em>http://tizen.org/privilege/bluetooth</em>.
</p>
<p><span class="remark"> Remark : </span>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter = tizen.bluetooth.getLEAdapter();
+ var adapter = tizen.bluetooth.getLEAdapter();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
http://tizen.org/privilege/bluetooth
</p>
<p class="warning"><b>Warning:</b>
- <em>http://tizen.org/privilege/bluetooth.admin</em> <em>(public level)</em> has been deprecated since 2.4.
+ <em>http://tizen.org/privilege/bluetooth.admin</em> <em>(public level)</em> has been deprecated since 2.4.
Instead, use <em>http://tizen.org/privilege/bluetooth</em>.
</p>
<p><span class="remark"> Remark : </span>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name to set
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function changeName(newName)
{
- if (adapter.name != newName)
- {
- /* Initiate change name */
- adapter.setName(newName, function()
- {
- console.log("Adapter name changed to " + adapter.name);
- }, function(e)
- {
- console.log("Failed to change name: " + e.message);
- });
- }
+ if (adapter.name != newName)
+ {
+ /* Initiate change name */
+ adapter.setName(newName, function()
+ {
+ console.log("Adapter name changed to " + adapter.name);
+ }, function(e)
+ {
+ console.log("Failed to change name: " + e.message);
+ });
+ }
}
if (bt_always_on === false)
{
- changeName("myDevice");
+ changeName("myDevice");
}
</pre>
</div>
http://tizen.org/privilege/bluetooth
</p>
<p class="warning"><b>Warning:</b>
- <em>http://tizen.org/privilege/bluetooth.admin</em> <em>(public level)</em> has been deprecated since 2.4.
+ <em>http://tizen.org/privilege/bluetooth.admin</em> <em>(public level)</em> has been deprecated since 2.4.
Instead, use <em>http://tizen.org/privilege/bluetooth</em>.
</p>
<p><span class="remark"> Remark : </span>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
State to set: <var>true</var> to power on Bluetooth, <var>false</var> to power it off
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called on successful Bluetooth activation/deactivation
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called on failure of a Bluetooth activation/deactivation
</li>
</ul>
function powerOn()
{
- /* If adapter is not powered on */
- if (!adapter.powered)
- {
- /* Initiates power on */
- adapter.setPowered(true, function()
- {
- console.log("Bluetooth powered on success.");
- }, function(e)
- {
- console.log("Failed to power on Bluetooth: " + e.message);
- });
- }
+ /* If adapter is not powered on */
+ if (!adapter.powered)
+ {
+ /* Initiates power on */
+ adapter.setPowered(true, function()
+ {
+ console.log("Bluetooth powered on success.");
+ }, function(e)
+ {
+ console.log("Failed to power on Bluetooth: " + e.message);
+ });
+ }
}
function powerOff()
{
- /* If powered on */
- if (adapter.powered)
- {
- /* Initiates power off */
- adapter.setPowered(false, function()
- {
- console.log("Bluetooth powered off successfully.");
- }, function(e)
- {
- console.log("Failed to power off Bluetooth: " + e.message);
- });
- }
+ /* If powered on */
+ if (adapter.powered)
+ {
+ /* Initiates power off */
+ adapter.setPowered(false, function()
+ {
+ console.log("Bluetooth powered off successfully.");
+ }, function(e)
+ {
+ console.log("Failed to power off Bluetooth: " + e.message);
+ });
+ }
}
var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
if (bt_always_on === true)
{
- console.log("Bluetooth cannot be turn off or on because this device must be always enabled.");
+ console.log("Bluetooth cannot be turn off or on because this device must be always enabled.");
}
else
{
- powerOn();
+ powerOn();
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
The Bluetooth Adapter event listener to set
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changeListener =
{
- onstatechanged: function(powered)
- {
- console.log("Power state is changed into: " + powered);
- },
- onnamechanged: function(name)
- {
- console.log("Name is changed to: " + name);
- },
- onvisibilitychanged: function(visible)
- {
- console.log("Visibility is changed into: " + visible);
- }
+ onstatechanged: function(powered)
+ {
+ console.log("Power state is changed into: " + powered);
+ },
+ onnamechanged: function(name)
+ {
+ console.log("Name is changed to: " + name);
+ },
+ onvisibilitychanged: function(visible)
+ {
+ console.log("Visibility is changed into: " + visible);
+ }
};
var adapter = tizen.bluetooth.getDefaultAdapter();
var changeListener =
{
- onstatechanged: function(powered)
- {
- console.log("Power state is changed into: " + powered);
- if (!powered)
- adapter.unsetChangeListener();
- },
- onnamechanged: function(name)
- {
- console.log("Name is changed to: " + name);
- },
- onvisibilitychanged: function(visible)
- {
- console.log("Visibility is changed into: " + visible);
- }
+ onstatechanged: function(powered)
+ {
+ console.log("Power state is changed into: " + powered);
+ if (!powered)
+ adapter.unsetChangeListener();
+ },
+ onnamechanged: function(name)
+ {
+ console.log("Name is changed to: " + name);
+ },
+ onvisibilitychanged: function(visible)
+ {
+ console.log("Visibility is changed into: " + visible);
+ }
};
adapter.setChangeListener(changeListener);
http://tizen.org/privilege/bluetooth
</p>
<p class="warning"><b>Warning:</b>
- <em>http://tizen.org/privilege/bluetooth.gap</em> <em>(public level)</em> has been deprecated since 2.4.
+ <em>http://tizen.org/privilege/bluetooth.gap</em> <em>(public level)</em> has been deprecated since 2.4.
Instead, use <em>http://tizen.org/privilege/bluetooth</em>.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function startDiscovery()
{
- var discoverDevicesSuccessCallback =
- {
- onstarted: function()
- {
- console.log("Device discovery started...");
- },
- ondevicefound: function(device)
- {
- console.log("Found device - name: " + device.name + ", Address: " + device.address);
- },
- ondevicedisappeared: function(address)
- {
- console.log("Device disappeared: " + address);
- },
- onfinished: function(devices)
- {
- console.log("Found Devices");
- for (var i = 0; i < devices.length; i++)
- {
- console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
- };
-
- /* Starts searching for nearby devices, for about 12 sec */
- adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
- {
- console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
- });
+ var discoverDevicesSuccessCallback =
+ {
+ onstarted: function()
+ {
+ console.log("Device discovery started...");
+ },
+ ondevicefound: function(device)
+ {
+ console.log("Found device - name: " + device.name + ", Address: " + device.address);
+ },
+ ondevicedisappeared: function(address)
+ {
+ console.log("Device disappeared: " + address);
+ },
+ onfinished: function(devices)
+ {
+ console.log("Found Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+ }
+ };
+
+ /* Starts searching for nearby devices, for about 12 sec */
+ adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
+ {
+ console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
+ });
}
function onSetPoweredError(e)
{
- console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
+ console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
}
adapter.setPowered(true, startDiscovery, onSetPoweredError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function to invoke when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function to invoke when an error occurs
</li>
</ul>
/* Calls this method whenever user finds one of the device */
function cancelDiscovery()
{
- adapter.stopDiscovery(function()
- {
- console.log("Stop discovery success.");
- }, function(e)
- {
- console.log("Error while stopDiscovery:" + e.message);
- });
+ adapter.stopDiscovery(function()
+ {
+ console.log("Stop discovery success.");
+ }, function(e)
+ {
+ console.log("Error while stopDiscovery:" + e.message);
+ });
}
function startDiscovery()
{
- var discoverDevicesSuccessCallback =
- {
- onstarted: function()
- {
- console.log("Device discovery started...");
- },
- ondevicefound: function(device)
- {
- console.log("Found device - name: " + device.name + ", Address: " + device.address);
- /* Shows the device to user to check if this is the device user is looking for */
- /* For example, add this to list view */
-
- cancelDiscovery();
- },
- ondevicedisappeared: function(address)
- {
- console.log("Device disappeared: " + address);
- /* Removes from list, as it is no longer valid */
- },
- onfinished: function(devices)
- {
- console.log("Found Devices");
- for (var i = 0; i < devices.length; i++)
- {
- console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
- };
-
- /* Starts searching for nearby devices, for about 12 sec */
- adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
- {
- console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
- });
+ var discoverDevicesSuccessCallback =
+ {
+ onstarted: function()
+ {
+ console.log("Device discovery started...");
+ },
+ ondevicefound: function(device)
+ {
+ console.log("Found device - name: " + device.name + ", Address: " + device.address);
+ /* Shows the device to user to check if this is the device user is looking for */
+ /* For example, add this to list view */
+
+ cancelDiscovery();
+ },
+ ondevicedisappeared: function(address)
+ {
+ console.log("Device disappeared: " + address);
+ /* Removes from list, as it is no longer valid */
+ },
+ onfinished: function(devices)
+ {
+ console.log("Found Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+ }
+ };
+
+ /* Starts searching for nearby devices, for about 12 sec */
+ adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
+ {
+ console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
+ });
}
function onSetPoweredError(e)
{
- console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
+ console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
}
adapter.setPowered(true, startDiscovery, onSetPoweredError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function to invoke at retrieval of a list of Bluetooth devices that were bonded (paired) to the local Bluetooth adapter
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function to invoke in case of failure in finding bonded devices
</li>
</ul>
function onGotDevices(devices)
{
- console.log("Devices");
- for (var i = 0; i < devices.length; i++)
- {
- console.log(" Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
+ console.log("Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log(" Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
}
function onError(e)
{
- console.log("Error: " + e.message);
+ console.log("Error: " + e.message);
}
function onBluetoothsetPowered()
{
- adapter.getKnownDevices(onGotDevices, onError);
+ adapter.getKnownDevices(onGotDevices, onError);
}
/* Turns on Bluetooth */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">address</span>:
+<span class="name">address</span>:
Address of a remote Bluetooth device to get
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function gotDeviceInfo(device)
{
- console.log("Device Name: " + device.name);
- console.log("Device Address: " + device.address);
- console.log("Device Class: " + device.deviceClass.major);
- console.log("Is Bonded: " + (device.isBonded ? "Yes" : "No"));
+ console.log("Device Name: " + device.name);
+ console.log("Device Address: " + device.address);
+ console.log("Device Class: " + device.deviceClass.major);
+ console.log("Is Bonded: " + (device.isBonded ? "Yes" : "No"));
}
function onError(e)
{
- console.log("Could not get device info:" + e.message);
+ console.log("Could not get device info:" + e.message);
}
var adapter = tizen.bluetooth.getDefaultAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">address</span>:
+<span class="name">address</span>:
MAC address of remote Bluetooth address to bond with
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onBondingSuccess(device)
{
- console.log("Device Name:" + device.name);
- console.log("Device Address:" + device.address);
- console.log("Device Service UUIDs:" + device.uuids.join("\n"));
+ console.log("Device Name:" + device.name);
+ console.log("Device Address:" + device.address);
+ console.log("Device Service UUIDs:" + device.uuids.join("\n"));
}
function onError(e)
{
- console.log("Could not create bonding, reason:" + e.message);
+ console.log("Could not create bonding, reason:" + e.message);
}
var adapter = tizen.bluetooth.getDefaultAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">address</span>:
+<span class="name">address</span>:
Address of a bonded device
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function gotDevice(device)
{
- if (device.isBonded)
- {
- /* Initiates destroying bonding */
- adapter.destroyBonding(device.address, function()
- {
- console.log("Succeeded to destroy the bond success with:" + device.address);
- }, function(e)
- {
- console.log("Failed to destroy the bond with " + device.address + ", reason: " + e.message);
- });
- }
+ if (device.isBonded)
+ {
+ /* Initiates destroying bonding */
+ adapter.destroyBonding(device.address, function()
+ {
+ console.log("Succeeded to destroy the bond success with:" + device.address);
+ }, function(e)
+ {
+ console.log("Failed to destroy the bond with " + device.address + ", reason: " + e.message);
+ });
+ }
}
var deviceAddress = "35:F4:59:D1:7A:03";
adapter.getDevice(deviceAddress, gotDevice, function(e)
{
- console.log("Failed to get device info for " + deviceAddress + ", reason: " + e.message);
+ console.log("Failed to get device info for " + deviceAddress + ", reason: " + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uuid</span>:
+<span class="name">uuid</span>:
UUID of the new service, to which clients connect
</li>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name of a service
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called on successful service registration
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function chatServiceSuccessCb(recordHandler)
{
- console.log("Chat service registration succeeds!");
- chatServiceHandler = recordHandler;
- recordHandler.onconnect = function(socket)
- {
- console.log("Client connected: " + socket.peer.name + "," + socket.peer.address);
- serviceSocket = socket;
- /* Messages received from remote device */
- socket.onmessage = function()
- {
- var data = socket.readData();
- /* Handles message code goes here */
- };
-
- socket.onclose = function()
- {
- console.log('The socket is closed.');
- serviceSocket = null;
- };
- };
+ console.log("Chat service registration succeeds!");
+ chatServiceHandler = recordHandler;
+ recordHandler.onconnect = function(socket)
+ {
+ console.log("Client connected: " + socket.peer.name + "," + socket.peer.address);
+ serviceSocket = socket;
+ /* Messages received from remote device */
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handles message code goes here */
+ };
+
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ serviceSocket = null;
+ };
+ };
};
function publishChatService()
{
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
- /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
+ var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+ adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
+ /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
}
-function unregisterChatService()
-{
- if (chatServiceHandler != null)
- {
- chatServiceHandler.unregister(function()
- {
- console.log("Chat service is unregistered");
- chatServiceHandler = null;
- }, function(e)
- {
- console.log("Failed to unregister service: " + e.message);
- });
- }
+function unregisterChatService()
+{
+ if (chatServiceHandler != null)
+ {
+ chatServiceHandler.unregister(function()
+ {
+ console.log("Chat service is unregistered");
+ chatServiceHandler = null;
+ }, function(e)
+ {
+ console.log("Failed to unregister service: " + e.message);
+ });
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileType</span>:
+<span class="name">profileType</span>:
Bluetooth Profile type
</li>
</ul>
if (healthCapability)
{
- healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+ healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
}
else
{
- console.log("Bluetooth Health Profile is not supported on this device.");
+ console.log("Bluetooth Health Profile is not supported on this device.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
called when advertisement is found.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("[Found device] address: " + device.address);
+ console.log("[Found device] address: " + device.address);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- adapter.stopScan();
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ adapter.stopScan();
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">advertiseData</span>:
+<span class="name">advertiseData</span>:
BluetoothLEAdvertiseData object to be added
</li>
<li class="param">
-<span class="name">packetType</span>:
+<span class="name">packetType</span>:
The bluetooth LE packet type
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when advertise is started successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The power and latency mode of advertising. The default mode is "BALANCED".
</li>
<li class="param">
-<span class="name">connectable</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">connectable</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The connectable status. It's true if the advertisement will be connectable. The default value of the parameter is <var>true</var>.
</li>
</ul>
var heart_rate_svc_uuid_16 = "180d"; /* Service solicitation UUID, 16-bit UUID is supported (e.g. 180d) */
var advertiseOptions =
{
- includeName: true, /* Whether the device name should be included */
- includeTxPowerLevel: true, /* Whether the transmission power level should be included */
- appearance: 192, /* External appearance of device, 192 - Generic Watch */
- uuids: [battery_svc_uuid_16],
- solicitationuuids: [heart_rate_svc_uuid_16]
+ includeName: true, /* Whether the device name should be included */
+ includeTxPowerLevel: true, /* Whether the transmission power level should be included */
+ appearance: 192, /* External appearance of device, 192 - Generic Watch */
+ uuids: [battery_svc_uuid_16],
+ solicitationuuids: [heart_rate_svc_uuid_16]
};
var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
adapter.startAdvertise(advertiseData, "ADVERTISE", function onstate(state)
{
- console.log("Advertiser state: " + state);
+ console.log("Advertiser state: " + state);
}, function(e)
{
- console.log("Failed to startAdvertise: " + e.message);
+ console.log("Failed to startAdvertise: " + e.message);
}, "LOW_LATENCY", connectable);
</pre>
</div>
var heart_rate_svc_uuid_16 = "180d"; /* Service solicitation UUID, 16-bit UUID is supported (e.g. 180d) */
var advertiseOptions =
{
- includeName: true, /* Whether the device name should be included */
- includeTxPowerLevel: true, /* Whether the transmission power level should be included */
- appearance: 192, /* External appearance of device, 192 - Generic Watch */
- uuids: [battery_svc_uuid_16],
- solicitationuuids: [heart_rate_svc_uuid_16]
+ includeName: true, /* Whether the device name should be included */
+ includeTxPowerLevel: true, /* Whether the transmission power level should be included */
+ appearance: 192, /* External appearance of device, 192 - Generic Watch */
+ uuids: [battery_svc_uuid_16],
+ solicitationuuids: [heart_rate_svc_uuid_16]
};
var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
adapter.startAdvertise(advertiseData, "ADVERTISE", function onstate(state)
{
- console.log("Advertiser state: " + state);
+ console.log("Advertiser state: " + state);
});
adapter.stopAdvertise();
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onconnected(device)
{
- console.log("Connected to device");
- var service = device.getService(device.uuids[0]);
- console.log("Service got");
+ console.log("Connected to device");
+ var service = device.getService(device.uuids[0]);
+ console.log("Service got");
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("[Found device] address: " + device.address);
- device.connect(onconnected.bind(null, device), onerror);
+ console.log("[Found device] address: " + device.address);
+ device.connect(onconnected.bind(null, device), onerror);
});
</pre>
</div>
var service = device.getService(device.uuids[0]);
for (var i = 0; i service.services.length; ++i)
{
- console.log("Subservices UUID " + service.services[i].uuid);
+ console.log("Subservices UUID " + service.services[i].uuid);
}
</pre>
</div>
var service = device.getService(device.uuids[0]);
for (var i = 0; i service.characteristics.length; ++i)
{
- console.log("Subservices UUID " + service.characteristics[i].isWritable);
+ console.log("Subservices UUID " + service.characteristics[i].isWritable);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the characteristic value is read successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function proccessDevice(device)
{
- device.connect(onConnected, onerror);
- function onConnected()
- {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- characteristic.readValue(function(val)
- {
- console.log("Value read: " + val);
- device.disconnect();
- });
- }
- }
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ characteristic.readValue(function(val)
+ {
+ console.log("Value read: " + val);
+ device.disconnect();
+ });
+ }
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
the characteristic value to write
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the characteristic value is written successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function proccessDevice(device)
{
- device.connect(onConnected, onerror);
- function onConnected()
- {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- var data = new Array(1, 2, 3, 4, 5, 6);
- characteristic.writeValue(data, function()
- {
- console.log("Value written");
- device.disconnect();
- }, function(e)
- {
- console.log("Failed to write: " + e.message);
- });
- }
- }
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var data = new Array(1, 2, 3, 4, 5, 6);
+ characteristic.writeValue(data, function()
+ {
+ console.log("Value written");
+ device.disconnect();
+ }, function(e)
+ {
+ console.log("Failed to write: " + e.message);
+ });
+ }
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Listener function that is called when the connection state changes
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function proccessDevice(device)
{
- function onConnected()
- {
- var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- var watchID;
-
- watchID = characteristic.addValueChangeListener(function(value)
- {
- console.log("Characteristic value changed: " + value);
- characteristic.removeValueChangeListener(watchID);
- device.disconnect();
- });
- }
- }
-
- device.connect(onConnected);
+ function onConnected()
+ {
+ var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var watchID;
+
+ watchID = characteristic.addValueChangeListener(function(value)
+ {
+ console.log("Characteristic value changed: " + value);
+ characteristic.removeValueChangeListener(watchID);
+ device.disconnect();
+ });
+ }
+ }
+
+ device.connect(onConnected);
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- adapter.stopScan();
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ adapter.stopScan();
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchID</span>:
+<span class="name">watchID</span>:
The watchID identifier returned by the addValueChangeListener() method.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the descriptor value is read successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function proccessDevice(device)
{
- device.connect(onConnected, onerror);
- function onConnected()
- {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- var descriptor = characteristic.descriptors[0];
- descriptor.readValue(function(val)
- {
- console.log("Value read: " + val);
- device.disconnect();
- });
- }
- }
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var descriptor = characteristic.descriptors[0];
+ descriptor.readValue(function(val)
+ {
+ console.log("Value read: " + val);
+ device.disconnect();
+ });
+ }
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
the descriptor value to write
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the descriptor value is written successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function proccessDevice(device)
{
- device.connect(onConnected, onerror);
- function onConnected()
- {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- var data = new Array(1, 2, 3, 4, 5, 6);
- var descriptor = characteristic.descriptors[0];
- descriptor.writeValue(data, function()
- {
- console.log("Value written");
- device.disconnect();
- }, function(e)
- {
- console.log("Failed to write: " + e.message);
- });
- }
- }
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var data = new Array(1, 2, 3, 4, 5, 6);
+ var descriptor = characteristic.descriptors[0];
+ descriptor.writeValue(data, function()
+ {
+ console.log("Value written");
+ device.disconnect();
+ }, function(e)
+ {
+ console.log("Failed to write: " + e.message);
+ });
+ }
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">device</span>:
+<span class="name">device</span>:
Device that is found
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
State that is Advertising process
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
Read characteristic value
</li>
</ul>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Device Name: " + device.name);
+ console.log("Device Name: " + device.name);
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Device Address: " + device.address);
+ console.log("Device Address: " + device.address);
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Device Major Class: " + device.deviceClass.major);
+ console.log("Device Major Class: " + device.deviceClass.major);
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
+ console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
+ console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
+ console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
});
</pre>
</div>
var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- var uuids = device.uuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++)
- {
- services += uuids[i] + "\n";
- }
- console.log("Services found: " + services);
- if (uuids.indexOf(CHAT_SERVICE_UUID) != -1)
- {
- /* Connects to service */
- device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket)
- {
- /* Connected to service, handle socket */
- }, function(e)
- {
- console.log("Could not connect to chat service !!!. Error: " + e.message);
- });
- }
+ var uuids = device.uuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Services found: " + services);
+ if (uuids.indexOf(CHAT_SERVICE_UUID) != -1)
+ {
+ /* Connects to service */
+ device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket)
+ {
+ /* Connected to service, handle socket */
+ }, function(e)
+ {
+ console.log("Could not connect to chat service !!!. Error: " + e.message);
+ });
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uuid</span>:
+<span class="name">uuid</span>:
128 bit unique identifier, which specifies the service on the remote device
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when opening of a socket fails
</li>
</ul>
/* Calls a method that is invoked when user wants to send a message to a remote device */
function sendMessage(msg)
{
- /* Validates socket state, if everything is ok */
- if (clientSocket != null && clientSocket.state == "OPEN")
- {
- /* Sends the message */
- clientSocket.writeData(msg);
- }
+ /* Validates socket state, if everything is ok */
+ if (clientSocket != null && clientSocket.state == "OPEN")
+ {
+ /* Sends the message */
+ clientSocket.writeData(msg);
+ }
}
/* Calls a method that is invoked when a socket is open */
function onSocketConnected(socket)
{
- clientSocket = socket;
- console.log("Opening a socket successfully!!!");
- socket.onmessage = function()
- {
- var data = socket.readData();
- var recvmsg = "";
- for (var i = 0; i < data.length; i++)
- {
- recvmsg += String.fromCharCode(data[i]);
- }
- console.log("server msg >> " + recvmsg);
- };
-
- socket.onclose = function()
- {
- console.log("socket disconnected.");
- };
+ clientSocket = socket;
+ console.log("Opening a socket successfully!!!");
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ var recvmsg = "";
+ for (var i = 0; i < data.length; i++)
+ {
+ recvmsg += String.fromCharCode(data[i]);
+ }
+ console.log("server msg >> " + recvmsg);
+ };
+
+ socket.onclose = function()
+ {
+ console.log("socket disconnected.");
+ };
}
function onDeviceReady(device)
{
- /* Validates device and service uuid */
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
- {
- /* Opens socket */
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e)
- {
- console.log("Error connecting to service. Reason: " + e.message);
- });
- }
- else
- {
- console.log("Chat service is not supported by this device");
- }
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e)
+ {
+ console.log("Error connecting to service. Reason: " + e.message);
+ });
+ }
+ else
+ {
+ console.log("Chat service is not supported by this device");
+ }
}
function onSetPowered()
{
- /* Gets the BluetoothDevice object */
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
}
adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message); });
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.address);
+ console.log("Found device: " + device.address);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.name);
+ console.log("Found device: " + device.name);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.txpowerlevel);
+ console.log("Found device: " + device.txpowerlevel);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.appearance);
+ console.log("Found device: " + device.appearance);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- var uuids = device.uuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++)
- {
- services += uuids[i] + "\n";
- }
- console.log("Service found: " + services);
+ var uuids = device.uuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Service found: " + services);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- var uuids = device.solicitationuuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++)
- {
- services += uuids[i] + "\n";
- }
- console.log("Service solicitations found: " + services);
+ var uuids = device.solicitationuuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Service solicitations found: " + services);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- var serviceData = device.serviceData;
- var data = "";
- for (var i = 0; i < serviceData.length; i++)
- {
- data += serviceData[i].id + serviceData[i].data + "\n";
- }
- console.log("Service data found: " + data);
+ var serviceData = device.serviceData;
+ var data = "";
+ for (var i = 0; i < serviceData.length; i++)
+ {
+ data += serviceData[i].id + serviceData[i].data + "\n";
+ }
+ console.log("Service data found: " + data);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- var manufacturerData = device.manufacturerData;
- console.log("Manufacture id: " + manufacturerData.id);
- console.log("Manufacture data: " + manufacturerData.data);
+ var manufacturerData = device.manufacturerData;
+ console.log("Manufacture id: " + manufacturerData.id);
+ console.log("Manufacture data: " + manufacturerData.data);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.name);
- console.log("RSSI: " + device.rssi);
+ console.log("Found device: " + device.name);
+ console.log("RSSI: " + device.rssi);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the connection is established successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function onconnected()
{
- console.log("Connected to device");
+ console.log("Connected to device");
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.connect(onconnected, onerror);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected, onerror);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the connection is finished successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- function ondisconnect()
- {
- console.log("Disconnected");
- }
-
- function onconnected()
- {
- console.log("Connected to device");
- device.disconnect(ondisconnect, onerror);
- }
-
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.connect(onconnected, onerror);
- }
+ function ondisconnect()
+ {
+ console.log("Disconnected");
+ }
+
+ function onconnected()
+ {
+ console.log("Connected to device");
+ device.disconnect(ondisconnect, onerror);
+ }
+
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected, onerror);
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uuid</span>:
+<span class="name">uuid</span>:
UUID of the service
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onconnected(device)
{
- console.log("Connected to device");
- var service = device.getService(device.uuids[0]);
- console.log("Service got");
+ console.log("Connected to device");
+ var service = device.getService(device.uuids[0]);
+ console.log("Service got");
}
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.connect(onconnected.bind(null, device), onerror);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected.bind(null, device), onerror);
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onconnected(device)
{
- console.log("Connected to device");
- var services = device.getServiceAllUuids();
- console.log("Services length " + services.length);
+ console.log("Connected to device");
+ var services = device.getServiceAllUuids();
+ console.log("Services length " + services.length);
}
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.connect(onconnected.bind(null, device), onerror);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected.bind(null, device), onerror);
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Listener functions that are called when the connection state changes
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- var onConnectionStateChange =
- {
- onconnected: function(device)
- {
- console.log("Device " + device.name + " connected");
- },
- ondisconnected: function(device)
- {
- console.log("Device " + device.name + " disconnected");
- }
- }
-
- if (device.address === "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.addConnectStateChangeListener(onConnectionStateChange);
- device.connect();
- }
+ var onConnectionStateChange =
+ {
+ onconnected: function(device)
+ {
+ console.log("Device " + device.name + " connected");
+ },
+ ondisconnected: function(device)
+ {
+ console.log("Device " + device.name + " disconnected");
+ }
+ }
+
+ if (device.address === "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.addConnectStateChangeListener(onConnectionStateChange);
+ device.connect();
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchID</span>:
+<span class="name">watchID</span>:
The watchID identifier returned by the addConnectStateChangeListener() method.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- var onConnectionStateChange =
- {
- onconnected: function(device)
- {
- console.log("Device " + device.name + " connected");
- },
- ondisconnected: function(device)
- {
- console.log("Device " + device.name + " disconnected");
- device.removeConnectStateChangeListener(listenerID);
- }
- }
-
- if (device.address === "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
- device.connect();
- }
+ var onConnectionStateChange =
+ {
+ onconnected: function(device)
+ {
+ console.log("Device " + device.name + " connected");
+ },
+ ondisconnected: function(device)
+ {
+ console.log("Device " + device.name + " disconnected");
+ device.removeConnectStateChangeListener(listenerID);
+ }
+ }
+
+ if (device.address === "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
+ device.connect();
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The data to send
</li>
</ul>
function onSocketConnected(socket)
{
- console.log("Opened connection to remote device");
- socket.onmessage = function()
- {
- console.log("Message received: " + socket.readData());
- };
-
- socket.onclose = function()
- {
- console.log("Socket closed with " + socket.peer.name);
- };
-
- /* Sends data to peer */
- var textmsg = "Test";
- var sendtextmsg = new Array();
- for (var i = 0; i < textmsg.length; i++)
- {
- sendtextmsg[i] = textmsg.charCodeAt(i);
- }
- socket.writeData(sendtextmsg);
+ console.log("Opened connection to remote device");
+ socket.onmessage = function()
+ {
+ console.log("Message received: " + socket.readData());
+ };
+
+ socket.onclose = function()
+ {
+ console.log("Socket closed with " + socket.peer.name);
+ };
+
+ /* Sends data to peer */
+ var textmsg = "Test";
+ var sendtextmsg = new Array();
+ for (var i = 0; i < textmsg.length; i++)
+ {
+ sendtextmsg[i] = textmsg.charCodeAt(i);
+ }
+ socket.writeData(sendtextmsg);
}
function onSocketError(e)
{
- console.log("Error connecting to service. Reason: " + e.message);
+ console.log("Error connecting to service. Reason: " + e.message);
}
function onDeviceReady(device)
{
- /* Validates device and service uuid */
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
- {
- /* Opens socket */
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onSocketError);
- }
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onSocketError);
+ }
}
function onSetPowered()
{
- /* Gets the BluetoothDevice object */
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
}
adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message);});
function onError(e)
{
- console.log("Error connecting to service. Reason: " + e.message);
+ console.log("Error connecting to service. Reason: " + e.message);
}
function onSocketConnected(socket)
{
- console.log("Opening socket success!!!");
+ console.log("Opening socket success!!!");
- socket.onmessage = function()
- {
- /* Gets a message from peer, reads it */
- var data = socket.readData();
+ socket.onmessage = function()
+ {
+ /* Gets a message from peer, reads it */
+ var data = socket.readData();
- /* Code to evaluate message goes here */
- };
+ /* Code to evaluate message goes here */
+ };
- socket.onclose = function()
- {
- console.log("Socket closed with " + socket.peer.name);
- };
+ socket.onclose = function()
+ {
+ console.log("Socket closed with " + socket.peer.name);
+ };
}
function onDeviceReady(device)
{
- /* Validates device and service uuid */
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
- {
- /* Opens socket */
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onError);
- }
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onError);
+ }
}
function onSetPowered()
{
- /* Gets the BluetoothDevice object */
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
}
adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message);});
function evaluateDevice(address)
{
- adapter.getDevice(address, function(device)
- {
- if (device.deviceClass.major == tizen.bluetooth.deviceMajor.COMPUTER)
- {
- /* Shows computer icon for this device */
- console.log("Device is computer");
- }
- else if (device.deviceClass.major == tizen.bluetooth.deviceMajor.PHONE)
- {
- /* Shows phone icon */
- console.log("Device is a Phone");
- }
- }, function(e)
- {
- console.log("Couldn't get any device with the given address: " + e.message);
- });
+ adapter.getDevice(address, function(device)
+ {
+ if (device.deviceClass.major == tizen.bluetooth.deviceMajor.COMPUTER)
+ {
+ /* Shows computer icon for this device */
+ console.log("Device is computer");
+ }
+ else if (device.deviceClass.major == tizen.bluetooth.deviceMajor.PHONE)
+ {
+ /* Shows phone icon */
+ console.log("Device is a Phone");
+ }
+ }, function(e)
+ {
+ console.log("Couldn't get any device with the given address: " + e.message);
+ });
}
evaluateDevice("11:22:33:44:55:66");
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
Service to check
</li>
</ul>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("12:34:56:78:9A:BC", function(device)
{
- if (device.deviceClass.hasService(tizen.bluetooth.deviceService.POSITIONING))
- {
- console.log("Device supports Positioning service");
- }
+ if (device.deviceClass.hasService(tizen.bluetooth.deviceService.POSITIONING))
+ {
+ console.log("Device supports Positioning service");
+ }
}, function(e)
{
- console.log("Couldn't get device for given address: " + e.message);
+ console.log("Couldn't get device for given address: " + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the record is removed successfully from the service records database
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure (to unregister)
</li>
</ul>
function chatServiceSuccessCb(handler)
{
- console.log("Chat service registration was successful!");
-
- chatServiceHandler = handler;
- handler.onconnect = function(socket)
- {
- console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
- socket.onmessage = function()
- {
- var data = socket.readData();
- /* Handle message code here */
- };
-
- /* Expected close */
- socket.onclose = function()
- {
- console.log('The socket is closed.');
- };
- };
+ console.log("Chat service registration was successful!");
+
+ chatServiceHandler = handler;
+ handler.onconnect = function(socket)
+ {
+ console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handle message code here */
+ };
+
+ /* Expected close */
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ };
+ };
}
function publishChatService()
{
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
- /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
+ var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+ adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
+ /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
}
function unRegisterChatService()
{
- if (chatServiceHandler != null)
- {
- chatServiceHandler.unregister(function()
- {
- chatServiceHandler = null;
- console.log("Chat service is unregistered.");
- }, function(e)
- {
- console.log("Error: " + e.message);
- });
- }
+ if (chatServiceHandler != null)
+ {
+ chatServiceHandler.unregister(function()
+ {
+ chatServiceHandler = null;
+ console.log("Chat service is unregistered.");
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
}
</pre>
</div>
Since: </span>
2.2
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataType</span>:
+<span class="name">dataType</span>:
MDEP data type used for communication, which is referenced in the ISO/IEEE 11073-20601 spec
For example, pulse oximeter is 4100 and blood pressure monitor is 4103.
</li>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Friendly name associated with sink application
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when a sink application is registered successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
+ console.log("Registered application: " + app.name);
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">peer</span>:
+<span class="name">peer</span>:
Remote device which acts as the Source role
</li>
<li class="param">
-<span class="name">application</span>:
+<span class="name">application</span>:
Registered application for the Sink role
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when a connection is established successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function healthConnectSuccess(channel)
{
- console.log("Health device is connected");
- var status = "Name of remote device: " + channel.peer.name +
- "channel type of device profile: " + channel.channelType +
- "health application name: " + channel.appication.name;
- console.log(status);
+ console.log("Health device is connected");
+ var status = "Name of remote device: " + channel.peer.name +
+ "channel type of device profile: " + channel.channelType +
+ "health application name: " + channel.appication.name;
+ console.log(status);
}
function healthConnectError(e)
{
- console.log("Failed to connect to source: " + e.message);
+ console.log("Failed to connect to source: " + e.message);
};
function gotDeviceInfo(device)
{
- healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess, healthConnectError);
+ healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess, healthConnectError);
}
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- registerHealthApp = app;
- adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo);
+ console.log("Registered application: " + app.name);
+ registerHealthApp = app;
+ adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo);
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when a sink application is registered successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- healthApp = app;
- healthApp.onconnect = function(channel)
- {
- console.log("Connected!!");
- };
+ console.log("Registered application: " + app.name);
+ healthApp = app;
+ healthApp.onconnect = function(channel)
+ {
+ console.log("Connected!!");
+ };
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
function startSink()
{
- try
- {
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- }
- catch (e)
- {
- console.log("Error: " + e.message);
- }
+ try
+ {
+ healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+ }
+ catch (e)
+ {
+ console.log("Error: " + e.message);
+ }
}
function stopSink()
{
- try
- {
- if (healthApp != null)
- {
- healthApp.unregister(function()
- {
- healthApp = null;
- console.log("Health application is unregistered.");
- }, function(e)
- {
- console.log("Error: " + e.message);
- });
- }
- }
- catch (err)
- {
- console.log("Error: " + err.message);
- }
+ try
+ {
+ if (healthApp != null)
+ {
+ healthApp.unregister(function()
+ {
+ healthApp = null;
+ console.log("Health application is unregistered.");
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
+ }
+ catch (err)
+ {
+ console.log("Error: " + err.message);
+ }
}
</pre>
</div>
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- channel.close();
- }
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.close();
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Data to send
</li>
</ul>
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- channel.sendData(dataToSend);
- }
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.sendData(dataToSend);
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Event listener of Bluetooth health channel
</li>
</ul>
var channelCallback =
{
- onmessage: function(data)
- {
- console.log("data is received")
- },
- onclose: function()
- {
- console.log("channel is closed");
- }
+ onmessage: function(data)
+ {
+ console.log("data is received")
+ },
+ onclose: function()
+ {
+ console.log("channel is closed");
+ }
};
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- channel.setListener(channelCallback);
- }
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.setListener(channelCallback);
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
var channelCallback =
{
- onmessage: function(data)
- {
- console.log("data is received")
- },
- onclose: function()
- {
- console.log("channel is closed");
- connectedChannel.unsetListener();
- }
+ onmessage: function(data)
+ {
+ console.log("data is received")
+ },
+ onclose: function()
+ {
+ console.log("channel is closed");
+ connectedChannel.unsetListener();
+ }
};
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- connectedChannel = channel;
- connectedChannel.setListener(channelCallback);
- }
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ connectedChannel = channel;
+ connectedChannel.setListener(channelCallback);
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">powered</span>:
+<span class="name">powered</span>:
Flag indicating power state of local Bluetooth: <var>true</var> means power-on, <var>false</var> means power-off
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name of local Bluetooth
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">visible</span>:
+<span class="name">visible</span>:
Flag indicating visibility of local Bluetooth: <var>true</var> means that local Bluetooth is discoverable, <var>false</var> means that local Bluetooth is hidden from other devices
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">device</span>:
+<span class="name">device</span>:
BluetoothDevice object
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">devices</span>:
+<span class="name">devices</span>:
List of devices known to local Bluetooth adapter
Each element is a BluetoothDevice.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">device</span>:
+<span class="name">device</span>:
Device that is found
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">address</span>:
+<span class="name">address</span>:
Address of the device that is no longer in range or visible
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">foundDevices</span>:
+<span class="name">foundDevices</span>:
Array of devices found in this discovery session
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">socket</span>:
+<span class="name">socket</span>:
Socket to connect to the specified service on a remote device
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">handler</span>:
+<span class="name">handler</span>:
Bluetooth service handler
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">application</span>:
+<span class="name">application</span>:
Registered health application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channel</span>:
+<span class="name">channel</span>:
Connected health channel
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Received data
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">parentFolder</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">parentFolder</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Parent bookmark folder to retrieve the result bookmarks
</li>
<li class="param">
-<span class="name">recursive</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">recursive</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag indicating whether sub-bookmarks are also retrieved recursively<br>(The default value is <em>false</em>).
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Retrieves bookmarks from the root bookmark folder recursively */
- var allBookmarks = tizen.bookmark.get(null, true);
+ /* Retrieves bookmarks from the root bookmark folder recursively */
+ var allBookmarks = tizen.bookmark.get(null, true);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">bookmark</span>:
+<span class="name">bookmark</span>:
Bookmark to be added
</li>
<li class="param">
-<span class="name">parentFolder</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">parentFolder</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Parent folder of a bookmark to be added
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Adds a bookmark item to root bookmark folder */
- tizen.bookmark.add(new tizen.BookmarkItem("tizen", "https://www.tizen.org"));
+ /* Adds a bookmark item to root bookmark folder */
+ tizen.bookmark.add(new tizen.BookmarkItem("tizen", "https://www.tizen.org"));
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">bookmark</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">bookmark</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Bookmark to be removed
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Removes all the bookmark folders and items */
- tizen.bookmark.remove();
+ /* Removes all the bookmark folders and items */
+ tizen.bookmark.remove();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Creates a bookmark item */
- var tizen = new tizen.BookmarkItem("tizen", "https://www.tizen.org");
+ /* Creates a bookmark item */
+ var tizen = new tizen.BookmarkItem("tizen", "https://www.tizen.org");
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Creates a bookmark folder */
- var folder = new tizen.BookmarkFolder("folder");
+ /* Creates a bookmark folder */
+ var folder = new tizen.BookmarkFolder("folder");
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Type of a calendar
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method that is invoked when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when an error occurs
</li>
</ul>
function eventFoundCallback(events)
{
- /* Event has been successfully found */
- /* Changes the summary */
- events[0].summary = 'HTML6 Webinar';
- calendar.update(events[0]);
- console.log('First event was updated!');
+ /* Event has been successfully found */
+ /* Changes the summary */
+ events[0].summary = 'HTML6 Webinar';
+ calendar.update(events[0]);
+ console.log('First event was updated!');
}
/* Defines the error callback for all the asynchronous calls */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the success callback for retrieving the list of calendars */
function calendarListCallback(calendars)
{
- if (calendars.length > 0)
- {
- calendar = calendars[0];
- console.log('The calendar id is ' + calendar.id + ' and name ' + calendar.name);
-
- var ev = new tizen.CalendarEvent(
- {
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
- });
- calendar.add(ev);
-
- /* Event has been successfully added */
- /* Checks whether the added event can be retrieved from the calendar */
- /* If the calendar was empty, only the item added through add() should be returned */
- var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
- calendar.find(eventFoundCallback, errorCallback, filter);
- }
+ if (calendars.length > 0)
+ {
+ calendar = calendars[0];
+ console.log('The calendar id is ' + calendar.id + ' and name ' + calendar.name);
+
+ var ev = new tizen.CalendarEvent(
+ {
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+ });
+ calendar.add(ev);
+
+ /* Event has been successfully added */
+ /* Checks whether the added event can be retrieved from the calendar */
+ /* If the calendar was empty, only the item added through add() should be returned */
+ var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
+ calendar.find(eventFoundCallback, errorCallback, filter);
+ }
}
/* Gets a list of available calendars */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Type of a calendar
</li>
</ul>
/* Defines the error callback for all the asynchronous calls */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
function eventFoundCallback(events)
{
- /* Event has been successfully found */
- /* Changes the summary */
- events[0].summary = 'HTML6 Webinar';
- unifiedCalendar.update(events[0]);
- console.log('First event was updated!');
+ /* Event has been successfully found */
+ /* Changes the summary */
+ events[0].summary = 'HTML6 Webinar';
+ unifiedCalendar.update(events[0]);
+ console.log('First event was updated!');
}
/* Gets the unified calendar */
var ev = new tizen.CalendarEvent(
{
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
});
unifiedCalendar.add(ev);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Type of a calendar
</li>
</ul>
/* Defines the error callback for all the asynchronous calls */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
function eventFoundCallback(events)
{
- /* Event has been successfully found */
- /* Changes the summary */
- events[0].summary = 'HTML6 Webinar';
- myCalendar.update(events[0]);
- console.log('First event was updated!');
+ /* Event has been successfully found */
+ /* Changes the summary */
+ events[0].summary = 'HTML6 Webinar';
+ myCalendar.update(events[0]);
+ console.log('First event was updated!');
}
/* Gets the default calendar */
var ev = new tizen.CalendarEvent(
{
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
});
myCalendar.add(ev);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">calendar</span>:
+<span class="name">calendar</span>:
Calendar to be added
</li>
</ul>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- var calendar = new tizen.Calendar(account.id,
- 'remote calendar', 'TASK');
- tizen.calendar.addCalendar(calendar);
- }
+ var account = accounts[0];
+ if (account)
+ {
+ var calendar = new tizen.Calendar(account.id,
+ 'remote calendar', 'TASK');
+ tizen.calendar.addCalendar(calendar);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Type of a calendar
</li>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
Identifier (id attribute) of the calendar object to delete
</li>
</ul>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- var calendar = new tizen.Calendar(account.id,
- 'remote calendar', 'TASK');
- tizen.calendar.addCalendar(calendar);
- tizen.calendar.removeCalendar('TASK', calendar.id);
- }
+ var account = accounts[0];
+ if (account)
+ {
+ var calendar = new tizen.Calendar(account.id,
+ 'remote calendar', 'TASK');
+ tizen.calendar.addCalendar(calendar);
+ tizen.calendar.removeCalendar('TASK', calendar.id);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Type of a calendar
</li>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
Identifier (id attribute) of the calendar object to get
</li>
</ul>
var calendarId; /* calendarId supposed to be initialized */
try
{
- var calendar = tizen.calendar.getCalendar("EVENT", calendarId);
- console.log("Successfully retrieved event calendar with id: " + calendarId);
+ var calendar = tizen.calendar.getCalendar("EVENT", calendarId);
+ console.log("Successfully retrieved event calendar with id: " + calendarId);
}
catch (err)
{
- console.log("Error: " + err.name);
+ console.log("Error: " + err.name);
}
</pre>
</div>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- var calendar = new tizen.Calendar(account.id,
- 'remote calendar', 'TASK');
- /* 'calendar' variable is not available until it is inserted into the database */
- tizen.calendar.addCalendar(calendar);
- }
+ var account = accounts[0];
+ if (account)
+ {
+ var calendar = new tizen.Calendar(account.id,
+ 'remote calendar', 'TASK');
+ /* 'calendar' variable is not available until it is inserted into the database */
+ tizen.calendar.addCalendar(calendar);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
Calendar item identifier
</li>
</ul>
var itemId; /* Calendar item identifier */
try
{
- var item = myCalendar.get(itemId);
- console.log("Successfully retrieved item with id: " + itemId);
+ var item = myCalendar.get(itemId);
+ console.log("Successfully retrieved item with id: " + itemId);
}
catch (err)
{
- console.log("Error: " + err.name);
+ console.log("Error: " + err.name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">item</span>:
+<span class="name">item</span>:
Calendar item to be added
</li>
</ul>
var ev = new tizen.CalendarEvent(
{
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
});
calendar.add(ev);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">items</span>:
+<span class="name">items</span>:
List of calendar items to add
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when the request fails
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
function addEventsSuccess(events)
{
- console.log("Successfully added " + events.length + " events!");
+ console.log("Successfully added " + events.length + " events!");
}
/* Gets the default calendar */
var ev = new tizen.CalendarEvent(
{
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
});
calendar.addBatch([ev], addEventsSuccess, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">item</span>:
+<span class="name">item</span>:
Item object to update
</li>
<li class="param">
-<span class="name">updateAllInstances</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">updateAllInstances</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag indicating whether all the event instances should be updated as well (default value is <var>true</var>) <br>This parameter only applies to calendar events, and does not apply to tasks.
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the event success callback */
function eventSearchSuccessCallback(events)
{
- events[0].description = 'New Description';
- /* Updates the first existing event */
- myCalendar.update(events[0]);
- console.log("The first item description was updated!");
+ events[0].description = 'New Description';
+ /* Updates the first existing event */
+ myCalendar.update(events[0]);
+ console.log("The first item description was updated!");
}
/* Gets the default calendar */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">items</span>:
+<span class="name">items</span>:
List of calendar item objects to update
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when the <em>updateEvents() </em>request succeeds
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when the <em>updateEvents() </em>request fails
</li>
<li class="param">
-<span class="name">updateAllInstances</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">updateAllInstances</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag indicating whether all the event instances should be updated <br>Default value for this flag is <var>true</var>). This parameter applies only to calendar events, and does not apply to tasks.
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the success callback */
function updateEventsSuccess()
{
- console.log("Successfully updated !");
+ console.log("Successfully updated !");
}
/* Defines the event success callback */
function eventSearchSuccessCallback(events)
{
- events[0].description = 'New Description 1';
- events[1].description = 'New Description 2';
- /* Updates the first two existing events */
- myCalendar.updateBatch(events.slice(0,2), updateEventsSuccess, errorCallback);
+ events[0].description = 'New Description 1';
+ events[1].description = 'New Description 2';
+ /* Updates the first two existing events */
+ myCalendar.updateBatch(events.slice(0,2), updateEventsSuccess, errorCallback);
}
/* Gets the default calendar */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The identifier (id attribute) of the item object to delete
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the event success callback */
function eventSearchSuccessCallback(events)
{
- /* Deletes the first existing event */
- myCalendar.remove(events[0].id);
- console.log('The first event was removed');
+ /* Deletes the first existing event */
+ myCalendar.remove(events[0].id);
+ console.log('The first event was removed');
}
/* Gets default calendar */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ids</span>:
+<span class="name">ids</span>:
The identifiers (<em>id </em>attribute) of the items to delete
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when the <em>removeBatch()</em> request succeeds
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when the <em>removeBatch()</em> request fails
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the removeBatch callback */
function removeBatchCallback()
{
- console.log("Requested events were successfully removed.");
+ console.log("Requested events were successfully removed.");
}
/* Defines the event search success callback */
function eventSearchSuccessCallback(events)
{
- /* Deletes the first two existing events */
- myCalendar.removeBatch([events[0].id, events[1].id],
- removeBatchCallback, errorCallback);
+ /* Deletes the first two existing events */
+ myCalendar.removeBatch([events[0].id, events[1].id],
+ removeBatchCallback, errorCallback);
}
/* Gets the default calendar */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method that is invoked when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when an error occurs
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Supplied data used to filter the results of the <em>find() </em>method
</li>
<li class="param">
-<span class="name">sortMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">sortMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Sort order in which the items return
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the event search success callback */
function eventSearchSuccessCallback(events)
{
- console.log(events.length + ' results found.');
+ console.log(events.length + ' results found.');
}
/* Gets the default calendar */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback methods that is invoked on receiving calendar change notifications
</li>
</ul>
var watcher =
{
- onitemsadded: function(items)
- {
- console.log(items.length + ' items were added');
- },
- onitemsupdated: function(items)
- {
- console.log(items.length + ' items were updated');
- },
- onitemsremoved: function(ids)
- {
- console.log(ids.length + ' items were removed');
- }
+ onitemsadded: function(items)
+ {
+ console.log(items.length + ' items were added');
+ },
+ onitemsupdated: function(items)
+ {
+ console.log(items.length + ' items were updated');
+ },
+ onitemsremoved: function(ids)
+ {
+ console.log(ids.length + ' items were removed');
+ }
};
/* Registers to be notified when the calendar changes */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
/* Receives calendar changes */
var watcher =
{
- onitemsadded: function(items)
- {
- console.log(items.length + ' items were added');
- },
- onitemsupdated: function(items)
- {
- console.log(evitemsents.length + ' items were updated');
- },
- onitemsremoved: function(ids)
- {
- console.log(ids.length + ' items were removed');
- }
+ onitemsadded: function(items)
+ {
+ console.log(items.length + ' items were added');
+ },
+ onitemsupdated: function(items)
+ {
+ console.log(evitemsents.length + ' items were updated');
+ },
+ onitemsremoved: function(ids)
+ {
+ console.log(ids.length + ' items were removed');
+ }
};
/* Registers to be notified when the calendar changes */
ev.startDate = new tizen.TZDate(2011, 2, 11, 8, 0, 0);
/* Gives a sound notification 30 minutes before the item's start time */
var alarm = new tizen.CalendarAlarm(new tizen.TimeDuration(30, "MINS"),
- "SOUND");
+ "SOUND");
ev.alarms = [alarm];
</pre>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
- {role: "CHAIR", RSVP: true});
+ {role: "CHAIR", RSVP: true});
event.attendees = [attendee];
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">format</span>:
+<span class="name">format</span>:
Format to use for exporting
</li>
</ul>
/* Defines the event search success callback */
function eventSearchSuccessCallback(events)
{
- /* Converts the first event to iCalendar 2.0 format (default) */
- var vevent = events[0].convertToString("ICALENDAR_20");
- console.log('iCalendar 2.0 representation of the event is: ' + vevent);
+ /* Converts the first event to iCalendar 2.0 format (default) */
+ var vevent = events[0].convertToString("ICALENDAR_20");
+ console.log('iCalendar 2.0 representation of the event is: ' + vevent);
}
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Gets the default calendar */
var calendar = tizen.calendar.getDefaultCalendar();
var html5seminar = new tizen.CalendarEvent({startDate: new tizen.TZDate(2012, 3, 4),
- duration: new tizen.TimeDuration(3, "DAYS"),
- summary: "HTML5 Seminar"});
+ duration: new tizen.TimeDuration(3, "DAYS"),
+ summary: "HTML5 Seminar"});
calendar.add(html5seminar);
var tizenseminar = html5seminar.clone();
try
{
- var task = new tizen.CalendarTask("BEGIN:VCALENDAR\r\n" +
- "VERSION:2.0\r\n" +
- "BEGIN:VTODO\r\n" +
- "DTSTAMP:TZID=CET:20110902T110000Z\r\n" +
- "DTSTART;TZID=CET:20110906T140000Z\r\n" +
- "DUE;TZID=CET:20110906T150000Z\r\n" +
- "SUMMARY:Discuss the schedule\r\n" +
- "DESCRIPTION:Find the feasible schedule\r\n" +
- "CATEGORIES:HUMAN RESOURCES\r\n" +
- "END:VTODO\r\n" +
- "END:VCALENDAR", "ICALENDAR_20");
-
- taskCalendar = tizen.calendar.getDefaultCalendar("TASK");
- taskCalendar.add(task);
- console.log("Task added with ID " + task.id);
+ var task = new tizen.CalendarTask("BEGIN:VCALENDAR\r\n" +
+ "VERSION:2.0\r\n" +
+ "BEGIN:VTODO\r\n" +
+ "DTSTAMP:TZID=CET:20110902T110000Z\r\n" +
+ "DTSTART;TZID=CET:20110906T140000Z\r\n" +
+ "DUE;TZID=CET:20110906T150000Z\r\n" +
+ "SUMMARY:Discuss the schedule\r\n" +
+ "DESCRIPTION:Find the feasible schedule\r\n" +
+ "CATEGORIES:HUMAN RESOURCES\r\n" +
+ "END:VTODO\r\n" +
+ "END:VCALENDAR", "ICALENDAR_20");
+
+ taskCalendar = tizen.calendar.getDefaultCalendar("TASK");
+ taskCalendar.add(task);
+ console.log("Task added with ID " + task.id);
}
catch (err)
{
- console.log("Failed to add VTODO to the calendar, error: " + err.name);
+ console.log("Failed to add VTODO to the calendar, error: " + err.name);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var taskInit =
{
- description: "HTML5 Introduction",
- summary: "HTML5 Webinar",
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- dueDate: new tizen.TZDate(2011, 5, 30, 10, 0),
- completedDate: new tizen.TZDate(2011, 4, 30, 10, 0),
- progress: "0"
+ description: "HTML5 Introduction",
+ summary: "HTML5 Webinar",
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ dueDate: new tizen.TZDate(2011, 5, 30, 10, 0),
+ completedDate: new tizen.TZDate(2011, 4, 30, 10, 0),
+ progress: "0"
};
var ev = new tizen.CalendarTask(taskInit);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="CalendarTask::constructor">Constructors</h4>
<dl>
try
{
- var ev = new tizen.CalendarEvent("BEGIN:VCALENDAR\r\n" +
- "BEGIN:VEVENT\r\n" +
- "DTSTAMP:19970901T1300Z\r\n" +
- "DTSTART:19970903T163000Z\r\n" +
- "DTEND:19970903T190000Z\r\n" +
- "SUMMARY:Annual Employee Review\r\n" +
- "CATEGORIES:BUSINESS,HUMAN RESOURCES\r\n" +
- "END:VEVENT\r\n" +
- "END:VCALENDAR", "ICALENDAR_20");
-
- calendar.add(ev);
- console.log('Event added with UID ' + ev.id.uid);
+ var ev = new tizen.CalendarEvent("BEGIN:VCALENDAR\r\n" +
+ "BEGIN:VEVENT\r\n" +
+ "DTSTAMP:19970901T1300Z\r\n" +
+ "DTSTART:19970903T163000Z\r\n" +
+ "DTEND:19970903T190000Z\r\n" +
+ "SUMMARY:Annual Employee Review\r\n" +
+ "CATEGORIES:BUSINESS,HUMAN RESOURCES\r\n" +
+ "END:VEVENT\r\n" +
+ "END:VCALENDAR", "ICALENDAR_20");
+
+ calendar.add(ev);
+ console.log('Event added with UID ' + ev.id.uid);
}
catch (err)
{
- console.log("Failed to add VEVENT to the calendar, error: " + err.name);
+ console.log("Failed to add VEVENT to the calendar, error: " + err.name);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var eventInit =
{
- description: "HTML5 Introduction",
- summary: "HTML5 Webinar",
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location: "Huesca"
+ description: "HTML5 Introduction",
+ summary: "HTML5 Webinar",
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location: "Huesca"
};
-
+
var ev = new tizen.CalendarEvent(eventInit);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="CalendarEvent::constructor">Constructors</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">startDate</span>:
+<span class="name">startDate</span>:
Start date/ time of an event(inclusive)
</li>
<li class="param">
-<span class="name">endDate</span>:
+<span class="name">endDate</span>:
End date/ time of an event (inclusive)
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method that is invoked when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method that is invoked when an error occurs
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the event expanding success callback */
function eventExpandingSuccessCallback(events)
{
- console.log(events.length + ' event instances were returned.');
+ console.log(events.length + ' event instances were returned.');
}
var calendar = tizen.calendar.getDefaultCalendar();
if (event.recurrenceRule != null)
{
- /* This is a recurring event. Expands all the instances during August 2011 */
- event.expandRecurrence(new tizen.TZDate(2011, 7, 1), new tizen.TZDate(2011, 7, 31),
- eventExpandingSuccessCallback, errorCallback);
+ /* This is a recurring event. Expands all the instances during August 2011 */
+ event.expandRecurrence(new tizen.TZDate(2011, 7, 1), new tizen.TZDate(2011, 7, 31),
+ eventExpandingSuccessCallback, errorCallback);
}
</pre>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var attendee = new tizen.CalendarAttendee('mailto:bob@domain.com',
- {role: "CHAIR", RSVP: true});
+ {role: "CHAIR", RSVP: true});
event.attendees = [attendee];
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">events</span>:
+<span class="name">events</span>:
Array of <em>CalendarEvent </em>objects
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* CalendarEventArraySuccessCallback instance */
function calendarEventArraySuccessCB(events)
{
- console.log(events.length + ' event instances were returned.');
+ console.log(events.length + ' event instances were returned.');
}
var calendar = tizen.calendar.getDefaultCalendar();
if (event.recurrenceRule != null)
{
- /* This is a recurring event. Expands all the instances during August 2011 */
- event.expandRecurrence(new tizen.TZDate(2011, 7, 1), new tizen.TZDate(2011, 7, 31),
- calendarEventArraySuccessCB, errorCallback);
+ /* This is a recurring event. Expands all the instances during August 2011 */
+ event.expandRecurrence(new tizen.TZDate(2011, 7, 1), new tizen.TZDate(2011, 7, 31),
+ calendarEventArraySuccessCB, errorCallback);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">items</span>:
+<span class="name">items</span>:
Array of <em>CalendarItem </em>objects
</li>
</ul>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* CalendarItemArraySuccessCallback instance */
function calendarItemArraySuccessCB(events)
{
- console.log("Successfully added " + events.length + " events!");
+ console.log("Successfully added " + events.length + " events!");
}
/* Gets the default calendar */
var ev = new tizen.CalendarEvent(
{
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
});
calendar.addBatch([ev], calendarItemArraySuccessCB, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">calendars</span>:
+<span class="name">calendars</span>:
Array of <em>Calendar </em>objects
</li>
</ul>
function eventFoundCallback(events)
{
- /* Event has been successfully found */
- /* Changes the summary */
- events[0].summary = 'HTML6 Webinar';
- calendar.update(events[0]);
- console.log('First event was updated!');
+ /* Event has been successfully found */
+ /* Changes the summary */
+ events[0].summary = 'HTML6 Webinar';
+ calendar.update(events[0]);
+ console.log('First event was updated!');
}
/* Defines the error callback for all the asynchronous calls */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* CalendarArraySuccessCallback instance */
function calendarArraySuccessCB(calendars)
{
- if (calendars.length > 0)
- {
- calendar = calendars[0];
- console.log('The calendar id is ' + calendar.id + ' and name ' + calendar.name);
-
- var ev = new tizen.CalendarEvent(
- {
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
- });
- calendar.add(ev);
-
- /* Event has been successfully added */
- /* Checks whether the added event can be retrieved from the calendar */
- /* If the calendar was empty, only the item added through add() should be returned */
- var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
- calendar.find(eventFoundCallback, errorCallback, filter);
- }
+ if (calendars.length > 0)
+ {
+ calendar = calendars[0];
+ console.log('The calendar id is ' + calendar.id + ' and name ' + calendar.name);
+
+ var ev = new tizen.CalendarEvent(
+ {
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
+ });
+ calendar.add(ev);
+
+ /* Event has been successfully added */
+ /* Checks whether the added event can be retrieved from the calendar */
+ /* If the calendar was empty, only the item added through add() should be returned */
+ var filter = new tizen.AttributeFilter('summary', 'CONTAINS', 'HTML5');
+ calendar.find(eventFoundCallback, errorCallback, filter);
+ }
}
/* Gets a list of available calendars */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">items</span>:
+<span class="name">items</span>:
List of items that were added
</li>
</ul>
var watcher =
{
- onitemsadded: function(items)
- {
- console.log('New item ' + items[0].id + ' added');
- },
- onitemsupdated: function(items)
- {
- /* Do something */
- },
- onitemsremoved: function(ids)
- {
- /* Do something */
- }
+ onitemsadded: function(items)
+ {
+ console.log('New item ' + items[0].id + ' added');
+ },
+ onitemsupdated: function(items)
+ {
+ /* Do something */
+ },
+ onitemsremoved: function(ids)
+ {
+ /* Do something */
+ }
};
/* Registers to be notified when the calendar changes */
var ev = new tizen.CalendarEvent(
{
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">items</span>:
+<span class="name">items</span>:
List of items that were updated
</li>
</ul>
var watcher =
{
- onitemsadded: function(items)
- {
- if (calendar.update)
- {
- items[0].location = 'New York';
- calendar.update(items[0]);
- }
- },
- onitemsupdated: function(items)
- {
- console.log('Item updated');
- },
- onitemsremoved: function(ids)
- {
- /* Do something */
- }
+ onitemsadded: function(items)
+ {
+ if (calendar.update)
+ {
+ items[0].location = 'New York';
+ calendar.update(items[0]);
+ }
+ },
+ onitemsupdated: function(items)
+ {
+ console.log('Item updated');
+ },
+ onitemsremoved: function(ids)
+ {
+ /* Do something */
+ }
};
/* Registers to be notified when the calendar changes */
watcherId = calendar.addChangeListener(watcher);
var ev = new tizen.CalendarEvent(
{
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ids</span>:
+<span class="name">ids</span>:
List of identifiers for the items that were removed
</li>
</ul>
var watcher =
{
- onitemsadded: function(items)
- {
- if (calendar.remove)
- {
- calendar.remove(items[0].id);
- }
- },
- onitemsupdated: function(items)
- {
- /* Do something */
- },
- onitemsremoved: function(ids)
- {
- console.log('Item removed');
- }
+ onitemsadded: function(items)
+ {
+ if (calendar.remove)
+ {
+ calendar.remove(items[0].id);
+ }
+ },
+ onitemsupdated: function(items)
+ {
+ /* Do something */
+ },
+ onitemsremoved: function(ids)
+ {
+ console.log('Item removed');
+ }
};
/* Registers to be notified when the calendar changes */
var ev = new tizen.CalendarEvent(
{
- description:'HTML5 Introduction',
- summary:'HTML5 Webinar ',
- startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
- duration: new tizen.TimeDuration(1, "HOURS"),
- location:'Huesca'
+ description:'HTML5 Introduction',
+ summary:'HTML5 Webinar ',
+ startDate: new tizen.TZDate(2011, 3, 30, 10, 0),
+ duration: new tizen.TimeDuration(1, "HOURS"),
+ location:'Huesca'
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A handler for a query result set.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs.
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A filter defined on <em>CallHistoryEntry </em>attributes. It can be a composite filter.
</li>
<li class="param">
-<span class="name">sortMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">sortMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The sort order in which call history is returned.
</li>
<li class="param">
-<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The maximum limit of a query result (It has the same meaning as SQL LIMIT).
If the limit is 0, the query result has no limit.
</li>
<li class="param">
-<span class="name">offset</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">offset</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The offset in the result set, from where the results are listed (It has the same semantics as SQL OFFSET).<br>The maximum number of results listed is the value of the specified <em>limit</em> parameter. Default value is <var> 0</var>, meaning no offset.
</li>
</ul>
/* Defines success callback */
function onSuccess(results)
{
- console.log(results.length + " call history item(s) found!");
- for (var i = 0; i < results.length; i++)
- {
- console.log(i + ". " + results[i].toString()); /* Process the CallHistoryEntry */
- }
+ console.log(results.length + " call history item(s) found!");
+ for (var i = 0; i < results.length; i++)
+ {
+ console.log(i + ". " + results[i].toString()); /* Process the CallHistoryEntry */
+ }
}
/* Defines error callback */
function onError(error)
{
- console.log("Query failed" + error.name);
+ console.log("Query failed" + error.name);
}
/* Defines filter: list CS calls, most recent first */
tizen.callhistory.find(onSuccess, onError, filter, sortMode);
var numberfilter = new tizen.AttributeFilter("remoteParties.remoteParty",
- "EXACTLY", "123456789");
+ "EXACTLY", "123456789");
/* Creates a composite filter for time constraints */
var y2009Filter = new tizen.AttributeRangeFilter("startTime", new Date(2009, 0, 1),
- new Date(2010, 0, 1));
+ new Date(2010, 0, 1));
var y2011Filter = new tizen.AttributeRangeFilter("startTime", new Date(2011, 0, 1),
- new Date(2012, 0, 1));
+ new Date(2012, 0, 1));
var datefilter = new tizen.CompositeFilter("UNION", [y2009Filter, y2011Filter]);
/* Creates a composite filter */
var ifilter = new tizen.CompositeFilter("INTERSECTION",
- [numberFilter, dateFilter, tfilter]);
+ [numberFilter, dateFilter, tfilter]);
/* Makes the query and wires up the callbacks; reuse sortMode */
tizen.callhistory.find(onSuccess, onError, ifilter, sortMode);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entry</span>:
+<span class="name">entry</span>:
Call history entry to be deleted.
</li>
</ul>
/* Defines success callback */
function onSuccess(results)
{
- if (results.length > 0)
- tizen.callhistory.remove(results[0]);
+ if (results.length > 0)
+ tizen.callhistory.remove(results[0]);
}
/* Defines error callback */
function onError(error)
{
- console.log("Query failed" + error.name);
+ console.log("Query failed" + error.name);
}
/* Makes the query and wires up the callbacks */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entries</span>:
+<span class="name">entries</span>:
A list of call history entries to delete.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A generic success handler.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An error handler.
</li>
</ul>
/* Defines success callback */
function onSuccess(results)
{
- tizen.callhistory.removeBatch(results);
+ tizen.callhistory.removeBatch(results);
}
/* Defines error callback */
function onError(error)
{
- console.log("Query failed" + error.name);
+ console.log("Query failed" + error.name);
}
/* Makes the query and wires up the callbacks */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A generic success handler.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An error handler.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">observer</span>:
+<span class="name">observer</span>:
A callback for handling the list of new or changed or <em>CallHistoryEntry </em>objects in the call history.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var onListenerCB =
{
- onadded: function(newItems)
- {
- console.log("New Item added");
- for (var i in newItems)
- {
- console.log("Item " + i + " startTime: " + newItems[i].startTime);
- }
- },
- onchanged: function(changedItems)
- {
- console.log("Items changed");
- for (var i in changedItems)
- {
- console.log("Item " + i + " direction: " + changedItems[i].direction);
- }
- },
- onremoved: function(removedItems)
- {
- console.log("Items removed");
- for (var i in removedItems)
- {
- console.log("Item " + i + ": " + removedItems[i]);
- }
- }
+ onadded: function(newItems)
+ {
+ console.log("New Item added");
+ for (var i in newItems)
+ {
+ console.log("Item " + i + " startTime: " + newItems[i].startTime);
+ }
+ },
+ onchanged: function(changedItems)
+ {
+ console.log("Items changed");
+ for (var i in changedItems)
+ {
+ console.log("Item " + i + " direction: " + changedItems[i].direction);
+ }
+ },
+ onremoved: function(removedItems)
+ {
+ console.log("Items removed");
+ for (var i in removedItems)
+ {
+ console.log("Item " + i + ": " + removedItems[i]);
+ }
+ }
};
try
{
- /* Registers a call history callback */
- var handle = tizen.callhistory.addChangeListener(onListenerCB);
+ /* Registers a call history callback */
+ var handle = tizen.callhistory.addChangeListener(onListenerCB);
- /* Unregisters a previously registered listener */
- tizen.callhistory.removeChangeListener(handle);
+ /* Unregisters a previously registered listener */
+ tizen.callhistory.removeChangeListener(handle);
}
catch (error)
{
- console.log("Exception - code: " + error.name + " message: " + error.message);
+ console.log("Exception - code: " + error.name + " message: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">handle</span>:
+<span class="name">handle</span>:
The previously obtained listener handle.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entries</span>:
+<span class="name">entries</span>:
An array of <em>CallHistoryEntry </em>objects, representing the result set of the query over the call history.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">newItems</span>:
+<span class="name">newItems</span>:
An array of <em>CallHistoryEntry </em>objects, representing the new items added to call history.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changedItems</span>:
+<span class="name">changedItems</span>:
An array of <em>CallHistoryEntry </em>objects, representing the changed items in call history.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">removedItems</span>:
+<span class="name">removedItems</span>:
An array of a UID of <em>CallHistoryEntry </em>objects, representing the removed items in call history.
</li>
</ul>
/* Defines the error callback for all the asynchronous calls */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function contactsFoundCB(contacts)
{
- /* Contact is successfully found */
- /* Tries to change the first name */
- contacts[0].name.firstName = 'Jeffrey Ross';
- try
- {
- addressbook.update(contacts[0]);
- }
- catch (err)
- {
- console.log('The following error occurred while updating: ' + err.name);
- }
- console.log('First contact was updated');
+ /* Contact is successfully found */
+ /* Tries to change the first name */
+ contacts[0].name.firstName = 'Jeffrey Ross';
+ try
+ {
+ addressbook.update(contacts[0]);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
+ console.log('First contact was updated');
}
/* Defines the success callback for retrieving all the Address Books */
function addressBooksCB(addressbooks)
{
- if (addressbooks.length > 0)
- {
- addressbook = addressbooks[0];
- console.log('The addressbook type is ' + addressbook.type +
- ' and name ' + addressbook.name);
-
- var contact = new tizen.Contact(
- {
- name: new tizen.ContactName(
- {
- firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']
- }),
- emails:[new tizen.ContactEmailAddress('user@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
- });
-
- addressbook.add(contact);
-
- /* Contact has been successfully added */
- /* Checks whether the added contact can be retrieved from the address book */
- /* If the address book is empty, only the item added through saveContact should be returned */
- var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Jeffrey');
- try
- {
- addressbook.find(contactsFoundCB, errorCB, filter);
- }
- catch (err)
- {
- console.log('The following error occurred while finding: ' + err.name);
- }
- }
+ if (addressbooks.length > 0)
+ {
+ addressbook = addressbooks[0];
+ console.log('The addressbook type is ' + addressbook.type +
+ ' and name ' + addressbook.name);
+
+ var contact = new tizen.Contact(
+ {
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+ });
+
+ addressbook.add(contact);
+
+ /* Contact has been successfully added */
+ /* Checks whether the added contact can be retrieved from the address book */
+ /* If the address book is empty, only the item added through saveContact should be returned */
+ var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Jeffrey');
+ try
+ {
+ addressbook.find(contactsFoundCB, errorCB, filter);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while finding: ' + err.name);
+ }
+ }
}
/* Gets a list of available address books */
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function contactsFoundCB(contacts)
{
- /* Contact has been successfully found */
- /* Tries to change the first name */
- contacts[0].name.firstName = 'Jeffrey Ross';
- try
- {
- addressbook.update(contacts[0]);
- console.log('First contact was updated');
- }
- catch (err)
- {
- console.log('The following error occurred while updating: ' + err.name);
- }
+ /* Contact has been successfully found */
+ /* Tries to change the first name */
+ contacts[0].name.firstName = 'Jeffrey Ross';
+ try
+ {
+ addressbook.update(contacts[0]);
+ console.log('First contact was updated');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
}
/* Gets the unified address book */
/* Adds a new contact */
var contact = new tizen.Contact(
{
- name: new tizen.ContactName(
- {
- firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']
- }),
- emails:[new tizen.ContactEmailAddress('user@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
});
try
{
- addressbook.add(contact);
+ addressbook.add(contact);
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
/* Contact has been successfully added */
var filter = new tizen.AttributeFiilter('name.firstName', 'CONTAINS', 'Jeffrey');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function contactsFoundCB(contacts)
{
- /* Contact has been successfully found */
- /* Tries to change the first name */
- contacts[0].name.firstName = 'Jeffrey Ross';
- try
- {
- addressbook.update(contacts[0]);
- console.log('First contact was updated');
- }
- catch (err)
- {
- console.log('The following error occurred while updating: ' + err.name);
- }
+ /* Contact has been successfully found */
+ /* Tries to change the first name */
+ contacts[0].name.firstName = 'Jeffrey Ross';
+ try
+ {
+ addressbook.update(contacts[0]);
+ console.log('First contact was updated');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
}
/* Gets the default address book */
/* Adds a new contact */
var contact = new tizen.Contact(
{
- name: new tizen.ContactName(
- {
- firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']
- }),
- emails:[new tizen.ContactEmailAddress('user@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
});
try
{
- addressbook.add(contact);
+ addressbook.add(contact);
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
/* Contact has been successfully added */
var filter = new tizen.AttributeFiilter('name.firstName', 'CONTAINS', 'Jeffrey');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- var addressbook = new tizen.AddressBook(account.id,
- 'remote addressbook');
- tizen.contact.addAddressBook(addressbook);
- }
+ var account = accounts[0];
+ if (account)
+ {
+ var addressbook = new tizen.AddressBook(account.id,
+ 'remote addressbook');
+ tizen.contact.addAddressBook(addressbook);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- var addressbook = new tizen.AddressBook(account.id,
- 'remote addressbook');
- tizen.contact.addAddressBook(addressbook);
- tizen.contact.removeAddressBook(addressbook.id);
- }
+ var account = accounts[0];
+ if (account)
+ {
+ var addressbook = new tizen.AddressBook(account.id,
+ 'remote addressbook');
+ tizen.contact.addAddressBook(addressbook);
+ tizen.contact.removeAddressBook(addressbook.id);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
var contactRef; /* ContactRef supposed to be initialized */
try
{
- /* Retrieves the Contact corresponding to a given ContactRef */
- var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
- var contact = addressBook.get(contactRef.contactId);
- console.log("Successfully resolved contact with id: " + contactRef.contactId);
+ /* Retrieves the Contact corresponding to a given ContactRef */
+ var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
+ var contact = addressBook.get(contactRef.contactId);
+ console.log("Successfully resolved contact with id: " + contactRef.contactId);
}
catch (err)
{
- console.log("Error: " + err.name);
+ console.log("Error: " + err.name);
}
</pre>
</div>
var contactRef; /* ContactRef supposed to be initialized */
try
{
- /* Retrieves the Person corresponding to a Contact */
- var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
- var contact = addressBook.get(contactRef.contactId);
- var person = tizen.contact.get(contact.personId);
- console.log("Successfully resolved person with id: " + contact.personId);
+ /* Retrieves the Person corresponding to a Contact */
+ var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
+ var contact = addressBook.get(contactRef.contactId);
+ var person = tizen.contact.get(contact.personId);
+ console.log("Successfully resolved person with id: " + contact.personId);
}
catch (err)
{
- console.log("Error: " + err.name);
+ console.log("Error: " + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function personsFoundCB(persons)
{
- /* Person has been successfully found */
- /* Tries to change the isFavorite attribute */
- persons[0].isFavorite = true;
- try
- {
- tizen.contact.update(persons[0]);
- console.log('First person was updated');
- }
- catch (err)
- {
- console.log('The following error occurred while updating: ' + err.name);
- }
+ /* Person has been successfully found */
+ /* Tries to change the isFavorite attribute */
+ persons[0].isFavorite = true;
+ try
+ {
+ tizen.contact.update(persons[0]);
+ console.log('First person was updated');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
}
try
{
- tizen.contact.find(personsFoundCB, errorCB);
+ tizen.contact.find(personsFoundCB, errorCB);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback for all the asynchronous calls */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function personsUpdatedCB()
{
- console.log('Contacts were updated');
+ console.log('Contacts were updated');
}
function personsFoundCB(persons)
{
- /* Person has been successfully found */
- for (var i = 0; i < persons.length; i++)
- {
- persons[i].isFavorite = true;
- }
- try
- {
- tizen.contact.updateBatch(persons, personsUpdatedCB, errorCB);
- }
- catch (err)
- {
- console.log('The following error occurred while updating: ' + err.name);
- }
+ /* Person has been successfully found */
+ for (var i = 0; i < persons.length; i++)
+ {
+ persons[i].isFavorite = true;
+ }
+ try
+ {
+ tizen.contact.updateBatch(persons, personsUpdatedCB, errorCB);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
}
try
{
- tizen.contact.find(personsFoundCB, errorCB);
+ tizen.contact.find(personsFoundCB, errorCB);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function personsFoundCB(persons)
{
- /* Person has been successfully found */
- if (persons.length > 0)
- {
- try
- {
- tizen.contact.remove(persons[0].id);
- console.log('First person was removed');
- }
- catch (err)
- {
- console.log('The following error occurred while removing: ' + err.name);
- }
- }
- else
- {
- console.log('No persons.');
- }
+ /* Person has been successfully found */
+ if (persons.length > 0)
+ {
+ try
+ {
+ tizen.contact.remove(persons[0].id);
+ console.log('First person was removed');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('No persons.');
+ }
}
try
{
- tizen.contact.find(personsFoundCB, errorCB);
+ tizen.contact.find(personsFoundCB, errorCB);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function personsRemovedCB()
{
- console.log('Contacts were removed');
+ console.log('Contacts were removed');
}
function personsFoundCB(persons)
{
- /* Person has been successfully found */
- if (persons.length > 2)
- {
- try
- {
- tizen.contact.removeBatch([persons[0].id, persons[1].id], personsRemovedCB, errorCB);
- }
- catch (err)
- {
- console.log('The following error occurred while removing: ' + err.name);
- }
- }
- else
- {
- console.log('Not enough persons.');
- }
+ /* Person has been successfully found */
+ if (persons.length > 2)
+ {
+ try
+ {
+ tizen.contact.removeBatch([persons[0].id, persons[1].id], personsRemovedCB, errorCB);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('Not enough persons.');
+ }
}
try
{
- tizen.contact.find(personsFoundCB, errorCB);
+ tizen.contact.find(personsFoundCB, errorCB);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method to be invoked when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Filter to select the persons returned
</li>
<li class="param">
-<span class="name">sortMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">sortMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Variable to determine the sort order in which the persons are returned
</li>
</ul>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
/* Defines the person search success callback */
function personsFoundCB(persons)
{
- console.log(persons.length + ' results found.');
+ console.log(persons.length + ' results found.');
}
/* Finds all the persons in the contact DB that have the word Ramone in their display name */
var sortingMode = new tizen.SortMode('displayName', 'ASC');
try
{
- tizen.contact.find(personsFoundCB, errorCB, filter, sortingMode);
+ tizen.contact.find(personsFoundCB, errorCB, filter, sortingMode);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
</dt>
<dd>
<div class="brief">
- Gets an array of <em>Person </em>objects from the contact DB which match the supplied filter. This method is for filtering usageCount property of Person objects.
+ Gets an array of <em>Person </em>objects from the contact DB which match the supplied filter. This method is for filtering usageCount property of Person objects.
</div>
<div class="synopsis"><pre class="signature prettyprint">void findByUsageCount(<a href="#ContactUsageCountFilter">ContactUsageCountFilter</a> filter, <a href="#PersonArraySuccessCallback">PersonArraySuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional <a href="tizen.html#SortModeOrder">SortModeOrder</a>? sortModeOrder, optional unsigned long limit, optional unsigned long offset);
</pre></div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filter</span>:
+<span class="name">filter</span>:
Filter to select the persons returned
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method to be invoked when the invocation ends successfully
</li>
<li class="param">
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">sortModeOrder</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">sortModeOrder</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Variable to determine the sort order in which the persons are returned. Default is 'ASC'
</li>
<li class="param">
-<span class="name">limit</span><span class="optional"> [optional]</span>:
+<span class="name">limit</span><span class="optional"> [optional]</span>:
Value, that determines limit for returned array size. By default, method would return all found records.
</li>
<li class="param">
-<span class="name">offset</span><span class="optional"> [optional]</span>:
+<span class="name">offset</span><span class="optional"> [optional]</span>:
Value, that determines offset of returned array. By default, offset is 0.
</li>
</ul>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
/* Defines the person search success callback */
function personsFoundCB(persons)
{
- console.log(persons.length + ' results found.');
+ console.log(persons.length + ' results found.');
}
/* Finds all the persons in the contact DB that have exactly five OUTGOING_CALL */
/* var filter = new tizen.AttributeRangeFilter('OUTGOING_CALL', 0, 5); */
try
{
- /* Finds three most used contacts from contacts found with filter */
- tizen.contact.findByUsageCount(filter, personsFoundCB, errorCB, 'DESC', 3, 0);
- /* Finds three least used contacts from contacts found with filter */
- /* tizen.contact.findByUsageCount(filter, personsFoundCB, errorCB, 'ASC', 3, 0); */
+ /* Finds three most used contacts from contacts found with filter */
+ tizen.contact.findByUsageCount(filter, personsFoundCB, errorCB, 'DESC', 3, 0);
+ /* Finds three least used contacts from contacts found with filter */
+ /* tizen.contact.findByUsageCount(filter, personsFoundCB, errorCB, 'ASC', 3, 0); */
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
var watcher =
{
- onpersonsadded: function(persons)
- {
- console.log(persons.length + ' persons were added');
- },
- onpersonsupdated: function(persons)
- {
- console.log(persons.length + ' persons were updated');
- },
- onpersonsremoved: function(ids)
- {
- console.log(ids.length + ' persons were deleted');
- }
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + ' persons were added');
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + ' persons were updated');
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + ' persons were deleted');
+ }
};
/* Registers to be notified when the person changes */
/* Receives person changes */
var watcher =
{
- onpersonsadded: function(persons)
- {
- console.log(persons.length + ' persons were added');
- },
- onpersonsupdated: function(persons)
- {
- console.log(persons.length + ' persons were updated');
- },
- onpersonsremoved: function(ids)
- {
- console.log(ids.length + ' persons were removed');
- }
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + ' persons were added');
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + ' persons were updated');
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + ' persons were removed');
+ }
};
/* Cancels the watch operation */
function cancelWatch()
{
- tizen.contact.removeChangeListener(watcherId);
+ tizen.contact.removeChangeListener(watcherId);
}
/* Registers to be notified of person changes */
var appId = tizen.application.getCurrentApplication().appInfo.id;
tizen.account.getAccounts(function(accounts)
{
- var account = accounts[0];
- if (account)
- {
- var addressbook = new tizen.AddressBook(account.id,
- 'remote addressbook');
+ var account = accounts[0];
+ if (account)
+ {
+ var addressbook = new tizen.AddressBook(account.id,
+ 'remote addressbook');
- /* 'addressbook' variable is not available until it is inserted into database */
- tizen.contact.addAddressBook(addressbook);
- }
+ /* 'addressbook' variable is not available until it is inserted into database */
+ tizen.contact.addAddressBook(addressbook);
+ }
}, function(e)
{
- console.log('Error: ' + e.message);
+ console.log('Error: ' + e.message);
}, appId);
</pre>
</div>
var contactRef; /* ContactRef supposed to be initialized */
try
{
- /* Retrieves the Contact corresponding to a given ContactRef */
- var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
- var contact = addressBook.get(contactRef.contactId);
- console.log("Successfully resolved contact with id: " + contactRef.contactId);
+ /* Retrieves the Contact corresponding to a given ContactRef */
+ var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
+ var contact = addressBook.get(contactRef.contactId);
+ console.log("Successfully resolved contact with id: " + contactRef.contactId);
}
catch (err)
{
- console.log("Error: " + err.name);
+ console.log("Error: " + err.name);
}
</pre>
</div>
try
{
- var contact = new tizen.Contact(
- {
- name: new tizen.ContactName(
- {
- firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']
- }),
- emails:[new tizen.ContactEmailAddress('user@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
- });
- addressbook.add(contact);
- console.log('Contact added with id ' + contact.id);
+ var contact = new tizen.Contact(
+ {
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+ });
+ addressbook.add(contact);
+ console.log('Contact added with id ' + contact.id);
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
/* Defines the add contact success callback */
function contactsAddedCB(contacts)
{
- console.log(contacts.length + ' contact(s) were successfully added to an Address Book');
+ console.log(contacts.length + ' contact(s) were successfully added to an Address Book');
};
/* Gets the default address book */
var c1 = new tizen.Contact(
{
- name: new tizen.ContactName(
- {
- firstName:'Jeffrey',
- lastName:'Hyman',
- nicknames:['joey ramone']
- }),
- emails:[new tizen.ContactEmailAddress('user1@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
+ name: new tizen.ContactName(
+ {
+ firstName:'Jeffrey',
+ lastName:'Hyman',
+ nicknames:['joey ramone']
+ }),
+ emails:[new tizen.ContactEmailAddress('user1@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]
});
var c2 = new tizen.Contact(
{
- name: new tizen.ContactName(
- {
- firstName:'Elton',
- lastName:'John',
- nicknames:['El']
- }),
- emails:[new tizen.ContactEmailAddress('user2@domain.com')],
- phoneNumbers:[new tizen.ContactPhoneNumber('987654321')]
+ name: new tizen.ContactName(
+ {
+ firstName:'Elton',
+ lastName:'John',
+ nicknames:['El']
+ }),
+ emails:[new tizen.ContactEmailAddress('user2@domain.com')],
+ phoneNumbers:[new tizen.ContactPhoneNumber('987654321')]
});
try
{
- addressbook.addBatch([c1, c2], contactsAddedCB, errorCB);
+ addressbook.addBatch([c1, c2], contactsAddedCB, errorCB);
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function contactsFoundCB(contacts)
{
- /* Contact has been successfully found */
- /* Tries to change the first name */
- contacts[0].name.firstName = 'Christopher';
- try
- {
- addressbook.update(contacts[0]);
- console.log('First contact was updated');
- }
- catch (err)
- {
- console.log('The following error occurred while updating: ' + err.name);
- }
+ /* Contact has been successfully found */
+ /* Tries to change the first name */
+ contacts[0].name.firstName = 'Christopher';
+ try
+ {
+ addressbook.update(contacts[0]);
+ console.log('First contact was updated');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
}
/* Gets the default address book */
var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback for all the asynchronous calls */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function contactsUpdatedCB()
{
- console.log('Contacts were updated');
+ console.log('Contacts were updated');
}
function contactsFoundCB(contacts)
{
- /* Contact has been successfully found */
- for (var i = 0; i < contacts.length; i++)
- {
- contacts[i].name.firstName = 'Christopher';
- }
- try
- {
- addressbook.updateBatch(contacts, contactsUpdatedCB, errorCB);
- }
- catch (err)
- {
- console.log('The following error occurred while updating: ' + err.name);
- }
+ /* Contact has been successfully found */
+ for (var i = 0; i < contacts.length; i++)
+ {
+ contacts[i].name.firstName = 'Christopher';
+ }
+ try
+ {
+ addressbook.updateBatch(contacts, contactsUpdatedCB, errorCB);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
}
/* Gets the default address book */
var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function contactsFoundCB(contacts)
{
- /* Contact has been successfully found */
- if (contacts.length > 0)
- {
- try
- {
- addressbook.remove(contacts[0].id);
- console.log('First contact was removed');
- }
- catch (err)
- {
- console.log('The following error occurred while removing: ' + err.name);
- }
- }
- else
- {
- console.log('No contacts.');
- }
+ /* Contact has been successfully found */
+ if (contacts.length > 0)
+ {
+ try
+ {
+ addressbook.remove(contacts[0].id);
+ console.log('First contact was removed');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('No contacts.');
+ }
}
/* Gets the default address book */
var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function contactsRemovedCB()
{
- console.log('Contacts were removed');
+ console.log('Contacts were removed');
}
function contactsFoundCB(contacts)
{
- /* Contact has been successfully found */
- if (contacts.length > 2)
- {
- try
- {
- addressbook.removeBatch([contacts[0].id, contacts[1].id], contactsRemovedCB, errorCB);
- }
- catch (err)
- {
- console.log('The following error occurred while removing: ' + err.name);
- }
- }
- else
- {
- console.log('Not enough contacts.');
- }
+ /* Contact has been successfully found */
+ if (contacts.length > 2)
+ {
+ try
+ {
+ addressbook.removeBatch([contacts[0].id, contacts[1].id], contactsRemovedCB, errorCB);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('Not enough contacts.');
+ }
}
/* Gets the default address book */
var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
/* Defines the contact search success callback */
function contactsFoundCB(contacts)
{
- console.log(contacts.length + ' results found.');
+ console.log(contacts.length + ' results found.');
}
/* Gets the default address book */
var sortingMode = new tizen.SortMode('name.lastName', 'ASC');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter, sortingModes);
+ addressbook.find(contactsFoundCB, errorCB, filter, sortingModes);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
var watcher =
{
- oncontactsadded: function(contacts)
- {
- console.log(contacts.length + ' contacts were added');
- },
- oncontactsupdated: function(contacts)
- {
- console.log(contacts.length + ' contacts were updated');
- },
- oncontactsremoved: function(ids)
- {
- console.log(ids.length + ' contacts were deleted');
- }
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + ' contacts were added');
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + ' contacts were updated');
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + ' contacts were deleted');
+ }
};
/* Registers to be notified when the address book changes */
/* Receives address book changes */
var watcher =
{
- oncontactsadded: function(contacts)
- {
- console.log(contacts.length + ' contacts were added');
- },
- oncontactsupdated: function(contacts)
- {
- console.log(contacts.length + ' contacts were updated');
- },
- oncontactsremoved: function(ids)
- {
- console.log(ids.length + ' contacts were removed');
- }
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + ' contacts were added');
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + ' contacts were updated');
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + ' contacts were removed');
+ }
};
/* Cancels the watch operation */
function cancelWatch()
{
- addressbook.removeChangeListener(watcherId);
+ addressbook.removeChangeListener(watcherId);
}
/* Registers to be notified when the address book changes */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Retrieves the Person corresponding to a Contact */
- var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
- var contact = addressBook.get(contactRef.contactId);
- var group = addressBook.getGroup(contact.groupIds[0].id);
- console.log("Successfully resolved group with id: " + contact.groupIds[0].id);
+ /* Retrieves the Person corresponding to a Contact */
+ var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId);
+ var contact = addressBook.get(contactRef.contactId);
+ var group = addressBook.getGroup(contact.groupIds[0].id);
+ console.log("Successfully resolved group with id: " + contact.groupIds[0].id);
}
catch (err)
{
- console.log("Error: " + err.name);
+ console.log("Error: " + err.name);
}
</pre>
</div>
try
{
- var group = new tizen.ContactGroup('Company');
- addressbook.addGroup(group);
- console.log('Group added with id ' + group.id);
+ var group = new tizen.ContactGroup('Company');
+ addressbook.addGroup(group);
+ console.log('Group added with id ' + group.id);
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
</pre>
</div>
try
{
- groups = addressbook.getGroups();
- groups[0].name = 'Friends';
- addressbook.updateGroup(groups[0]);
- console.log('First group was updated');
+ groups = addressbook.getGroups();
+ groups[0].name = 'Friends';
+ addressbook.updateGroup(groups[0]);
+ console.log('First group was updated');
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
</pre>
</div>
try
{
- groups = addressbook.getGroups();
- addressbook.removeGroup(groups[0].id);
- console.log('First group was removed');
+ groups = addressbook.getGroups();
+ addressbook.removeGroup(groups[0].id);
+ console.log('First group was removed');
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
try
{
- groups = addressbook.getGroups();
- console.log('Number of groups is ' + groups.length);
+ groups = addressbook.getGroups();
+ console.log('Number of groups is ' + groups.length);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback for all the asynchronous calls */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function personsFoundCB(persons)
{
- /* Persons have been successfully found */
- try
- {
- persons[0].link(persons[1].id);
- console.log('Second person was merged to the first person.');
- }
- catch (err)
- {
- console.log('The following error occurred while updating: ' + err.name);
- }
+ /* Persons have been successfully found */
+ try
+ {
+ persons[0].link(persons[1].id);
+ console.log('Second person was merged to the first person.');
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while updating: ' + err.name);
+ }
}
try
{
- tizen.contact.find(personsFoundCB, errorCB);
+ tizen.contact.find(personsFoundCB, errorCB);
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
/* Defines the contact search success callback */
function contactsFoundCB(contacts)
{
- if (contacts.length > 1)
- {
- try
- {
- /* Unlinks the first contact */
- newPerson = person.unlink(contacts[0].id);
- }
- catch (err)
- {
- console.log('The following error occurred while unlink: ' + err.name);
- }
- }
- else
- {
- console.log('Not enough contacts ');
- }
+ if (contacts.length > 1)
+ {
+ try
+ {
+ /* Unlinks the first contact */
+ newPerson = person.unlink(contacts[0].id);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while unlink: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('Not enough contacts ');
+ }
}
try
{
- /* Gets the person */
- person = tizen.contact.get(myPersonId);
+ /* Gets the person */
+ person = tizen.contact.get(myPersonId);
- /* Gets the default address book */
- addressbook = tizen.contact.getDefaultAddressBook();
+ /* Gets the default address book */
+ addressbook = tizen.contact.getDefaultAddressBook();
- /* Finds all the contacts in the default address book with personId as exactly myPersonId */
- var filter = new tizen.AttributeFilter('personId', 'EXACTLY', myPersonId);
+ /* Finds all the contacts in the default address book with personId as exactly myPersonId */
+ var filter = new tizen.AttributeFilter('personId', 'EXACTLY', myPersonId);
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (err)
{
- console.log('The following error occurred while processing: ' + err.name);
+ console.log('The following error occurred while processing: ' + err.name);
}
</pre>
</div>
try
{
- contact = new tizen.Contact("BEGIN:VCARD\n"+
- "VERSION:3.0\n"+
- "N:Gump;Forrest\n"+
- "FN:Forrest Gump\n"+
- "ORG:Bubba Gump Shrimp Co.\n"+
- "TITLE:Shrimp Man\n"+
- "TEL;WORK:(111) 555-1212\n"+
- "TEL;HOME:(404) 555-1212\n"+
- "EMAIL;WORK;PREF:forrestgump@example.com\n"+
- "END:VCARD");
+ contact = new tizen.Contact("BEGIN:VCARD\n"+
+ "VERSION:3.0\n"+
+ "N:Gump;Forrest\n"+
+ "FN:Forrest Gump\n"+
+ "ORG:Bubba Gump Shrimp Co.\n"+
+ "TITLE:Shrimp Man\n"+
+ "TEL;WORK:(111) 555-1212\n"+
+ "TEL;HOME:(404) 555-1212\n"+
+ "EMAIL;WORK;PREF:forrestgump@example.com\n"+
+ "END:VCARD");
}
catch (err)
{
- console.log('The following error occurred while converting: ' + err.name);
+ console.log('The following error occurred while converting: ' + err.name);
}
try
{
- if (contact)
- {
- addressbook.add(contact);
- console.log('Contact was added with ID ' + contact.id);
- }
+ if (contact)
+ {
+ addressbook.add(contact);
+ console.log('Contact was added with ID ' + contact.id);
+ }
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
</pre>
</div>
var name = new tizen.ContactName(
{
- firstName: "Forrest",
- lastName: "Gump"
+ firstName: "Forrest",
+ lastName: "Gump"
});
var addresses = [new tizen.ContactAddress(
{
- city: "New York",
- streetAddress: "46th St.",
- isDefault: true
+ city: "New York",
+ streetAddress: "46th St.",
+ isDefault: true
})];
var phoneNumbers = [new tizen.ContactPhoneNumber("(111) 555-1212"),
- new tizen.ContactPhoneNumber("(111) 555-1213")];
+ new tizen.ContactPhoneNumber("(111) 555-1213")];
try
{
- contact = new tizen.Contact(
- {
- name: name,
- addresses: addresses,
- phoneNumbers: phoneNumbers
- });
+ contact = new tizen.Contact(
+ {
+ name: name,
+ addresses: addresses,
+ phoneNumbers: phoneNumbers
+ });
}
catch (err)
{
- console.log('The following error occurred while creating contact: ' + err.name);
+ console.log('The following error occurred while creating contact: ' + err.name);
}
try
{
- if (contact)
- {
- addressbook.add(contact);
- console.log('Contact was added with ID ' + contact.id);
- }
+ if (contact)
+ {
+ addressbook.add(contact);
+ console.log('Contact was added with ID ' + contact.id);
+ }
}
catch (err)
{
- console.log('The following error occurred while adding: ' + err.name);
+ console.log('The following error occurred while adding: ' + err.name);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
if (contact.isFavorite)
{
- /* Do something */
+ /* Do something */
}
</pre>
</div>
var contactInit = {};
var contactAddr = new tizen.ContactAddress(
{
- streetAddress:'Gran Via, 32',
- postalCode:'50013',
- city:'Zaragoza',
- country:'ES'
+ streetAddress:'Gran Via, 32',
+ postalCode:'50013',
+ city:'Zaragoza',
+ country:'ES'
});
contactInit.addresses = [contactAddr];
</pre>
var contactInit = {};
tizen.filesystem.resolve('images/mypicture.jpg', function(imageFile)
{
- contactInit.photoURI = imageFile.toURI();
+ contactInit.photoURI = imageFile.toURI();
});
</pre>
</div>
/* Defines the error callback */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
/* Defines the contact find success callback */
function contactsFoundCB(contacts)
{
- try
- {
- /* Converts the first contact to vCard 3.0 format */
- var vcard = contacts[0].convertToString("VCARD_30");
- console.log('textual representation of the contact is: ' + vcard);
- }
- catch (err)
- {
- console.log('The following error occurred while converting: ' + err.name);
- }
+ try
+ {
+ /* Converts the first contact to vCard 3.0 format */
+ var vcard = contacts[0].convertToString("VCARD_30");
+ console.log('textual representation of the contact is: ' + vcard);
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while converting: ' + err.name);
+ }
}
/* Gets the default address book */
var filter = new tizen.AttributeFilter('firstName', 'CONTAINS', 'Chris');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (err)
{
- console.log('The following error occurred while finding: ' + err.name);
+ console.log('The following error occurred while finding: ' + err.name);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var myContactName = new tizen.ContactName(
{
- prefix: "Mr.", firstName: "John", lastName: "Doe"
+ prefix: "Mr.", firstName: "John", lastName: "Doe"
});
</pre>
</div>
var contactInit = {};
var contactAddress = new tizen.ContactAddress(
{
- streetAddress:'Gran Via, 32',
- postalCode:'50013', city:'Zaragoza',
- country:'ES', types:['WORK']
+ streetAddress:'Gran Via, 32',
+ postalCode:'50013', city:'Zaragoza',
+ country:'ES', types:['WORK']
});
contactInit.contactAddress = [contactAddress];
</pre>
/* Defines the error callback for all the asynchronous calls */
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
/* Defines the success callback for retrieving all the Address Books */
function addressBooksCB(addressbooks)
{
- addressbook = addressbooks[0];
- try
- {
- group = new tizen.ContactGroup('Family', ringtones.resolve('ring.mp3').toURI());
- }
- catch (err)
- {
- console.log('The following error occurred while converting: ' + err.name);
- }
-
- try
- {
- if (group)
- {
- addressbook.addGroup(group);
- console.log('Group was added with ID ' + group.id);
- }
- }
- catch (err)
- {
- console.log('The following error occurred while adding: ' + err.name);
- }
+ addressbook = addressbooks[0];
+ try
+ {
+ group = new tizen.ContactGroup('Family', ringtones.resolve('ring.mp3').toURI());
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while converting: ' + err.name);
+ }
+
+ try
+ {
+ if (group)
+ {
+ addressbook.addGroup(group);
+ console.log('Group was added with ID ' + group.id);
+ }
+ }
+ catch (err)
+ {
+ console.log('The following error occurred while adding: ' + err.name);
+ }
}
tizen.filesystem.resolve("ringtones", function(dir)
{
- ringtones = dir;
- tizen.contact.getAddressBooks(addressBooksCB, errorCB);
+ ringtones = dir;
+ tizen.contact.getAddressBooks(addressBooksCB, errorCB);
});
</pre>
</div>
var contact_extension2 = new tizen.ContactExtension({data3: 'Favourite color: green'});
var contact1 = new tizen.Contact(
{
- name: name,
- extensions: [contact_extension1, contact_extension2]
+ name: name,
+ extensions: [contact_extension1, contact_extension2]
});
console.log(contact1.extensions[1].data3); /* It shows: 'Favourite color: green' */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log("The following error occurred " + err.name);
+ console.log("The following error occurred " + err.name);
}
function onsuccess(persons)
{
- var p;
+ var p;
- /* Log each found person's name to the console */
- for (p = 0; p < persons.length; p += 1)
- {
- console.log("Name: " + persons[p].displayName);
- }
+ /* Log each found person's name to the console */
+ for (p = 0; p < persons.length; p += 1)
+ {
+ console.log("Name: " + persons[p].displayName);
+ }
}
try
{
- tizen.contact.find(onsuccess, onerror);
+ tizen.contact.find(onsuccess, onerror);
}
catch (err)
{
- console.log("The following error occurred while finding: " + err.name);
+ console.log("The following error occurred while finding: " + err.name);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCB(err)
{
- console.log("An error occurred: " + err.name);
+ console.log("An error occurred: " + err.name);
}
/* Callback invoked on successful retrieval of all the Address Books */
function addressBooksCB(addressBooks)
{
- console.log(addressBooks.length + " address books available.");
+ console.log(addressBooks.length + " address books available.");
}
/* Gets a list of available address books */
var watcher =
{
- oncontactsadded: function(contacts)
- {
- console.log(contacts.length + " contacts were added");
- },
- oncontactsupdated: function(contacts)
- {
- console.log(contacts.length + " contacts were updated");
- },
- oncontactsremoved: function(ids)
- {
- console.log(ids.length + " contacts were removed");
- }
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + " contacts were added");
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + " contacts were updated");
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + " contacts were removed");
+ }
};
/* Registers to be notified when the address book changes */
/* Adds a new contact to invoke an oncontactsadded call */
try
{
- var contact = new tizen.Contact(
- {
- name: new tizen.ContactName(
- {
- firstName: 'John',
- lastName: 'Doe',
- nicknames: ['Johnny']
- }),
- emails: [new tizen.ContactEmailAddress('john@doe.com')],
- phoneNumbers: [new tizen.ContactPhoneNumber('789456123')]});
- addressbook.add(contact);
+ var contact = new tizen.Contact(
+ {
+ name: new tizen.ContactName(
+ {
+ firstName: 'John',
+ lastName: 'Doe',
+ nicknames: ['Johnny']
+ }),
+ emails: [new tizen.ContactEmailAddress('john@doe.com')],
+ phoneNumbers: [new tizen.ContactPhoneNumber('789456123')]});
+ addressbook.add(contact);
}
catch (err)
{
- console.log('An error occurred while adding a contact: ' + err.name + ", " + err.message);
+ console.log('An error occurred while adding a contact: ' + err.name + ", " + err.message);
}
</pre>
</div>
var watcher =
{
- oncontactsadded: function(contacts)
- {
- console.log(contacts.length + " contacts were added");
- },
- oncontactsupdated: function(contacts)
- {
- console.log(contacts.length + " contacts were updated");
- },
- oncontactsremoved: function(ids)
- {
- console.log(ids.length + " contacts were removed");
- }
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + " contacts were added");
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + " contacts were updated");
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + " contacts were removed");
+ }
};
/* Registers to be notified when the address book changes */
/* Updates a contact to invoke an oncontactsupdated call */
function errorCB(error)
{
- console.log(error.name + ": " + error.message);
+ console.log(error.name + ": " + error.message);
}
function contactsFoundCB(contacts)
{
- contacts[0].name.firstName = 'Stanley';
- try
- {
- addressbook.update(contacts[0]);
- console.log('Successfully updated.');
- }
- catch (error)
- {
- console.log(error.name + ": " + error.message);
- }
+ contacts[0].name.firstName = 'Stanley';
+ try
+ {
+ addressbook.update(contacts[0]);
+ console.log('Successfully updated.');
+ }
+ catch (error)
+ {
+ console.log(error.name + ": " + error.message);
+ }
}
var filter = new tizen.AttributeFilter('name.lastName', 'EXACTLY', 'Doe');
try
{
- addressbook.find(contactsFoundCB, errorCB, filter);
+ addressbook.find(contactsFoundCB, errorCB, filter);
}
catch (error)
{
- console.log(error.name + ": " + error.message);
+ console.log(error.name + ": " + error.message);
}
</pre>
</div>
var watcher =
{
- oncontactsadded: function(contacts)
- {
- console.log(contacts.length + " contacts were added");
- },
- oncontactsupdated: function(contacts)
- {
- console.log(contacts.length + " contacts were updated");
- },
- oncontactsremoved: function(ids)
- {
- console.log(ids.length + " contacts were removed");
- }
+ oncontactsadded: function(contacts)
+ {
+ console.log(contacts.length + " contacts were added");
+ },
+ oncontactsupdated: function(contacts)
+ {
+ console.log(contacts.length + " contacts were updated");
+ },
+ oncontactsremoved: function(ids)
+ {
+ console.log(ids.length + " contacts were removed");
+ }
};
/* Registers to be notified when the address book changes */
/* Removes a first contact whose name is 'Doe' to invoke oncontactsremoved call */
function onErrorCB(err)
{
- console.log('An error occurred: ' + err.name);
+ console.log('An error occurred: ' + err.name);
}
function onContactsFoundCB(contacts)
{
- if (contacts.length > 0)
- {
- try
- {
- addressbook.remove(contacts[0].id);
- console.log('First contact has been removed.');
- }
- catch (err)
- {
- console.log('An error occurred while removing: ' + err.name);
- }
- }
- else
- {
- console.log('No contacts to delete.');
- }
+ if (contacts.length > 0)
+ {
+ try
+ {
+ addressbook.remove(contacts[0].id);
+ console.log('First contact has been removed.');
+ }
+ catch (err)
+ {
+ console.log('An error occurred while removing: ' + err.name);
+ }
+ }
+ else
+ {
+ console.log('No contacts to delete.');
+ }
}
var filter = new tizen.AttributeFilter('name.lastName', 'EXACTLY', 'Doe');
try
{
- addressbook.find(onContactsFoundCB, onErrorCB, filter);
+ addressbook.find(onContactsFoundCB, onErrorCB, filter);
}
catch (err)
{
- console.log('An error occurred while finding: ' + err.name);
+ console.log('An error occurred while finding: ' + err.name);
}
</pre>
</div>
var watcher =
{
- onpersonsadded: function(persons)
- {
- console.log(persons.length + " persons were added");
- },
- onpersonsupdated: function(persons)
- {
- console.log(persons.length + " persons were updated");
- },
- onpersonsremoved: function(ids)
- {
- console.log(ids.length + " persons were deleted");
- }
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + " persons were added");
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + " persons were updated");
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + " persons were deleted");
+ }
};
/* Registers to be notified when the address book changes */
var watcher =
{
- onpersonsadded: function(persons)
- {
- console.log(persons.length + " persons were added");
- },
- onpersonsupdated: function(persons)
- {
- console.log(persons.length + " persons were updated");
- },
- onpersonsremoved: function(ids)
- {
- console.log(ids.length + " persons were deleted");
- }
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + " persons were added");
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + " persons were updated");
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + " persons were deleted");
+ }
};
/* Registers to be notified when the address book changes */
var watcher =
{
- onpersonsadded: function(persons)
- {
- console.log(persons.length + " persons were added");
- },
- onpersonsupdated: function(persons)
- {
- console.log(persons.length + " persons were updated");
- },
- onpersonsremoved: function(ids)
- {
- console.log(ids.length + " persons were deleted");
- }
+ onpersonsadded: function(persons)
+ {
+ console.log(persons.length + " persons were added");
+ },
+ onpersonsupdated: function(persons)
+ {
+ console.log(persons.length + " persons were updated");
+ },
+ onpersonsremoved: function(ids)
+ {
+ console.log(ids.length + " persons were deleted");
+ }
};
/* Registers to be notified when the address book changes */
/* Check the description is editable, and then set a description */
if (content.editableAttributes.indexOf("description") >= 0)
{
- content.description = "Sample content";
+ content.description = "Sample content";
}
tizen.content.update(content);
</pre>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Attributes set successfully');
+ console.log('Attributes set successfully');
}
/* Assume the content is a Content object as a result of find method */
/* Check the rating is editable, and then increase by 1 */
if (content.editableAttributes.indexOf("rating") >= 0)
{
- content.rating++;
+ content.rating++;
}
tizen.content.updateBatch([content], successCB, errorCB);
</pre>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printDirectory(directory, index, directories)
{
- console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
+ console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
}
function getDirectoriesCB(directories)
{
- directories.forEach(printDirectory);
+ directories.forEach(printDirectory);
}
tizen.content.getDirectories(getDirectoriesCB, errorCB);
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printContent(content, index, contents)
{
- console.log('Name: ' + content.name + ' Title: ' + content.title +
- 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
+ console.log('Name: ' + content.name + ' Title: ' + content.title +
+ 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:');
- contents.forEach(printContent);
- /* Increase the offset as much as the count and then find content again */
- if (contents.length === count)
- {
- offset += count;
- tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
- }
+ console.log('The Joshua Tree by U2:');
+ contents.forEach(printContent);
+ /* Increase the offset as much as the count and then find content again */
+ if (contents.length === count)
+ {
+ offset += count;
+ tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
+ }
}
tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB(path)
{
- console.log('scanning is completed');
+ console.log('scanning is completed');
}
tizen.filesystem.resolve("images/tizen.jpg", function(imageFile)
{
- tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
+ tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
});
</pre>
</div>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB(path)
{
- console.log('scanning is completed');
+ console.log('scanning is completed');
}
tizen.filesystem.resolve("images", function(directory)
{
- tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
+ tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
/* Adds the listener */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
var listenerId = tizen.content.addChangeListener(listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
/* Registers to be notified when the content changes */
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err.message);
+ console.log("getPlaylists failed: " + err.message);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
}
function findSuccess(contents)
{
- if (contents.length > 0)
- {
- gPlaylist.add(contents[0]);
- }
+ if (contents.length > 0)
+ {
+ gPlaylist.add(contents[0]);
+ }
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+ tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
}
function findFail(err)
{
- console.log("find FAIL: " + err.message);
+ console.log("find FAIL: " + err.message);
}
function createSuccess(playlist)
{
- console.log("create SUCCESS");
+ console.log("create SUCCESS");
- gPlaylist = playlist;
- tizen.content.find(findSuccess, findFail, null,
- new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
+ gPlaylist = playlist;
+ tizen.content.find(findSuccess, findFail, null,
+ new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
}
function createFail(err)
{
- console.log("create FAIL: " + err.message);
+ console.log("create FAIL: " + err.message);
}
tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
function removePlaylistSuccess()
{
- console.log("removePlaylist SUCCESS");
+ console.log("removePlaylist SUCCESS");
}
function removePlaylistFail(err)
{
- console.log("removePlaylist FAIL: " + err);
+ console.log("removePlaylist FAIL: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
- if (gPlaylists.length < 1)
- {
- console.log("Please add at least 1 playlist");
+ if (gPlaylists.length < 1)
+ {
+ console.log("Please add at least 1 playlist");
- return;
- }
+ return;
+ }
- console.log("will remove playlist at index [0] name:"
- + gPlaylists[0].name);
+ console.log("will remove playlist at index [0] name:"
+ + gPlaylists[0].name);
- tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
- removePlaylistFail);
+ tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
+ removePlaylistFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function createCB(path)
{
- console.log("The thumbnail path is " + path);
+ console.log("The thumbnail path is " + path);
}
function findCB(contents)
{
- if (contents.length > 0)
- {
- tizen.content.createThumbnail(contents[0], createCB);
- }
+ if (contents.length > 0)
+ {
+ tizen.content.createThumbnail(contents[0], createCB);
+ }
}
tizen.content.find(findCB);
function get2Fail(err)
{
- console.log("get items (after remove) failed: " + err);
+ console.log("get items (after remove) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist items:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 1)
- {
- console.log("Please add at least 1 tracks to playlist!");
+ if (gItems.length < 1)
+ {
+ console.log("Please add at least 1 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original playlist:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will remove item at index [0] name:" + gItems[0].content.name);
- gCurPlaylist.remove(gItems[0]);
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("Will remove item at index [0] name:" + gItems[0].content.name);
+ gCurPlaylist.remove(gItems[0]);
+ gCurPlaylist.get(get2Success, get2Fail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after remove batch) failed: " + err);
+ console.log("get items (after remove batch) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist after remove batch:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist after remove batch:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function removeBatchSuccess()
{
- console.log("removeBatch success");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("removeBatch success");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function removeBatchFail(err)
{
- console.log("removeBatch failed: " + err);
+ console.log("removeBatch failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 4)
- {
- console.log("Please add at least 4 tracks to playlist!");
+ if (gItems.length < 4)
+ {
+ console.log("Please add at least 4 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original playlist:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will remove items at index [0](name:" + gItems[0].content.name
- + ") and at index [2](name:" + gItems[2].content.name + ")");
- gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
+ console.log("Will remove items at index [0](name:" + gItems[0].content.name
+ + ") and at index [2](name:" + gItems[2].content.name + ")");
+ gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function getSuccess(items)
{
- gItems = items;
- console.log("Playlist items:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].name);
- }
+ gItems = items;
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].name);
+ }
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- /* To retrieve all playlist items of 'gCurPlaylist' playlist */
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ /* To retrieve all playlist items of 'gCurPlaylist' playlist */
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after set order) failed: " + err);
+ console.log("get items (after set order) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist order after setOrder:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist order after setOrder:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function setOrderSuccess()
{
- console.log("set items order SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("set items order SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function setOrderFail(err)
{
- console.log("set items order failed: " + err);
+ console.log("set items order failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 2)
- {
- console.log("Please add at least 2 tracks to playlist!");
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original order:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- gExpectedOrder = gItems.slice(0);
- gExpectedOrder.reverse();
+ gExpectedOrder = gItems.slice(0);
+ gExpectedOrder.reverse();
- console.log("New order:");
- for (var i = 0; i < gExpectedOrder.length; ++i)
- {
- console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
- }
+ console.log("New order:");
+ for (var i = 0; i < gExpectedOrder.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
+ }
- gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
+ gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after move item) failed: " + err);
+ console.log("get items (after move item) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist order after move:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist order after move:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function moveSuccess()
{
- console.log("move item SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("move item SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function moveFail(err)
{
- console.log("move item failed: " + err);
+ console.log("move item failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 2)
- {
- console.log("Please add at least 2 tracks to playlist!");
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original order:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will move item at index [1] (name: " +
- gItems[1].content.name + ") up by one place (to [0])");
+ console.log("Will move item at index [1] (name: " +
+ gItems[1].content.name + ") up by one place (to [0])");
- gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
- gItems.unshift(gItems.splice(1, 1)[0]);
+ gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
+ gItems.unshift(gItems.splice(1, 1)[0]);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
/* Handling device discovery results */
var discoveryCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- /* Do something with the discovered device */
- /* If desired device is found, stop discovery with following call */
- tizen.convergence.stopDiscovery();
- },
-
- onfinished: function(foundDevices)
- {
- console.log('Device discovery has finished');
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ /* Do something with the discovered device */
+ /* If desired device is found, stop discovery with following call */
+ tizen.convergence.stopDiscovery();
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log('Device discovery has finished');
+ }
};
/* Running device discovery procedure */
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoveryCallback, function(err)
- {
- console.log(err.name + ': ' + err.message);
- }, 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoveryCallback, function(err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }, 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(channelinfo, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channelinfo.uri);
- console.log('channel id: ' + channelinfo.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channelinfo.uri);
+ console.log('channel id: ' + channelinfo.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
/* Create an instance of application communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(channelinfo, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channelinfo.uri);
- console.log('channel id: ' + channelinfo.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channelinfo.uri);
+ console.log('channel id: ' + channelinfo.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess(clientinfolist)
{
- console.log('get client list');
- for (i in clientinfolist)
- {
- console.log('isHost: ' + clientinfolist[i].isHost);
- console.log('client id: ' + clientinfolist[i].clientId);
- console.log('connection time: ' + clientinfolist[i].connectionTime);
- }
+ console.log('get client list');
+ for (i in clientinfolist)
+ {
+ console.log('isHost: ' + clientinfolist[i].isHost);
+ console.log('client id: ' + clientinfolist[i].clientId);
+ console.log('connection time: ' + clientinfolist[i].connectionTime);
+ }
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri' + channel.uri);
- console.log('channel id ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- service.getClientList(requestChannel, onsuccess, onerror);
+ console.log('Channel started');
+ console.log('channel uri' + channel.uri);
+ console.log('channel id ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ service.getClientList(requestChannel, onsuccess, onerror);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess(clientinfolist)
{
- console.log('get client list');
- for (i in clientinfolist)
- {
- console.log('isHost: ' + clientinfolist[i].isHost);
- console.log('client id: ' + clientinfolist[i].clientId);
- console.log('connection time: ' + clientinfolist[i].connectionTime);
- }
+ console.log('get client list');
+ for (i in clientinfolist)
+ {
+ console.log('isHost: ' + clientinfolist[i].isHost);
+ console.log('client id: ' + clientinfolist[i].clientId);
+ console.log('connection time: ' + clientinfolist[i].connectionTime);
+ }
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri' + channel.uri);
- console.log('channel id ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- clientService.getClientList(requestChannel, onsuccess, onerror);
+ console.log('Channel started');
+ console.log('channel uri' + channel.uri);
+ console.log('channel id ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ clientService.getClientList(requestChannel, onsuccess, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function sendSuccessCallback(channelinfo)
{
- console.log('requestPayload sent');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('requestPayload sent');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by Multi Screen server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- /* Send data to the remote service */
- service.send(channel, requestPayload, sendSuccessCallback, onerror);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by Multi Screen server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ /* Send data to the remote service */
+ service.send(channel, requestPayload, sendSuccessCallback, onerror);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function sendSuccessCallback(channel)
{
- console.log('requestPayload sent');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('requestPayload sent');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- /* Send data to the remote service */
- clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ /* Send data to the remote service */
+ clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- clientService = device.service[i];
- clientService.start(requestChannel, onstarted, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ clientService = device.service[i];
+ clientService.start(requestChannel, onstarted, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped(channel)
{
- console.log('Channel stopped');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('Channel stopped');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('clienti id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- if (channel id == 'chB')
- {
- service.stop(requestChannel2, onstopped);
- }
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('clienti id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ if (channel id == 'chB')
+ {
+ service.stop(requestChannel2, onstopped);
+ }
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped(channel)
{
- console.log('Channel stopped');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('Channel stopped');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- if (channel id == 'chB')
- {
- clientService.stop(requestChannel2, onstopped);
- }
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ if (channel id == 'chB')
+ {
+ clientService.stop(requestChannel2, onstopped);
+ }
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onnotify(channel, payload, senderclientid)
{
- console.log('On service notification');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- /* clientid of the sender of the payload */
- console.log('client id of sender: ' + senderclientid);
- for (i in payload)
- {
- console.log('payload: ' + payload[i].key + '-' + payload[i].value);
- }
- /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
- service.unsetListener();
+ console.log('On service notification');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ /* clientid of the sender of the payload */
+ console.log('client id of sender: ' + senderclientid);
+ for (i in payload)
+ {
+ console.log('payload: ' + payload[i].key + '-' + payload[i].value);
+ }
+ /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
+ service.unsetListener();
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by Multi Screen server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by Multi Screen server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onnotify(channel, payload, senderclientid)
{
- console.log('On service notification');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- /* clientid of the sender of the payload */
- console.log('client id of sender: ' + senderclientid);
- for (i in payload)
- {
- console.log('payload ' + payload[i].key + ': ' + payload[i].value);
- }
- /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
- clientService.unsetListener();
+ console.log('On service notification');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ /* clientid of the sender of the payload */
+ console.log('client id of sender: ' + senderclientid);
+ for (i in payload)
+ {
+ console.log('payload ' + payload[i].key + ': ' + payload[i].value);
+ }
+ /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
+ clientService.unsetListener();
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- service.start(requestChannel, onstarted, onerror);
- /* Register listener to receive notifications from remote service */
- service.setListener(onnotify);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ service.start(requestChannel, onstarted, onerror);
+ /* Register listener to receive notifications from remote service */
+ service.setListener(onnotify);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- }
- else if (service.type === "REMOTE_APP_CONTROL")
- {
- console.log('Connected to the remote app control service');
- }
- service.disconnect();
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ }
+ else if (service.type === "REMOTE_APP_CONTROL")
+ {
+ console.log('Connected to the remote app control service');
+ }
+ service.disconnect();
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- else if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ else if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke on success
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(service)
{
- console.log('Remote app control service started');
- service.disconnect();
+ console.log('Remote app control service started');
+ service.disconnect();
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.start(onstarted, onerror);
+ console.log('Connected to the remote app control service');
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- device.services[i].start(onstarted, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ device.services[i].start(onstarted, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
<div class="output">
<span class="title"><p>Output example:</p></span><pre> >> STARTING DEVICE DISCOVERY
<< Found a device
- - id: de2bea-ddvia
- - name : deviceA
- - type : TV
- - service amount: 2
+ - id: de2bea-ddvia
+ - name : deviceA
+ - type : TV
+ - service amount: 2
<< Device discovery has finished
Connected to the remote app control service
Remote app control service started
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on success
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped()
{
- console.log('Remote App Control service stopped');
- /* Disconnect */
- service.disconnect();
+ console.log('Remote App Control service stopped');
+ /* Disconnect */
+ service.disconnect();
}
function onstarted(service)
{
- console.log('Remote App Control service started');
- /* Stop the service */
- service.stop(onstopped, onerror);
+ console.log('Remote App Control service started');
+ /* Stop the service */
+ service.stop(onstopped, onerror);
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.start(onstarted, onerror);
+ console.log('Connected to the remote app control service');
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- device.services[i].start(onstarted, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ device.services[i].start(onstarted, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
<div class="output">
<span class="title"><p>Output example:</p></span><pre> >> STARTING DEVICE DISCOVERY
<< Found a device
- - id: de2bea-ddvia
- - name : deviceA
- - type : TV
- - service amount: 2
+ - id: de2bea-ddvia
+ - name : deviceA
+ - type : TV
+ - service amount: 2
<< Device discovery has finished
Connected to the remote app control service
Remote App Control service started
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.disconnect();
+ console.log('Connected to the remote app control service');
+ service.disconnect();
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
console.log('>> STARTING DEVICE DISCOVERY');
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function ondisconnected()
{
- console.log('Disconnected to the service');
+ console.log('Disconnected to the service');
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState == "CONNECTED")
- {
- device.services[i].disconnect(ondisconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log('Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState == "CONNECTED")
+ {
+ device.services[i].disconnect(ondisconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log('Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess()
{
- console.log('The application has launched successfully');
+ console.log('The application has launched successfully');
}
function onstarted(service)
{
- console.log('Service started');
+ console.log('Service started');
- /* Launching server app remotely */
- service.launch(requestAppId, remoteAppControlCallback, onerror);
+ /* Launching server app remotely */
+ service.launch(requestAppId, remoteAppControlCallback, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- /* Start the service */
- service.start(onstarted, onerror);
+ console.log('Connected to the service');
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
console.log('>> STARTING DEVICE DISCOVERY');
The method to invoke on failure.
</li>
<li class="param">
-<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the application gets back result from the remote service.
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var requestAppControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/view',
- null, 'image/jpeg', null,
- [new tizen.ApplicationControlData('images', [testImgData])]);
+ null, 'image/jpeg', null,
+ [new tizen.ApplicationControlData('images', [testImgData])]);
function onsuccess()
{
- console.log('Launch application control succeed');
+ console.log('Launch application control succeed');
}
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
var remoteAppControlCallback =
{
- onsuccess: function(data)
- {
- console.log('On remote app control service reply');
- for(var i = 0; i < data.length; i++)
- {
- console.log("key : " + data[i].key + "value : " + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ onsuccess: function(data)
+ {
+ console.log('On remote app control service reply');
+ for(var i = 0; i < data.length; i++)
+ {
+ console.log("key : " + data[i].key + "value : " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
function onstarted(service)
{
- console.log('Service started');
+ console.log('Service started');
- /* Send data to the remote service */
- service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
+ /* Send data to the remote service */
+ service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
}
function onconnected(service)
{
- console.log('Connected to the service');
+ console.log('Connected to the service');
- /* Start the service */
- service.start(onstarted, onerror);
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">expression</span>:
+<span class="name">expression</span>:
The expression to be evaluated.
</li>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be displayed if an expression is false.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">obj</span>:
+<span class="name">obj</span>:
An object whose JavaScript representation will be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">obj</span>:
+<span class="name">obj</span>:
An object whose XML/HTML Element representation will be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
The label to start timing with.
</li>
</ul>
var array = new Array(1000000);
for (var i = array.length - 1; i >= 0; i -= 1)
{
- array[i] = new Object();
+ array[i] = new Object();
};
console.timeEnd("Big array initialization");
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
The label associated to the timing (with the use of <var>console.time()</var>method).
</li>
</ul>
var array = new Array(1000000);
for (var i = array.length - 1; i >= 0; i -= 1)
{
- array[i] = new Object();
+ array[i] = new Object();
};
console.timeEnd("Big array initialization");
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Error object containing some information about the error.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked with current acceleration values.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked with current acceleration values.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Specifies the interval of calling successcallback in miliseconds. If not provided, default value for frequency is 10000 (10 seconds).
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- console.log('Please wait 3 seconds for the next measurement...');
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ console.log('Please wait 3 seconds for the next measurement...');
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
var options = {frequency: 3000}; /* Update every 3 seconds */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchID</span>:
+<span class="name">watchID</span>:
The id of the watch returned from <a href="device-motion.html#Accelerometer::watchAcceleration">watchAcceleration</a>.
</li>
</ul>
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- if (3 == ++counter)
- {
- navigator.accelerometer.clearWatch(watchID);
- }
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ if (3 == ++counter)
+ {
+ navigator.accelerometer.clearWatch(watchID);
+ }
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
var options = {frequency: 30}; /* Update every 0.03 seconds */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">acceleration</span>:
+<span class="name">acceleration</span>:
The acceleration at a single moment in time.
</li>
</ul>
function onDeviceReady()
{
- console.log('Device Cordova: ' + device.cordova);
+ console.log('Device Cordova: ' + device.cordova);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Model: ' + device.model);
+ console.log('Device Model: ' + device.model);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Platform: ' + device.platform);
+ console.log('Device Platform: ' + device.platform);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device UUID: ' + device.uuid);
+ console.log('Device UUID: ' + device.uuid);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Version: ' + device.version);
+ console.log('Device Version: ' + device.version);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog dialog.
</li>
<li class="param">
-<span class="name">alertCallback</span>:
+<span class="name">alertCallback</span>:
The callback to be invoked when alert dialog would be dismissed.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Dialog'.
</li>
<li class="param">
-<span class="name">buttonName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button name to be shown on dialog box. Default value is 'OK'.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var alertDismissed = function()
{
- console.log('Alert was dismissed');
+ console.log('Alert was dismissed');
}
navigator.notification.alert('Please click OK button', alertDismissed,
- 'OK click alert', 'OK');
+ 'OK click alert', 'OK');
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog box.
</li>
<li class="param">
-<span class="name">confirmCallback</span>:
+<span class="name">confirmCallback</span>:
The callback to be invoked when user perform an action on dialog box.
Callback provides index of button pressed (1,2,3 etc.) or 0, if dialog was dismissed without button press.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Confirm'.
</li>
<li class="param">
-<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button names to be shown on dialog box. Default values are ['OK', 'Cancel'].
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var confirmCallback = function(buttonIndex)
{
- console.log('Selected option was ' + buttonIndex);
+ console.log('Selected option was ' + buttonIndex);
}
navigator.notification.confirm('Choose one option', confirmCallback,
- 'Options', ['Option1', 'Option2']);
+ 'Options', ['Option1', 'Option2']);
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog box.
</li>
<li class="param">
-<span class="name">promptCallback</span>:
+<span class="name">promptCallback</span>:
The callback to be invoked when user perform an action on dialog box.
Callback provides <em>PromptData</em> object, which holds all data provided by user.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Prompt'.
</li>
<li class="param">
-<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button names to be shown on dialog box. Default values are ['OK', 'Cancel'].
</li>
<li class="param">
-<span class="name">defaultText</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">defaultText</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Default text to be shown in textbox of dialog box. Default value is an empty string ('').
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var promptCallback = function(results)
{
- console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
+ console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
}
navigator.notification.prompt('Please enter your name', promptCallback,
- 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
+ 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">times</span>:
+<span class="name">times</span>:
The number of times to repeat the beep.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">buttonIndex</span>:
+<span class="name">buttonIndex</span>:
The index of button, which was pressed by user.
the index uses one-based indexing, so the values could be 1, 2, 3, etc.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The data input into dialog box.
</li>
</ul>
function onDeviceReady()
{
- /* Now safe to use device APIs */
+ /* Now safe to use device APIs */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('pause', onPause, false);
+ document.addEventListener('pause', onPause, false);
}
function onPause()
{
- /* Handle the pause event */
+ /* Handle the pause event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('resume', onResume, false);
+ document.addEventListener('resume', onResume, false);
}
function onResume()
{
- /* Handle the resume event */
+ /* Handle the resume event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('backbutton', onBackKeyDown, false);
+ document.addEventListener('backbutton', onBackKeyDown, false);
}
function onBackKeyDown()
{
- /* Handle the back button */
+ /* Handle the back button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('menubutton', onMenuKeyDown, false);
+ document.addEventListener('menubutton', onMenuKeyDown, false);
}
function onMenuKeyDown()
{
- /* Handle the back button */
+ /* Handle the back button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('searchbutton', onSearchKeyDown, false);
+ document.addEventListener('searchbutton', onSearchKeyDown, false);
}
function onSearchKeyDown()
{
- /* Handle the search button */
+ /* Handle the search button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('startcallbutton', onStartCallKeyDown, false);
+ document.addEventListener('startcallbutton', onStartCallKeyDown, false);
}
function onStartCallKeyDown()
{
- /* Handle the start call button */
+ /* Handle the start call button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('endcallbutton', onEndCallKeyDown, false);
+ document.addEventListener('endcallbutton', onEndCallKeyDown, false);
}
function onEndCallKeyDown()
{
- /* Handle the end call button */
+ /* Handle the end call button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
+ document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
}
function onVolumeDownKeyDown()
{
- /* Handle the volume down button */
+ /* Handle the volume down button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
+ document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
}
function onVolumeUpKeyDown()
{
- /* Handle the volume up button */
+ /* Handle the volume up button */
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var eventInit =
{
- loaded: 128,
- total: 1024
+ loaded: 128,
+ total: 1024
};
var event = new ProgressEvent('submit', eventInit);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fileSystem)
{
- console.log('Name of the filesystem: ' + fileSystem.name);
+ console.log('Name of the filesystem: ' + fileSystem.name);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Local file system type, either TEMPORARY or PERSISTENT.
</li>
<li class="param">
-<span class="name">size</span>:
+<span class="name">size</span>:
Indicates how much storage space, in bytes, the application expects to need.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked with a <em>FileSystem</em> object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked if error occurs retrieving file system.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(fs)
{
- console.log('File system name ' + fs.name);
+ console.log('File system name ' + fs.name);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span>:
+<span class="name">uri</span>:
URI referring to a local file or directory.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked with <em>Entry</em> object corresponding to URI.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked if error occurs retrieving file system entry.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(entry)
{
- console.log('Entry name ' + entry.name);
+ console.log('Entry name ' + entry.name);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
var uri = 'file:///home/owner/content/Documents/example.txt';
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the time of the last modification.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called when errors happen.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getMetadata(function(metadata)
- {
- console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
- });
+ fs.root.getMetadata(function(metadata)
+ {
+ console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">parent</span>:
+<span class="name">parent</span>:
The directory to which to move the entry.
</li>
<li class="param">
-<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The new name of the entry. Defaults to the Entry's current name if unspecified.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called with the Entry for the new location.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
- {
- fs.root.getFile("aa.txt", {create:true}, function(fileentry)
- {
- console.log('Full path before move: ' + fileentry.fullPath);
- fileentry.moveTo(direntry, 'newname.txt', successCallback);
- });
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("aa.txt", {create:true}, function(fileentry)
+ {
+ console.log('Full path before move: ' + fileentry.fullPath);
+ fileentry.moveTo(direntry, 'newname.txt', successCallback);
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">parent</span>:
+<span class="name">parent</span>:
The directory to which to copy the entry.
</li>
<li class="param">
-<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The new name of the entry. Defaults to the Entry's current name if unspecified.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called with the Entry for the new location.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
- {
- fs.root.getFile("test.txt", {create:true}, function(fileentry)
- {
- fileentry.copyTo(direntry, 'newname.txt', successCallback);
- });
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("test.txt", {create:true}, function(fileentry)
+ {
+ fileentry.copyTo(direntry, 'newname.txt', successCallback);
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called to return the parent Entry.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getParent(function(entry)
- {
- console.log("success");
- });
+ fs.root.getParent(function(entry)
+ {
+ console.log("success");
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called on success.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile('test.txt', {create: true}, function(fileEntry)
- {
- fileEntry.remove(function()
- {
- console.log("success");
- });
- });
+ fs.root.getFile('test.txt', {create: true}, function(fileEntry)
+ {
+ fileEntry.remove(function()
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(entry)
- {
- var url = entry.toURL();
- console.log('URL: ' + url);
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(entry)
+ {
+ var url = entry.toURL();
+ console.log('URL: ' + url);
+ });
});
</pre>
</div>
Since: </span>
3.0
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(entry)
{
- entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
- {
- var directoryReader = dirEntry.createReader();
- });
+ entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
+ {
+ var directoryReader = dirEntry.createReader();
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">path</span>:
+<span class="name">path</span>:
Either an absolute path or a relative path from this DirectoryEntry to the directory to be looked up or created. It is an error to attempt to create a directory whose immediate parent does not yet exist.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flags
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called to return the DirectoryEntry selected or created.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory("ert", {create:true}, function(dir)
- {
- console.log('Created dir: ' + dir.name);
- })
+ fs.root.getDirectory("ert", {create:true}, function(dir)
+ {
+ console.log('Created dir: ' + dir.name);
+ })
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">path</span>:
+<span class="name">path</span>:
Either an absolute path or a relative path from this DirectoryEntry to the file to be looked up or created. It is an error to attempt to create a file whose immediate parent does not yet exist.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flags
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called to return the File selected or created.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("qa.txt", {create:true}, function(file)
- {
- console.log('Created file: ' + file.name);
- });
+ fs.root.getFile("qa.txt", {create:true}, function(file)
+ {
+ console.log('Created file: ' + file.name);
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called on success.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
- {
- directoryEntry.removeRecursively(function()
- {
- console.log("success");
- });
- });
+ fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
+ {
+ directoryEntry.removeRecursively(function()
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Called once per successful call to readEntries to deliver the next previously-unreported set of Entries in the associated Directory. If all Entries have already been returned from previous invocations of readEntries, successCallback must be called with a zero-length array as an argument.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback indicating that there was an error reading from the Directory.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- var a = fs.root.createReader();
- a.readEntries(function successCallback(entries)
- {
- console.log("success");
- });
+ var a = fs.root.createReader();
+ a.readEntries(function successCallback(entries)
+ {
+ console.log("success");
+ });
});
</pre>
</div>
void file (<a href="#FileCallback">FileCallback</a> onsuccess, optional <a href="#ErrorCallback">ErrorCallback</a> onerror);
};</pre>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the new FileWriter.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("logFile.txt", {create: true}, function(f)
- {
- f.createWriter(function(fileWriter)
- {
- fileWriter.write(new Blob(['hello']));
- fileWriter.onerror = function(e)
- {
- console.log('Write file failed:' + e);
- };
- fileWriter.onwriteend = function()
- {
- console.log("success");
- };
- });
- });
+ fs.root.getFile("logFile.txt", {create: true}, function(f)
+ {
+ f.createWriter(function(fileWriter)
+ {
+ fileWriter.write(new Blob(['hello']));
+ fileWriter.onerror = function(e)
+ {
+ console.log('Write file failed:' + e);
+ };
+ fileWriter.onwriteend = function()
+ {
+ console.log("success");
+ };
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the File.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("abcdz.txt", {create: true}, function(f)
- {
- f.file(function(file)
- {
- console.log("success");
- });
- });
+ fs.root.getFile("abcdz.txt", {create: true}, function(f)
+ {
+ f.file(function(file)
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
var deviceReady, fileReader;
deviceReady = function()
{
- fileReader = new FileReader();
+ fileReader = new FileReader();
};
document.addEventListener('deviceready', deviceReady, true);
</pre>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded');
+ console.log('Loaded');
};
fileReader.onabort = function()
{
- console.log('aborted');
+ console.log('aborted');
};
fileReader.readAsDataURL(blob);
fileReader.abort();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as data URL.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsDataURL(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as text.
</li>
<li class="param">
-<span class="name">label</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">label</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An optional argument, that represents the label of an encoding
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsText(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as binary.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsBinaryString(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as array buffer.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- resultValue = fileReader.result;
- console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
+ resultValue = fileReader.result;
+ console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
};
fileReader.readAsArrayBuffer(blob);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('write success');
- };
- writer.onabort = function(e)
- {
- console.log('abort');
- };
- writer.write('some sample text');
- writer.abort();
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+ writer.onabort = function(e)
+ {
+ console.log('abort');
+ };
+ writer.write('some sample text');
+ writer.abort();
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">offset</span>:
+<span class="name">offset</span>:
Location to move the file pointer to.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- /* Fast forwards file pointer to the end of file */
- writer.seek(writer.length);
+ /* Fast forwards file pointer to the end of file */
+ writer.seek(writer.length);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">size</span>:
+<span class="name">size</span>:
Size to chop the file at.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('truncate success');
- };
+ writer.onwrite = function(evt)
+ {
+ console.log('truncate success');
+ };
- writer.truncate(10);
+ writer.truncate(10);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Text or Blob to be written.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('write success');
- };
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
- writer.write('some sample text');
+ writer.write('some sample text');
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
A progress event.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filesystem</span>:
+<span class="name">filesystem</span>:
FileSystem The file systems to which the app is granted access.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entry</span>:
+<span class="name">entry</span>:
Entry
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entries</span>:
+<span class="name">entries</span>:
Entry[]
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">metadata</span>:
+<span class="name">metadata</span>:
Metadata
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileWriter</span>:
+<span class="name">fileWriter</span>:
FileWriter
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
File
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">err</span>:
+<span class="name">err</span>:
FileError
</li>
</ul>
var win = function(r)
{
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
}
var fail = function(error)
{
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
}
var options = new FileUploadOptions();
var win = function(r)
{
- console.log('Success. File uploaded.');
+ console.log('Success. File uploaded.');
}
var fail = function(error)
{
- /* error.code == FileTransferError.ABORT_ERR */
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
};
var ft = new FileTransfer();
ft.onprogress = function(event)
{
- console.log('uploaded: ' + event.loaded);
+ console.log('uploaded: ' + event.loaded);
};
ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileURL</span>:
+<span class="name">fileURL</span>:
Filesystem URL representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
</li>
<li class="param">
-<span class="name">server</span>:
+<span class="name">server</span>:
URL of the server to receive the file, as encoded by encodeURI().
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is passed a FileUploadResult object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
: A callback that executes if an error occurs retrieving the FileUploadResult. Invoked with a FileTransferError object.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameters
</li>
<li class="param">
-<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameter, defaults to false. If set to true, it accepts all security certificates.
</li>
</ul>
var win = function(r)
{
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
}
var fail = function(error)
{
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
}
var ft = new FileTransfer();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">source</span>:
+<span class="name">source</span>:
URL of the server to download the file, as encoded by encodeURI().
</li>
<li class="param">
-<span class="name">target</span>:
+<span class="name">target</span>:
Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is passed a FileEntry object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that executes if an error occurs when retrieving the FileEntry. Invoked with a FileTransferError object.
</li>
<li class="param">
-<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameter, defaults to false. If set to true, it accepts all security certificates.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
</li>
</ul>
fileTransfer.download(uri, fileURL, function(entry)
{
- console.log('download complete: ' + entry.toURL());
+ console.log('download complete: ' + entry.toURL());
}, function(error)
{
- console.log('download error source ' + error.source);
- console.log('download error target ' + error.target);
- console.log('upload error code' + error.code);
+ console.log('download error source ' + error.source);
+ console.log('download error target ' + error.target);
+ console.log('upload error code' + error.code);
}, false,
{
- headers:
- {
- 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
- }
+ headers:
+ {
+ 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
+ }
});
</pre>
</div>
var win = function(r)
{
- console.log('Should not be called.');
+ console.log('Should not be called.');
}
var fail = function(error)
{
- /* error.code == FileTransferError.ABORT_ERR */
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
};
var ft = new FileTransfer();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">result</span>:
+<span class="name">result</span>:
A result object that defines an upload result.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
An object that defines a downloaded file.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
An object that defines details of the error
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked if the preferred language
is obtained successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
during this method's execution.
</li>
*/
navigator.globalization.getPreferredLanguage(function(language)
{
- console.log('Language: ' + language.value);
+ console.log('Language: ' + language.value);
}, function()
{
- console.log('Error getting language.');
+ console.log('Error getting language.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback function called when the locale name
has been obtained successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors
occuring while getting a locale name.
</li>
*/
navigator.globalization.getLocaleName(function(locale)
{
- console.log('Locale: ' + locale.value);
+ console.log('Locale: ' + locale.value);
}, function()
{
- console.log('Error getting locale.');
+ console.log('Error getting locale.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
The date to be converted to a DOMString. It should be of type Date.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method called after a successful conversion.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called if errors occur during conversion.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Optional parameter defining conversion options. The default values are:
<var>{formatLength : 'short', selector : 'date and time'}</var>.
</li>
*/
navigator.globalization.dateToString(new Date(), function(date)
{
- console.log('Date: ' + date.value);
+ console.log('Date: ' + date.value);
}, function()
{
- console.log('Error getting dateString.');
+ console.log('Error getting dateString.');
}, {formatLength: 'short', selector: 'date and time'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">currencyCode</span>:
+<span class="name">currencyCode</span>:
ISO 4217 compliant currency code provided as a DOMString,
for example 'USD'.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method invoked after a successful conversion.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called if errors occur during the conversion.
</li>
</ul>
*/
navigator.globalization.getCurrencyPattern('USD', function(pattern)
{
- console.log('pattern: ' + pattern.pattern);
- console.log('code: ' + pattern.code);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
+ console.log('pattern: ' + pattern.pattern);
+ console.log('code: ' + pattern.code);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
}, function()
{
- console.log('Error getting pattern.');
+ console.log('Error getting pattern.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The function to be called if this method returns the names correctly.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The function to be called in case of error occuring.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
An optional parameter specifying additional options.
The default value is <var>{type: 'wide', item: 'months'}</var> </li>
</ul>
*/
navigator.globalization.getDateNames(function(names)
{
- for (var i = 0; i < names.value.length; i++)
- {
- console.log('month: ' + names.value[i]);
- }
+ for (var i = 0; i < names.value.length; i++)
+ {
+ console.log('month: ' + names.value[i]);
+ }
}, function()
{
- console.log('Error getting names.');
+ console.log('Error getting names.');
}, {type: 'wide', item: 'months'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to be invoked when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The function to be invoked in case of errors occuring.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
The DateOptions object containing additional options.
The default value is <var>{formatLength: 'short', selector: 'date and time'}</var>.
</li>
*/
function checkDatePattern()
{
- navigator.globalization.getDatePattern(function(date)
- {
- console.log('Date pattern: ' + date.pattern);
- }, function()
- {
- console.log('Error getting pattern');
- }, {formatLength: 'short', selector: 'date and time'});
+ navigator.globalization.getDatePattern(function(date)
+ {
+ console.log('Date pattern: ' + date.pattern);
+ }, function()
+ {
+ console.log('Error getting pattern');
+ }, {formatLength: 'short', selector: 'date and time'});
}
checkDatePattern();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to be called when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The method to be invoked in case of errors occuring.
</li>
</ul>
*/
navigator.globalization.getFirstDayOfWeek(function(day)
{
- console.log('day: ' + day.value);
+ console.log('day: ' + day.value);
}, function()
{
- console.log('Error getting first day of week.');
+ console.log('Error getting first day of week.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked
when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method to be invoked
in case of errors occuring during this method's execution.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Defines the type of numeric value for which
the pattern will be returned.
</li>
*/
navigator.globalization.getNumberPattern(function(pattern)
{
- console.log('pattern: ' + pattern.pattern);
- console.log('symbol: ' + pattern.symbol);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('positive: ' + pattern.positive);
- console.log('negative: ' + pattern.negative);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
+ console.log('pattern: ' + pattern.pattern);
+ console.log('symbol: ' + pattern.symbol);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('positive: ' + pattern.positive);
+ console.log('negative: ' + pattern.negative);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
}, function()
{
- console.log('An error occurred.');
+ console.log('An error occurred.');
}, {type: 'decimal'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
The Date object for which the daylight savings time status will be checked.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be called when this function
successfully completes its execution.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method to be called in case of
errors occuring during this method's execution.
</li>
*/
navigator.globalization.isDayLightSavingsTime(new Date(), function(date)
{
- console.log('dst: ' + date.dst);
+ console.log('dst: ' + date.dst);
}, function()
{
- console.log('Error getting the DST state.');
+ console.log('Error getting the DST state.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">number</span>:
+<span class="name">number</span>:
The number that will be converted to a DOMString
in accordance with the client's user preferences.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback function executed when the conversion
is done successfully. The results of the conversion are passed
as a parameter to this callback function.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback function executed in case of errors
occuring during the conversion. The GlobalizationError object with
the details is passed as a parameter to this callback function.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of conversion.
It is a dictionary with a single property <var>type</var>.
The default value of this parameter is <var>{type: 'decimal'}</var>.
*/
navigator.globalization.numberToString(3.1415926, function(number)
{
- console.log('decimal number: ' + number.value);
+ console.log('decimal number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
navigator.globalization.numberToString(1000003, function(number)
{
- console.log('big decimal number: ' + number.value);
+ console.log('big decimal number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
navigator.globalization.numberToString(0.3183099, function(number)
{
- console.log('percentile: ' + number.value);
+ console.log('percentile: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'percent'});
navigator.globalization.numberToString(1099.95, function(number)
{
- console.log('currency: ' + number.value);
+ console.log('currency: ' + number.value);
}, function()
{
- console.log('Error getting number');
+ console.log('Error getting number');
}, {type: 'currency'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dateString</span>:
+<span class="name">dateString</span>:
a string containing the representation of a date to be converted
to a Date object.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method invoked when the conversion completes successfully.
The result of conversion is passed as a parameter to this callback.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors occuring during
the conversion. A GlobalizationError object is passed as a parameter
to this callback.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of the conversion.
The default value is <var>{formatLength: 'short', selector: 'date and time'}</var>.
</li>
*/
navigator.globalization.stringToDate('9/25/2012', function(date)
{
- console.log('month: ' + date.month +
- ', day: ' + date.day +
- ', year: ' + date.year)
+ console.log('month: ' + date.month +
+ ', day: ' + date.day +
+ ', year: ' + date.year)
}, function()
{
- console.log('Error getting date.');
+ console.log('Error getting date.');
}, {selector: 'date'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">numberString</span>:
+<span class="name">numberString</span>:
The DOMString containing a text representation of a number
to be converted to a double data type.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method called after a successful conversion.
The result of a conversion is passed as a parameter of this callback method.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors occuring during
the conversion. The error is passed as a parameter of this callback method.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of the conversion.
The default value is <var>{type: 'decimal'}</var> </li>
</ul>
*/
navigator.globalization.stringToNumber('1234.56', function(number)
{
- console.log('number: ' + number.value);
+ console.log('number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "dst" of boolean type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a DOMString type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
an object with the field "value"
containing an Array of DOMString values.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a long type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a double type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
a GlobalizationDate object containing the date information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a CurrencyPattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a DatePattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a NumberPattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">positionSuccessCallback</span>:
+<span class="name">positionSuccessCallback</span>:
The callback that is passed the current position in seconds.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span>:
The callback to execute if an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
positionSuccessCallback = function(position)
{
- console.log('Current position is ' + position);
+ console.log('Current position is ' + position);
}
var src = 'file:///home/app/content/Documents/play.mp3';
setTimeout(function()
{
- myMedia.getCurrentPosition(positionSuccessCallback);
+ myMedia.getCurrentPosition(positionSuccessCallback);
}, 2000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file:///home/app/content/Documents/play.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
statusCallback = function(status)
{
- if (status == Media.MEDIA_PAUSED)
- {
- console.log('Audio file has been paused');
- }
+ if (status == Media.MEDIA_PAUSED)
+ {
+ console.log('Audio file has been paused');
+ }
}
var src = 'file:///home/app/content/Documents/play.mp3';
/* Pause after 2 seconds */
setTimeout(function()
{
- myMedia.pause();
+ myMedia.pause();
}, 2000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file:///home/app/content/Documents/play.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been stopped or released.');
+ console.log('Audio file has been stopped or released.');
}
errorCallback = function(err)
{
- console.log('An error occurred: ' + err.message);
+ console.log('An error occurred: ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
The position to set the playback position within the audio, in milliseconds.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('An error occurred: ' + err.message);
+ console.log('An error occurred: ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* SeekTo to 10 seconds after 5 seconds */
setTimeout(function()
{
- myMedia.seekTo(10000);
- console.log('Playback position has been set to 10 seconds.');
+ myMedia.seekTo(10000);
+ console.log('Playback position has been set to 10 seconds.');
}, 5000);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
The volume to set for playback. The value must be within the range of 0.0 to 1.0.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* Mute volume after 2 seconds */
setTimeout(function()
{
- myMedia.setVolume(0.0);
- console.log('Playback volume has been muted.');
+ myMedia.setVolume(0.0);
+ console.log('Playback volume has been muted.');
}, 2000);
/* Set volume to 1.0 after 5 seconds */
setTimeout(function()
{
- myMedia.setVolume(1.0);
- console.log('Playback volume has been set to 1.0.');
+ myMedia.setVolume(1.0);
+ console.log('Playback volume has been set to 1.0.');
}, 5000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Started recording an audio file.');
+ console.log('Started recording an audio file.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'recordAudio.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Started recording an audio file.');
+ console.log('Started recording an audio file.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'recordAudio.mp3';
/* Stop recording after 10 seconds */
setTimeout(function()
{
- myRecMedia.stopRecord();
- console.log('Stopped recording an audio file.');
+ myRecMedia.stopRecord();
+ console.log('Stopped recording an audio file.');
}, 10000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been stopped.');
+ console.log('Audio file has been stopped.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* Stop after 10 seconds */
setTimeout(function()
{
- myMedia.stop();
+ myMedia.stop();
}, 10000);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Error object containing some information about the error.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">status</span>:
+<span class="name">status</span>:
The status of the <a href="media.html#Media">Media</a> object. It is equal to one of the Media interface constant: MEDIA_NONE, MEDIA_STARTING, MEDIA_RUNNING, MEDIA_PAUSED or MEDIA_STOPPED.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
The current position of the media file.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function checkConnection()
{
- var networkState = navigator.connection.type;
+ var networkState = navigator.connection.type;
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
- alert('Connection type: ' + states[networkState]);
+ var states = {};
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+ alert('Connection type: ' + states[networkState]);
}
checkConnection();
function onDeviceReady()
{
- document.addEventListener('online', onOnline, false);
+ document.addEventListener('online', onOnline, false);
}
function onOnline()
{
- /* Handle the online event */
+ /* Handle the online event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('offline', onOffline, false);
+ document.addEventListener('offline', onOffline, false);
}
function onOffline()
{
- /* Handle the offline event */
+ /* Handle the offline event */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">providerId</span>:
+<span class="name">providerId</span>:
A provider ID to use, which should be shared between the DataControl provider and DataControl consumer.
</li>
<li class="param">
-<span class="name">dataId</span>:
+<span class="name">dataId</span>:
A string for identifying specific data.
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The DataType to use.
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-/*
+/*
The data provider, a native application, should be pre-installed and launched
The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer)
In this example, the DictionaryDataControlProvider native sample application is used as a data control provider
/* Gets SQL type DataControlConsumerObject */
try
{
- var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
+ var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
}
catch (err)
{
- console.log(err.name +": " + err.message);
+ console.log(err.name +": " + err.message);
}
/* Gets MAP type DataControlConsumerObject */
try
{
- globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
+ globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
}
catch (err)
{
- console.log(err.name +": " + err.message);
+ console.log(err.name +": " + err.message);
}
</pre>
</div>
Since: </span>
2.1
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">insertionData</span>:
+<span class="name">insertionData</span>:
The data on columns and values to insert.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id, insertRowId)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- var rowData =
- {
- columns: ["WORD", "WORD_DESC"] ,
- values: ["'tizen1'", "'tizen2'"]
- };
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'tizen2'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">updateData</span>:
+<span class="name">updateData</span>:
The data on columns and values to update.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows to update. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- var rowData =
- {
- columns: ["WORD", "WORD_DESC"] ,
- values: ["'tizen1'", "'Web apps platform!'"]
- };
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'Web apps platform!'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows to remove. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">columns</span>:
+<span class="name">columns</span>:
The columns to select.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">page</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">page</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The page number of the result set. <br>It starts from <var>1</var>. If the number is out of page, DataControlSelectSuccessCallback is invoked with no result data.
</li>
<li class="param">
-<span class="name">maxNumberPerPage</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">maxNumberPerPage</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The maximum number of rows on a page. The maximum allowed value is equal to 1024.
</li>
<li class="param">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function getValueSuccessCB(result, id)
{
- console.log("getValueSuccessCB result.length: " + result.length);
- var length = result.length;
- for (var i = 0; i < length; i++)
- {
- var rowData = "| ";
- var j = 0;
- for (j = 0; j < result[i].columns.length; j++)
- {
- rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
- }
- console.log(rowData);
- }
+ console.log("getValueSuccessCB result.length: " + result.length);
+ var length = result.length;
+ for (var i = 0; i < length; i++)
+ {
+ var rowData = "| ";
+ var j = 0;
+ for (j = 0; j < result[i].columns.length; j++)
+ {
+ rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
+ }
+ console.log(rowData);
+ }
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* globalSQLConsumer and globalReqId should be defined before */
- /* Increases globalReqId for uniqueness */
- var columns = ["WORD", "WORD_DESC"];
- var whereClause = "1";
- console.log("----- Calling for ascending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC ASC");
- setTimeout(function()
- {
- console.log("----- Calling descending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC DESC");
- }, 1000);
+ /* globalSQLConsumer and globalReqId should be defined before */
+ /* Increases globalReqId for uniqueness */
+ var columns = ["WORD", "WORD_DESC"];
+ var whereClause = "1";
+ console.log("----- Calling for ascending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC ASC");
+ setTimeout(function()
+ {
+ console.log("----- Calling descending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC DESC");
+ }, 1000);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
Since: </span>
2.1
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
The value to add into a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation. <br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
The value to remove from a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function getValueSuccessCB(result, id)
{
- console.log(result.length + ":" + result[0]);
+ console.log(result.length + ":" + result[0]);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">oldValue</span>:
+<span class="name">oldValue</span>:
The value to update in a values array mapped by the key.
</li>
<li class="param">
-<span class="name">newValue</span>:
+<span class="name">newValue</span>:
The new value to replace in a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier of the successful operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier of the failed operation.
</li>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
An error message.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So it is recommended to increase the <em>reqId</em> value every time to guarantee uniqueness.
</li>
<li class="param">
-<span class="name">insertRowId</span>:
+<span class="name">insertRowId</span>:
The inserted row ID set by the data control provider if the specified providerResult is <var>true</var>, else <var>-1</var>.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">rows</span>:
+<span class="name">rows</span>:
Rows of SQL selection results from another application.<br>The array operation of rows would be different from general JavaScript array behavior depending on platform implementation. For example, Array.isArray(rows) returns <em>false</em>.
</li>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So it is recommended to increase the <em>reqId</em> value every time to guarantee uniqueness.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">values</span>:
+<span class="name">values</span>:
A list of values assigned to the requested key.
</li>
<li class="param">
-<span class="name">reqid</span>:
+<span class="name">reqid</span>:
A unique identifier of the successful operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profile</span>:
+<span class="name">profile</span>:
The sync profile information to add.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profile</span>:
+<span class="name">profile</span>:
The sync profile information to update.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The sync profile ID to remove.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The ID used to get profile information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The profile ID with which to initiate the sync operation.
</li>
<li class="param">
-<span class="name">progressCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">progressCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the sync operation progresses or an error occurs.
</li>
</ul>
var profileId; /* profileId obtained from SyncProfileInfo */
var syncCallback =
{
- onprogress: function(profileId, serviceType, isFromServer, totalPerType, syncedPerType)
- {
- console.log('Total: ' + totalPerType + ', synced: ' + syncedPerType + ' for the sync type: ' + serviceType);
- },
- onfailed: function(profileId, error)
- {
- console.log('Failed with id: ' + profileId + ', error name: ' + error.name);
- }
+ onprogress: function(profileId, serviceType, isFromServer, totalPerType, syncedPerType)
+ {
+ console.log('Total: ' + totalPerType + ', synced: ' + syncedPerType + ' for the sync type: ' + serviceType);
+ },
+ onfailed: function(profileId, error)
+ {
+ console.log('Failed with id: ' + profileId + ', error name: ' + error.name);
+ }
};
/* Starts the sync operation with the corresponding callbacks */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The ID of the ongoing sync operation to stop.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The ID used to get the sync statistics.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The ID of the corresponding sync operation.
</li>
<li class="param">
-<span class="name">serviceType</span>:
+<span class="name">serviceType</span>:
The sync service category type.
</li>
<li class="param">
-<span class="name">isFromServer</span>:
+<span class="name">isFromServer</span>:
The direction of the operation.<br> If the direction of the operation is from the server to the client, then the value is<var> true</var>.
</li>
<li class="param">
-<span class="name">totalPerService</span>:
+<span class="name">totalPerService</span>:
The total number of records to synchronize for the current sync service type aggregating all operations.
</li>
<li class="param">
-<span class="name">syncedPerService</span>:
+<span class="name">syncedPerService</span>:
The number of synchronized records for the current sync service type aggregating all operations.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The ID of the corresponding sync operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The ID of the corresponding sync operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileId</span>:
+<span class="name">profileId</span>:
The ID of the corresponding sync operation.
</li>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
The reason for sync failure.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadRequest</span>:
+<span class="name">downloadRequest</span>:
The URL and destination information of the object to download.
</li>
<li class="param">
-<span class="name">downloadCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">downloadCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the download state changes or an error occurs.
</li>
</ul>
var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
if (download_api_capability === false)
{
- console.log("Download API is not supported on this device.");
+ console.log("Download API is not supported on this device.");
- return;
+ return;
}
var listener =
{
- onprogress: function(id, receivedSize, totalSize)
- {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id)
- {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id)
- {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, path)
- {
- console.log('Completed with id: ' + id + ', path: ' + path);
- },
- onfailed: function(id, error)
- {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, path)
+ {
+ console.log('Completed with id: ' + id + ', path: ' + path);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
};
/* Starts downloading the file from the Web with the corresponding callbacks */
/* If you want to download a large file through Wi-Fi */
var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
var wifiDownloadRequest = new tizen.DownloadRequest(
- "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
+ "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
if (wifi_capability === true)
{
- var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
+ var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
}
else
{
- /* If you call tizen.download.start(), NotSupportedError will be thrown */
- console.log("This device doesn't support Download API through Wi-Fi.");
+ /* If you call tizen.download.start(), NotSupportedError will be thrown */
+ console.log("This device doesn't support Download API through Wi-Fi.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the ongoing download operation to stop.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the ongoing download operation to pause.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the paused download operation to resume.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the current state of the download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the download request information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the MIME type information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to set the download callback.
</li>
<li class="param">
-<span class="name">downloadCallback</span>:
+<span class="name">downloadCallback</span>:
The method to invoke when the download state changes or an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- onprogress: function(id, receivedSize, totalSize)
- {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id)
- {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id)
- {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, fileName)
- {
- console.log('Completed with id: ' + id + ', file name: ' + fileName);
- },
- onfailed: function(id, error)
- {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, fileName)
+ {
+ console.log('Completed with id: ' + id + ', file name: ' + fileName);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
};
/* Start downloading the html file on the web with the corresponding callbacks */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
<li class="param">
-<span class="name">receivedSize</span>:
+<span class="name">receivedSize</span>:
The size of data received in bytes.
</li>
<li class="param">
-<span class="name">totalSize</span>:
+<span class="name">totalSize</span>:
The total size of data to receive in bytes.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
The reason for download failure.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span>:
+<span class="name">uri</span>:
URI of the JPEG file, as available in ImageContent::contentURI or returned by File::toURI()
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method to be invoked when Exif information has been retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
/* Defines success callback */
function onSuccess(exifInfo)
{
- console.log("success to get Exif information object");
+ console.log("success to get Exif information object");
}
/* Defines error callback */
function onError(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">exifInfo</span>:
+<span class="name">exifInfo</span>:
Exif information object that contains the Exif data in the JPEG file
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when Exif data has been saved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
/* Defines success callback */
function onSaveSuccess()
{
- console.log("success to save Exif information");
+ console.log("success to save Exif information");
}
/* Defines error callback */
function onSaveError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
/* Defines success callback */
function onSuccess(exifInfo)
{
- console.log("success to get Exif information object");
- exifInfo.orientation = "ROTATE_90";
- tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
+ console.log("success to get Exif information object");
+ exifInfo.orientation = "ROTATE_90";
+ tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
}
/* Defines error callback */
function onError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span>:
+<span class="name">uri</span>:
URI of the JPEG file
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method to be invoked when thumbnail data has been retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
/* Defines success callback */
function onSuccess(thumbData)
{
- console.log("got thumbnail data of JPEG file");
- if (thumbData)
- {
- var img = new Image();
- img.src = thumbData;
- document.body.appendChild(img);
- }
+ console.log("got thumbnail data of JPEG file");
+ if (thumbData)
+ {
+ var img = new Image();
+ img.src = thumbData;
+ document.body.appendChild(img);
+ }
}
/* Defines error callback */
function onError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
+ tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">exifInfo</span>:
+<span class="name">exifInfo</span>:
<em>ExifInformation</em> to be retrieved
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span><span class="optional"> [nullable]</span>:
+<span class="name">uri</span><span class="optional"> [nullable]</span>:
URI for the thumbnail to be retrieved <br>If there is no thumbnail in the JPEG file, <var>null</var> is returned.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
+ tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
- tizen.feedback.stop();
+ tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
+ tizen.feedback.stop();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var isSupported = "";
if (!isPatternSupported)
{
- isSupported = " not";
+ isSupported = " not";
}
console.log("pattern " + pattern + " is" + isSupported + " supported");
</pre>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- }
-
- var testFile = documentsDir.createFile("test.txt");
-
- if (testFile != null)
- {
- testFile.openStream("w", function(fs)
- {
- fs.write("HelloWorld");
- fs.close();
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">location</span>:
+<span class="name">location</span>:
Location to resolve that can be a virtual path or file URI
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the location has been successfully resolved, passing the newly created <em>File </em>object
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional value to indicate the file access mode on all files and directories that can be reached from the <em>File </em>object passed to onsuccess <br>Default value of this parameter is <var>rw</var> if absent or <var>null</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.filesystem.resolve('images', function(dir)
{
- console.log("Mount point Name is " + dir.path);
+ console.log("Mount point Name is " + dir.path);
}, function(e)
{
- console.log("Error: " + e.message);
+ console.log("Error: " + e.message);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
Storage label
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the list of storage is available, passing the storage list to the callback
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onStorage(storage)
{
- /* Do something */
+ /* Do something */
}
function onStorageError(e)
{
- console.log("Storage not found!" + e.message);
+ console.log("Storage not found!" + e.message);
}
tizen.filesystem.getStorage("music", onStorage, onStorageError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a list of storage is available, and passing the storage list to the callback
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function alertForCorruptedRemovableDrives(storages)
{
- for (var i = 0; i < storages.length; i++)
- {
- if (storages[i].type != "EXTERNAL")
- continue;
- if (storages[i].state == "UNMOUNTABLE")
- console.log("External drive " + storages[i].label + " is corrupted.");
- }
+ for (var i = 0; i < storages.length; i++)
+ {
+ if (storages[i].type != "EXTERNAL")
+ continue;
+ if (storages[i].state == "UNMOUNTABLE")
+ console.log("External drive " + storages[i].label + " is corrupted.");
+ }
}
tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when any change is made to storage state
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs during the watch process
</li>
</ul>
var watchID;
function onStorageStateChanged(storage)
{
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
}
watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
var watchID;
function onStorageStateChanged(storage)
{
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- tizen.filesystem.removeStorageStateChangeListener(watchID);
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+ tizen.filesystem.removeStorageStateChangeListener(watchID);
}
watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- /* Alerts each name of dir's contents */
- console.log(files[i].name);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ /* Alerts each name of dir's contents */
+ console.log(files[i].name);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
/* List directory contents */
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- /*
- Prints the file parent, must contain the
- same value for all the files in the loop
- */
- console.log("All the files should have the same parent " +
- files[i].parent);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ /*
+ Prints the file parent, must contain the
+ same value for all the files in the loop
+ */
+ console.log("All the files should have the same parent " +
+ files[i].parent);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
</pre>
</div>
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].readOnly)
- console.log("Cannot write to file " + files[i].name);
- else
- console.log("Can write to file " + files[i].name);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].readOnly)
+ console.log("Cannot write to file " + files[i].name);
+ else
+ console.log("Can write to file " + files[i].name);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
{
- var audio = new Audio(file.toURI());
- audio.play();
- console.log(file.toURI());
+ var audio = new Audio(file.toURI());
+ audio.play();
+ console.log(file.toURI());
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the list operation has been successfully completed
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Criteria to restrict the listed files
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- console.log("There are " + files.length + " in the selected folder");
+ console.log("There are " + files.length + " in the selected folder");
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve("documents", function(dir)
{
- dir.listFiles(onsuccess, onerror);
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error " + e.message);
+ console.log("Error " + e.message);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Mode in which the file is opened<br><b>"r"</b> for reading<br><b>"a"</b> for appending<br><b>"w"</b> for [over]writing<br><b>"rw"</b> for reading and writing<br> </li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a file has been opened
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Encoding to use for read/write operations on the file, at least the following encodings must be supported:<br>"<a href="http://www.ietf.org/rfc/rfc2279.txt">UTF-8</a>" default encoding<br>"<a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">ISO-8859-1</a>" latin1 encoding<br>If no encoding is passed by the developer, then the default platform encoding must be used.
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- }
-
- var testFile = documentsDir.createFile("test.txt");
- if (testFile != null)
- {
- testFile.openStream("w", function(fs)
- {
- fs.write("HelloWorld");
- fs.close();
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a file has been successfully read
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs while reading a file
</li>
<li class="param">
-<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Encoding for read/write operations on a file, at least the following encodings must be supported:<br>"<a href="http://www.ietf.org/rfc/rfc2279.txt">UTF-8</a>" default encoding<br>"<a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">ISO-8859-1</a>" latin1 encoding<br>If no encoding is passed by the developer, then the default platform encoding must be used.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- if (files[i].isDirectory == false)
- {
- files[i].readAsText(function(str)
- {
- console.log("The file content " + str);
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ if (files[i].isDirectory == false)
+ {
+ files[i].readAsText(function(str)
+ {
+ console.log("The file content " + str);
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
var documentsDir;
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">originFilePath</span>:
+<span class="name">originFilePath</span>:
Origin full virtual file or directory path and it must be under the current directory
</li>
<li class="param">
-<span class="name">destinationFilePath</span>:
+<span class="name">destinationFilePath</span>:
New full virtual file path or directory path
</li>
<li class="param">
-<span class="name">overwrite</span>:
+<span class="name">overwrite</span>:
Attribute to determine whether overwriting is allowed or not <br>If set to <var>true</var>, it enforces overwriting an existing file.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file has been copied
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory == false)
- {
- documentsDir.copyTo(files[i].fullPath,
- "images/backup/" + files[i].name, false,
- function() {console.log("file copied");});
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.copyTo(files[i].fullPath,
+ "images/backup/" + files[i].name, false,
+ function() {console.log("file copied");});
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">originFilePath</span>:
+<span class="name">originFilePath</span>:
Origin full virtual file or directory path, and it must be under the current directory
</li>
<li class="param">
-<span class="name">destinationFilePath</span>:
+<span class="name">destinationFilePath</span>:
New full virtual file path or directory path
</li>
<li class="param">
-<span class="name">overwrite</span>:
+<span class="name">overwrite</span>:
Flag indicating whether to overwrite an existing file.<br>When set to <var>true</var>, the files can be overwritten.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file has been moved
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory == false)
- {
- documentsDir.moveTo(files[i].fullPath,
- "images/newFolder/" + files[i].name, false,
- function() {console.log("file moved");});
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.moveTo(files[i].fullPath,
+ "images/newFolder/" + files[i].name, false,
+ function() {console.log("file moved");});
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred during listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred during listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dirPath</span>:
+<span class="name">dirPath</span>:
Relative directory path, and it only contains characters supported by the underlying filesystem
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">relativeFilePath</span>:
+<span class="name">relativeFilePath</span>:
New file path and it should only contain characters supported by the underlying Filesystem
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filePath</span>:
+<span class="name">filePath</span>:
Relative file/directory path/file URI to resolve
</li>
</ul>
*/
tizen.filesystem.resolve('documents', function(dir)
{
- file = dir.resolve("helloWorld.doc");
+ file = dir.resolve("helloWorld.doc");
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">directoryPath</span>:
+<span class="name">directoryPath</span>:
Full virtual path to the directory to delete (must be under the current one)
</li>
<li class="param">
-<span class="name">recursive</span>:
+<span class="name">recursive</span>:
Flag indicating whether the deletion is recursive or not <br>When set to <var>true</var> recursive deletion is allowed. Also, this function deletes
all data in all subdirectories and so needs to be used with caution.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when a directory is successfully deleted
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory)
- {
- documentsDir.deleteDirectory(files[i].fullPath, false, function()
- {
- console.log("Directory Deleted");
- }, function(e)
- {
- console.log("Error" + e.message);
- });
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory)
+ {
+ documentsDir.deleteDirectory(files[i].fullPath, false, function()
+ {
+ console.log("Directory Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filePath</span>:
+<span class="name">filePath</span>:
Full virtual path to the file to delete (must be under the current directory)
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file is successfully deleted
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (!files[i].isDirectory)
- {
- documentsDir.deleteFile(files[i].fullPath, function()
- {
- console.log("File Deleted");
- }, function(e)
- {
- console.log("Error" + e.message);
- });
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (!files[i].isDirectory)
+ {
+ documentsDir.deleteFile(files[i].fullPath, function()
+ {
+ console.log("File Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
var documentsDir;
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess,onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
if (stream.eof)
{
- /* File has been read completely */
+ /* File has been read completely */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">charCount</span>:
+<span class="name">charCount</span>:
Number of characters being read
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">byteCount</span>:
+<span class="name">byteCount</span>:
Number of bytes to read
</li>
</ul>
var raw = stream.readBytes(256);
for (var i = 0; i < raw.length; i++)
{
- /* raw[i] contains the i-th byte of the current data chunk */
+ /* raw[i] contains the i-th byte of the current data chunk */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">stringData</span>:
+<span class="name">stringData</span>:
Actual string to write
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">byteData</span>:
+<span class="name">byteData</span>:
Byte data array being written
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">base64Data</span>:
+<span class="name">base64Data</span>:
The base64 data to written
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
File resulting from the asynchronous call
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">storages</span>:
+<span class="name">storages</span>:
List of available storage devices
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">storage</span>:
+<span class="name">storage</span>:
Storage device structure
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileStr</span>:
+<span class="name">fileStr</span>:
File represented as a DOMString resulting from the asynchronous call
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filestream</span>:
+<span class="name">filestream</span>:
Filestream to access file content
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">files</span>:
+<span class="name">files</span>:
Files resulting from the asynchronous call
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
if (!tizen.fmradio.isAntennaConnected)
{
- console.log("Please plug in the earphones to listen to the radio");
+ console.log("Please plug in the earphones to listen to the radio");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">frequency</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">frequency</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Frequency(MHz) of FM radio waves to set
</li>
</ul>
if (radioState == "READY")
{
- tizen.fmradio.start(87.5);
+ tizen.fmradio.start(87.5);
}
/* Jump to your favorite radio station (95.9MHz) and start playing */
/* tizen.fmradio.start(95.9); */
if (radioState == "PLAYING")
{
- tizen.fmradio.stop();
+ tizen.fmradio.stop();
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the radio successfully finds a radio channel
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
function successCallback()
{
- console.log("The radio find a new frequency successfully");
+ console.log("The radio find a new frequency successfully");
}
function errorCallback(err)
{
- console.log("The following error occurred: " + err.name);
+ console.log("The following error occurred: " + err.name);
}
if (radioState == "PLAYING")
{
- tizen.fmradio.seekUp(successCallback, errorCallback);
+ tizen.fmradio.seekUp(successCallback, errorCallback);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the radio successfully finds a radio channel
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
function successCallback()
{
- console.log("The radio find a new frequency successfully");
+ console.log("The radio find a new frequency successfully");
}
function errorCallback(err)
{
- console.log("The following error occurred: " + err.name);
+ console.log("The following error occurred: " + err.name);
}
if (radioState == "PLAYING")
{
- tizen.fmradio.seekDown(successCallback, errorCallback);
+ tizen.fmradio.seekDown(successCallback, errorCallback);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">radioScanCallback</span>:
+<span class="name">radioScanCallback</span>:
Callback method to be invoked when a radio channel is found
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
var radioScanCallback =
{
- onfrequencyfound: function(frequency)
- {
- console.log("A new frequency found: " + frequency);
- },
- onfinished: function(frequencies)
- {
- console.log(frequencies.length + "frequencies found!");
- for (var i = 0; i < frequencies.length; i++)
- {
- console.log(i + ": " + frequencies[i]);
- }
- }
+ onfrequencyfound: function(frequency)
+ {
+ console.log("A new frequency found: " + frequency);
+ },
+ onfinished: function(frequencies)
+ {
+ console.log(frequencies.length + "frequencies found!");
+ for (var i = 0; i < frequencies.length; i++)
+ {
+ console.log(i + ": " + frequencies[i]);
+ }
+ }
};
function errorCallback(err)
{
- console.log("The following error occurred: " + err.name);
+ console.log("The following error occurred: " + err.name);
}
if (radioState == "READY")
{
- tizen.fmradio.scanStart(radioScanCallback, errorCallback);
+ tizen.fmradio.scanStart(radioScanCallback, errorCallback);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when scanning radio channels stops successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
function successCallback()
{
- console.log("The scanning stops");
+ console.log("The scanning stops");
}
function errorCallback(err)
{
- console.log("The following error occurred: " + err.name);
+ console.log("The following error occurred: " + err.name);
}
if (radioState == "SCANNING")
{
- tizen.fmradio.scanStop(successCallback, errorCallback);
+ tizen.fmradio.scanStop(successCallback, errorCallback);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">interruptCallback</span>:
+<span class="name">interruptCallback</span>:
Callback method to be invoked when the radio is interrupted
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var interruptCallback =
{
- oninterrupted: function(reason)
- {
- console.log(reason);
- },
- oninterruptfinished: function()
- {
- console.log("The radio interruption finished.");
- }
+ oninterrupted: function(reason)
+ {
+ console.log(reason);
+ },
+ oninterruptfinished: function()
+ {
+ console.log("The radio interruption finished.");
+ }
};
tizen.fmradio.setFMRadioInterruptedListener(interruptCallback);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function antennaCallback(isAntennaConnected)
{
- alert("Antenna status has been changed. It is now " + (isAntennaConnected ? "connected" : "disconnected"));
+ alert("Antenna status has been changed. It is now " + (isAntennaConnected ? "connected" : "disconnected"));
}
tizen.fmradio.setAntennaChangeListener(antennaCallback);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">frequency</span>:
+<span class="name">frequency</span>:
Channel frequency found during the scan
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">frequencies</span>:
+<span class="name">frequencies</span>:
Array of channel frequencies found during the scan
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reason</span>:
+<span class="name">reason</span>:
Reason why FM radio is interrupted (e.g. interrupted by an incoming call, alarm, notifications)
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">isAntennaConnected</span>:
+<span class="name">isAntennaConnected</span>:
New value of the <a href="#FMRadioManager::isAntennaConnected">isAntennaConnected</a> attribute
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onchangedCB(sleepInfo)
{
- console.log("Sleep status: " + sleepInfo.status);
- console.log("Timestamp: " + sleepInfo.timestamp);
+ console.log("Sleep status: " + sleepInfo.status);
+ console.log("Timestamp: " + sleepInfo.timestamp);
}
tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccessCB(pedometerInfo)
{
- console.log("Step status: " + pedometerInfo.stepStatus);
- console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
}
function onerrorCB(error)
{
- console.log("Error occurs. name:" + error.name + ", message: " + error.message);
+ console.log("Error occurs. name:" + error.name + ", message: " + error.message);
}
function onchangedCB(pedometerdata)
{
- console.log("From now on, you will be notified when the pedometer data changes.");
- /* To get the current data information */
- tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
+ console.log("From now on, you will be notified when the pedometer data changes.");
+ /* To get the current data information */
+ tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
}
tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onchangedCB(pedometerInfo)
{
- console.log("Step status: " + pedometerInfo.stepStatus);
- console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
}
tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onchangedCB(info)
{
- var gpsInfo = info.gpsInfo;
- for (var index = 0; index < gpsInfo.length; index++)
- {
- console.log("latitude: " + gpsInfo[index].latitude);
- console.log("longitude: " + gpsInfo[index].longitude);
- }
+ var gpsInfo = info.gpsInfo;
+ for (var index = 0; index < gpsInfo.length; index++)
+ {
+ console.log("latitude: " + gpsInfo[index].latitude);
+ console.log("longitude: " + gpsInfo[index].longitude);
+ }
}
function onerrorCB(error)
{
- console.log("Error occurred. Name:" + error.name + ", message: " + error.message);
+ console.log("Error occurred. Name:" + error.name + ", message: " + error.message);
}
try
{
- tizen.humanactivitymonitor.start("GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000});
+ tizen.humanactivitymonitor.start("GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000});
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onchangedCB(pedometerInfo)
{
- console.log("Step status: " + pedometerInfo.stepStatus);
- console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount);
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount);
}
tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error.name + ': ' + error.message);
+ console.log(error.name + ': ' + error.message);
}
function listener(info)
{
- console.log('type: ' + info.type);
- console.log('timestamp: ' + info.timestamp);
- console.log('accuracy: ' + info.accuracy);
+ console.log('type: ' + info.type);
+ console.log('timestamp: ' + info.timestamp);
+ console.log('accuracy: ' + info.accuracy);
}
try
{
- var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
+ var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
}
catch (error)
{
- console.log(error.name + ': ' + error.message);
+ console.log(error.name + ': ' + error.message);
}
</pre>
</div>
function errorCallback(error)
{
- console.log(error.name + ': ' + error.message);
+ console.log(error.name + ': ' + error.message);
}
function listener(info)
{
- console.log('type: ' + info.type);
- console.log('timestamp: ' + info.timestamp);
- console.log('accuracy: ' + info.accuracy);
+ console.log('type: ' + info.type);
+ console.log('timestamp: ' + info.timestamp);
+ console.log('accuracy: ' + info.accuracy);
- tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback);
+ tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback);
}
try
{
- listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
+ listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
}
catch (error)
{
- console.log(error.name + ': ' + error.message);
+ console.log(error.name + ': ' + error.message);
}
</pre>
</div>
var type = 'PRESSURE';
var options =
{
- retentionPeriod: 1 /* 1 hour */
+ retentionPeriod: 1 /* 1 hour */
};
try
{
- tizen.humanactivitymonitor.startRecorder(type, options);
+ tizen.humanactivitymonitor.startRecorder(type, options);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var type = 'PRESSURE';
try
{
- tizen.humanactivitymonitor.startRecorder(type);
+ tizen.humanactivitymonitor.startRecorder(type);
- /* Do something */
+ /* Do something */
- tizen.humanactivitymonitor.stopRecorder(type);
+ tizen.humanactivitymonitor.stopRecorder(type);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(error)
{
- console.log(error.name + ": " + error.message);
+ console.log(error.name + ": " + error.message);
}
function onread(data)
{
- for (var idx = 0; idx < data.length; ++idx)
- {
- console.log('startTime: ' + data[idx].startTime);
- console.log('endTime: ' + data[idx].endTime);
- console.log('calories: ' + data[idx].calorie);
- }
+ for (var idx = 0; idx < data.length; ++idx)
+ {
+ console.log('startTime: ' + data[idx].startTime);
+ console.log('endTime: ' + data[idx].endTime);
+ console.log('calories: ' + data[idx].calorie);
+ }
}
var type = 'PEDOMETER';
var query = {};
try
{
- tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror);
+ tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var option =
{
- interval: 10,
- retentionPeriod: 1
+ interval: 10,
+ retentionPeriod: 1
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(error)
{
- console.log(error.name + ": " + error.message);
+ console.log(error.name + ": " + error.message);
}
function onread(data)
{
- for (var idx = 0; idx < data.length; ++idx)
- {
- console.log("*** " + idx);
- console.log('totalStepCount: ' + data[idx].totalStepCount);
- }
+ for (var idx = 0; idx < data.length; ++idx)
+ {
+ console.log("*** " + idx);
+ console.log('totalStepCount: ' + data[idx].totalStepCount);
+ }
}
var type = 'PEDOMETER';
var anchorTime = (new Date(2000, 1, 2, 6)).getTime();
var query =
{
- startTime: startTime / 1000,
- anchorTime: anchorTime / 1000,
- interval: 1440 /* 1 day */
+ startTime: startTime / 1000,
+ anchorTime: anchorTime / 1000,
+ interval: 1440 /* 1 day */
};
try
{
- tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror);
+ tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
supportedKeys = tizen.inputdevice.getSupportedKeys();
for (i = 0; i < supportedKeys.length; i++)
{
- keyCode[supportedKeys[i].name] = supportedKeys[i].code;
+ keyCode[supportedKeys[i].name] = supportedKeys[i].code;
}
if (keyCode.hasOwnProperty("VolumeUp"))
{
- tizen.inputdevice.registerKey("VolumeUp");
+ tizen.inputdevice.registerKey("VolumeUp");
}
window.addEventListener("keydown", function(keyEvent)
{
- /* Identify the key by the numeric code from the keyEvent */
- if (keyEvent.keyCode === keyCode.VolumeUp)
- {
- console.log("The VOLUME UP was pressed");
- }
+ /* Identify the key by the numeric code from the keyEvent */
+ if (keyEvent.keyCode === keyCode.VolumeUp)
+ {
+ console.log("The VOLUME UP was pressed");
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key to retrieve
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key which should generate DOM key events when pressed
</li>
</ul>
var keys = ["VolumeUp", "VolumeDown"], i;
for (i = 0; i < keys.length; i++)
{
- try
- {
- tizen.inputdevice.registerKey(keys[i]);
- }
- catch (error)
- {
- console.log("failed to register " + keys[i] + ": " + error);
- }
+ try
+ {
+ tizen.inputdevice.registerKey(keys[i]);
+ }
+ catch (error)
+ {
+ console.log("failed to register " + keys[i] + ": " + error);
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key which should not be monitored any longer
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyNames</span>:
+<span class="name">keyNames</span>:
The array with key names of keys which should generate DOM key events when pressed
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when keys are registered.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Registered successfully');
+ console.log('Registered successfully');
}
var keys = ["VolumeUp", "VolumeDown"];
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyNames</span>:
+<span class="name">keyNames</span>:
The array containing names of keys which should not be monitored any longer
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when keys are unregistered.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Unregistsered successfully');
+ console.log('Unregistsered successfully');
}
var keys = ["VolumeUp", "VolumeDown"];
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
- var iotClient = tizen.iotcon.getClient();
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
+ var iotClient = tizen.iotcon.getClient();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
- var iotServer = tizen.iotcon.getServer();
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
+ var iotServer = tizen.iotcon.getServer();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var watchId
function RandomPinSuccess(pin)
{
- console.log("Pin code: " + pin);
- tizen.iotcon.removeGeneratedPinListener(watchId);
+ console.log("Pin code: " + pin);
+ tizen.iotcon.removeGeneratedPinListener(watchId);
}
var cborPath = "App_installed_fullpath/iotcon-test.dat"
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(resource)
{
- if (resource)
- {
- console.log("######## Found a resource ########")
- console.log("URI: " + resource.uriPath);
- console.log("Host Address: " + resource.hostAddress);
- console.log("Device ID: " + resource.deviceId);
- var resourceTypes = resource.resourceTypes;
- console.log("Resource Types: ");
- for (var index in resourceTypes)
- {
- console.log(" " + resourceTypes[index]);
- }
- var resourceInterfaces = resource.resourceInterfaces;
- console.log("Resource interfaces: ");
- for (var index in resourceInterfaces)
- {
- console.log(" " + resourceInterfaces[index]);
- }
- }
+ if (resource)
+ {
+ console.log("######## Found a resource ########")
+ console.log("URI: " + resource.uriPath);
+ console.log("Host Address: " + resource.hostAddress);
+ console.log("Device ID: " + resource.deviceId);
+ var resourceTypes = resource.resourceTypes;
+ console.log("Resource Types: ");
+ for (var index in resourceTypes)
+ {
+ console.log(" " + resourceTypes[index]);
+ }
+ var resourceInterfaces = resource.resourceInterfaces;
+ console.log("Resource interfaces: ");
+ for (var index in resourceInterfaces)
+ {
+ console.log(" " + resourceInterfaces[index]);
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function presenceSuccess(presenceResponse)
{
- console.log("######## Get a presence response ########");
- if (presenceResponse.resultType != "OK")
- {
- console.log("the result is not OK")
-
- return;
- }
- console.log("Trigger type: " + presenceResponse.triggerType);
- console.log("Host address: " + presenceResponse.hostAddress);
- console.log("Connectivity type: " + presenceResponse.connectivityType);
- console.log("Presence resource type: " + presenceResponse.resourceType);
-
- client.removePresenceEventListener(watchID);
+ console.log("######## Get a presence response ########");
+ if (presenceResponse.resultType != "OK")
+ {
+ console.log("the result is not OK")
+
+ return;
+ }
+ console.log("Trigger type: " + presenceResponse.triggerType);
+ console.log("Host address: " + presenceResponse.hostAddress);
+ console.log("Connectivity type: " + presenceResponse.connectivityType);
+ console.log("Presence resource type: " + presenceResponse.resourceType);
+
+ client.removePresenceEventListener(watchID);
}
try
{
- client = tizen.iotcon.getClient();
- watchID = client.addPresenceEventListener(null, null, connectivityType, presenceSuccess);
+ client = tizen.iotcon.getClient();
+ watchID = client.addPresenceEventListener(null, null, connectivityType, presenceSuccess);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(deviceInfo)
{
- if (deviceInfo)
- {
- console.log("######## Get a device info ########");
- console.log("Name: " + deviceInfo.deviceName); /* Human friendly name for device */
- console.log("Spec version: " + deviceInfo.specVersion); /* Spec version of the core specification */
- console.log("ID: " + deviceInfo.oicDeviceId); /* Unique identifier for OIC device */
- console.log("Data model version: " + deviceInfo.dataModelVersion); /* Version of the specs this device data model is implemented to */
- }
+ if (deviceInfo)
+ {
+ console.log("######## Get a device info ########");
+ console.log("Name: " + deviceInfo.deviceName); /* Human friendly name for device */
+ console.log("Spec version: " + deviceInfo.specVersion); /* Spec version of the core specification */
+ console.log("ID: " + deviceInfo.oicDeviceId); /* Unique identifier for OIC device */
+ console.log("Data model version: " + deviceInfo.dataModelVersion); /* Version of the specs this device data model is implemented to */
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- client.findDeviceInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ client.findDeviceInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(platformInfo)
{
- console.log("######## Get a platform info ########");
- console.log("ID: " + platformInfo.platformId);
- console.log("Manufacturer name: " + platformInfo.manufacturerName);
- console.log("Manufacturer URL: " + platformInfo.manufacturerUrl);
- console.log("Model number: " + platformInfo.modelNumber);
- console.log("Date of manufacture: " + platformInfo.manufactureDate);
- console.log("Platform version: " + platformInfo.platformVersion);
- console.log("OS version: " + platformInfo.operatingSystemVersion);
- console.log("Hardware version: " + platformInfo.hardwareVersion);
- console.log("Firmware version: " + platformInfo.firmwareVersion);
- console.log("Support URL: " + platformInfo.supportUrl);
- console.log("System time: " + platformInfo.systemTime);
+ console.log("######## Get a platform info ########");
+ console.log("ID: " + platformInfo.platformId);
+ console.log("Manufacturer name: " + platformInfo.manufacturerName);
+ console.log("Manufacturer URL: " + platformInfo.manufacturerUrl);
+ console.log("Model number: " + platformInfo.modelNumber);
+ console.log("Date of manufacture: " + platformInfo.manufactureDate);
+ console.log("Platform version: " + platformInfo.platformVersion);
+ console.log("OS version: " + platformInfo.operatingSystemVersion);
+ console.log("Hardware version: " + platformInfo.hardwareVersion);
+ console.log("Firmware version: " + platformInfo.firmwareVersion);
+ console.log("Support URL: " + platformInfo.supportUrl);
+ console.log("System time: " + platformInfo.systemTime);
}
try
{
- var client = tizen.iotcon.getClient();
- client.findPlatformInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ client.findPlatformInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var attributes = {openstate: 'open'};
var policy =
{
- isObservable: true,
- isDiscoverable: true
+ isObservable: true,
+ isDiscoverable: true
};
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- if (remoteResponse.result != "SUCCESS")
- {
- console.log("the result is not SUCCESS");
-
- return;
- }
- var repr = remoteResponse.representation;
- console.log("Resource attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ if (remoteResponse.result != "SUCCESS")
+ {
+ console.log("the result is not SUCCESS");
+
+ return;
+ }
+ var repr = remoteResponse.representation;
+ console.log("Resource attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- query["filter"] = {openstate: 'open'};
- resource.methodGet(onresponse, query, onerror);
- }
+ if (resource)
+ {
+ query["filter"] = {openstate: 'open'};
+ resource.methodGet(onresponse, query, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- console.log("result is " + remoteResponse.result);
- var repr = remoteResponse.representation;
- console.log("representation attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ console.log("result is " + remoteResponse.result);
+ var repr = remoteResponse.representation;
+ console.log("representation attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- query["filter"] = {openstate: 'open'};
- representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.attributes = {openstate: 'closed'};
- resource.methodPut(representation, onresponse, query, onerror);
- }
+ if (resource)
+ {
+ query["filter"] = {openstate: 'open'};
+ representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.attributes = {openstate: 'closed'};
+ resource.methodPut(representation, onresponse, query, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- console.log("result is " + remoteResponse.result);
- var repr = remoteResponse.representation;
- console.log("representation attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ console.log("result is " + remoteResponse.result);
+ var repr = remoteResponse.representation;
+ console.log("representation attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.attributes = {openstate: 'closed'};
- resource.methodPost(representation, onresponse, null, onerror);
- }
+ if (resource)
+ {
+ representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.attributes = {openstate: 'closed'};
+ resource.methodPost(representation, onresponse, null, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- if (remoteResponse.result == "RESOURCE_DELETED" || remoteResponse.result == "SUCCESS")
- {
- console.log("Successfully deleted");
- }
+ if (remoteResponse.result == "RESOURCE_DELETED" || remoteResponse.result == "SUCCESS")
+ {
+ console.log("Successfully deleted");
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- resource.methodDelete(onresponse, onerror);
- }
+ if (resource)
+ {
+ resource.methodDelete(onresponse, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onchanged(remoteResponse)
{
- if (remoteResponse.result == "SUCCESS")
- {
- var attributes = remoteResponse.representation.attributes;
- console.log("start observing, door is " + attributes["openstate"]);
- }
- doorResource.stopObserving();
+ if (remoteResponse.result == "SUCCESS")
+ {
+ var attributes = remoteResponse.representation.attributes;
+ console.log("start observing, door is " + attributes["openstate"]);
+ }
+ doorResource.stopObserving();
}
function foundSuccess(resource)
{
- if (resource)
- {
- if (resource.uriPath == "/door")
- {
- doorResource = resource;
- try
- {
- doorResource.startObserving("IGNORE_OUT_OF_ORDER", onchanged);
- }
- catch (err)
- {
- console.log(err.name + ': ' + err.message);
- }
- }
- }
+ if (resource)
+ {
+ if (resource.uriPath == "/door")
+ {
+ doorResource = resource;
+ try
+ {
+ doorResource.startObserving("IGNORE_OUT_OF_ORDER", onchanged);
+ }
+ catch (err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onupdated(representation)
{
- console.log("######## updated representation ########");
- for (var key in representation.attributes)
- {
- console.log("key: " + key + ", value: " + representation.attributes[key]);
- }
- resource.stopCaching();
+ console.log("######## updated representation ########");
+ for (var key in representation.attributes)
+ {
+ console.log("key: " + key + ", value: " + representation.attributes[key]);
+ }
+ resource.stopCaching();
}
function foundSuccess(remoteResource)
{
- if (remoteResource)
- {
- resource = remoteResource;
- remoteResource.startCaching(onupdated); /* Start caching */
- }
+ if (remoteResource)
+ {
+ resource = remoteResource;
+ remoteResource.startCaching(onupdated); /* Start caching */
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onchanged(isAlive)
{
- if (isAlive == true)
- {
- console.log("Remote resource is alive");
- }
- else
- {
- console.log("Remote resource is lost");
- }
- doorResource.unsetResourceStateChangeListener();
+ if (isAlive == true)
+ {
+ console.log("Remote resource is alive");
+ }
+ else
+ {
+ console.log("Remote resource is lost");
+ }
+ doorResource.unsetResourceStateChangeListener();
}
function foundSuccess(resource)
{
- if (resource)
- {
- if (resource.uriPath == "/door")
- {
- try
- {
- resource.setResourceStateChangeListener(onchanged);
- }
- catch (err)
- {
- console.log(err.name + ': ' + err.message);
- }
- }
- }
+ if (resource)
+ {
+ if (resource.uriPath == "/door")
+ {
+ try
+ {
+ resource.setResourceStateChangeListener(onchanged);
+ }
+ catch (err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var doorAttributes = {openstate: 'open'};
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
var lockAttributes = {lockstate: 'closed'};
policy =
{
- isObservable: true,
- isDiscoverable: true
+ isObservable: true,
+ isDiscoverable: true
};
var lockRequestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(lockResource.uriPath);
- representation.resourceTypes = lockResource.resourceTypes;
- representation.resourceInterfaces = lockResource.resourceInterfaces;
- representation.attributes = lockResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(lockResource.uriPath);
+ representation.resourceTypes = lockResource.resourceTypes;
+ representation.resourceInterfaces = lockResource.resourceInterfaces;
+ representation.attributes = lockResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
lockResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, lockRequestListener, policy);
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
var newRequestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- var response = new tizen.Response(request);
- try
- {
- doorResource.attributes = request.representation.attributes;
- response.representation = request.representation;
- response.result = "RESOURCE_CHANGED";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "RESOURCE_DELETED";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- server.removeResource(doorResource);
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving observeType:" + observeType + ", observeId:" + observeId);
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ var response = new tizen.Response(request);
+ try
+ {
+ doorResource.attributes = request.representation.attributes;
+ response.representation = request.representation;
+ response.result = "RESOURCE_CHANGED";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "RESOURCE_DELETED";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ server.removeResource(doorResource);
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving observeType:" + observeType + ", observeId:" + observeId);
+ }
}
try
{
- server = tizen.iotcon.getServer();
- var uriPath = "/door";
- var resourceTypes = ["core.door"];
- var resourceInterfaces = ["oic.if.b"];
- var attributes = {openstate: 'open'};
- var policy =
- {
- isObservable: true,
- isDiscoverable: true
- };
-
- doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
- doorResource.attributes = attributes;
- doorResource.setRequestListener(newRequestListener);
+ server = tizen.iotcon.getServer();
+ var uriPath = "/door";
+ var resourceTypes = ["core.door"];
+ var resourceInterfaces = ["oic.if.b"];
+ var attributes = {openstate: 'open'};
+ var policy =
+ {
+ isObservable: true,
+ isDiscoverable: true
+ };
+
+ doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
+ doorResource.attributes = attributes;
+ doorResource.setRequestListener(newRequestListener);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var filter = {"openstate": "open"};
var query =
{
- resourceType: "core.door",
- resourceInterface: "oic.if.b"
+ resourceType: "core.door",
+ resourceInterface: "oic.if.b"
}
query["filter"] = filter;
</pre>
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
try
{
- server = tizen.iotcon.getServer();
- var uriPath = "/door";
- var resourceTypes = ["core.door"];
- var resourceInterfaces = ["oic.if.b"];
- var policy =
- {
- isObservable: true,
- isDiscoverable: true
- };
-
- doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
- doorResource.attributes = {openstate: 'open'};
+ server = tizen.iotcon.getServer();
+ var uriPath = "/door";
+ var resourceTypes = ["core.door"];
+ var resourceInterfaces = ["oic.if.b"];
+ var policy =
+ {
+ isObservable: true,
+ isDiscoverable: true
+ };
+
+ doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
+ doorResource.attributes = {openstate: 'open'};
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var uriPath = "/door";
- var representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.resourceInterfaces = ["oic.if.b"];
- representation.attributes = {"openstate": "open"};
-
- var response = new tizen.Response(request);
- response.representation = representation;
- response.result = "SUCCESS";
+ var uriPath = "/door";
+ var representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.resourceInterfaces = ["oic.if.b"];
+ representation.attributes = {"openstate": "open"};
+
+ var response = new tizen.Response(request);
+ response.representation = representation;
+ response.result = "SUCCESS";
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
- response.result = "ERROR";
+ console.log(err.name + ': ' + err.message);
+ response.result = "ERROR";
}
response.send();
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name to identify the data - this will be the <em>name</em> attribute of the <a href="#KeyManagerAlias">KeyManagerAlias</a> which this method adds, on success, into the KeyManager
</li>
<li class="param">
-<span class="name">rawData</span>:
+<span class="name">rawData</span>:
Raw data to be stored
</li>
<li class="param">
-<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Password to use for encrypting the data
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when data is successfully saved
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function onSave()
{
- console.log("Successfully saved data");
+ console.log("Successfully saved data");
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias of the data to remove
</li>
</ul>
function onSave()
{
- /* Do something */
+ /* Do something */
- /*
- Dictionary does not require package ID because the
- application which is calling removeData() saved "data1"
- */
- tizen.keymanager.removeData({"name": data_name});
+ /*
+ Dictionary does not require package ID because the
+ application which is calling removeData() saved "data1"
+ */
+ tizen.keymanager.removeData({"name": data_name});
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
if (aliases.length != 0)
{
- /*
- Assuming the application calling removeData() has permission
- to remove aliases[0]
- */
- var app_data = tizen.keymanager.removeData(aliases[0]);
+ /*
+ Assuming the application calling removeData() has permission
+ to remove aliases[0]
+ */
+ var app_data = tizen.keymanager.removeData(aliases[0]);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias of the data to get
</li>
<li class="param">
-<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Password which was used to encrypt the data
</li>
</ul>
function onSave()
{
- /*
- Dictionary does not require package ID because the
- application which is calling getData() saved "data1"
- */
- var app_data = tizen.keymanager.getData({"name": data_name});
- console.log("App data: " + app_data + " was retrieved");
+ /*
+ Dictionary does not require package ID because the
+ application which is calling getData() saved "data1"
+ */
+ var app_data = tizen.keymanager.getData({"name": data_name});
+ console.log("App data: " + app_data + " was retrieved");
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
if (aliases.length != 0)
{
- /*
- Assuming the application calling getData() has permission to read
- aliases[0]
- */
- var app_data = tizen.keymanager.getData(aliases[0]);
- console.log("App data: " + app_data + " was retrieved");
+ /*
+ Assuming the application calling getData() has permission to read
+ aliases[0]
+ */
+ var app_data = tizen.keymanager.getData(aliases[0]);
+ console.log("App data: " + app_data + " was retrieved");
}
</pre>
</div>
console.log("aliases: ");
for (var i = 0; i < aliases.length; i++)
{
- console.log("Package ID: " + aliases[i].packageId + ", Name: "
- + aliases[i].name);
+ console.log("Package ID: " + aliases[i].packageId + ", Name: "
+ + aliases[i].name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias the data for which permission will be set
</li>
<li class="param">
-<span class="name">packageId</span>:
+<span class="name">packageId</span>:
Package ID of the accessor application
</li>
<li class="param">
-<span class="name">permissionType</span>:
+<span class="name">permissionType</span>:
Permission to grant to the accessor application
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when permission is successfully set
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function onPermissionSet()
{
- console.log("Successfully set permission");
+ console.log("Successfully set permission");
}
function onSave()
{
- /*
- Dictionary does not require package ID because an
- application can only set permission for data which it saved
- */
- tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
+ /*
+ Dictionary does not require package ID because an
+ application can only set permission for data which it saved
+ */
+ tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
function onPermissionSet()
{
- console.log("Successfully set permssion");
+ console.log("Successfully set permssion");
}
if (aliases.length != 0)
{
- /*
- Check that the application calling setPermission() saved aliases[0] into
- the KeyManager
- */
- if (aliases[0].packageId === tizen.package.getPackageInfo().id)
- {
- tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
- }
- else
- {
- console.log("This application did not save aliases[0] into the KeyManager");
- }
+ /*
+ Check that the application calling setPermission() saved aliases[0] into
+ the KeyManager
+ */
+ if (aliases[0].packageId === tizen.package.getPackageInfo().id)
+ {
+ tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+ }
+ else
+ {
+ console.log("This application did not save aliases[0] into the KeyManager");
+ }
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var mcClient = tizen.mediacontroller.getClient();
+ var mcClient = tizen.mediacontroller.getClient();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var mcServer = tizen.mediacontroller.createServer();
+ var mcServer = tizen.mediacontroller.createServer();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Playback state.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
Playback position.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Shuffle mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Repeat mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">metadata</span>:
+<span class="name">metadata</span>:
Metadata object.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Change request listener to add.
</li>
</ul>
var playbackRequestListener =
{
- onplaybackstaterequest: function(state)
- {
- console.log('Playback state requested to: ' + state);
- },
- onplaybackpositionrequest: function(position)
- {
- console.log('Playback position requested to: ' + position);
- },
- onshufflemoderequest: function(mode)
- {
- console.log('Shuffle mode requested to: ' + mode);
- },
- onrepeatmoderequest: function(mode)
- {
- console.log('Repeat mode requested to: ' + mode);
- }
+ onplaybackstaterequest: function(state)
+ {
+ console.log('Playback state requested to: ' + state);
+ },
+ onplaybackpositionrequest: function(position)
+ {
+ console.log('Playback position requested to: ' + position);
+ },
+ onshufflemoderequest: function(mode)
+ {
+ console.log('Shuffle mode requested to: ' + mode);
+ },
+ onrepeatmoderequest: function(mode)
+ {
+ console.log('Repeat mode requested to: ' + mode);
+ }
};
/* Registers to receive playback info change requests from client */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
var playbackRequestListener =
{
- onplaybackstaterequest: function(state)
- {
- console.log('Playback state requested to: ' + state);
- },
- onplaybackpositionrequest: function(position)
- {
- console.log('Playback position requested to: ' + position);
- },
- onshufflemoderequest: function(mode)
- {
- console.log('Shuffle mode requested to: ' + mode);
- },
- onrepeatmoderequest: function(mode)
- {
- console.log('Repeat mode requested to: ' + mode);
- }
+ onplaybackstaterequest: function(state)
+ {
+ console.log('Playback state requested to: ' + state);
+ },
+ onplaybackpositionrequest: function(position)
+ {
+ console.log('Playback position requested to: ' + position);
+ },
+ onshufflemoderequest: function(mode)
+ {
+ console.log('Shuffle mode requested to: ' + mode);
+ },
+ onrepeatmoderequest: function(mode)
+ {
+ console.log('Repeat mode requested to: ' + mode);
+ }
};
/* Registers to receive playback info change requests */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Custom commands listener to add.
</li>
</ul>
var commandReceiveListener = function(clientName, command, data)
{
- console.log('Command ' + command + ' received from: ' + clientName +
- ' with data: ' + JSON.stringify(data));
+ console.log('Command ' + command + ' received from: ' + clientName +
+ ' with data: ' + JSON.stringify(data));
- var reply = {myReply: 'someValue'};
+ var reply = {myReply: 'someValue'};
- return reply;
+ return reply;
};
/* Registers to receive custom commands from client */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
var commandReceiveListener = function(clientName, command, data)
{
- console.log('Command ' + command + ' received from: ' + clientName +
- ' with data: ' + JSON.stringify(data));
+ console.log('Command ' + command + ' received from: ' + clientName +
+ ' with data: ' + JSON.stringify(data));
- var reply = {myReply: 'someValue'};
+ var reply = {myReply: 'someValue'};
- return reply;
+ return reply;
};
/* Registers to receive custom commands from client */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoked when all of the registered media controller servers was fund.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure of retrieving servers list.
</li>
</ul>
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
console.log('Latest server name is: ' + mcServerInfo.name +
- ', server state: ' + mcServerInfo.name);
+ ', server state: ' + mcServerInfo.name);
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Playback state.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoked when playback state was changed.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendPlaybackState('STOP', function()
{
- console.log('Playback has stopped');
+ console.log('Playback has stopped');
}, function(e)
{
- console.log('Unable to change playback state: ' + e.message);
+ console.log('Unable to change playback state: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
Playback position.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoked when playback position was changed.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendPlaybackPosition(164, function()
{
- console.log('Playback position changed');
+ console.log('Playback position changed');
}, function(e)
{
- console.log('Unable to change playback position: ' + e.message);
+ console.log('Unable to change playback position: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Shuffle mode.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoked when shuffle mode was changed.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendShuffleMode(true, function()
{
- console.log('Shuffle mode changed');
+ console.log('Shuffle mode changed');
}, function(e)
{
- console.log('Unable to change shuffle mode: ' + e.message);
+ console.log('Unable to change shuffle mode: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Repeat mode.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoked when repeat mode was changed.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendRepeatMode(false, function()
{
- console.log('Repeat mode changed');
+ console.log('Repeat mode changed');
}, function(e)
{
- console.log('Unable to change repeat mode: ' + e.message);
+ console.log('Unable to change repeat mode: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">command</span>:
+<span class="name">command</span>:
Custom command name which is handled on server side.
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Additional data for custom command which is send to server.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoked when server responded to custom command.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendCommand('myPlaylistFilter', exampleCustomCommandData, function(response)
{
- console.log('Command executed with result: ' + JSON.stringify(response));
+ console.log('Command executed with result: ' + JSON.stringify(response));
}, function(e)
{
- console.log('Error executing command: ' + e.message);
+ console.log('Error executing command: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Status change listener to add.
</li>
</ul>
/* Registers to be notified when server status changes */
watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
{
- console.log(mcServerInfo.name + ' server status changed to ' + status);
+ console.log(mcServerInfo.name + ' server status changed to ' + status);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
/* Registers to be notified when server status changes */
watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
{
- console.log(mcServerInfo.name + ' server status changed to ' + status);
+ console.log(mcServerInfo.name + ' server status changed to ' + status);
});
/* Cancels the watch operation */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Status change listener to add.
</li>
</ul>
var playbackListener =
{
- onplaybackchanged: function(state, position)
- {
- console.log('Current playback state: ' + state);
- console.log('Current playback position: ' + position);
- },
- onshufflemodechanged: function(mode)
- {
- console.log('Shuffle mode changed to: ' + mode);
- },
- onrepeatmodechanged: function(mode)
- {
- console.log('Repeat mode changed to: ' + mode);
- },
- onmetadatachanged: function(metadata)
- {
- console.log('Playback metadata changed: ' + JSON.stringify(metadata));
- }
+ onplaybackchanged: function(state, position)
+ {
+ console.log('Current playback state: ' + state);
+ console.log('Current playback position: ' + position);
+ },
+ onshufflemodechanged: function(mode)
+ {
+ console.log('Shuffle mode changed to: ' + mode);
+ },
+ onrepeatmodechanged: function(mode)
+ {
+ console.log('Repeat mode changed to: ' + mode);
+ },
+ onmetadatachanged: function(metadata)
+ {
+ console.log('Playback metadata changed: ' + JSON.stringify(metadata));
+ }
};
/* Registers to be notified when playback state changes */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
/* Receives playback state changes */
var playbackListener =
{
- onplaybackchanged: function(state, position)
- {
- console.log('Current playback state: ' + state);
- console.log('Current playback position: ' + position);
- },
- onshufflemodechanged: function(mode)
- {
- console.log('Shuffle mode changed to: ' + mode);
- },
- onrepeatmodechanged: function(mode)
- {
- console.log('Repeat mode changed to: ' + mode);
- },
- onmetadatachanged: function(metadata)
- {
- console.log('Playback metadata changed: ' + JSON.stringify(metadata));
- }
+ onplaybackchanged: function(state, position)
+ {
+ console.log('Current playback state: ' + state);
+ console.log('Current playback position: ' + position);
+ },
+ onshufflemodechanged: function(mode)
+ {
+ console.log('Shuffle mode changed to: ' + mode);
+ },
+ onrepeatmodechanged: function(mode)
+ {
+ console.log('Repeat mode changed to: ' + mode);
+ },
+ onmetadatachanged: function(metadata)
+ {
+ console.log('Playback metadata changed: ' + JSON.stringify(metadata));
+ }
};
/* Registers to be notified when playback state changes */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">servers</span>:
+<span class="name">servers</span>:
List of registered media controller servers
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span><span class="optional"> [nullable]</span>:
+<span class="name">data</span><span class="optional"> [nullable]</span>:
Response object sent from server.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">clientName</span>:
+<span class="name">clientName</span>:
Client application id which sent command.
</li>
<li class="param">
-<span class="name">command</span>:
+<span class="name">command</span>:
Custom command sent from client.
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Response object sent from client.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">status</span>:
+<span class="name">status</span>:
Current server status
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Current playback state.
</li>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
Current playback position.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Current shuffle mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Current repeat mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">metadata</span>:
+<span class="name">metadata</span>:
Current playback metadata.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Current playback state.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
Current playback position.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Current shuffle mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Current repeat mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback method to be invoked when a media key has been pressed or released.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.mediakey.setMediaKeyEventListener(
{
- onpressed: function(key)
- {
- console.log("Pressed key: " + key);
- },
- onreleased: function(key)
- {
- console.log("Released key: " + key);
- }
+ onpressed: function(key)
+ {
+ console.log("Pressed key: " + key);
+ },
+ onreleased: function(key)
+ {
+ console.log("Released key: " + key);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The pressed media key
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The released media key
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">localMessagePortName</span>:
+<span class="name">localMessagePortName</span>:
Name of the local message port to retrieve <br>The LocalMessagePort instances are identical for the same message port name.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">localMessagePortName</span>:
+<span class="name">localMessagePortName</span>:
Name of local message port <br>The LocalMessagePort instances are identical for the same message port name.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the application to send messages
</li>
<li class="param">
-<span class="name">remoteMessagePortName</span>:
+<span class="name">remoteMessagePortName</span>:
Name of remote message port
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the application to send messages
</li>
<li class="param">
-<span class="name">remoteMessagePortName</span>:
+<span class="name">remoteMessagePortName</span>:
Name of remote message port
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Callback function that is called when a message is received
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onreceived(data, remoteMsgPort)
{
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
}
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
ID to identify the listener
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Array of data to send
</li>
<li class="param">
-<span class="name">localMessagePort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">localMessagePort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
<em>LocalMessagePort</em> object that gives local message port of the current application<br>It can be used to receive reply messages from the other end of the message port.<br>The order of items in this array is not guaranteed to be preserved during data transfer, and values of <em>key</em> within this
array must not be duplicated or empty.
</li>
var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
localMsgPort.addMessagePortListener(function(items, remoteport)
{
- /* ... */
- if (remoteport !== null)
- {
- remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
- }
+ /* ... */
+ if (remoteport !== null)
+ {
+ remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
+ }
});
/* stream - FileStream object */
var bytePockets = [], byteCount = 0, i = 0;
while (byteCount < stream.bytesAvailable - 256)
{
- bytePockets[i] = stream.readBytes(256);
- byteCount+=256;
- i++;
+ bytePockets[i] = stream.readBytes(256);
+ byteCount+=256;
+ i++;
}
bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
var messagePortPockets = [{key: "key1", value: "val1"},
- {key: "key2", value: ["val2", "val3", "val4"]},
- {key: "key3", value: bytePockets[0]},
- {key: "key4", value: bytePockets}];
+ {key: "key2", value: ["val2", "val3", "val4"]},
+ {key: "key3", value: bytePockets[0]},
+ {key: "key4", value: bytePockets}];
remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Array of data received from another application
</li>
<li class="param">
-<span class="name">remoteMessagePort</span><span class="optional"> [nullable]</span>:
+<span class="name">remoteMessagePort</span><span class="optional"> [nullable]</span>:
RemoteMessagePort port that can be used to reply for the received message
</li>
</ul>
/* MessagePortCallback instance */
function onreceived(data, remoteMsgPort)
{
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
}
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
/* Defines the success callback */
var messageSentCallback = function(recipients)
{
- console.log("Message sent successfully to " + recipients.length + " recipients.");
+ console.log("Message sent successfully to " + recipients.length + " recipients.");
}
/* Defines the error callback */
function errorCallback(err)
{
- console.log(err.name + " error: " + err.message);
+ console.log(err.name + " error: " + err.message);
}
function serviceListCB(services)
{
- if (services.length > 0)
- {
- var msg = new tizen.Message("messaging.sms", {plainBody: "Tizen first SMS message."});
- services[0].sendMessage(msg, messageSentCallback, errorCallback);
- }
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.sms", {plainBody: "Tizen first SMS message."});
+ services[0].sendMessage(msg, messageSentCallback, errorCallback);
+ }
}
tizen.messaging.getMessageServices("messaging.sms", serviceListCB, errorCallback);
/* Define the success callback */
function serviceListCB(services)
{
- if (services.length > 0)
- {
- var msg = new tizen.Message("messaging.email");
- msg.attachments = [new tizen.MessageAttachment("images/myimage.png", "image/png"),
- new tizen.MessageAttachment("documents/mydoc.pdf", "text/pdf")];
- }
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.email");
+ msg.attachments = [new tizen.MessageAttachment("images/myimage.png", "image/png"),
+ new tizen.MessageAttachment("documents/mydoc.pdf", "text/pdf")];
+ }
}
tizen.messaging.getMessageServices("messaging.email", serviceListCB);
/* Defines the success callback */
function serviceListCB(services)
{
- if (services.length > 0)
- {
- var msg = new tizen.Message("messaging.email");
- msg.body.htmlBody = "<html><body><img src='myimage.png'></body></html>";
- msg.body.inlineAttachments = [new tizen.MessageAttachment("images/myimage.png")];
- }
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.email");
+ msg.body.htmlBody = "<html><body><img src='myimage.png'></body></html>";
+ msg.body.inlineAttachments = [new tizen.MessageAttachment("images/myimage.png")];
+ }
}
tizen.messaging.getMessageServices("messaging.email", serviceListCB);
/* Defines the success callback */
function serviceListCB(services)
{
- if (services.length > 0)
- {
- var msg = new tizen.Message("messaging.sms");
- }
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.sms");
+ }
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot get messaging service " + error.message);
+ console.log("Cannot get messaging service " + error.message);
}
tizen.messaging.getMessageServices("messaging.sms", serviceListCB,
- errorCallback);
+ errorCallback);
</pre>
</div>
<div class="methods">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">messageServiceType</span>:
+<span class="name">messageServiceType</span>:
Type of the services to be retrieved
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the services are successfully retrieved
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs.
</li>
</ul>
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot get messaging service " + error.message);
+ console.log("Cannot get messaging service " + error.message);
}
/* Defines the success callback */
function serviceListCB(services)
{
- console.log("Found " + services.length + "email services");
+ console.log("Found " + services.length + "email services");
}
tizen.messaging.getMessageServices("messaging.email", serviceListCB,
- errorCallback);
+ errorCallback);
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">services</span>:
+<span class="name">services</span>:
Array of available <em>MessageService</em> objects on the device
</li>
</ul>
/* Defines the success callback */
function messageSent(recipients)
{
- console.log("The SMS has been sent");
+ console.log("The SMS has been sent");
}
/* Defines the error callback */
function messageFailed(error)
{
- console.log("The SMS could not be sent " + error.message);
+ console.log("The SMS could not be sent " + error.message);
}
/* Defines the service error callback */
function serviceErrorCB(error)
{
- console.log("Cannot get messaging service " + error.message);
+ console.log("Cannot get messaging service " + error.message);
}
/* Defines the success callback */
function serviceListCB(services)
{
- if (services.length > 0)
- {
- /* SMS sending example */
- var msg = new tizen.Message("messaging.sms", {plainBody:"I will arrive in 10 minutes.",
- to:["+34666666666"]});
- /* Sends request */
- services[0].sendMessage(msg, messageSent, messageFailed);
- }
+ if (services.length > 0)
+ {
+ /* SMS sending example */
+ var msg = new tizen.Message("messaging.sms", {plainBody:"I will arrive in 10 minutes.",
+ to:["+34666666666"]});
+ /* Sends request */
+ services[0].sendMessage(msg, messageSent, messageFailed);
+ }
}
tizen.messaging.getMessageServices("messaging.sms", serviceListCB, serviceErrorCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
Message to be sent
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the message is successfully sent
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the sending request has failed
</li>
<li class="param">
-<span class="name">simIndex</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">simIndex</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The index of SIM card used to send an SMS message.
<em>simIndex</em> value of the first SIM card is <var>1</var>.<br>If the given <em>message</em> is not SMS message type, the <em>simIndex</em> is ignored.
If <var>simIndex</var> is not set, the SMS message is sent through the currently enabled SIM.
/* Defines the success callback */
function messageSent(recipients)
{
- for (var i = 0; i < recipients.length; i++)
- {
- console.log("The SMS has been sent to " + recipients[i]);
- }
+ for (var i = 0; i < recipients.length; i++)
+ {
+ console.log("The SMS has been sent to " + recipients[i]);
+ }
}
/* Defines the error callback */
function messageFailed(error)
{
- console.log("The SMS could not be sent " + error.message);
+ console.log("The SMS could not be sent " + error.message);
}
/* Defines the success callback */
function serviceListCB(services)
{
- if (services.length > 0)
- {
- /* SMS sending example */
- var msg = new tizen.Message("messaging.sms", {plainBody: "I will arrive in 10 minutes.",
- to: ["+34666666666", "+34888888888"]});
- /* Sends request */
- services[0].sendMessage(msg, messageSent, messageFailed);
- }
+ if (services.length > 0)
+ {
+ /* SMS sending example */
+ var msg = new tizen.Message("messaging.sms", {plainBody: "I will arrive in 10 minutes.",
+ to: ["+34666666666", "+34888888888"]});
+ /* Sends request */
+ services[0].sendMessage(msg, messageSent, messageFailed);
+ }
}
tizen.messaging.getMessageServices("messaging.sms", serviceListCB);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
Message with the body to be loaded
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the message body is successfully loaded
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the loading request fails
</li>
</ul>
/* Defines the success body loaded callback */
function successCallback(message)
{
- console.log("body for message: " + message.subject + "from: " + message.from + "loaded.");
+ console.log("body for message: " + message.subject + "from: " + message.from + "loaded.");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot load message body" + error.message);
+ console.log("Cannot load message body" + error.message);
}
function messageQueryCallback(messages)
{
- for (var i = 0; i < messages.length; i++)
- {
- var message = messages[i];
- if (!message.body.loaded)
- {
- service.loadMessageBody(message, successCallback, errorCallback);
- }
- }
+ for (var i = 0; i < messages.length; i++)
+ {
+ var message = messages[i];
+ if (!message.body.loaded)
+ {
+ service.loadMessageBody(message, successCallback, errorCallback);
+ }
+ }
}
service.messageStorage.findMessages(new tizen.AttributeFilter("type", "EXACTLY", "messaging.email"), messageQueryCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">attachment</span>:
+<span class="name">attachment</span>:
Message attachment to be loaded
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the message attachment is successfully loaded
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the loading request fails
</li>
</ul>
/* Defines the success body loaded callback */
function successCallback(attachment)
{
- console.log("attachment" + attachment.id + "is loaded to:" + attachment.filePath);
+ console.log("attachment" + attachment.id + "is loaded to:" + attachment.filePath);
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot load message attachment" + error.message);
+ console.log("Cannot load message attachment" + error.message);
}
function messagesFoundCB(messages)
{
- for (var i = 0; i < messages.length; i++)
- {
- var message = messages[i];
- if (!message.attachments[0].loaded)
- {
- service.loadMessageAttachment(message.attachments[0], successCallback, errorCallback);
- }
- }
+ for (var i = 0; i < messages.length; i++)
+ {
+ var message = messages[i];
+ if (!message.attachments[0].loaded)
+ {
+ service.loadMessageAttachment(message.attachments[0], successCallback, errorCallback);
+ }
+ }
}
service.messageStorage.findMessages(new tizen.AttributeFilter("hasAttachment", "EXACTLY", true), messagesFoundCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the operation is completed successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the request fails
</li>
<li class="param">
-<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Maximum amount of messages retrieved within each folder
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">folder</span>:
+<span class="name">folder</span>:
Folder to be synchronized
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the operation is completed successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the request fails
</li>
<li class="param">
-<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The maximum amount of messages retrieved within a given folder
</li>
</ul>
/* Defines the error callback */
function errorCallback(err)
{
- console.log(err.name + " error: " + err.message);
+ console.log(err.name + " error: " + err.message);
}
function serviceCallback(services)
{
- emailService = services[0];
- var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", emailService.id);
+ emailService = services[0];
+ var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", emailService.id);
- emailService.messageStorage.findFolders(filter, folderQueryCallback);
+ emailService.messageStorage.findFolders(filter, folderQueryCallback);
}
/* Defines the success callback */
function folderSynced()
{
- console.log("New messages are fetched!");
+ console.log("New messages are fetched!");
}
function folderQueryCallback(folders)
{
- console.log(folders.length + " folders(s) found!");
- for (var i = 0; i < folders.length; i++)
- {
- emailService.syncFolder (folders[i], folderSynced, null, 30);
- }
+ console.log(folders.length + " folders(s) found!");
+ for (var i = 0; i < folders.length; i++)
+ {
+ emailService.syncFolder (folders[i], folderSynced, null, 30);
+ }
}
tizen.messaging.getMessageServices("messaging.email", serviceCallback, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">opId</span>:
+<span class="name">opId</span>:
Service operation identifier
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">recipients</span>:
+<span class="name">recipients</span>:
Recipients of the message
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
Message containing the loaded body
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">attachment</span>:
+<span class="name">attachment</span>:
Loaded attachment
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
Draft message to add to the storage
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when draft messages are successfully added
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
/* Defines the success callback */
function successCallback()
{
- console.log("Draft message added");
+ console.log("Draft message added");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot add draft message " + error.message);
+ console.log("Cannot add draft message " + error.message);
}
/* Defines the service query success callback */
function serviceListCB(services)
{
- if (services.length > 0)
- {
- var msg = new tizen.Message("messaging.sms", {plainBody: "Tizen draft SMS message."});
- services[0].messageStorage.addDraftMessage(msg, successCallback,
- errorCallback);
- }
+ if (services.length > 0)
+ {
+ var msg = new tizen.Message("messaging.sms", {plainBody: "Tizen draft SMS message."});
+ services[0].messageStorage.addDraftMessage(msg, successCallback,
+ errorCallback);
+ }
}
tizen.messaging.getMessageServices("messaging.sms", serviceListCB);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filter</span>:
+<span class="name">filter</span>:
Criteria to be used when filtering
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
<li class="param">
-<span class="name">sort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">sort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Sorting mode for the query
</li>
<li class="param">
-<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The maximum number of messages to retrieve (It has the same meaning as SQL LIMIT)<br>Defaults to <var>0</var>, meaning that there is no limit
</li>
<li class="param">
-<span class="name">offset</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">offset</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Offset in the result set, from where the results are listed (It is the same semantics as SQL OFFSET)<br>Defaults to <var>0</var>, meaning no offset.
</li>
</ul>
var messageStorage = service.messageStorage;
function messageArrayCB(messages)
{
- console.log(messages.length + " message(s) fetched!");
- for (var i = 0; i < messages.length; i++)
- {
- console.log(i + ". message from " + messages[i].from);
- }
+ console.log(messages.length + " message(s) fetched!");
+ for (var i = 0; i < messages.length; i++)
+ {
+ console.log(i + ". message from " + messages[i].from);
+ }
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot query messages" + error.message);
+ console.log("Cannot query messages" + error.message);
}
var filter = new tizen.AttributeFilter("from", "CONTAINS", "2593");
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">messages</span>:
+<span class="name">messages</span>:
Array of messages to delete
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when messages are successfully deleted
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
var messageStorage = service.messageStorage;
function successCallback()
{
- console.log("Messages were deleted");
+ console.log("Messages were deleted");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot delete messages " + error.message);
+ console.log("Cannot delete messages " + error.message);
}
function messageArrayCB(messages)
{
- if (messages.length > 0)
- {
- messageStorage.removeMessages(messages, successCallback, errorCallback);
- }
- else
- {
- console.log("No messages found");
- }
+ if (messages.length > 0)
+ {
+ messageStorage.removeMessages(messages, successCallback, errorCallback);
+ }
+ else
+ {
+ console.log("No messages found");
+ }
}
var filter = new tizen.AttributeFilter("from", "CONTAINS", "2593");
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">messages</span>:
+<span class="name">messages</span>:
Array listing messages to update
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when messages are successfully updated
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
/* Defines the success callback */
function successCallback()
{
- console.log("Messages were updated");
+ console.log("Messages were updated");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot update messages " + error.message);
+ console.log("Cannot update messages " + error.message);
}
function messageArrayCB(messages)
{
- if (messages.length > 0)
- {
- messages[0].isRead = true;
- messageStorage.updateMessages([messages[0]], successCallback, errorCallback);
- }
- else
- {
- console.log("No messages found");
- }
+ if (messages.length > 0)
+ {
+ messages[0].isRead = true;
+ messageStorage.updateMessages([messages[0]], successCallback, errorCallback);
+ }
+ else
+ {
+ console.log("No messages found");
+ }
}
var filter = new tizen.AttributeFilter('isRead', 'EXACTLY', false);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filter</span>:
+<span class="name">filter</span>:
Criteria to be used when filtering
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
<li class="param">
-<span class="name">sort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">sort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Sorting mode for the query
</li>
<li class="param">
-<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The maximum number of messages to retrieve (It has the same meaning as SQL LIMIT)<br>If set to <var>0</var> or omitted, then the number of records is not limited.
</li>
<li class="param">
-<span class="name">offset</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">offset</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Offset in the result set, from where the results are listed (It is the same semantics as SQL OFFSET) <br>Defaults to<var> 0</var>, meaning no offset.
</li>
</ul>
var messageStorage = service.messageStorage;
function conversationsArrayCB(conversations)
{
- console.log(conversations.length + " conversation(s) found!");
- for (var i = 0; i < conversations.length; i++)
- {
- console.log(i + ". conversation preview " + conversations[i].preview);
- }
+ console.log(conversations.length + " conversation(s) found!");
+ for (var i = 0; i < conversations.length; i++)
+ {
+ console.log(i + ". conversation preview " + conversations[i].preview);
+ }
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot query conversations" + error.message);
+ console.log("Cannot query conversations" + error.message);
}
var filter = new tizen.AttributeFilter('from', 'CONTAINS', '2593');
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">conversations</span>:
+<span class="name">conversations</span>:
Array of conversations to delete
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when conversations are successfully deleted
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
/* Defines the success callback */
function successCallback()
{
- console.log("Conversations deleted");
+ console.log("Conversations deleted");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Cannot delete conversations " + error.message);
+ console.log("Cannot delete conversations " + error.message);
}
function conversationsArrayCB(conversations)
{
- if (conversations.length > 0)
- {
- messageStorage.removeConversations(conversations, successCallback,
- errorCallback);
- }
- else
- {
- console.log("No conversations found");
- }
- console.log("Deleted " + conversations.length + " conversation(s)");
+ if (conversations.length > 0)
+ {
+ messageStorage.removeConversations(conversations, successCallback,
+ errorCallback);
+ }
+ else
+ {
+ console.log("No conversations found");
+ }
+ console.log("Deleted " + conversations.length + " conversation(s)");
}
/* Defines the error callback */
function queryErrorCB(error)
{
- console.log("Cannot query conversations" + error.message);
+ console.log("Cannot query conversations" + error.message);
}
var filter = new tizen.AttributeFilter('from', 'CONTAINS', '2593');
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filter</span>:
+<span class="name">filter</span>:
Criteria used when filtering
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
var messageStorage = service.messageStorage;
function folderArrayCB(folders)
{
- console.log(folders.length + " folders(s) found!");
- for (var i = 0; i < folders.length; i++)
- {
- console.log(i + ", folder: " + folders[i].name);
- }
+ console.log(folders.length + " folders(s) found!");
+ for (var i = 0; i < folders.length; i++)
+ {
+ console.log(i + ", folder: " + folders[i].name);
+ }
}
var filter = new tizen.AttributeFilter("serviceId", "EXACTLY", service.id);
messageStorage.findFolders(filter, folderArrayCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">messagesChangeCallback</span>:
+<span class="name">messagesChangeCallback</span>:
Callback function that is called when the MessageStorage is changed
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Criteria to be used when filtering (Message filter)
</li>
</ul>
var messageStorage = service.messageStorage;
var messageChangeCallback =
{
- messagesupdated: function(messages)
- {
- console.log(messages.length + " message(s) updated");
- },
- messagesadded: function(messages)
- {
- console.log(messages.length + " message(s) added");
- },
- messagesremoved: function(messages)
- {
- console.log(messages.length + " message(s) removed");
- }
+ messagesupdated: function(messages)
+ {
+ console.log(messages.length + " message(s) updated");
+ },
+ messagesadded: function(messages)
+ {
+ console.log(messages.length + " message(s) added");
+ },
+ messagesremoved: function(messages)
+ {
+ console.log(messages.length + " message(s) removed");
+ }
};
messageStorage.addMessagesChangeListener(messageChangeCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">conversationsChangeCallback</span>:
+<span class="name">conversationsChangeCallback</span>:
Callback function that is called when the MessageConversation is changed
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Criteria to be used when filtering (MessageConversation filter)
</li>
</ul>
var messageStorage = service.messageStorage;
var conversationChangeCB =
{
- conversationsupdated: function(conversations)
- {
- console.log(conversations.length + " conversations(s) updated");
- },
- conversationsadded: function(conversations)
- {
- console.log(conversations.length + " conversations(s) added");
- },
- conversationsremoved: function(conversations)
- {
- console.log(conversations.length + " conversations(s) removed");
- }
+ conversationsupdated: function(conversations)
+ {
+ console.log(conversations.length + " conversations(s) updated");
+ },
+ conversationsadded: function(conversations)
+ {
+ console.log(conversations.length + " conversations(s) added");
+ },
+ conversationsremoved: function(conversations)
+ {
+ console.log(conversations.length + " conversations(s) removed");
+ }
};
messageStorage.addConversationsChangeListener(conversationChangeCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">foldersChangeCallback</span>:
+<span class="name">foldersChangeCallback</span>:
Callback function that is called when the MessageFolder is changed
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Criteria to be used when filtering (MessageFolder filter)
</li>
</ul>
var messageStorage = service.messageStorage;
var folderChangeCB =
{
- foldersupdated: function(folders)
- {
- console.log(folders.length + " folders(s) updated");
- },
- foldersadded: function(folders)
- {
- console.log(folders.length + " folders(s) added");
- },
- foldersremoved: function(folders)
- {
- console.log(folders.length + " folders(s) removed");
- }
+ foldersupdated: function(folders)
+ {
+ console.log(folders.length + " folders(s) updated");
+ },
+ foldersadded: function(folders)
+ {
+ console.log(folders.length + " folders(s) added");
+ },
+ foldersremoved: function(folders)
+ {
+ console.log(folders.length + " folders(s) removed");
+ }
};
messageStorage.addFoldersChangeListener(folderChangeCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Identifier of the subscription returned by addMessagesChangeListener(), addConversationsChangeListener() or
addFoldersChangeListener() methods
</li>
var messageStorage = service.messageStorage;
var folderChangeCB =
{
- foldersupdated: function(folders)
- {
- console.log(folders.length + " folders(s) updated. Cancel watching.");
- messageStorage.removeChangeListener(watchId);
- },
- foldersadded: function(folders)
- {
- console.log(folders.length + " folders(s) added. Cancel watching.");
- messageStorage.removeChangeListener(watchId);
- },
- foldersremoved: function(folders)
- {
- console.log(folders.length + " folders(s) removed. Cancel watching.");
- messageStorage.removeChangeListener(watchId)
- }
+ foldersupdated: function(folders)
+ {
+ console.log(folders.length + " folders(s) updated. Cancel watching.");
+ messageStorage.removeChangeListener(watchId);
+ },
+ foldersadded: function(folders)
+ {
+ console.log(folders.length + " folders(s) added. Cancel watching.");
+ messageStorage.removeChangeListener(watchId);
+ },
+ foldersremoved: function(folders)
+ {
+ console.log(folders.length + " folders(s) removed. Cancel watching.");
+ messageStorage.removeChangeListener(watchId)
+ }
};
watchId = messageStorage.addFoldersChangeListener(folderChangeCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">messages</span>:
+<span class="name">messages</span>:
Array of messages that satisfy the query
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">conversations</span>:
+<span class="name">conversations</span>:
Array of conversations that satisfy the query
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">folders</span>:
+<span class="name">folders</span>:
Array of folders that satisfy the query
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">addedMessages</span>:
+<span class="name">addedMessages</span>:
Array of added messages
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">updatedMessages</span>:
+<span class="name">updatedMessages</span>:
Array of updated messages
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">removedMessages</span>:
+<span class="name">removedMessages</span>:
Array of removed messages
It contains only MessageId attribute.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">addedConversations</span>:
+<span class="name">addedConversations</span>:
Array of added conversations
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">updatedConversations</span>:
+<span class="name">updatedConversations</span>:
Array of updated conversations
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">removedConversations</span>:
+<span class="name">removedConversations</span>:
Array of removed conversations.
Every element contains only MessageConvId attribute.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">addedFolders</span>:
+<span class="name">addedFolders</span>:
Array of added folders
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">updatedFolders</span>:
+<span class="name">updatedFolders</span>:
Array of updated folders
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">removedFolders</span>:
+<span class="name">removedFolders</span>:
Array of removed folders
Each element contains only MessageFolderId attribute.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">networkType</span>:
+<span class="name">networkType</span>:
The network type
</li>
<li class="param">
-<span class="name">domainName</span>:
+<span class="name">domainName</span>:
The domain name
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when data network connection is connected
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the request is failed
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var statuscb =
{
- onsuccess: function() {console.log("onsuccess func is called");},
- ondisconnected: function() {console.log("ondisconnected func is called");}
+ onsuccess: function() {console.log("onsuccess func is called");},
+ ondisconnected: function() {console.log("ondisconnected func is called");}
};
function ecb(e) {console.log("error callback is called: " + e.message + ": " + e.code);}
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">networkType</span>:
+<span class="name">networkType</span>:
Network type
</li>
<li class="param">
-<span class="name">domainName</span>:
+<span class="name">domainName</span>:
Domain name
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when data network connection is released
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the releasing fails
</li>
</ul>
function ecb(e) {console.log("error callback is called: " + e.message + ": " + e.code);}
var statuscb =
{
- onsuccess: function()
- {
- console.log("onsuccess func is called");
- tizen.networkbearerselection.releaseRouteToHost("CELLULAR", "www.google.com", scb, ecb);
- },
- ondisconnected: function() {console.log("ondisconnected func is called");}
+ onsuccess: function()
+ {
+ console.log("onsuccess func is called");
+ tizen.networkbearerselection.releaseRouteToHost("CELLULAR", "www.google.com", scb, ecb);
+ },
+ ondisconnected: function() {console.log("ondisconnected func is called");}
};
tizen.networkbearerselection.requestRouteToHost("CELLULAR", "www.google.com", statuscb, ecb);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter = tizen.nfc.getDefaultAdapter();
+ var adapter = tizen.nfc.getDefaultAdapter();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
The value of the exclusive mode.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.nfc.setExclusiveMode(true);
+ tizen.nfc.setExclusiveMode(true);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
The state of the NFC adapter, <var>true</var> means on, <var>false</var> means off
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the NFC adapter is
enabled or disabled successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs.
</li>
</ul>
var gNfcAdapter;
var onPowerOn = function()
{
- /* Called when NFC adapter is powered on */
- try
- {
- console.log("Power on succeed");
- /* Implement NFC communication routines */
- gNfcAdapter.setPowered(false, /* Disable NFC adapter */
- function() {console.log("Power off succeed");}, /* Handle success */
- function() {console.log("Power off failed");}); /* Handle failure */
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ /* Called when NFC adapter is powered on */
+ try
+ {
+ console.log("Power on succeed");
+ /* Implement NFC communication routines */
+ gNfcAdapter.setPowered(false, /* Disable NFC adapter */
+ function() {console.log("Power off succeed");}, /* Handle success */
+ function() {console.log("Power off failed");}); /* Handle failure */
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
try
{
- gNfcAdapter = tizen.nfc.getDefaultAdapter();
- if (!gNfcAdapter.powered)
- {
- gNfcAdapter.setPowered(true, /* Enable NFC adapter */
- onPowerOn, /* Handle success */
- function() {console.log("Power on failed")}); /* Handle failure */
- }
- else
- {
- onPowerOn();
- }
+ gNfcAdapter = tizen.nfc.getDefaultAdapter();
+ if (!gNfcAdapter.powered)
+ {
+ gNfcAdapter.setPowered(true, /* Enable NFC adapter */
+ onPowerOn, /* Handle success */
+ function() {console.log("Power on failed")}); /* Handle failure */
+ }
+ else
+ {
+ onPowerOn();
+ }
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">detectCallback</span>:
+<span class="name">detectCallback</span>:
Callback method to be invoked when an NFC tag is successfully detected.
</li>
<li class="param">
-<span class="name">tagFilter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">tagFilter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A filter to be used when a specific NFC tag is detected.
</li>
</ul>
var adapter = tizen.nfc.getDefaultAdapter();
var onSuccessCB =
{
- onattach: function(nfcTag)
- {
- console.log("NFC Tag's type is " + nfcTag.type);
- },
- ondetach: function()
- {
- console.log("NFC Tag is detached");
- }
+ onattach: function(nfcTag)
+ {
+ console.log("NFC Tag's type is " + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ console.log("NFC Tag is detached");
+ }
};
adapter.setTagListener(onSuccessCB);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">detectCallback</span>:
+<span class="name">detectCallback</span>:
Callback method to be invoked when an NFC peer-to-peer target is successfully detected.
</li>
</ul>
var adapter = tizen.nfc.getDefaultAdapter();
var onSuccessCB =
{
- onattach: function(nfcPeer)
- {
- console.log("NFC Target is detected");
- },
- ondetach: function()
- {
- console.log("NFC Target is detached");
- }
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
};
adapter.setPeerListener(onSuccessCB);
</pre>
/* Receives NFCTag */
var onSuccessCB =
{
- onattach: function(nfcTag)
- {
- console.log("The attached NFC tag's type is " + nfcTag.type);
- },
- ondetach: function()
- {
- console.log("NFC tag is detached.");
-
- /* Unregister the listener when the NFC tag is detached */
- adapter.unsetTagListener();
- }
+ onattach: function(nfcTag)
+ {
+ console.log("The attached NFC tag's type is " + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ console.log("NFC tag is detached.");
+
+ /* Unregister the listener when the NFC tag is detached */
+ adapter.unsetTagListener();
+ }
};
/* Registers to be notified when NFC tag is detected */
/* Receives an NFC peer */
var onSuccessCB =
{
- onattach: function(nfcPeer)
- {
- console.log("NFC peer target is attached.");
- },
- ondetach: function()
- {
- console.log("NFC peer target is detached.");
-
- /* Unregisters the listener when NFC peer target is detached */
- adapter.unsetPeerListener();
- }
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC peer target is attached.");
+ },
+ ondetach: function()
+ {
+ console.log("NFC peer target is detached.");
+
+ /* Unregisters the listener when NFC peer target is detached */
+ adapter.unsetPeerListener();
+ }
};
/* Registers to be notified when NFC peer target is detected */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changeCallback</span>:
+<span class="name">changeCallback</span>:
Callback method to be invoked when the card emulation mode is changed
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onSuccessCB = function(mode)
- {
- console.log("The card emulation mode is " + mode);
- };
- var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
+ var onSuccessCB = function(mode)
+ {
+ console.log("The card emulation mode is " + mode);
+ };
+ var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier to remove
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.removeCardEmulationModeChangeListener(listenerId);
+ adapter.removeCardEmulationModeChangeListener(listenerId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Secure element type to listen
</li>
<li class="param">
-<span class="name">eventCallback</span>:
+<span class="name">eventCallback</span>:
Callback method to be invoked when an external reader tries to access a secure element
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data) {console.log("transaction event occurs");});
+ var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data) {console.log("transaction event occurs");});
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier to remove
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.removeTransactionEventListener(listenerId);
+ adapter.removeTransactionEventListener(listenerId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changeCallback</span>:
+<span class="name">changeCallback</span>:
Callback method to be invoked when an active secure element is changed
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onSuccessCB = function(seType)
- {
- console.log("Active secure element is " + seType);
- };
- var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
+ var onSuccessCB = function(seType)
+ {
+ console.log("Active secure element is " + seType);
+ };
+ var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier to remove
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.removeActiveSecureElementChangeListener(listenerId);
+ adapter.removeActiveSecureElementChangeListener(listenerId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Value of the exclusive mode
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.setExclusiveModeForTransaction(true);
+ adapter.setExclusiveModeForTransaction(true);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">eventCallback</span>:
+<span class="name">eventCallback</span>:
Callback method to be invoked when host device receives an APDU that is defined in the ISO/IEC 7816-4 specification
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onDetectedCB = function(event_data)
- {
- console.log("HCE event type is " + event_data.eventType);
- console.log("APDU is " + event_data.apdu);
- };
- var listenerId = adapter.addHCEEventListener(onDetectedCB);
+ var onDetectedCB = function(event_data)
+ {
+ console.log("HCE event type is " + event_data.eventType);
+ console.log("APDU is " + event_data.apdu);
+ };
+ var listenerId = adapter.addHCEEventListener(onDetectedCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier to remove
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.removeHCEEventListener(listenerId);
+ adapter.removeHCEEventListener(listenerId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">apdu</span>:
+<span class="name">apdu</span>:
The APDU data to send. APDU is defined in the ISO/IEC 7816-4 specification.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked when an APDU is successfully sent to the NFC reader.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked in case any error occurs while sending.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var successCB = function()
- {
- console.log("Sending APDU response was successful.");
- };
-
- var errorCB = function()
- {
- console.log("Sending APDU response failed.");
- };
-
- var classOfInstruction = 0x00; /* No SM or no SM indication */
- var instructionCode = 0xA4; /* Select File */
- var firstParam = 0x04; /* Direct selection by DF name */
- var secondParam = 0x00; /* First record */
- var dataFieldLength = 0x03; /* Variable length 1 or 3 bytes */
- var bytes = [ 0x20, 0x21, 0x22]; /* Variable length equal to dataFieldLength */
- var maxBytesExpected = 0x02; /* Maximum bytes in answer */
-
- var apdu_response = [classOfInstruction, instructionCode, firstParam, secondParam] + bytes + [maxBytesExpected]; /* Set apdu response */
- adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB);
+ var successCB = function()
+ {
+ console.log("Sending APDU response was successful.");
+ };
+
+ var errorCB = function()
+ {
+ console.log("Sending APDU response failed.");
+ };
+
+ var classOfInstruction = 0x00; /* No SM or no SM indication */
+ var instructionCode = 0xA4; /* Select File */
+ var firstParam = 0x04; /* Direct selection by DF name */
+ var secondParam = 0x00; /* First record */
+ var dataFieldLength = 0x03; /* Variable length 1 or 3 bytes */
+ var bytes = [ 0x20, 0x21, 0x22]; /* Variable length equal to dataFieldLength */
+ var maxBytesExpected = 0x02; /* Maximum bytes in answer */
+
+ var apdu_response = [classOfInstruction, instructionCode, firstParam, secondParam] + bytes + [maxBytesExpected]; /* Set apdu response */
+ adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
-<span class="name">aid</span>:
+<span class="name">aid</span>:
Application ID, specified in ISO/IEC 7816-4
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var aid = "ABC0012345";
- var isActiveHandler = adapter.isActivatedHandlerForAID("HCE", aid);
- if (isActiveHandler)
- {
- console.log("current application is activated handler for the AID");
- }
+ var aid = "ABC0012345";
+ var isActiveHandler = adapter.isActivatedHandlerForAID("HCE", aid);
+ if (isActiveHandler)
+ {
+ console.log("current application is activated handler for the AID");
+ }
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
-<span class="name">category</span>:
+<span class="name">category</span>:
The card emulation category type
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var isActiveHandler = adapter.isActivatedHandlerForCategory("ESE", "PAYMENT");
- if (isActiveHandler)
- {
- console.log("current application is activated handler for the category");
- }
+ var isActiveHandler = adapter.isActivatedHandlerForCategory("ESE", "PAYMENT");
+ if (isActiveHandler)
+ {
+ console.log("current application is activated handler for the category");
+ }
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
-<span class="name">aid</span>:
+<span class="name">aid</span>:
Application Id, specified in ISO/IEC 7816-4
</li>
<li class="param">
-<span class="name">category</span>:
+<span class="name">category</span>:
The card emulation category type
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var aid = "ABC0012345";
- adapter.registerAID("HCE", aid, "PAYMENT");
+ var aid = "ABC0012345";
+ adapter.registerAID("HCE", aid, "PAYMENT");
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
-<span class="name">aid</span>:
+<span class="name">aid</span>:
Application Id, specified in ISO/IEC 7816-4
</li>
<li class="param">
-<span class="name">category</span>:
+<span class="name">category</span>:
The card emulation category type
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var aid = "ABC0012345";
- adapter.unregisterAID("HCE", aid, "PAYMENT");
+ var aid = "ABC0012345";
+ adapter.unregisterAID("HCE", aid, "PAYMENT");
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
-<span class="name">category</span>:
+<span class="name">category</span>:
The card emulation category type
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Invoked when the AIDs are retrieved successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked in case any error occurs while retrieving.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var successCB = function(aids)
- {
- var arrayLength = aids.length;
- for (var i = 0; i arrayLength; i++)
- {
- console.log("Get AID category was successful.");
- console.log("AID type is " + aids[i].type);
- console.log("AID is " + aids[i].aid);
- console.log("AID isReadOnly is " + aids[i].readOnly);
- }
- };
-
- var errorCB = function()
- {
- console.log("Get AID category failed.");
- };
-
- adapter.getAIDsForCategory("HCE", "PAYMENT", successCB, errorCB);
+ var successCB = function(aids)
+ {
+ var arrayLength = aids.length;
+ for (var i = 0; i arrayLength; i++)
+ {
+ console.log("Get AID category was successful.");
+ console.log("AID type is " + aids[i].type);
+ console.log("AID is " + aids[i].aid);
+ console.log("AID isReadOnly is " + aids[i].readOnly);
+ }
+ };
+
+ var errorCB = function()
+ {
+ console.log("Get AID category failed.");
+ };
+
+ adapter.getAIDsForCategory("HCE", "PAYMENT", successCB, errorCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var adapter = tizen.nfc.getDefaultAdapter();
var onSuccessCB =
{
- onattach: function(nfcTag)
- {
- console.log("NFC Tag's type is " + nfcTag.type);
- for (var i in nfcTag.properties)
- {
- console.log("key:" + i + " value:" + nfcTag.properties[i]);
- }
- },
- ondetach: function()
- {
- console.log("NFC Tag is detached");
- }
+ onattach: function(nfcTag)
+ {
+ console.log("NFC Tag's type is " + nfcTag.type);
+ for (var i in nfcTag.properties)
+ {
+ console.log("key:" + i + " value:" + nfcTag.properties[i]);
+ }
+ },
+ ondetach: function()
+ {
+ console.log("NFC Tag is detached");
+ }
};
adapter.setTagListener(onSuccessCB);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">readCallback</span>:
+<span class="name">readCallback</span>:
Callback method to be invoked in case reading the NDEF Data is completed successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked in case any error occurs while reading the NDEF Data.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var successCB = function(ndefMessage)
- {
- console.log("Message read was successful.");
- for (var i = 0; i < ndefMessage.recordCount; ++i)
- {
- console.log("Message record " + i + "tnf: " + ndefMessage.records[i].tnf);
- console.log("Message record " + i + "tnf: " + ndefMessage.records[i].tnf);
- console.log("Message record type " + ndefMessage.records[i].type.toString());
- }
- };
-
- var errorCB = function()
- {
- console.log("Message read failed.");
- };
-
- nfcTag.readNDEF(successCB, errorCB);
+ var successCB = function(ndefMessage)
+ {
+ console.log("Message read was successful.");
+ for (var i = 0; i < ndefMessage.recordCount; ++i)
+ {
+ console.log("Message record " + i + "tnf: " + ndefMessage.records[i].tnf);
+ console.log("Message record " + i + "tnf: " + ndefMessage.records[i].tnf);
+ console.log("Message record type " + ndefMessage.records[i].type.toString());
+ }
+ };
+
+ var errorCB = function()
+ {
+ console.log("Message read failed.");
+ };
+
+ nfcTag.readNDEF(successCB, errorCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ndefMessage</span>:
+<span class="name">ndefMessage</span>:
The NDEF message to write to an NFC tag.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked in case writing the NDEF Data is completed successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked in case any error occurs while writing the NDEF Data.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var successCB = function()
- {
- console.log("Message write was successful.");
- };
+ var successCB = function()
+ {
+ console.log("Message write was successful.");
+ };
- var errorCB = function()
- {
- console.log("Message write failed.");
- };
+ var errorCB = function()
+ {
+ console.log("Message write failed.");
+ };
- var record = new tizen.NDEFRecordText("Hi!", "en-GB");
- var message = new tizen.NDEFMessage([record]);
+ var record = new tizen.NDEFRecordText("Hi!", "en-GB");
+ var message = new tizen.NDEFMessage([record]);
- nfcTag.writeNDEF(message, successCB, errorCB);
+ nfcTag.writeNDEF(message, successCB, errorCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The raw data to transceive with the NFC tag.
</li>
<li class="param">
-<span class="name">dataCallback</span>:
+<span class="name">dataCallback</span>:
Invoked in case transceiving the raw data is completed successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked in case any error occurs while transceiving the NDEF Data.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var successCB = function(data)
- {
- console.log("Message write was successful.");
- console.log("Response is " + data.toString());
- };
+ var successCB = function(data)
+ {
+ console.log("Message write was successful.");
+ console.log("Response is " + data.toString());
+ };
- var errorCB = function()
- {
- console.log("Message write failed.");
- };
+ var errorCB = function()
+ {
+ console.log("Message write failed.");
+ };
- var message = [0x30, 0x00, 0x02, 0xa8]; /* READ command for MIFARE tags */
+ var message = [0x30, 0x00, 0x02, 0xa8]; /* READ command for MIFARE tags */
- nfcTag.transceive(message, successCB, errorCB);
+ nfcTag.transceive(message, successCB, errorCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Invoked in case receiving the message is completed successfully.
</li>
</ul>
/* Receives NFCPeer */
var onSuccessCB =
{
- onattach: function(nfcPeer)
- {
- console.log("NFC Target is detected");
- nfcPeer.setReceiveNDEFListener(function(message)
- {
- console.log("Receive message");
- });
- },
- ondetach: function()
- {
- console.log("NFC Target is detached");
- }
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ nfcPeer.setReceiveNDEFListener(function(message)
+ {
+ console.log("Receive message");
+ });
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
};
adapter.setPeerListener(onSuccessCB);
var adapter = tizen.nfc.getDefaultAdapter();
var onSuccessCB =
{
- onattach: function(nfcPeer)
- {
- console.log("NFC Target is detected");
- nfcPeer.setReceiveNDEFListener(function(message)
- {
- console.log("Receive message");
- nfcPeer.unsetReceiveNDEFListener();
- });
- },
- ondetach: function()
- {
- console.log("NFC Target is detached");
- }
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ nfcPeer.setReceiveNDEFListener(function(message)
+ {
+ console.log("Receive message");
+ nfcPeer.unsetReceiveNDEFListener();
+ });
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
};
adapter.setPeerListener(onSuccessCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ndefMessage</span>:
+<span class="name">ndefMessage</span>:
The NDEF message to send to the NFC peer-to-peer target.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked in case sending data to the NFC peer-to-peer target is completed successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked in case any error occurs while sending.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- peerListener =
- {
- onattach: function(peer)
- {
- var record = new tizen.NDEFRecordText("sendNDEF-test", 'en-US');
- var message = new tizen.NDEFMessage([record]);
- returned = peer.sendNDEF(ndefMessage);
- },
- ondetach: t.step_func(function()
- {
- adapter.unsetPeerListener();
- }
- };
-
- adapter.setPeerListener(peerListener);
+ peerListener =
+ {
+ onattach: function(peer)
+ {
+ var record = new tizen.NDEFRecordText("sendNDEF-test", 'en-US');
+ var message = new tizen.NDEFMessage([record]);
+ returned = peer.sendNDEF(ndefMessage);
+ },
+ ondetach: t.step_func(function()
+ {
+ adapter.unsetPeerListener();
+ }
+ };
+
+ adapter.setPeerListener(peerListener);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var record = new tizen.NDEFRecordText("Hi!", "en-GB");
- var tempMessage = new tizen.NDEFMessage([record]);
- var rawData = tempMessage.toByte();
+ var record = new tizen.NDEFRecordText("Hi!", "en-GB");
+ var tempMessage = new tizen.NDEFMessage([record]);
+ var rawData = tempMessage.toByte();
- var message = new tizen.NDEFMessage(rawData);
+ var message = new tizen.NDEFMessage(rawData);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Prepare two NDEFRecords */
- var myRecordURI = new tizen.NDEFRecordURI("https://www.tizen.org/");
- var myRecordTextPlain = new tizen.NDEFRecordMedia("text/plain", [116, 105, 122, 101, 110]);
+ /* Prepare two NDEFRecords */
+ var myRecordURI = new tizen.NDEFRecordURI("https://www.tizen.org/");
+ var myRecordTextPlain = new tizen.NDEFRecordMedia("text/plain", [116, 105, 122, 101, 110]);
- /* Create a NDEFMessage composed of two NDEFRecords */
- var myMessage = new NDEFMessage([myRecordURI, myRecordTextPlain]);
+ /* Create a NDEFMessage composed of two NDEFRecords */
+ var myMessage = new NDEFMessage([myRecordURI, myRecordTextPlain]);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var recordBytes = [217, 1, 2, 3, 202, 219, 218, 217, 240, 241];
- var record = new tizen.NDEFRecord(recordBytes);
+ var recordBytes = [217, 1, 2, 3, 202, 219, 218, 217, 240, 241];
+ var record = new tizen.NDEFRecord(recordBytes);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var type = new Array(255),
- var payload = new Array(256),
- var recordId = [155, 150],
- var newRecord = new tizen.NDEFRecord(tizen.nfc.NFC_RECORD_TNF_UNKNOWN, type, payload, recordId);
+ var type = new Array(255),
+ var payload = new Array(256),
+ var recordId = [155, 150],
+ var newRecord = new tizen.NDEFRecord(tizen.nfc.NFC_RECORD_TNF_UNKNOWN, type, payload, recordId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
Since: </span>
1.0
</p>
-
+
<div class="constructors">
<h4 id="NDEFRecordText::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">NDEFRecordText(DOMString text, DOMString languageCode, optional DOMString? encoding);</pre></dl>
Since: </span>
1.0
</p>
-
+
<div class="constructors">
<h4 id="NDEFRecordURI::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">NDEFRecordURI(DOMString uri);</pre></dl>
Since: </span>
1.0
</p>
-
+
<div class="constructors">
<h4 id="NDEFRecordMedia::constructor">Constructors</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">nfcTag</span>:
+<span class="name">nfcTag</span>:
The attached NFC tag.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onSuccessCB =
- {
- onattach: function(nfcTag)
- {
- console.log("Successfully detected nfcTag type:" + nfcTag.type);
- }
- }
-
- var adapter = tizen.nfc.getDefaultAdapter();
- adapter.setTagListener(onSuccessCB);
+ var onSuccessCB =
+ {
+ onattach: function(nfcTag)
+ {
+ console.log("Successfully detected nfcTag type:" + nfcTag.type);
+ }
+ }
+
+ var adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setTagListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter;
- var onSuccessCB =
- {
- onattach: function(nfcTag)
- {
- console.log("Successfully detected nfcTag type:" + nfcTag.type);
- },
- ondetach: function()
- {
- adapter.unsetTagListener();
- }
- }
-
- adapter = tizen.nfc.getDefaultAdapter();
- adapter.setTagListener(onSuccessCB);
+ var adapter;
+ var onSuccessCB =
+ {
+ onattach: function(nfcTag)
+ {
+ console.log("Successfully detected nfcTag type:" + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ adapter.unsetTagListener();
+ }
+ }
+
+ adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setTagListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">nfcPeer</span>:
+<span class="name">nfcPeer</span>:
The attached NFC peer-to-peer target.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter;
- var onSuccessCB =
- {
- onattach: function(nfcPeer)
- {
- console.log("Successfully detected nfcPeer:" + nfcPeer.isConnected);
- }
- }
-
- adapter = tizen.nfc.getDefaultAdapter();
- adapter.setPeerListener(onSuccessCB);
+ var adapter;
+ var onSuccessCB =
+ {
+ onattach: function(nfcPeer)
+ {
+ console.log("Successfully detected nfcPeer:" + nfcPeer.isConnected);
+ }
+ }
+
+ adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setPeerListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter;
- var onSuccessCB =
- {
- onattach: function(nfcPeer)
- {
- console.log("Successfully detected nfcPeer:" + nfcPeer.isConnected);
- },
- ondetach: function()
- {
- adapter.unsetPeerListener();
- }
- }
-
- adapter = tizen.nfc.getDefaultAdapter();
- adapter.setPeerListener(onSuccessCB);
+ var adapter;
+ var onSuccessCB =
+ {
+ onattach: function(nfcPeer)
+ {
+ console.log("Successfully detected nfcPeer:" + nfcPeer.isConnected);
+ },
+ ondetach: function()
+ {
+ adapter.unsetPeerListener();
+ }
+ }
+
+ adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setPeerListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ndefMessage</span>:
+<span class="name">ndefMessage</span>:
NDEF message that is read from the NFC tag or target.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter;
-
- var readCallback = function(ndefMessage)
- {
- console.log("NDEFMessageReadCallback called successfully");
- }
-
- var tagListener =
- {
- onattach: function(nfcTag)
- {
- var result = nfcTag.readNDEF(readCallback);
- }
- }
-
- adapter = tizen.nfc.getDefaultAdapter();
- adapter.setTagListener(tagListener);
+ var adapter;
+
+ var readCallback = function(ndefMessage)
+ {
+ console.log("NDEFMessageReadCallback called successfully");
+ }
+
+ var tagListener =
+ {
+ onattach: function(nfcTag)
+ {
+ var result = nfcTag.readNDEF(readCallback);
+ }
+ }
+
+ adapter = tizen.nfc.getDefaultAdapter();
+ adapter.setTagListener(tagListener);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The raw data that is read from the NFC tag or response of a transceive operation.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var successCB = function(data)
- {
- console.log("ByteArraySuccessCallback called successfully.");
- };
+ var successCB = function(data)
+ {
+ console.log("ByteArraySuccessCallback called successfully.");
+ };
- var message = [0x30, 0x00, 0x02, 0xa8]; /* READ command for MIFARE tags */
+ var message = [0x30, 0x00, 0x02, 0xa8]; /* READ command for MIFARE tags */
- nfcTag.transceive(message, successCB);
+ nfcTag.transceive(message, successCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Changed card emulation mode
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onSuccessCB = function(mode)
- {
- console.log("CardEmulationModeChangeCallback called successfully");
- };
+ var onSuccessCB = function(mode)
+ {
+ console.log("CardEmulationModeChangeCallback called successfully");
+ };
- var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
+ var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appletId</span>:
+<span class="name">appletId</span>:
ID of the applet in which the transaction has happened
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Transaction data
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onSuccessCB = function(aid, data)
- {
- console.log("TransactionEventCallback called successfully");
- };
+ var onSuccessCB = function(aid, data)
+ {
+ console.log("TransactionEventCallback called successfully");
+ };
- var listenerId = adapter.addTransactionEventListener("UICC", onSuccessCB);
+ var listenerId = adapter.addTransactionEventListener("UICC", onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Type of a newly changed active secure element
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onSuccessCB = function(seType)
- {
- console.log("ActiveSecureElementChangeCallback called successfully");
- };
+ var onSuccessCB = function(seType)
+ {
+ console.log("ActiveSecureElementChangeCallback called successfully");
+ };
- var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
+ var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
HCE event data
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onDetectedCB = function(event_data)
- {
- console.log("HCEEventReceiveCallback called successfully");
- };
+ var onDetectedCB = function(event_data)
+ {
+ console.log("HCEEventReceiveCallback called successfully");
+ };
- var listenerId = adapter.addHCEEventListener(onDetectedCB);
+ var listenerId = adapter.addHCEEventListener(onDetectedCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">aids</span>:
+<span class="name">aids</span>:
The list of AIDs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var successCB = function(aids)
- {
- console.log("AIDArraySuccessCallback called successfully");
- };
+ var successCB = function(aids)
+ {
+ console.log("AIDArraySuccessCallback called successfully");
+ };
- adapter.getAIDsForCategory("HCE", "PAYMENT", successCB);
+ adapter.getAIDsForCategory("HCE", "PAYMENT", successCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">notification</span>:
+<span class="name">notification</span>:
A notification to post.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
- null, "image/jpg", null);
- var notificationDict =
- {
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3",
- vibration: true,
- appControl: appControl
- };
-
- var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
+ null, "image/jpg", null);
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appControl: appControl
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">notification</span>:
+<span class="name">notification</span>:
A notification to update.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Uses a variable for the previously posted notification */
- notification.content = "My notification";
- tizen.notification.update(notification);
+ /* Uses a variable for the previously posted notification */
+ notification.content = "My notification";
+ tizen.notification.update(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
A previously posted notification ID to remove.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Uses a variable for the previously posted notification */
- tizen.notification.remove(notification.id);
+ /* Uses a variable for the previously posted notification */
+ tizen.notification.remove(notification.id);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.notification.removeAll();
+ tizen.notification.removeAll();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
A previously posted notification ID.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Uses a variable for the previously posted notification */
- /* Saves the notification ID for future use */
- var myId = notification.id;
+ /* Uses a variable for the previously posted notification */
+ /* Saves the notification ID for future use */
+ var myId = notification.id;
- var myNotification = tizen.notification.get(myId);
+ var myNotification = tizen.notification.get(myId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var notifications = tizen.notification.getAll();
- var index = 0;
-
- for (index = 0; index < notifications.length; index++)
- {
- console.log(notifications[index].id);
- console.log(notifications[index].title);
- console.log(notifications[index].statusType);
- console.log(notifications[index].type);
- console.log(notifications[index].content);
- console.log(notifications[index].postedTime);
- console.log(notifications[index].iconPath);
- console.log(notifications[index].soundPath);
- console.log(notifications[index].vibration);
- console.log(notifications[index].appControl);
- }
+ var notifications = tizen.notification.getAll();
+ var index = 0;
+
+ for (index = 0; index < notifications.length; index++)
+ {
+ console.log(notifications[index].id);
+ console.log(notifications[index].title);
+ console.log(notifications[index].statusType);
+ console.log(notifications[index].type);
+ console.log(notifications[index].content);
+ console.log(notifications[index].postedTime);
+ console.log(notifications[index].iconPath);
+ console.log(notifications[index].soundPath);
+ console.log(notifications[index].vibration);
+ console.log(notifications[index].appControl);
+ }
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.notification.playLEDCustomEffect(1000, 1000, "#FFFF0080", ["LED_CUSTOM_DUTY_ON", "LED_CUSTOM_DEFAULT"]);
+ tizen.notification.playLEDCustomEffect(1000, 1000, "#FFFF0080", ["LED_CUSTOM_DUTY_ON", "LED_CUSTOM_DEFAULT"]);
}
catch (e)
{
- console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
+ console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.notification.playLEDCustomEffect(1000, 1000, "#FFFF0080", ["LED_CUSTOM_DUTY_ON", "LED_CUSTOM_DEFAULT"]);
- setTimeout(function()
- {
- tizen.notification.stopLEDCustomEffect();
- }, 5000);
+ tizen.notification.playLEDCustomEffect(1000, 1000, "#FFFF0080", ["LED_CUSTOM_DUTY_ON", "LED_CUSTOM_DEFAULT"]);
+ setTimeout(function()
+ {
+ tizen.notification.stopLEDCustomEffect();
+ }, 5000);
}
catch (e)
{
- console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
+ console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
The name of template to be saved.
</li>
<li class="param">
-<span class="name">notification</span>:
+<span class="name">notification</span>:
A notification to be saved as a template.
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try {
- var notificationDict = {
- content : "This is a simple notification.",
- iconPath : "images/image1.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true
- };
+ var notificationDict = {
+ content : "This is a simple notification.",
+ iconPath : "images/image1.jpg",
+ soundPath : "music/Over the horizon.mp3",
+ vibration : true
+ };
- var notification = new tizen.StatusNotification("SIMPLE",
- "Simple notification", notificationDict);
+ var notification = new tizen.StatusNotification("SIMPLE",
+ "Simple notification", notificationDict);
- tizen.notification.saveNotificationAsTemplate("SIMPLE_TEMPLATE", notification);
+ tizen.notification.saveNotificationAsTemplate("SIMPLE_TEMPLATE", notification);
} catch (err) {
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
The name of template to be used as source of notification.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
/* the template with name "SIMPLE_TEMPLATE" should be previously created */
try {
- var notification = tizen.notification.createNotificationFromTemplate("SIMPLE_TEMPLATE");
+ var notification = tizen.notification.createNotificationFromTemplate("SIMPLE_TEMPLATE");
} catch (err) {
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
All notifications must have a title attribute.
</p>
</div>
-
+
<div class="constructors">
<h4 id="StatusNotification::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">StatusNotification(<a href="#StatusNotificationType">StatusNotificationType</a> statusType, DOMString title, optional <a href="#StatusNotificationInit">StatusNotificationInit</a>? notificationInitDict);</pre></dl>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var notificationDict =
- {
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3",
- vibration: true,
- ledColor: "#FFFF00",
- ledOnPeriod: 1000,
- ledOffPeriod: 500
- };
-
- var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ ledColor: "#FFFF00",
+ ledOnPeriod: 1000,
+ ledOffPeriod: 500
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Gets the current application information with tizen.application.getAppInfo */
- var myappInfo = tizen.application.getAppInfo();
+ /* Gets the current application information with tizen.application.getAppInfo */
+ var myappInfo = tizen.application.getAppInfo();
- var notificationDict =
- {
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3",
- vibration: true,
- appId: myappInfo.id
- };
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appId: myappInfo.id
+ };
- var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
- tizen.notification.post(notification);
+ tizen.notification.post(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
- null, "image/jpg", null);
-
- var notificationDict =
- {
- content: "This is a progress notification.",
- iconPath: "images/image2.jpg",
- soundPath: "music/Over the horizon.mp3",
- vibration: true,
- appControl: appControl,
- progressValue: 20
- };
- /* Constructs the progress notification */
- var notification = new tizen.StatusNotification("PROGRESS", "Progress notification", notificationDict);
- /* Posts the notification */
- tizen.notification.post(notification);
-
- /* Updates the progress value of the notification */
- notification.progressValue = 59;
- tizen.notification.update(notification);
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
+ null, "image/jpg", null);
+
+ var notificationDict =
+ {
+ content: "This is a progress notification.",
+ iconPath: "images/image2.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appControl: appControl,
+ progressValue: 20
+ };
+ /* Constructs the progress notification */
+ var notification = new tizen.StatusNotification("PROGRESS", "Progress notification", notificationDict);
+ /* Posts the notification */
+ tizen.notification.post(notification);
+
+ /* Updates the progress value of the notification */
+ notification.progressValue = 59;
+ tizen.notification.update(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void uninstall(<a href="#PackageId">PackageId</a> id,
+ void uninstall(<a href="#PackageId">PackageId</a> id,
<a href="#PackageProgressCallback">PackageProgressCallback</a> progressCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void setPackageInfoEventListener(<a href="#PackageInformationEventCallback">PackageInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
void unsetPackageInfoEventListener() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
};</pre>
<p><span class="version">
Since: </span>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">packageFileURI</span>:
+<span class="name">packageFileURI</span>:
The location of the package to install
</li>
<li class="param">
-<span class="name">progressCallback</span>:
+<span class="name">progressCallback</span>:
The method to invoke when the installation is in progress or has been completed
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var onInstallation =
{
- onprogress: function(packageId, percentage)
- {
- console.log("On installation(" + packageId + "): progress(" + percentage + ")");
- },
- oncomplete: function(packageId)
- {
- console.log("Installation(" + packageId + ") Complete");
- }
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On installation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Installation(" + packageId + ") Complete");
+ }
}
var onError = function(err)
{
- console.log("Error occurred on installation: " + err.name);
+ console.log("Error occurred on installation: " + err.name);
}
/* Let's assume that the "test.wgt" file exists in the downloads directory */
tizen.filesystem.resolve("downloads/test.wgt", function(file)
{
- console.log("file URI: " + file.toURI());
- tizen.package.install(file.toURI(), onInstallation, onError);
+ console.log("file URI: " + file.toURI());
+ tizen.package.install(file.toURI(), onInstallation, onError);
}, function(err)
{
- console.log("Error occurred on resolve: " + err.name);
+ console.log("Error occurred on resolve: " + err.name);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID to uninstall
</li>
<li class="param">
-<span class="name">progressCallback</span>:
+<span class="name">progressCallback</span>:
The method to invoke when uninstallation is in progress or has been completed
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var onUninstallation =
{
- onprogress: function(packageId, percentage)
- {
- console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
- },
- oncomplete: function(packageId)
- {
- console.log("Uninstallation(" + packageId + ") Complete");
- }
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Uninstallation(" + packageId + ") Complete");
+ }
};
var onError = function(err)
{
- console.log("Error occurred on installation: " + err.name);
+ console.log("Error occurred on installation: " + err.name);
};
/* Let's assume that the package ID to uninstall is "testapp001" */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when an invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledPackages(packages)
{
- for (var i = 0; i < packages.length; i++)
- {
- console.log("Package id[" + i + "]: " + packages[i].id);
- }
+ for (var i = 0; i < packages.length; i++)
+ {
+ console.log("Package id[" + i + "]: " + packages[i].id);
+ }
}
tizen.package.getPackagesInfo(onListInstalledPackages, function(err)
{
- console.log("Can't obtain packages list" + err.name);
+ console.log("Can't obtain packages list" + err.name);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing the package ID. If the ID is not provided, the package information of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">eventCallback</span>:
+<span class="name">eventCallback</span>:
The method to be called when any change is made to the list of installed packages.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var packageEventCallback =
{
- oninstalled: function(packageInfo)
- {
- console.log('The package ' + packageInfo.name + ' is installed');
- },
- onupdated: function(packageInfo)
- {
- console.log('The package ' + packageInfo.name + ' is updated');
- },
- onuninstalled: function(packageId)
- {
- console.log('The package ' + packageId + ' is uninstalled');
- }
+ oninstalled: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is installed');
+ },
+ onupdated: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is updated');
+ },
+ onuninstalled: function(packageId)
+ {
+ console.log('The package ' + packageId + ' is uninstalled');
+ }
};
tizen.package.setPackageInfoEventListener(packageEventCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed packages' information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID
</li>
<li class="param">
-<span class="name">progress</span>:
+<span class="name">progress</span>:
The progress in percentage.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The information of the installed package
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The information of the updated package
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the uninstalled package
</li>
</ul>
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void uninstall(<a href="#PackageId">PackageId</a> id,
+ void uninstall(<a href="#PackageId">PackageId</a> id,
<a href="#PackageProgressCallback">PackageProgressCallback</a> progressCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void setPackageInfoEventListener(<a href="#PackageInformationEventCallback">PackageInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
void unsetPackageInfoEventListener() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
};
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Latency mode to set.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">resource</span>:
+<span class="name">resource</span>:
Power resource for which the request is made
</li>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Minimal power state in which the power resource is desired to be
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">resource</span>:
+<span class="name">resource</span>:
Resource for which requests are to be removed
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Screen state change callback
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onScreenStateChanged(previousState, changedState)
{
- console.log("Screen state changed from " + previousState + " to " + changedState);
+ console.log("Screen state changed from " + previousState + " to " + changedState);
}
/* Sets the screen state change listener */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">brightness</span>:
+<span class="name">brightness</span>:
The screen brightness value to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">previousState</span>:
+<span class="name">previousState</span>:
Previous screen state
</li>
<li class="param">
-<span class="name">changedState</span>:
+<span class="name">changedState</span>:
Changed screen state
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var successCB = function(preferences)
{
- if (preferences.length)
- {
- console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
- }
+ if (preferences.length)
+ {
+ console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
+ }
};
tizen.preference.getAll(successCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
if (tizen.preference.exists('key1'))
{
- console.log('Preference with the key key1 exists');
+ console.log('Preference with the key key1 exists');
}
else
{
- console.log('Preference with the key key1 doesn't exist');
+ console.log('Preference with the key key1 doesn't exist');
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener = function(data)
{
- console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
+ console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
};
tizen.preference.setChangeListener('key1', listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener = function(data)
{
- tizen.preference.unsetChangeListener(data.key);
+ tizen.preference.unsetChangeListener(data.key);
};
tizen.preference.setChangeListener('key1', listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener = function(data)
{
- tizen.preference.unsetChangeListener(data.key);
+ tizen.preference.unsetChangeListener(data.key);
};
tizen.preference.setChangeListener('key1', listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var successCB = function(preferences)
{
- if (preferences.length)
- {
- console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
- }
+ if (preferences.length)
+ {
+ console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
+ }
};
tizen.preference.getAll(successCB);
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the registration success callback */
function registerSuccessCallback(id)
{
- console.log("Registration succeeded with id: " + id);
+ console.log("Registration succeeded with id: " + id);
}
/* Requests registration */
/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the registration success callback */
function registerSuccessCallback(id)
{
- console.log("Registration succeeded with id: " + id);
+ console.log("Registration succeeded with id: " + id);
}
/* Defines the state change callback */
function stateChangeCallback(state)
{
- console.log("The state is changed to: " + state);
+ console.log("The state is changed to: " + state);
- if (state == "UNREGISTERED")
- {
- /* Requests application registration */
- tizen.push.register(registerSuccessCallback, errorCallback);
- }
+ if (state == "UNREGISTERED")
+ {
+ /* Requests application registration */
+ tizen.push.register(registerSuccessCallback, errorCallback);
+ }
}
/* Defines the notification callback */
function notificationCallback(notification)
{
- console.log("A notification arrives.");
+ console.log("A notification arrives.");
}
/* Connects to push service */
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the unregistration success callback */
function unregisterSuccessCallback()
{
- console.log("Unregistration succeeded.");
+ console.log("Unregistration succeeded.");
}
/* Requests unregistration */
/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the unregistration success callback */
function unregisterSuccessCallback()
{
- console.log("Unregistration succeeded.");
+ console.log("Unregistration succeeded.");
}
/* Requests unregistration */
/* Defines the connect success callback */
function notificationCallback(noti)
{
- console.log("Notification received with alert message: " + noti.alertMessage);
+ console.log("Notification received with alert message: " + noti.alertMessage);
}
/* Defines the data to be used when this process is launched by notification service */
/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the registration success callback */
function registerSuccessCallback(id)
{
- console.log("Registration succeeded with id: " + id);
+ console.log("Registration succeeded with id: " + id);
- /* Requests for push service connection */
- tizen.push.connectService(notificationCallback);
+ /* Requests for push service connection */
+ tizen.push.connectService(notificationCallback);
}
/* Requests registration */
/* Defines the state change callback */
function stateChangeCallback(state)
{
- console.log("The state is changed to: " + state);
+ console.log("The state is changed to: " + state);
}
/* Defines the notification callback */
function notificationCallback(notification)
{
- console.log("A notification arrives.");
+ console.log("A notification arrives.");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("The following error occurred: " + error.name);
+ console.log("The following error occurred: " + error.name);
}
/* Requests for push service connection */
var registrationId = tizen.push.getRegistrationId();
if (registrationId != null)
{
- console.log("The registration id: " + registrationId);
+ console.log("The registration id: " + registrationId);
}
</pre>
</div>
/* Defines the state change callback */
function stateChangeCallback(state)
{
- console.log("The state is changed to: " + state);
+ console.log("The state is changed to: " + state);
- var id = tizen.push.getRegisterationId();
- console.log("The registration ID: " + id);
+ var id = tizen.push.getRegisterationId();
+ console.log("The registration ID: " + id);
}
/* Defines the notification callback */
function notificationCallback(notification)
{
- console.log("A notification arrives.");
+ console.log("A notification arrives.");
}
/* Requests for push service connection */
/* Defines the connect success callback */
function notificationCallback(message)
{
- console.log("New push message: " + message.alertMessage + ", date: " + message.date + ", data: " + message.appData);
+ console.log("New push message: " + message.alertMessage + ", date: " + message.date + ", data: " + message.appData);
}
/* Requests for push service connection */
/* Defines the state change callback */
function stateChangeCallback(state)
{
- console.log("The state is changed to: " + state);
+ console.log("The state is changed to: " + state);
- if (state === "REGISTERED")
- {
- /* Gets unread push notifications */
- tizen.push.getUnreadNotifications();
- }
+ if (state === "REGISTERED")
+ {
+ /* Gets unread push notifications */
+ tizen.push.getUnreadNotifications();
+ }
}
/* Defines the notification callback */
function notificationCallback(notification)
{
- console.log("A notification arrives.");
+ console.log("A notification arrives.");
}
/* Requests for push service connection */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var message = tizen.push.getPushMessage();
- console.log('Message received from: ' + message.sender);
+ var message = tizen.push.getPushMessage();
+ console.log('Message received from: ' + message.sender);
}
catch (err)
{
- console.log('Exception - code: ' + err.name + ' message: ' + err.message);
+ console.log('Exception - code: ' + err.name + ' message: ' + err.message);
}
</pre>
</div>
/* Defines the connect success callback */
function notificationCallback(noti)
{
- console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
- console.log('Details:');
- console.log(' - data: ' + noti.appData);
- console.log(' - alert message: ' + noti.alertMessage);
- console.log(' - message: ' + noti.message);
- console.log(' - session: ' + noti.sessionInfo);
- console.log(' - request ID: ' + noti.requestId);
+ console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
+ console.log('Details:');
+ console.log(' - data: ' + noti.appData);
+ console.log(' - alert message: ' + noti.alertMessage);
+ console.log(' - message: ' + noti.message);
+ console.log(' - session: ' + noti.sessionInfo);
+ console.log(' - request ID: ' + noti.requestId);
}
/* Requests for push service connection */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- function success(readers)
- {
- for (var i = 0; i < readers.length; i++)
- {
- if (readers[i].isPresent)
- {
- console.log("Reader Name: " + readers[i].getName());
- }
- }
- }
- function error(err)
- {
- console.log(err.name + ": " + err.message);
- }
- tizen.seService.getReaders(success, error);
+ function success(readers)
+ {
+ for (var i = 0; i < readers.length; i++)
+ {
+ if (readers[i].isPresent)
+ {
+ console.log("Reader Name: " + readers[i].getName());
+ }
+ }
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ tizen.seService.getReaders(success, error);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- onSEReady: function(reader)
- {
- console.log(reader.getName() + " is ready.");
- },
- onSENotReady: function(reader)
- {
- console.log(reader.getName() + " is not ready.");
- },
- onSEError: function(reader, error)
- {
- console.log(reader.getName() + ": error occurred: " + error.message);
- }
+ onSEReady: function(reader)
+ {
+ console.log(reader.getName() + " is ready.");
+ },
+ onSENotReady: function(reader)
+ {
+ console.log(reader.getName() + " is not ready.");
+ },
+ onSEError: function(reader, error)
+ {
+ console.log(reader.getName() + ": error occurred: " + error.message);
+ }
};
try
{
- var seListener = tizen.seService.registerSEListener(listener);
+ var seListener = tizen.seService.registerSEListener(listener);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var seListener; /* seListener obtained from registerSEListener */
try
{
- tizen.seService.unregisterSEListener(seListener);
+ tizen.seService.unregisterSEListener(seListener);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.seService.shutdown();
+ tizen.seService.shutdown();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- function success(readers)
- {
- for (var i = 0; i < readers.length; i++)
- {
- if (readers[i].isPresent)
- {
- console.log("Reader Name: " + readers[i].getName());
- }
- }
- }
- function error(err)
- {
- console.log(err.name + ": " + err.message);
- }
- tizen.seService.getReaders(success, error);
+ function success(readers)
+ {
+ for (var i = 0; i < readers.length; i++)
+ {
+ if (readers[i].isPresent)
+ {
+ console.log("Reader Name: " + readers[i].getName());
+ }
+ }
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ tizen.seService.getReaders(success, error);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- function success(session)
- {
- console.log("Open Session Success: " + !session.isClosed);
- }
- function error(err)
- {
- console.log(err.name + ": " + err.message);
- }
- reader.openSession(success, error);
+ function success(session)
+ {
+ console.log("Open Session Success: " + !session.isClosed);
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ reader.openSession(success, error);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- reader.closeSessions();
+ reader.closeSessions();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- function successChannel(channel)
- {
- if (channel.isBasicChannel)
- {
- console.log("Basic channel is opened.");
- }
- else
- {
- console.log("Logical channel is opened.");
- }
- }
- function errorChannel(err)
- {
- console.log("openBasicChannel Error:" + err.name +": " + err.message);
- }
+ function successChannel(channel)
+ {
+ if (channel.isBasicChannel)
+ {
+ console.log("Basic channel is opened.");
+ }
+ else
+ {
+ console.log("Logical channel is opened.");
+ }
+ }
+ function errorChannel(err)
+ {
+ console.log("openBasicChannel Error:" + err.name +": " + err.message);
+ }
- function successSession(session)
- {
- console.log("Open Session Success: " + !session.isClosed);
- /* This aid is for test. Use aid for your applet in secure element */
- session.openBasicChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
- }
- function errorSession(err)
- {
- console.log("openSession Error: " + err.name + ": " + err.message);
- }
- reader.openSession(successSession, errorSession);
+ function successSession(session)
+ {
+ console.log("Open Session Success: " + !session.isClosed);
+ /* This aid is for test. Use aid for your applet in secure element */
+ session.openBasicChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
+ }
+ function errorSession(err)
+ {
+ console.log("openSession Error: " + err.name + ": " + err.message);
+ }
+ reader.openSession(successSession, errorSession);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var session; /* Session obtained from openSession callback */
try
{
- function successChannel(channel)
- {
- if (channel.isBasicChannel)
- {
- console.log("Basic channel is opened.");
- }
- else
- {
- console.log("Logical channel is opened.");
- }
- }
- function errorChannel(err)
- {
- console.log("openLogicalChannel Error:" + err.name + ": " + err.message);
- }
+ function successChannel(channel)
+ {
+ if (channel.isBasicChannel)
+ {
+ console.log("Basic channel is opened.");
+ }
+ else
+ {
+ console.log("Logical channel is opened.");
+ }
+ }
+ function errorChannel(err)
+ {
+ console.log("openLogicalChannel Error:" + err.name + ": " + err.message);
+ }
- /* This aid is for test. Use aid for your applet in secure element */
- session.openLogicalChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
+ /* This aid is for test. Use aid for your applet in secure element */
+ session.openLogicalChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var session; /* Session obtained from openSession callback */
try
{
- var atr = session.getATR();
+ var atr = session.getATR();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var session; /* Session obtained from openSession callback */
try
{
- session.close();
+ session.close();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var session; /* Session obtained from openSession callback */
try
{
- session.closeChannels();
+ session.closeChannels();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var channel; /* Obtained from openLogicalChannel or openBasicChannel */
try
{
- channel.close();
+ channel.close();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
if (proximityCapability === true)
{
- /* Device supports proximity sensor and you can get proximity sensor's data */
- var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+ /* Device supports proximity sensor and you can get proximity sensor's data */
+ var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
}
else
{
- /* If tizen.sensorservice.getDefaultSensor("PROXIMITY") is used, NotSupportedError is thrown */
- console.log("Proximity sensor is not supported on this device.");
+ /* If tizen.sensorservice.getDefaultSensor("PROXIMITY") is used, NotSupportedError is thrown */
+ console.log("Proximity sensor is not supported on this device.");
}
</pre>
</div>
function onsuccessCB()
{
- console.log("The proximity sensor started successfully.");
+ console.log("The proximity sensor started successfully.");
}
proximitySensor.start(onsuccessCB);
function onsuccessCB()
{
- console.log("proximity sensor start");
- proximitySensor.stop();
+ console.log("proximity sensor start");
+ proximitySensor.stop();
}
proximitySensor.start(onsuccessCB);
function onchangedCB(sensorData)
{
- console.log("proximity distance: " + sensorData.proximityState);
+ console.log("proximity distance: " + sensorData.proximityState);
}
proximitySensor.setChangeListener(onchangedCB);
function onsuccessCB(hardwareInfo)
{
- console.log("name: " + hardwareInfo.name);
- console.log("type: " + hardwareInfo.type);
- console.log("vendor: " + hardwareInfo.vendor);
- console.log("minValue: " + hardwareInfo.minValue);
- console.log("maxValue: " + hardwareInfo.maxValue);
- console.log("resolution: " + hardwareInfo.resolution);
- console.log("minInterval: " + hardwareInfo.minInterval);
- console.log("maxBatchCount: " + hardwareInfo.maxBatchCount);
+ console.log("name: " + hardwareInfo.name);
+ console.log("type: " + hardwareInfo.type);
+ console.log("vendor: " + hardwareInfo.vendor);
+ console.log("minValue: " + hardwareInfo.minValue);
+ console.log("maxValue: " + hardwareInfo.maxValue);
+ console.log("resolution: " + hardwareInfo.resolution);
+ console.log("minInterval: " + hardwareInfo.minInterval);
+ console.log("maxBatchCount: " + hardwareInfo.maxBatchCount);
}
</pre>
</div>
function onGetSuccessCB(sensorData)
{
- console.log("light level: " + sensorData.lightLevel);
+ console.log("light level: " + sensorData.lightLevel);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- lightSensor.getLightSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ lightSensor.getLightSensorData(onGetSuccessCB, onerrorCB);
}
lightSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("magnetic field of the X axis: " + sensorData.x);
- console.log("magnetic field of the Y axis: " + sensorData.y);
- console.log("magnetic field of the Z axis: " + sensorData.z);
+ console.log("magnetic field of the X axis: " + sensorData.x);
+ console.log("magnetic field of the Y axis: " + sensorData.y);
+ console.log("magnetic field of the Z axis: " + sensorData.z);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- magneticSensor.getMagneticSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ magneticSensor.getMagneticSensorData(onGetSuccessCB, onerrorCB);
}
magneticSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("pressure: " + sensorData.pressure);
+ console.log("pressure: " + sensorData.pressure);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
}
pressureSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("proximity state: " + sensorData.proximityState);
+ console.log("proximity state: " + sensorData.proximityState);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("proximity sensor start");
- proximitySensor.getProximitySensorData(onGetSuccessCB, onerrorCB);
+ console.log("proximity sensor start");
+ proximitySensor.getProximitySensorData(onGetSuccessCB, onerrorCB);
}
proximitySensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("ultraviolet level: " + sensorData.ultravioletLevel);
+ console.log("ultraviolet level: " + sensorData.ultravioletLevel);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("ultraviolet sensor start");
- ultravioletSensor.getUltravioletSensorData(onGetSuccessCB, onerrorCB);
+ console.log("ultraviolet sensor start");
+ ultravioletSensor.getUltravioletSensorData(onGetSuccessCB, onerrorCB);
}
ultravioletSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("HRMRaw light intensity: " + sensorData.lightIntensity);
+ console.log("HRMRaw light intensity: " + sensorData.lightIntensity);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("HRMRaw sensor start");
- HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
+ console.log("HRMRaw sensor start");
+ HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
}
HRMrawsensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("######## Get the gravity sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
+ console.log("######## Get the gravity sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- gravitySensor.getGravitySensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ gravitySensor.getGravitySensorData(onGetSuccessCB, onerrorCB);
}
gravitySensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("######## Get the gyroscope sensor date ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
+ console.log("######## Get the gyroscope sensor date ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- gyroscopeSensor.getGyroscopeSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ gyroscopeSensor.getGyroscopeSensorData(onGetSuccessCB, onerrorCB);
}
gyroscopeSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("######## Get the gyroscope rotation vector sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- console.log("w: " + sensorData.w);
+ console.log("######## Get the gyroscope rotation vector sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+ console.log("w: " + sensorData.w);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- gyroscopeRotationVectorSensor.getGyroscopeRotationVectorSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ gyroscopeRotationVectorSensor.getGyroscopeRotationVectorSensorData(onGetSuccessCB, onerrorCB);
}
gyroscopeRotationVectorSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("######## Get the linear acceleration sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
+ console.log("######## Get the linear acceleration sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("linear acceleration sensor start");
- linearAccelerationSensor.getLinearAccelerationSensorData(onGetSuccessCB, onerrorCB);
+ console.log("linear acceleration sensor start");
+ linearAccelerationSensor.getLinearAccelerationSensorData(onGetSuccessCB, onerrorCB);
}
linearAccelerationSensor.start(onsuccessCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The sound type
</li>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
The volume level to set <br>The level ranges from 0 to 1.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The sound type
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback method to be invoked when the sound mode is changed
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback method to be invoked when the volume level is changed
</li>
</ul>
for (var i = 0; i < infoArr.length; i++)
{
- console.log(infoArr[i].device);
+ console.log(infoArr[i].device);
}
</pre>
</div>
for (var i = 0; i < infoArr.length; i++)
{
- console.log(infoArr[i].device);
+ console.log(infoArr[i].device);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback method to be invoked when the sound device state is changed
</li>
</ul>
/* Callback */
var onChanged = function(info)
{
- /* Some code to execute when a sound device state is changed */
- if (info.isConnected)
- {
- /* Some code to execute if the device is connected */
- console.log(info.device + " is connected");
- }
- else
- {
- /* Some code to execute if the device is not connected */
- console.log(info.device + " is not connected");
- }
+ /* Some code to execute when a sound device state is changed */
+ if (info.isConnected)
+ {
+ /* Some code to execute if the device is connected */
+ console.log(info.device + " is connected");
+ }
+ else
+ {
+ /* Some code to execute if the device is not connected */
+ console.log(info.device + " is not connected");
+ }
- if (info.isActivated)
- {
- /* Some code to execute if the device is activated */
- console.log(info.device + " is activated");
- }
- else
- {
- /* Some code to execute if the device is not activated */
- console.log(info.device + " is not activated");
- }
+ if (info.isActivated)
+ {
+ /* Some code to execute if the device is activated */
+ console.log(info.device + " is activated");
+ }
+ else
+ {
+ /* Some code to execute if the device is not activated */
+ console.log(info.device + " is not activated");
+ }
}
var id = tizen.sound.addDeviceStateChangeListener(onChanged);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
An ID that identifies the listener
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Sound mode
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Sound type
</li>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
New volume level
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The info to have changed
</li>
</ul>
deviceCapabilities = tizen.systeminfo.getCapabilities();
if (deviceCapabilities.bluetooth)
{
- console.log("Bluetooth is supported");
+ console.log("Bluetooth is supported");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Checks if a device supports bluetooth API */
- var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
- console.log(" Bluetooth = " + bluetooth);
+ /* Checks if a device supports bluetooth API */
+ var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
+ console.log(" Bluetooth = " + bluetooth);
}
catch (error)
{
- console.log("Error name: " + error.name + ", message: " + error.message);
+ console.log("Error name: " + error.name + ", message: " + error.message);
}
</pre>
</div>
var count = tizen.systeminfo.getCount("SIM");
if (count === 0)
{
- console.log("There is no available SIM card.");
+ console.log("There is no available SIM card.");
}
else
{
- console.log("There is(are) " + count + " SIM card(s) available.");
+ console.log("There is(are) " + count + " SIM card(s) available.");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cpu)
{
- console.log("The cpu load is " + cpu.load);
+ console.log("The cpu load is " + cpu.load);
}
function onErrorCallback(error)
{
- console.log("An error occurred " + error.message);
+ console.log("An error occurred " + error.message);
}
tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cellular)
{
- console.log("The status of the cellular network is " + cellular.status);
+ console.log("The status of the cellular network is " + cellular.status);
}
function onErrorCallback(error)
{
- console.log("An error occurred " + error.message);
- /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
+ console.log("An error occurred " + error.message);
+ /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
}
var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
if (telephony_capability === true)
{
- /* onSuccessCallback will be invoked */
- tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
+ /* onSuccessCallback will be invoked */
+ tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
}
else
{
- console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
+ console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(property)
{
- console.log("The SIM's current state is " + property.state);
+ console.log("The SIM's current state is " + property.state);
}
function successArrayCB(properties)
{
- console.log("The number of the returned system properties is " + properties.length);
- for (var i = 0; i < properties.length; i++)
- {
- console.log("[" + i + "] SIM's state is " + properties[i].state);
- }
+ console.log("The number of the returned system properties is " + properties.length);
+ for (var i = 0; i < properties.length; i++)
+ {
+ console.log("[" + i + "] SIM's state is " + properties[i].state);
+ }
}
var count = tizen.systeminfo.getCount("SIM");
if (count === 0)
{
- console.log("This device does not provide SIM card.");
+ console.log("This device does not provide SIM card.");
}
else if (count > 1)
{
- tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
+ tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
}
else
{
- tizen.systeminfo.getPropertyValue("SIM", successCB);
+ tizen.systeminfo.getPropertyValue("SIM", successCB);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cpu)
{
- console.log("The cpu load: " + cpu.load);
+ console.log("The cpu load: " + cpu.load);
}
tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2});
var id = null;
function onSuccessCallback(cpu)
{
- console.log("New value for CPU load is " + cpu.load);
- if (id != null)
- {
- /* After receiving the first notification, clear it */
- tizen.systeminfo.removePropertyValueChangeListener(id);
- }
+ console.log("New value for CPU load is " + cpu.load);
+ if (id != null)
+ {
+ /* After receiving the first notification, clear it */
+ tizen.systeminfo.removePropertyValueChangeListener(id);
+ }
}
id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
{
- console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
+ console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
}, function(error)
{
- console.log("Error, name: " + error.name + ", message: " + error.message);
+ console.log("Error, name: " + error.name + ", message: " + error.message);
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
{
- try
- {
- flash.setBrightness(1);
- }
- catch (error)
- {
- console.log("Setting flash brightness failed: " + error.message);
- }
+ try
+ {
+ flash.setBrightness(1);
+ }
+ catch (error)
+ {
+ console.log("Setting flash brightness failed: " + error.message);
+ }
}, function(error)
{
- console.log("Error, name: " + error.name + ", message: " + error.message);
+ console.log("Error, name: " + error.name + ", message: " + error.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Setting type to set
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
Location path of a wallpaper or ringtone file
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the setting value is successfully set
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the setting value cannot be set
</li>
</ul>
/* Defines the success callback */
function successCallback()
{
- console.log("Succeeded in changing the property");
+ console.log("Succeeded in changing the property");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Failed to change the property. Error: " + error.message);
+ console.log("Failed to change the property. Error: " + error.message);
}
if (systemsetting_api_supported === true)
{
- /* tizen.systemsetting will be available */
- if (home_screen_system_setting === true)
- {
- /* Sets the home screen image */
- /* newHomeScreenImagePath variable should hold the path of the image to be set as home screen background */
- tizen.systemsetting.setProperty("HOME_SCREEN", newHomeScreenImagePath, successCallback, errorCallback);
- }
- else
- {
- /* if tizen.systemsetting.setProperty("HOME_SCREEN", ..) is invoked, NotSupportedError is returned through ErrorCallback */
- }
+ /* tizen.systemsetting will be available */
+ if (home_screen_system_setting === true)
+ {
+ /* Sets the home screen image */
+ /* newHomeScreenImagePath variable should hold the path of the image to be set as home screen background */
+ tizen.systemsetting.setProperty("HOME_SCREEN", newHomeScreenImagePath, successCallback, errorCallback);
+ }
+ else
+ {
+ /* if tizen.systemsetting.setProperty("HOME_SCREEN", ..) is invoked, NotSupportedError is returned through ErrorCallback */
+ }
}
else
{
- /* tizen.systemsetting will be 'undefined' */
- console.log("SystemSetting API is not supported on the device.");
+ /* tizen.systemsetting will be 'undefined' */
+ console.log("SystemSetting API is not supported on the device.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Type of the property to get
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the setting value is successfully retrieved
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the setting value cannot be retrieved
</li>
</ul>
/* Defines the success callback */
function getPropertySuccessCallback(value)
{
- /* Case: tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen") returns 'true' */
- console.log("Succeeded in retrieving the property. The value is " + value);
+ /* Case: tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen") returns 'true' */
+ console.log("Succeeded in retrieving the property. The value is " + value);
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Failed to get the property. Error: " + error.message);
- /* If the device does not support to get the image on home screen, NotSupportedError is thrown */
+ console.log("Failed to get the property. Error: " + error.message);
+ /* If the device does not support to get the image on home screen, NotSupportedError is thrown */
}
tizen.systemsetting.getProperty("HOME_SCREEN", getPropertySuccessCallback, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
The value of the requested property.
</li>
</ul>
/* Checks whether an entry 'Europe/Berlin' exists in the array */
if (tzids.indexOf(currentLocation) > -1)
{
- console.log('The device supports ' + currentLocation + ' timezone.');
+ console.log('The device supports ' + currentLocation + ' timezone.');
}
else
{
- console.log('The device does not support ' + currentLocation + ' timezone.');
+ console.log('The device does not support ' + currentLocation + ' timezone.');
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">shortformat</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">shortformat</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The flag indicating whether the user is interested in the short
date format (23/10/2011) instead of a long date format ("Monday, October 23 2011") <br>By default, this attribute is set to false.
</li>
var dateFormat = tizen.time.getDateFormat();
/* Gets the short date format, e.g. "d/m/y" */
-var shortDateFormat = tizen.time.getDateFormat(true);
+var shortDateFormat = tizen.time.getDateFormat(true);
console.log("Long date format: " + dateFormat);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
The year to check
</li>
</ul>
var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
if (is_leap)
{
- console.log("This year is a leap year.");
+ console.log("This year is a leap year.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changeCallback</span>:
+<span class="name">changeCallback</span>:
Callback method to be invoked when device time was set <br>It is not invoked when time passes naturally.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setDateTimeChangeListener(changedCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- tizen.time.unsetDateTimeChangeListener();
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ tizen.time.unsetDateTimeChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setDateTimeChangeListener(changedCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changeCallback</span>:
+<span class="name">changeCallback</span>:
Callback method that is invoked when the time zone has changed
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setTimezoneChangeListener(changedCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- tizen.time.unsetTimezoneChangeListener();
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ tizen.time.unsetTimezoneChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setTimezoneChangeListener(changedCallback);
If its date/time exceeds the platform limit, TZDate will be invalid.
</div>
<pre class="webidl prettyprint"> [Constructor(optional Date? datetime, optional DOMString? timezone),
-
+
Constructor(long year, long month, long day, optional long? hours, optional long? minutes, optional long? seconds, optional long? milliseconds, optional DOMString? timezone)]
interface TZDate {
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
/* Creates a new TZDate object with current date/time and timezone */
var now = new tizen.TZDate();
-
+
/* Creates a new TZDate object with date set to 1st of January 2016 in time zone for Germany */
var newYear = new tizen.TZDate(new Date("2016-01-01"), 'Europe/Berlin');
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
Date to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
Year to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">hours</span>:
+<span class="name">hours</span>:
Hours to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ms</span>:
+<span class="name">ms</span>:
Milliseconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">minutes</span>:
+<span class="name">minutes</span>:
Minutes to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">month</span>:
+<span class="name">month</span>:
Month to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">seconds</span>:
+<span class="name">seconds</span>:
Seconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
Date to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
Year to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">hours</span>:
+<span class="name">hours</span>:
Hours to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ms</span>:
+<span class="name">ms</span>:
Milliseconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">minutes</span>:
+<span class="name">minutes</span>:
Minutes to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">month</span>:
+<span class="name">month</span>:
Month to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">seconds</span>:
+<span class="name">seconds</span>:
Seconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">tzid</span>:
+<span class="name">tzid</span>:
Timezone identifier to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other Date/Time to compare to
</li>
</ul>
/* Those are the same dates (in different time zones), so the output should be "Those dates are equal." */
if (isTheSame)
{
- console.log("Those dates are equal.");
+ console.log("Those dates are equal.");
}
else
{
- console.log("Those dates are not equal.");
+ console.log("Those dates are not equal.");
}
</pre>
</div>
*/
if (isTheSame)
{
- console.log("Those dates are equal.");
+ console.log("Those dates are equal.");
}
else
{
- console.log("Those dates are not equal.");
+ console.log("Those dates are not equal.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
/* Is 12:00 local time in London earlier than 18:00 local time in Seoul? */
var isEarlier = tzd1.earlierThan(tzd2);
-
+
/* Outputs 'false', since local time in Seoul is GMT (London) + 9 hours */
console.log(isEarlier);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
/* Is 12:00 local time in London earlier than 18:00 local time in Seoul? */
var isLater = tzd1.laterThan(tzd2);
-
+
/* Outputs 'true', since local time in Seoul is GMT (London) + 9 hours */
console.log(isLater);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">duration</span>:
+<span class="name">duration</span>:
TimeDuration to add
</li>
</ul>
/* Gets the date of previous DST transition */
var previousDstTransition = winter16.getPreviousDSTTransition();
-
+
/* Output: "Sunday, October 25, 2015, 1:00:00 AM GMT+0000 United Kingdom Time" */
console.log(previousDstTransition.toString());
</pre>
/* Gets the date of next DST transition */
var nextDstTransition = winter16.getNextDSTTransition();
-
+
/* Output: "Sunday, March 27, 2016, 2:00:00 AM GMT+0100 United Kingdom Time" */
console.log(nextDstTransition.toString());
</pre>
The TimeDuration interface that contains the length and its associated time unit.
</div>
<pre class="webidl prettyprint"> [Constructor(long long length, optional <a href="#TimeDurationUnit">TimeDurationUnit</a>? unit)]
-
+
interface TimeDuration
{
attribute long long length;
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
/* Computes event1.duration - event2.duration */
var diff = event1.duration.difference(event2.duration);
if (diff.length > 0)
- console.log("The event1 is longer than event2.");
+ console.log("The event1 is longer than event2.");
else if (diff.length == 0)
- console.log("The duration of two events is same.");
+ console.log("The duration of two events is same.");
else
- console.log("The event1 is shorter than the event2.");
+ console.log("The event1 is shorter than the event2.");
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
};
[Constructor(optional Date? datetime, optional DOMString? timezone),
-
+
Constructor(long year, long month, long day, optional long? hours, optional long? minutes, optional long? seconds, optional long? milliseconds, optional DOMString? timezone)]
interface TZDate {
};
[Constructor(long long length, optional <a href="#TimeDurationUnit">TimeDurationUnit</a>? unit)]
-
+
interface TimeDuration
{
attribute long long length;
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The Joshua Tree:' + contents.length);
+ console.log('The Joshua Tree:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AttributeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AttributeFilter(DOMString attributeName, optional <a href="#FilterMatchFlag">FilterMatchFlag</a>? matchFlag, optional any matchValue);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The contents modified today:' + contents.length);
+ console.log('The contents modified today:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AttributeRangeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AttributeRangeFilter(DOMString attributeName, optional any initialValue, optional any endValue);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:' + contents.length);
+ console.log('The Joshua Tree by U2:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('Songs found:' + contents.length);
+ console.log('Songs found:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="CompositeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">CompositeFilter(<a href="#CompositeFilterType">CompositeFilterType</a> type, optional <a href="#AbstractFilter">AbstractFilter</a>[]? filters);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printContent(content, index, contents)
{
- console.log('Track: ' + content.trackNumber + ' Title: ' + content.title + 'Duration: ' + content.duration +
- 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
+ console.log('Track: ' + content.trackNumber + ' Title: ' + content.title + 'Duration: ' + content.duration +
+ 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:');
- contents.forEach(printContent);
- /* Increase the offset as much as the count and then find content again */
- if (contents.length == count)
- {
- offset += count;
- tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
- }
+ console.log('The Joshua Tree by U2:');
+ contents.forEach(printContent);
+ /* Increase the offset as much as the count and then find content again */
+ if (contents.length == count)
+ {
+ offset += count;
+ tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
+ }
}
tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
/* Reads current position from the GPS module */
function onChangedCB(info)
{
- var latitude, longitude;
- latitude = info.gpsInfo[0].latitude;
- longitude = info.gpsInfo[0].longitude;
+ var latitude, longitude;
+ latitude = info.gpsInfo[0].latitude;
+ longitude = info.gpsInfo[0].longitude;
- /* Packs these values in one variable */
- myPosition = new SimpleCoordinates(latitude, longitude);
+ /* Packs these values in one variable */
+ myPosition = new SimpleCoordinates(latitude, longitude);
}
/* Starts monitoring GPS info periodically */
try
{
- tizen.humanactivitymonitor.start("GPS", onChangedCB, {callbackInterval: 120000, sampleInterval: 60000});
+ tizen.humanactivitymonitor.start("GPS", onChangedCB, {callbackInterval: 120000, sampleInterval: 60000});
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
readonly attribute DOMString message;
const unsigned short INDEX_SIZE_ERR = 1;
- const unsigned short DOMSTRING_SIZE_ERR = 2;
+ const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
- const unsigned short NO_DATA_ALLOWED_ERR = 6;
+ const unsigned short NO_DATA_ALLOWED_ERR = 6;
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
- const unsigned short INUSE_ATTRIBUTE_ERR = 10;
+ const unsigned short INUSE_ATTRIBUTE_ERR = 10;
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short SYNTAX_ERR = 12;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short NAMESPACE_ERR = 14;
const unsigned short INVALID_ACCESS_ERR = 15;
- const unsigned short VALIDATION_ERR = 16;
+ const unsigned short VALIDATION_ERR = 16;
const unsigned short TYPE_MISMATCH_ERR = 17;
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess()
{
- console.log("Application launched successfully");
+ console.log("Application launched successfully");
}
var app = tizen.application.getCurrentApplication();
/* Define the error callback */
function onError(error)
{
- console.log(error.message);
+ console.log(error.message);
}
function onSuccess()
{
- console.log("Application launched successfully");
+ console.log("Application launched successfully");
}
var app = tizen.application.getCurrentApplication();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Generic error.
</li>
</ul>
readonly attribute DOMString message;
const unsigned short INDEX_SIZE_ERR = 1;
- const unsigned short DOMSTRING_SIZE_ERR = 2;
+ const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
- const unsigned short NO_DATA_ALLOWED_ERR = 6;
+ const unsigned short NO_DATA_ALLOWED_ERR = 6;
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
- const unsigned short INUSE_ATTRIBUTE_ERR = 10;
+ const unsigned short INUSE_ATTRIBUTE_ERR = 10;
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short SYNTAX_ERR = 12;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short NAMESPACE_ERR = 14;
const unsigned short INVALID_ACCESS_ERR = 15;
- const unsigned short VALIDATION_ERR = 16;
+ const unsigned short VALIDATION_ERR = 16;
const unsigned short TYPE_MISMATCH_ERR = 17;
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">userAgent</span>:
+<span class="name">userAgent</span>:
User agent to set for the Web view in your Web application.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
To be invoked if the requested setting operation succeeds.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
To be invoked if the requested setting operation fails.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCallback()
{
- console.log("The requested user agent string has just been set successfully.");
+ console.log("The requested user agent string has just been set successfully.");
}
tizen.websetting.setUserAgentString("the new user agent string to set", successCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
To be invoked if the requested delete operation succeeds.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
To be invoked if the requested delete operation fails.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCallback()
{
- console.log("The cookies saved for your application have just been removed.");
+ console.log("The cookies saved for your application have just been removed.");
}
tizen.websetting.removeAllCookies(successCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">widgetId</span>:
+<span class="name">widgetId</span>:
The ID of the Widget to retrieve
</li>
</ul>
var id = "org.tizen.gallery.widget";
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- console.log("Widget id is " + myWidget.id);
- console.log("Widget details:");
- console.log("Main application id: " + myWidget.applicationId);
- console.log("Package id: " + myWidget.packageId);
- console.log("Is hidden in the list of widgets: " + myWidget.noDisplay);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ console.log("Widget id is " + myWidget.id);
+ console.log("Widget details:");
+ console.log("Main application id: " + myWidget.applicationId);
+ console.log("Package id: " + myWidget.packageId);
+ console.log("Is hidden in the list of widgets: " + myWidget.noDisplay);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A function to call when widgets are retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A function to call when an error occurs
</li>
<li class="param">
-<span class="name">packageId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">packageId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
If this parameter is given, then only widgets belonging to the given package are returned
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.widgetservice.getWidgets(function(widgets)
{
- console.log("There are " + widgets.length + " available widgets");
+ console.log("There are " + widgets.length + " available widgets");
}, function(error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
Package or Application ID
</li>
</ul>
var id = "org.tizen.gallery";
try
{
- var widgetId = tizen.widgetservice.getPrimaryWidgetId(id);
- console.log("Widget id is " + widgetId);
+ var widgetId = tizen.widgetservice.getPrimaryWidgetId(id);
+ console.log("Widget id is " + widgetId);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">sizeType</span>:
+<span class="name">sizeType</span>:
<em>WidgetSizeType</em> used for retrieving corresponding pixel size object.
</li>
</ul>
var sizeType = "4x4";
try
{
- var widgetSize = tizen.widgetservice.getSize(sizeType);
- console.log("Widget size width: " + widgetSize.width + ", height: " + widgetSize.height);
+ var widgetSize = tizen.widgetservice.getSize(sizeType);
+ console.log("Widget size width: " + widgetSize.width + ", height: " + widgetSize.height);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">locale</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">locale</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Locale ("en-us", "ko-kr", ...). If <var>null</var>, then the default system locale is used.
</li>
</ul>
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- var name = myWidget.getName("en-us");
- console.log("Widget name is " + name);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var name = myWidget.getName("en-us");
+ console.log("Widget name is " + name);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A function to call when widgets are retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A function to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
widgetSuccessCb = function(instances)
{
- console.log("Instances array size: " + instances.length);
+ console.log("Instances array size: " + instances.length);
}
widgetErrorCb = function(error)
{
- console.log("Error occurred: " + error.name + ": " + error.message);
+ console.log("Error occurred: " + error.name + ": " + error.message);
}
/* Variable id should contain valid id of the installed widget */
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- myWidget.getInstances(widgetSuccessCb, widgetErrorCb);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ myWidget.getInstances(widgetSuccessCb, widgetErrorCb);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">sizeType</span>:
+<span class="name">sizeType</span>:
<em>WidgetSizeType</em> value that information will be returned about.
</li>
</ul>
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- var variant = myWidget.getVariant("4x4");
- console.log("Variant preview image path is " + variant.previewImagePath);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var variant = myWidget.getVariant("4x4");
+ console.log("Variant preview image path is " + variant.previewImagePath);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A function to call when widgets are retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A function to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
widgetSuccessCb = function(variants)
{
- console.log("Variants array size: " + variants.length);
+ console.log("Variants array size: " + variants.length);
}
widgetErrorCb = function(error)
{
- console.log("Error occurred: " + error.name + ": " + error.message);
+ console.log("Error occurred: " + error.name + ": " + error.message);
}
/* Variable id should contain valid id of the installed widget */
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- myWidget.getVariants(widgetSuccessCb, widgetErrorCb);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ myWidget.getVariants(widgetSuccessCb, widgetErrorCb);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
The callback
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
widgetChangeCb = function(instance, event)
{
- console.log("Instance " + instance.id + " is " + event);
+ console.log("Instance " + instance.id + " is " + event);
}
/* Variable id should contain valid id of the installed widget */
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- var watchId = myWidget.addStateChangeListener(widgetChangeCb);
- console.log("Listener with id " + watchId + " has been added");
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var watchId = myWidget.addStateChangeListener(widgetChangeCb);
+ console.log("Listener with id " + watchId + " has been added");
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
The ID of the registered listener
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
widgetChangeCb = function(instance, event)
{
- console.log("Instance " + instance.id + " is " + event);
- myWidget.removeStateChangeListener(watchId);
- console.log("Listener with id " + watchId + " has been removed");
+ console.log("Instance " + instance.id + " is " + event);
+ myWidget.removeStateChangeListener(watchId);
+ console.log("Listener with id " + watchId + " has been removed");
}
/* Variable id should contain valid id of the installed widget */
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- watchId = myWidget.addStateChangeListener(widgetChangeCb);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ watchId = myWidget.addStateChangeListener(widgetChangeCb);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">seconds</span>:
+<span class="name">seconds</span>:
The interval in seconds
</li>
</ul>
try
{
- instance.changeUpdatePeriod(period);
- console.log("Update period has been set to " + period + " seconds");
+ instance.changeUpdatePeriod(period);
+ console.log("Update period has been set to " + period + " seconds");
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The new content data
</li>
<li class="param">
-<span class="name">updateIfPaused</span>:
+<span class="name">updateIfPaused</span>:
<var>true</var> if you want to update your widget even if the provider is paused
</li>
</ul>
var data =
{
- data1: 'test1',
- data2: 'test2'
+ data1: 'test1',
+ data2: 'test2'
};
try
{
- instance.sendContent(data, true);
- console.log("Data has been successfully sent");
+ instance.sendContent(data, true);
+ console.log("Data has been successfully sent");
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A function to call when data is retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span>:
+<span class="name">errorCallback</span>:
A function to call when an error occurs
</li>
</ul>
contentSuccessCb = function(data)
{
- console.log("Data has been obtained successfully");
- for (var prop in data)
- {
- console.log(prop + ": " + data[prop]);
- }
+ console.log("Data has been obtained successfully");
+ for (var prop in data)
+ {
+ console.log(prop + ": " + data[prop]);
+ }
}
contentErrorCb = function(error)
{
- console.log("Error occurred: " + error.name + ":" + error.message);
+ console.log("Error occurred: " + error.name + ":" + error.message);
}
try
{
- instance.getContent(contentSuccessCb, contentErrorCb);
+ instance.getContent(contentSuccessCb, contentErrorCb);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">widgets</span>:
+<span class="name">widgets</span>:
Array of <em>Widget</em> objects.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">instances</span>:
+<span class="name">instances</span>:
Array of <em>WidgetInstance</em> objects.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">instances</span>:
+<span class="name">instances</span>:
Array of <em>WidgetVariants</em> objects.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Content of the given widget instance.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">instance</span>:
+<span class="name">instance</span>:
Widget instance id that change is related to.
</li>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Event of widget life cycle.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">alarm</span>:
+<span class="name">alarm</span>:
An alarm to add. It can be either <em>AlarmRelative </em> or <em>AlarmAbsolute</em>.
</li>
<li class="param">
-<span class="name">applicationId</span>:
+<span class="name">applicationId</span>:
The application ID to run when the alarm is triggered.
</li>
<li class="param">
-<span class="name">appControl</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">appControl</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The data structure describing application control details.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the alarm to remove
</li>
</ul>
/* Removes the first alarm */
if (alarms.length > 0)
{
- try
- {
- tizen.alarm.remove(alarms[0].id);
- console.log("Successfully removed the first alarm.");
- }
- catch (error)
- {
- console.log("Failed to remove the first alarm.");
- }
+ try
+ {
+ tizen.alarm.remove(alarms[0].id);
+ console.log("Successfully removed the first alarm.");
+ }
+ catch (error)
+ {
+ console.log("Failed to remove the first alarm.");
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The alarm ID to retrieve.
</li>
</ul>
tizen.alarm.add(alarm2, appId);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AlarmRelative::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AlarmRelative(long delay, optional long? period);</pre></dl>
tizen.alarm.add(alarm3, appId);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AlarmAbsolute::constructor">Constructors</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contextId</span>:
+<span class="name">contextId</span>:
The identifier of the application to kill
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an application is killed successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onKillSuccess()
{
- console.log("Application terminated successfully");
+ console.log("Application terminated successfully");
}
function onRunningAppsContext(contexts)
{
- /* Let's assume that the application "targetApp0.main" has been installed */
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++)
- {
- if (contexts[i].appId == targetId)
- {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
}
tizen.application.getAppsContext(onRunningAppsContext);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
A unique string representing the application ID
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess()
{
- console.log("The application has launched successfully");
+ console.log("The application has launched successfully");
}
/* Let's assume that application "targetApp0.main" has been installed */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
The data structure describing application control details
</li>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An identifier of the application to be launched. If the ID is <var>null </var>or not specified, then the system tries to find the application to be launched for the requested application control
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
<li class="param">
-<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the application gets back results from the launched application
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
-var appControlReplyCallback =
+var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
A data structure describing application control details
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call that returns a list of application information
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onRunningAppsContext(contexts)
{
- for (var i = 0; i < contexts.length; i++)
- console.log("ID: " + contexts[i].id);
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
}
tizen.application.getAppsContext(onRunningAppsContext);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contextId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">contextId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application context ID<br>If the ID is not provided, the application context of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID<br>If the ID is not provided, the application information of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the application certificate of the calling application is returned.
</li>
</ul>
for (var i = 0; i < appCerts.length; i++)
{
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the shared directory URI of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the application metadata array of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">eventCallback</span>:
+<span class="name">eventCallback</span>:
The method to call when a change on the installed applications is made
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var appEventCallback =
+var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
An ID that identifies the listener
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var appEventCallback =
+var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
tizen.application.removeAppInfoEventListener(watchId);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
-if (reqAppControl)
+if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Event which will invoke the callback
</li>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback function to be invoked when the event occurs
</li>
</ul>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- });
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Listener identifier
</li>
</ul>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- if (watchId)
- {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Event to broadcast
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
User defined event data to broadcast
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var myCustomData =
+var myCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Trusted event to broadcast
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
User defined trusted event data to broadcast
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var myTrustedCustomData =
+var myTrustedCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
- null, "image/jpeg", null,
- [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
</pre>
</div>
<div class="constructors">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An array of ApplicationControlData objects
</li>
</ul>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
}
</pre>
</div>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- reqAppControl.replyFailure();
- }
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed applications
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed applications
</li>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
The application control that is passed to <em>ApplicationManager.findAppControl()</em> </li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* FindAppControlSuccessCallback instance */
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contexts</span>:
+<span class="name">contexts</span>:
A list of running applications
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* ApplicationControlDataArrayReplyCallback instance */
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
<div class="methods">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An array of <em>ApplicationControlData</em> objects
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The application information of the installed application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The application information of the updated application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the uninstalled application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Broadcasted event which invokes this callback
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Broadcasted event data
</li>
</ul>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- };
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
File to open
</li>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
File mode for the opened archive. Determines which operations are available
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when archive is opened successfully
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Additional options for initializing the ArchiveFile instance
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCallback(archive)
{
- console.log("Success, can now read from archive " + archive);
+ console.log("Success, can now read from archive " + archive);
}
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">operationIdentifier</span>:
+<span class="name">operationIdentifier</span>:
Task ID returned by an asynchronous function from this module
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function openSuccess(archive)
{
- operationId = archive.extractAll("downloads/extracted");
- tizen.archive.abort(operationId);
+ operationId = archive.extractAll("downloads/extracted");
+ tizen.archive.abort(operationId);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">sourceFile</span>:
+<span class="name">sourceFile</span>:
File or directory to be added to archive
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when this operation is completed successfully
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked to notify about operation progress <br>It is called every time a single source file has been completely added.
If the source file is big then the callback can also be called while the file is being processed.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Additional options used to control how the sourceFile will be compressed and stored in the archive
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function successCallback()
{
- console.log("done");
+ console.log("done");
}
function progressCallback(opId, val, name)
{
- console.log("opId: " + opId + " with progress val: " + val);
+ console.log("opId: " + opId + " with progress val: " + val);
}
function createSuccess(archive)
{
- archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
+ archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
}
tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">destinationDirectory</span>:
+<span class="name">destinationDirectory</span>:
Directory where extracted files will be stored <br>Specified as a virtual path or a <em>File</em> object representing a directory.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an archive is extracted successfully
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked while the extracting is in progress <br>The onprogress callback is called at least once. It will be invoked for every extracted file.
</li>
<li class="param">
-<span class="name">overwrite</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">overwrite</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag indicating whether to overwrite or keep the existing files with the same name in the <var>destinationDirectory</var> location when extracting an archive <br>By default, this attribute is set to <var>false</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function successCallback()
{
- console.log("done");
+ console.log("done");
}
function progressCallback(opId, val, name)
{
- console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
+ console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
}
function openSuccess(archive)
{
- archive.extractAll("music", successCallback, errorCallback, progressCallback);
+ archive.extractAll("music", successCallback, errorCallback, progressCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when information about all the files in the archive is successfully retrieved
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function getEntriesSuccess(entries)
{
- console.log("Entries length: " + entries.length);
- for (var i = 0; i < entries.length; i++)
- {
- console.log(entries[i].name);
- }
+ console.log("Entries length: " + entries.length);
+ for (var i = 0; i < entries.length; i++)
+ {
+ console.log(entries[i].name);
+ }
}
function openSuccess(archive)
{
- archive.getEntries(getEntriesSuccess, errorCallback);
+ archive.getEntries(getEntriesSuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name of <em>ArchiveFileEntry</em> to extract
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a file matched with the given name is found
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function getEntrySuccess(entry)
{
- console.log("Entry: " + entry.name + " size: " + entry.size);
+ console.log("Entry: " + entry.name + " size: " + entry.size);
}
function openSuccess(archive)
{
- archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
+ archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">destinationDirectory</span>:
+<span class="name">destinationDirectory</span>:
Directory where extracted files will be stored <br>Given as a virtual path or a <em>File</em> object representing a directory.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an extract operation is completed
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
<li class="param">
-<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onprogress</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked while the extracting is in progress <br>The onprogress callback is called at least once. It will be invoked for every extracted file.
</li>
<li class="param">
-<span class="name">stripName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">stripName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag which determines if directory name part of <em>ArchiveFileEntry</em> should be removed or preserved <br>The default value is <var>false</var>. If it is <var>true</var>, use only base name (part after last slash) as a target path.
</li>
<li class="param">
-<span class="name">overwrite</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">overwrite</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flag which determines if it possible to overwrite files when the decompressed file already exists in this destination location <br>The default value is <var>false</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function extractSuccessCallback()
{
- console.log("done");
+ console.log("done");
}
function getEntrySuccess(entry)
{
- entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
+ entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
}
function openSuccess(archive)
{
- archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
+ archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">archive</span>:
+<span class="name">archive</span>:
Archive file object
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entry</span>:
+<span class="name">entry</span>:
ArchiveFileEntry object representing the file found in ArchiveFile
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entries</span>:
+<span class="name">entries</span>:
List of ArchiveFileEntry objects found in ArchiveFile
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">operationIdentifier</span>:
+<span class="name">operationIdentifier</span>:
Operation identifier for which progress is reported
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
Progress of the operation, value between 0.0 and 1.0 where 1.0 is 100% progress
</li>
<li class="param">
-<span class="name">filename</span>:
+<span class="name">filename</span>:
Name of the compressed or extracted file
</li>
</ul>
/* Check the description is editable, and then set a description */
if (content.editableAttributes.indexOf("description") >= 0)
{
- content.description = "Sample content";
+ content.description = "Sample content";
}
tizen.content.update(content);
</pre>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Attributes set successfully');
+ console.log('Attributes set successfully');
}
/* Assume the content is a Content object as a result of find method */
/* Check the rating is editable, and then increase by 1 */
if (content.editableAttributes.indexOf("rating") >= 0)
{
- content.rating++;
+ content.rating++;
}
tizen.content.updateBatch([content], successCB, errorCB);
</pre>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printDirectory(directory, index, directories)
{
- console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
+ console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
}
function getDirectoriesCB(directories)
{
- directories.forEach(printDirectory);
+ directories.forEach(printDirectory);
}
tizen.content.getDirectories(getDirectoriesCB, errorCB);
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printContent(content, index, contents)
{
- console.log('Name: ' + content.name + ' Title: ' + content.title +
- 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
+ console.log('Name: ' + content.name + ' Title: ' + content.title +
+ 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:');
- contents.forEach(printContent);
- /* Increase the offset as much as the count and then find content again */
- if (contents.length === count)
- {
- offset += count;
- tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
- }
+ console.log('The Joshua Tree by U2:');
+ contents.forEach(printContent);
+ /* Increase the offset as much as the count and then find content again */
+ if (contents.length === count)
+ {
+ offset += count;
+ tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
+ }
}
tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB(path)
{
- console.log('scanning is completed');
+ console.log('scanning is completed');
}
tizen.filesystem.resolve("images/tizen.jpg", function(imageFile)
{
- tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
+ tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
});
</pre>
</div>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB(path)
{
- console.log('scanning is completed');
+ console.log('scanning is completed');
}
tizen.filesystem.resolve("images", function(directory)
{
- tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
+ tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
/* Adds the listener */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
var listenerId = tizen.content.addChangeListener(listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
/* Registers to be notified when the content changes */
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err.message);
+ console.log("getPlaylists failed: " + err.message);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
}
function findSuccess(contents)
{
- if (contents.length > 0)
- {
- gPlaylist.add(contents[0]);
- }
+ if (contents.length > 0)
+ {
+ gPlaylist.add(contents[0]);
+ }
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+ tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
}
function findFail(err)
{
- console.log("find FAIL: " + err.message);
+ console.log("find FAIL: " + err.message);
}
function createSuccess(playlist)
{
- console.log("create SUCCESS");
+ console.log("create SUCCESS");
- gPlaylist = playlist;
- tizen.content.find(findSuccess, findFail, null,
- new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
+ gPlaylist = playlist;
+ tizen.content.find(findSuccess, findFail, null,
+ new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
}
function createFail(err)
{
- console.log("create FAIL: " + err.message);
+ console.log("create FAIL: " + err.message);
}
tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
function removePlaylistSuccess()
{
- console.log("removePlaylist SUCCESS");
+ console.log("removePlaylist SUCCESS");
}
function removePlaylistFail(err)
{
- console.log("removePlaylist FAIL: " + err);
+ console.log("removePlaylist FAIL: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
- if (gPlaylists.length < 1)
- {
- console.log("Please add at least 1 playlist");
+ if (gPlaylists.length < 1)
+ {
+ console.log("Please add at least 1 playlist");
- return;
- }
+ return;
+ }
- console.log("will remove playlist at index [0] name:"
- + gPlaylists[0].name);
+ console.log("will remove playlist at index [0] name:"
+ + gPlaylists[0].name);
- tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
- removePlaylistFail);
+ tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
+ removePlaylistFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function createCB(path)
{
- console.log("The thumbnail path is " + path);
+ console.log("The thumbnail path is " + path);
}
function findCB(contents)
{
- if (contents.length > 0)
- {
- tizen.content.createThumbnail(contents[0], createCB);
- }
+ if (contents.length > 0)
+ {
+ tizen.content.createThumbnail(contents[0], createCB);
+ }
}
tizen.content.find(findCB);
function get2Fail(err)
{
- console.log("get items (after remove) failed: " + err);
+ console.log("get items (after remove) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist items:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 1)
- {
- console.log("Please add at least 1 tracks to playlist!");
+ if (gItems.length < 1)
+ {
+ console.log("Please add at least 1 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original playlist:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will remove item at index [0] name:" + gItems[0].content.name);
- gCurPlaylist.remove(gItems[0]);
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("Will remove item at index [0] name:" + gItems[0].content.name);
+ gCurPlaylist.remove(gItems[0]);
+ gCurPlaylist.get(get2Success, get2Fail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after remove batch) failed: " + err);
+ console.log("get items (after remove batch) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist after remove batch:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist after remove batch:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function removeBatchSuccess()
{
- console.log("removeBatch success");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("removeBatch success");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function removeBatchFail(err)
{
- console.log("removeBatch failed: " + err);
+ console.log("removeBatch failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 4)
- {
- console.log("Please add at least 4 tracks to playlist!");
+ if (gItems.length < 4)
+ {
+ console.log("Please add at least 4 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original playlist:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will remove items at index [0](name:" + gItems[0].content.name
- + ") and at index [2](name:" + gItems[2].content.name + ")");
- gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
+ console.log("Will remove items at index [0](name:" + gItems[0].content.name
+ + ") and at index [2](name:" + gItems[2].content.name + ")");
+ gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function getSuccess(items)
{
- gItems = items;
- console.log("Playlist items:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].name);
- }
+ gItems = items;
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].name);
+ }
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- /* To retrieve all playlist items of 'gCurPlaylist' playlist */
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ /* To retrieve all playlist items of 'gCurPlaylist' playlist */
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after set order) failed: " + err);
+ console.log("get items (after set order) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist order after setOrder:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist order after setOrder:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function setOrderSuccess()
{
- console.log("set items order SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("set items order SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function setOrderFail(err)
{
- console.log("set items order failed: " + err);
+ console.log("set items order failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 2)
- {
- console.log("Please add at least 2 tracks to playlist!");
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original order:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- gExpectedOrder = gItems.slice(0);
- gExpectedOrder.reverse();
+ gExpectedOrder = gItems.slice(0);
+ gExpectedOrder.reverse();
- console.log("New order:");
- for (var i = 0; i < gExpectedOrder.length; ++i)
- {
- console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
- }
+ console.log("New order:");
+ for (var i = 0; i < gExpectedOrder.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
+ }
- gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
+ gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after move item) failed: " + err);
+ console.log("get items (after move item) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist order after move:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist order after move:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function moveSuccess()
{
- console.log("move item SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("move item SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function moveFail(err)
{
- console.log("move item failed: " + err);
+ console.log("move item failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 2)
- {
- console.log("Please add at least 2 tracks to playlist!");
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original order:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will move item at index [1] (name: " +
- gItems[1].content.name + ") up by one place (to [0])");
+ console.log("Will move item at index [1] (name: " +
+ gItems[1].content.name + ") up by one place (to [0])");
- gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
- gItems.unshift(gItems.splice(1, 1)[0]);
+ gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
+ gItems.unshift(gItems.splice(1, 1)[0]);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
/* Handling device discovery results */
var discoveryCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- /* Do something with the discovered device */
- /* If desired device is found, stop discovery with following call */
- tizen.convergence.stopDiscovery();
- },
-
- onfinished: function(foundDevices)
- {
- console.log('Device discovery has finished');
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ /* Do something with the discovered device */
+ /* If desired device is found, stop discovery with following call */
+ tizen.convergence.stopDiscovery();
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log('Device discovery has finished');
+ }
};
/* Running device discovery procedure */
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoveryCallback, function(err)
- {
- console.log(err.name + ': ' + err.message);
- }, 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoveryCallback, function(err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }, 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(channelinfo, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channelinfo.uri);
- console.log('channel id: ' + channelinfo.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channelinfo.uri);
+ console.log('channel id: ' + channelinfo.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
/* Create an instance of application communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(channelinfo, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channelinfo.uri);
- console.log('channel id: ' + channelinfo.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channelinfo.uri);
+ console.log('channel id: ' + channelinfo.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess(clientinfolist)
{
- console.log('get client list');
- for (i in clientinfolist)
- {
- console.log('isHost: ' + clientinfolist[i].isHost);
- console.log('client id: ' + clientinfolist[i].clientId);
- console.log('connection time: ' + clientinfolist[i].connectionTime);
- }
+ console.log('get client list');
+ for (i in clientinfolist)
+ {
+ console.log('isHost: ' + clientinfolist[i].isHost);
+ console.log('client id: ' + clientinfolist[i].clientId);
+ console.log('connection time: ' + clientinfolist[i].connectionTime);
+ }
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri' + channel.uri);
- console.log('channel id ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- service.getClientList(requestChannel, onsuccess, onerror);
+ console.log('Channel started');
+ console.log('channel uri' + channel.uri);
+ console.log('channel id ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ service.getClientList(requestChannel, onsuccess, onerror);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess(clientinfolist)
{
- console.log('get client list');
- for (i in clientinfolist)
- {
- console.log('isHost: ' + clientinfolist[i].isHost);
- console.log('client id: ' + clientinfolist[i].clientId);
- console.log('connection time: ' + clientinfolist[i].connectionTime);
- }
+ console.log('get client list');
+ for (i in clientinfolist)
+ {
+ console.log('isHost: ' + clientinfolist[i].isHost);
+ console.log('client id: ' + clientinfolist[i].clientId);
+ console.log('connection time: ' + clientinfolist[i].connectionTime);
+ }
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri' + channel.uri);
- console.log('channel id ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- clientService.getClientList(requestChannel, onsuccess, onerror);
+ console.log('Channel started');
+ console.log('channel uri' + channel.uri);
+ console.log('channel id ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ clientService.getClientList(requestChannel, onsuccess, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function sendSuccessCallback(channelinfo)
{
- console.log('requestPayload sent');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('requestPayload sent');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by Multi Screen server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- /* Send data to the remote service */
- service.send(channel, requestPayload, sendSuccessCallback, onerror);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by Multi Screen server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ /* Send data to the remote service */
+ service.send(channel, requestPayload, sendSuccessCallback, onerror);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function sendSuccessCallback(channel)
{
- console.log('requestPayload sent');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('requestPayload sent');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- /* Send data to the remote service */
- clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ /* Send data to the remote service */
+ clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- clientService = device.service[i];
- clientService.start(requestChannel, onstarted, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ clientService = device.service[i];
+ clientService.start(requestChannel, onstarted, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped(channel)
{
- console.log('Channel stopped');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('Channel stopped');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('clienti id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- if (channel id == 'chB')
- {
- service.stop(requestChannel2, onstopped);
- }
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('clienti id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ if (channel id == 'chB')
+ {
+ service.stop(requestChannel2, onstopped);
+ }
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped(channel)
{
- console.log('Channel stopped');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('Channel stopped');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- if (channel id == 'chB')
- {
- clientService.stop(requestChannel2, onstopped);
- }
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ if (channel id == 'chB')
+ {
+ clientService.stop(requestChannel2, onstopped);
+ }
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onnotify(channel, payload, senderclientid)
{
- console.log('On service notification');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- /* clientid of the sender of the payload */
- console.log('client id of sender: ' + senderclientid);
- for (i in payload)
- {
- console.log('payload: ' + payload[i].key + '-' + payload[i].value);
- }
- /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
- service.unsetListener();
+ console.log('On service notification');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ /* clientid of the sender of the payload */
+ console.log('client id of sender: ' + senderclientid);
+ for (i in payload)
+ {
+ console.log('payload: ' + payload[i].key + '-' + payload[i].value);
+ }
+ /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
+ service.unsetListener();
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by Multi Screen server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by Multi Screen server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onnotify(channel, payload, senderclientid)
{
- console.log('On service notification');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- /* clientid of the sender of the payload */
- console.log('client id of sender: ' + senderclientid);
- for (i in payload)
- {
- console.log('payload ' + payload[i].key + ': ' + payload[i].value);
- }
- /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
- clientService.unsetListener();
+ console.log('On service notification');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ /* clientid of the sender of the payload */
+ console.log('client id of sender: ' + senderclientid);
+ for (i in payload)
+ {
+ console.log('payload ' + payload[i].key + ': ' + payload[i].value);
+ }
+ /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
+ clientService.unsetListener();
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- service.start(requestChannel, onstarted, onerror);
- /* Register listener to receive notifications from remote service */
- service.setListener(onnotify);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ service.start(requestChannel, onstarted, onerror);
+ /* Register listener to receive notifications from remote service */
+ service.setListener(onnotify);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- }
- else if (service.type === "REMOTE_APP_CONTROL")
- {
- console.log('Connected to the remote app control service');
- }
- service.disconnect();
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ }
+ else if (service.type === "REMOTE_APP_CONTROL")
+ {
+ console.log('Connected to the remote app control service');
+ }
+ service.disconnect();
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- else if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ else if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke on success
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(service)
{
- console.log('Remote app control service started');
- service.disconnect();
+ console.log('Remote app control service started');
+ service.disconnect();
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.start(onstarted, onerror);
+ console.log('Connected to the remote app control service');
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- device.services[i].start(onstarted, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ device.services[i].start(onstarted, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
<div class="output">
<span class="title"><p>Output example:</p></span><pre> >> STARTING DEVICE DISCOVERY
<< Found a device
- - id: de2bea-ddvia
- - name : deviceA
- - type : TV
- - service amount: 2
+ - id: de2bea-ddvia
+ - name : deviceA
+ - type : TV
+ - service amount: 2
<< Device discovery has finished
Connected to the remote app control service
Remote app control service started
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on success
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped()
{
- console.log('Remote App Control service stopped');
- /* Disconnect */
- service.disconnect();
+ console.log('Remote App Control service stopped');
+ /* Disconnect */
+ service.disconnect();
}
function onstarted(service)
{
- console.log('Remote App Control service started');
- /* Stop the service */
- service.stop(onstopped, onerror);
+ console.log('Remote App Control service started');
+ /* Stop the service */
+ service.stop(onstopped, onerror);
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.start(onstarted, onerror);
+ console.log('Connected to the remote app control service');
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- device.services[i].start(onstarted, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ device.services[i].start(onstarted, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
<div class="output">
<span class="title"><p>Output example:</p></span><pre> >> STARTING DEVICE DISCOVERY
<< Found a device
- - id: de2bea-ddvia
- - name : deviceA
- - type : TV
- - service amount: 2
+ - id: de2bea-ddvia
+ - name : deviceA
+ - type : TV
+ - service amount: 2
<< Device discovery has finished
Connected to the remote app control service
Remote App Control service started
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.disconnect();
+ console.log('Connected to the remote app control service');
+ service.disconnect();
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
console.log('>> STARTING DEVICE DISCOVERY');
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function ondisconnected()
{
- console.log('Disconnected to the service');
+ console.log('Disconnected to the service');
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState == "CONNECTED")
- {
- device.services[i].disconnect(ondisconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log('Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState == "CONNECTED")
+ {
+ device.services[i].disconnect(ondisconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log('Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess()
{
- console.log('The application has launched successfully');
+ console.log('The application has launched successfully');
}
function onstarted(service)
{
- console.log('Service started');
+ console.log('Service started');
- /* Launching server app remotely */
- service.launch(requestAppId, remoteAppControlCallback, onerror);
+ /* Launching server app remotely */
+ service.launch(requestAppId, remoteAppControlCallback, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- /* Start the service */
- service.start(onstarted, onerror);
+ console.log('Connected to the service');
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
console.log('>> STARTING DEVICE DISCOVERY');
The method to invoke on failure.
</li>
<li class="param">
-<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the application gets back result from the remote service.
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var requestAppControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/view',
- null, 'image/jpeg', null,
- [new tizen.ApplicationControlData('images', [testImgData])]);
+ null, 'image/jpeg', null,
+ [new tizen.ApplicationControlData('images', [testImgData])]);
function onsuccess()
{
- console.log('Launch application control succeed');
+ console.log('Launch application control succeed');
}
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
var remoteAppControlCallback =
{
- onsuccess: function(data)
- {
- console.log('On remote app control service reply');
- for(var i = 0; i < data.length; i++)
- {
- console.log("key : " + data[i].key + "value : " + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ onsuccess: function(data)
+ {
+ console.log('On remote app control service reply');
+ for(var i = 0; i < data.length; i++)
+ {
+ console.log("key : " + data[i].key + "value : " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
function onstarted(service)
{
- console.log('Service started');
+ console.log('Service started');
- /* Send data to the remote service */
- service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
+ /* Send data to the remote service */
+ service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
}
function onconnected(service)
{
- console.log('Connected to the service');
+ console.log('Connected to the service');
- /* Start the service */
- service.start(onstarted, onerror);
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">expression</span>:
+<span class="name">expression</span>:
The expression to be evaluated.
</li>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be displayed if an expression is false.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">obj</span>:
+<span class="name">obj</span>:
An object whose JavaScript representation will be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">obj</span>:
+<span class="name">obj</span>:
An object whose XML/HTML Element representation will be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
The label to start timing with.
</li>
</ul>
var array = new Array(1000000);
for (var i = array.length - 1; i >= 0; i -= 1)
{
- array[i] = new Object();
+ array[i] = new Object();
};
console.timeEnd("Big array initialization");
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
The label associated to the timing (with the use of <var>console.time()</var>method).
</li>
</ul>
var array = new Array(1000000);
for (var i = array.length - 1; i >= 0; i -= 1)
{
- array[i] = new Object();
+ array[i] = new Object();
};
console.timeEnd("Big array initialization");
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Error object containing some information about the error.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked with current acceleration values.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked with current acceleration values.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Specifies the interval of calling successcallback in miliseconds. If not provided, default value for frequency is 10000 (10 seconds).
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- console.log('Please wait 3 seconds for the next measurement...');
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ console.log('Please wait 3 seconds for the next measurement...');
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
var options = {frequency: 3000}; /* Update every 3 seconds */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchID</span>:
+<span class="name">watchID</span>:
The id of the watch returned from <a href="device-motion.html#Accelerometer::watchAcceleration">watchAcceleration</a>.
</li>
</ul>
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- if (3 == ++counter)
- {
- navigator.accelerometer.clearWatch(watchID);
- }
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ if (3 == ++counter)
+ {
+ navigator.accelerometer.clearWatch(watchID);
+ }
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
var options = {frequency: 30}; /* Update every 0.03 seconds */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">acceleration</span>:
+<span class="name">acceleration</span>:
The acceleration at a single moment in time.
</li>
</ul>
function onDeviceReady()
{
- console.log('Device Cordova: ' + device.cordova);
+ console.log('Device Cordova: ' + device.cordova);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Model: ' + device.model);
+ console.log('Device Model: ' + device.model);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Platform: ' + device.platform);
+ console.log('Device Platform: ' + device.platform);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device UUID: ' + device.uuid);
+ console.log('Device UUID: ' + device.uuid);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Version: ' + device.version);
+ console.log('Device Version: ' + device.version);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog dialog.
</li>
<li class="param">
-<span class="name">alertCallback</span>:
+<span class="name">alertCallback</span>:
The callback to be invoked when alert dialog would be dismissed.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Dialog'.
</li>
<li class="param">
-<span class="name">buttonName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button name to be shown on dialog box. Default value is 'OK'.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var alertDismissed = function()
{
- console.log('Alert was dismissed');
+ console.log('Alert was dismissed');
}
navigator.notification.alert('Please click OK button', alertDismissed,
- 'OK click alert', 'OK');
+ 'OK click alert', 'OK');
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog box.
</li>
<li class="param">
-<span class="name">confirmCallback</span>:
+<span class="name">confirmCallback</span>:
The callback to be invoked when user perform an action on dialog box.
Callback provides index of button pressed (1,2,3 etc.) or 0, if dialog was dismissed without button press.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Confirm'.
</li>
<li class="param">
-<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button names to be shown on dialog box. Default values are ['OK', 'Cancel'].
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var confirmCallback = function(buttonIndex)
{
- console.log('Selected option was ' + buttonIndex);
+ console.log('Selected option was ' + buttonIndex);
}
navigator.notification.confirm('Choose one option', confirmCallback,
- 'Options', ['Option1', 'Option2']);
+ 'Options', ['Option1', 'Option2']);
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog box.
</li>
<li class="param">
-<span class="name">promptCallback</span>:
+<span class="name">promptCallback</span>:
The callback to be invoked when user perform an action on dialog box.
Callback provides <em>PromptData</em> object, which holds all data provided by user.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Prompt'.
</li>
<li class="param">
-<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button names to be shown on dialog box. Default values are ['OK', 'Cancel'].
</li>
<li class="param">
-<span class="name">defaultText</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">defaultText</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Default text to be shown in textbox of dialog box. Default value is an empty string ('').
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var promptCallback = function(results)
{
- console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
+ console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
}
navigator.notification.prompt('Please enter your name', promptCallback,
- 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
+ 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">times</span>:
+<span class="name">times</span>:
The number of times to repeat the beep.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">buttonIndex</span>:
+<span class="name">buttonIndex</span>:
The index of button, which was pressed by user.
the index uses one-based indexing, so the values could be 1, 2, 3, etc.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The data input into dialog box.
</li>
</ul>
function onDeviceReady()
{
- /* Now safe to use device APIs */
+ /* Now safe to use device APIs */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('pause', onPause, false);
+ document.addEventListener('pause', onPause, false);
}
function onPause()
{
- /* Handle the pause event */
+ /* Handle the pause event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('resume', onResume, false);
+ document.addEventListener('resume', onResume, false);
}
function onResume()
{
- /* Handle the resume event */
+ /* Handle the resume event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('backbutton', onBackKeyDown, false);
+ document.addEventListener('backbutton', onBackKeyDown, false);
}
function onBackKeyDown()
{
- /* Handle the back button */
+ /* Handle the back button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('menubutton', onMenuKeyDown, false);
+ document.addEventListener('menubutton', onMenuKeyDown, false);
}
function onMenuKeyDown()
{
- /* Handle the back button */
+ /* Handle the back button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('searchbutton', onSearchKeyDown, false);
+ document.addEventListener('searchbutton', onSearchKeyDown, false);
}
function onSearchKeyDown()
{
- /* Handle the search button */
+ /* Handle the search button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('startcallbutton', onStartCallKeyDown, false);
+ document.addEventListener('startcallbutton', onStartCallKeyDown, false);
}
function onStartCallKeyDown()
{
- /* Handle the start call button */
+ /* Handle the start call button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('endcallbutton', onEndCallKeyDown, false);
+ document.addEventListener('endcallbutton', onEndCallKeyDown, false);
}
function onEndCallKeyDown()
{
- /* Handle the end call button */
+ /* Handle the end call button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
+ document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
}
function onVolumeDownKeyDown()
{
- /* Handle the volume down button */
+ /* Handle the volume down button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
+ document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
}
function onVolumeUpKeyDown()
{
- /* Handle the volume up button */
+ /* Handle the volume up button */
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var eventInit =
{
- loaded: 128,
- total: 1024
+ loaded: 128,
+ total: 1024
};
var event = new ProgressEvent('submit', eventInit);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fileSystem)
{
- console.log('Name of the filesystem: ' + fileSystem.name);
+ console.log('Name of the filesystem: ' + fileSystem.name);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Local file system type, either TEMPORARY or PERSISTENT.
</li>
<li class="param">
-<span class="name">size</span>:
+<span class="name">size</span>:
Indicates how much storage space, in bytes, the application expects to need.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked with a <em>FileSystem</em> object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked if error occurs retrieving file system.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(fs)
{
- console.log('File system name ' + fs.name);
+ console.log('File system name ' + fs.name);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span>:
+<span class="name">uri</span>:
URI referring to a local file or directory.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked with <em>Entry</em> object corresponding to URI.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked if error occurs retrieving file system entry.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(entry)
{
- console.log('Entry name ' + entry.name);
+ console.log('Entry name ' + entry.name);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
var uri = 'file:///home/owner/content/Documents/example.txt';
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the time of the last modification.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called when errors happen.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getMetadata(function(metadata)
- {
- console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
- });
+ fs.root.getMetadata(function(metadata)
+ {
+ console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">parent</span>:
+<span class="name">parent</span>:
The directory to which to move the entry.
</li>
<li class="param">
-<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The new name of the entry. Defaults to the Entry's current name if unspecified.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called with the Entry for the new location.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
- {
- fs.root.getFile("aa.txt", {create:true}, function(fileentry)
- {
- console.log('Full path before move: ' + fileentry.fullPath);
- fileentry.moveTo(direntry, 'newname.txt', successCallback);
- });
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("aa.txt", {create:true}, function(fileentry)
+ {
+ console.log('Full path before move: ' + fileentry.fullPath);
+ fileentry.moveTo(direntry, 'newname.txt', successCallback);
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">parent</span>:
+<span class="name">parent</span>:
The directory to which to copy the entry.
</li>
<li class="param">
-<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The new name of the entry. Defaults to the Entry's current name if unspecified.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called with the Entry for the new location.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
- {
- fs.root.getFile("test.txt", {create:true}, function(fileentry)
- {
- fileentry.copyTo(direntry, 'newname.txt', successCallback);
- });
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("test.txt", {create:true}, function(fileentry)
+ {
+ fileentry.copyTo(direntry, 'newname.txt', successCallback);
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called to return the parent Entry.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getParent(function(entry)
- {
- console.log("success");
- });
+ fs.root.getParent(function(entry)
+ {
+ console.log("success");
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called on success.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile('test.txt', {create: true}, function(fileEntry)
- {
- fileEntry.remove(function()
- {
- console.log("success");
- });
- });
+ fs.root.getFile('test.txt', {create: true}, function(fileEntry)
+ {
+ fileEntry.remove(function()
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(entry)
- {
- var url = entry.toURL();
- console.log('URL: ' + url);
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(entry)
+ {
+ var url = entry.toURL();
+ console.log('URL: ' + url);
+ });
});
</pre>
</div>
Since: </span>
3.0
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(entry)
{
- entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
- {
- var directoryReader = dirEntry.createReader();
- });
+ entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
+ {
+ var directoryReader = dirEntry.createReader();
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">path</span>:
+<span class="name">path</span>:
Either an absolute path or a relative path from this DirectoryEntry to the directory to be looked up or created. It is an error to attempt to create a directory whose immediate parent does not yet exist.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flags
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called to return the DirectoryEntry selected or created.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory("ert", {create:true}, function(dir)
- {
- console.log('Created dir: ' + dir.name);
- })
+ fs.root.getDirectory("ert", {create:true}, function(dir)
+ {
+ console.log('Created dir: ' + dir.name);
+ })
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">path</span>:
+<span class="name">path</span>:
Either an absolute path or a relative path from this DirectoryEntry to the file to be looked up or created. It is an error to attempt to create a file whose immediate parent does not yet exist.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flags
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called to return the File selected or created.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("qa.txt", {create:true}, function(file)
- {
- console.log('Created file: ' + file.name);
- });
+ fs.root.getFile("qa.txt", {create:true}, function(file)
+ {
+ console.log('Created file: ' + file.name);
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called on success.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
- {
- directoryEntry.removeRecursively(function()
- {
- console.log("success");
- });
- });
+ fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
+ {
+ directoryEntry.removeRecursively(function()
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Called once per successful call to readEntries to deliver the next previously-unreported set of Entries in the associated Directory. If all Entries have already been returned from previous invocations of readEntries, successCallback must be called with a zero-length array as an argument.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback indicating that there was an error reading from the Directory.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- var a = fs.root.createReader();
- a.readEntries(function successCallback(entries)
- {
- console.log("success");
- });
+ var a = fs.root.createReader();
+ a.readEntries(function successCallback(entries)
+ {
+ console.log("success");
+ });
});
</pre>
</div>
void file (<a href="#FileCallback">FileCallback</a> onsuccess, optional <a href="#ErrorCallback">ErrorCallback</a> onerror);
};</pre>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the new FileWriter.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("logFile.txt", {create: true}, function(f)
- {
- f.createWriter(function(fileWriter)
- {
- fileWriter.write(new Blob(['hello']));
- fileWriter.onerror = function(e)
- {
- console.log('Write file failed:' + e);
- };
- fileWriter.onwriteend = function()
- {
- console.log("success");
- };
- });
- });
+ fs.root.getFile("logFile.txt", {create: true}, function(f)
+ {
+ f.createWriter(function(fileWriter)
+ {
+ fileWriter.write(new Blob(['hello']));
+ fileWriter.onerror = function(e)
+ {
+ console.log('Write file failed:' + e);
+ };
+ fileWriter.onwriteend = function()
+ {
+ console.log("success");
+ };
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the File.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("abcdz.txt", {create: true}, function(f)
- {
- f.file(function(file)
- {
- console.log("success");
- });
- });
+ fs.root.getFile("abcdz.txt", {create: true}, function(f)
+ {
+ f.file(function(file)
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
var deviceReady, fileReader;
deviceReady = function()
{
- fileReader = new FileReader();
+ fileReader = new FileReader();
};
document.addEventListener('deviceready', deviceReady, true);
</pre>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded');
+ console.log('Loaded');
};
fileReader.onabort = function()
{
- console.log('aborted');
+ console.log('aborted');
};
fileReader.readAsDataURL(blob);
fileReader.abort();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as data URL.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsDataURL(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as text.
</li>
<li class="param">
-<span class="name">label</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">label</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An optional argument, that represents the label of an encoding
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsText(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as binary.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsBinaryString(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as array buffer.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- resultValue = fileReader.result;
- console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
+ resultValue = fileReader.result;
+ console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
};
fileReader.readAsArrayBuffer(blob);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('write success');
- };
- writer.onabort = function(e)
- {
- console.log('abort');
- };
- writer.write('some sample text');
- writer.abort();
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+ writer.onabort = function(e)
+ {
+ console.log('abort');
+ };
+ writer.write('some sample text');
+ writer.abort();
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">offset</span>:
+<span class="name">offset</span>:
Location to move the file pointer to.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- /* Fast forwards file pointer to the end of file */
- writer.seek(writer.length);
+ /* Fast forwards file pointer to the end of file */
+ writer.seek(writer.length);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">size</span>:
+<span class="name">size</span>:
Size to chop the file at.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('truncate success');
- };
+ writer.onwrite = function(evt)
+ {
+ console.log('truncate success');
+ };
- writer.truncate(10);
+ writer.truncate(10);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Text or Blob to be written.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('write success');
- };
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
- writer.write('some sample text');
+ writer.write('some sample text');
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
A progress event.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filesystem</span>:
+<span class="name">filesystem</span>:
FileSystem The file systems to which the app is granted access.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entry</span>:
+<span class="name">entry</span>:
Entry
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entries</span>:
+<span class="name">entries</span>:
Entry[]
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">metadata</span>:
+<span class="name">metadata</span>:
Metadata
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileWriter</span>:
+<span class="name">fileWriter</span>:
FileWriter
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
File
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">err</span>:
+<span class="name">err</span>:
FileError
</li>
</ul>
var win = function(r)
{
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
}
var fail = function(error)
{
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
}
var options = new FileUploadOptions();
var win = function(r)
{
- console.log('Success. File uploaded.');
+ console.log('Success. File uploaded.');
}
var fail = function(error)
{
- /* error.code == FileTransferError.ABORT_ERR */
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
};
var ft = new FileTransfer();
ft.onprogress = function(event)
{
- console.log('uploaded: ' + event.loaded);
+ console.log('uploaded: ' + event.loaded);
};
ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileURL</span>:
+<span class="name">fileURL</span>:
Filesystem URL representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
</li>
<li class="param">
-<span class="name">server</span>:
+<span class="name">server</span>:
URL of the server to receive the file, as encoded by encodeURI().
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is passed a FileUploadResult object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
: A callback that executes if an error occurs retrieving the FileUploadResult. Invoked with a FileTransferError object.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameters
</li>
<li class="param">
-<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameter, defaults to false. If set to true, it accepts all security certificates.
</li>
</ul>
var win = function(r)
{
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
}
var fail = function(error)
{
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
}
var ft = new FileTransfer();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">source</span>:
+<span class="name">source</span>:
URL of the server to download the file, as encoded by encodeURI().
</li>
<li class="param">
-<span class="name">target</span>:
+<span class="name">target</span>:
Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is passed a FileEntry object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that executes if an error occurs when retrieving the FileEntry. Invoked with a FileTransferError object.
</li>
<li class="param">
-<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameter, defaults to false. If set to true, it accepts all security certificates.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
</li>
</ul>
fileTransfer.download(uri, fileURL, function(entry)
{
- console.log('download complete: ' + entry.toURL());
+ console.log('download complete: ' + entry.toURL());
}, function(error)
{
- console.log('download error source ' + error.source);
- console.log('download error target ' + error.target);
- console.log('upload error code' + error.code);
+ console.log('download error source ' + error.source);
+ console.log('download error target ' + error.target);
+ console.log('upload error code' + error.code);
}, false,
{
- headers:
- {
- 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
- }
+ headers:
+ {
+ 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
+ }
});
</pre>
</div>
var win = function(r)
{
- console.log('Should not be called.');
+ console.log('Should not be called.');
}
var fail = function(error)
{
- /* error.code == FileTransferError.ABORT_ERR */
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
};
var ft = new FileTransfer();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">result</span>:
+<span class="name">result</span>:
A result object that defines an upload result.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
An object that defines a downloaded file.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
An object that defines details of the error
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked if the preferred language
is obtained successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
during this method's execution.
</li>
*/
navigator.globalization.getPreferredLanguage(function(language)
{
- console.log('Language: ' + language.value);
+ console.log('Language: ' + language.value);
}, function()
{
- console.log('Error getting language.');
+ console.log('Error getting language.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback function called when the locale name
has been obtained successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors
occuring while getting a locale name.
</li>
*/
navigator.globalization.getLocaleName(function(locale)
{
- console.log('Locale: ' + locale.value);
+ console.log('Locale: ' + locale.value);
}, function()
{
- console.log('Error getting locale.');
+ console.log('Error getting locale.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
The date to be converted to a DOMString. It should be of type Date.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method called after a successful conversion.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called if errors occur during conversion.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Optional parameter defining conversion options. The default values are:
<var>{formatLength : 'short', selector : 'date and time'}</var>.
</li>
*/
navigator.globalization.dateToString(new Date(), function(date)
{
- console.log('Date: ' + date.value);
+ console.log('Date: ' + date.value);
}, function()
{
- console.log('Error getting dateString.');
+ console.log('Error getting dateString.');
}, {formatLength: 'short', selector: 'date and time'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">currencyCode</span>:
+<span class="name">currencyCode</span>:
ISO 4217 compliant currency code provided as a DOMString,
for example 'USD'.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method invoked after a successful conversion.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called if errors occur during the conversion.
</li>
</ul>
*/
navigator.globalization.getCurrencyPattern('USD', function(pattern)
{
- console.log('pattern: ' + pattern.pattern);
- console.log('code: ' + pattern.code);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
+ console.log('pattern: ' + pattern.pattern);
+ console.log('code: ' + pattern.code);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
}, function()
{
- console.log('Error getting pattern.');
+ console.log('Error getting pattern.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The function to be called if this method returns the names correctly.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The function to be called in case of error occuring.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
An optional parameter specifying additional options.
The default value is <var>{type: 'wide', item: 'months'}</var> </li>
</ul>
*/
navigator.globalization.getDateNames(function(names)
{
- for (var i = 0; i < names.value.length; i++)
- {
- console.log('month: ' + names.value[i]);
- }
+ for (var i = 0; i < names.value.length; i++)
+ {
+ console.log('month: ' + names.value[i]);
+ }
}, function()
{
- console.log('Error getting names.');
+ console.log('Error getting names.');
}, {type: 'wide', item: 'months'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to be invoked when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The function to be invoked in case of errors occuring.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
The DateOptions object containing additional options.
The default value is <var>{formatLength: 'short', selector: 'date and time'}</var>.
</li>
*/
function checkDatePattern()
{
- navigator.globalization.getDatePattern(function(date)
- {
- console.log('Date pattern: ' + date.pattern);
- }, function()
- {
- console.log('Error getting pattern');
- }, {formatLength: 'short', selector: 'date and time'});
+ navigator.globalization.getDatePattern(function(date)
+ {
+ console.log('Date pattern: ' + date.pattern);
+ }, function()
+ {
+ console.log('Error getting pattern');
+ }, {formatLength: 'short', selector: 'date and time'});
}
checkDatePattern();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to be called when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The method to be invoked in case of errors occuring.
</li>
</ul>
*/
navigator.globalization.getFirstDayOfWeek(function(day)
{
- console.log('day: ' + day.value);
+ console.log('day: ' + day.value);
}, function()
{
- console.log('Error getting first day of week.');
+ console.log('Error getting first day of week.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked
when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method to be invoked
in case of errors occuring during this method's execution.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Defines the type of numeric value for which
the pattern will be returned.
</li>
*/
navigator.globalization.getNumberPattern(function(pattern)
{
- console.log('pattern: ' + pattern.pattern);
- console.log('symbol: ' + pattern.symbol);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('positive: ' + pattern.positive);
- console.log('negative: ' + pattern.negative);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
+ console.log('pattern: ' + pattern.pattern);
+ console.log('symbol: ' + pattern.symbol);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('positive: ' + pattern.positive);
+ console.log('negative: ' + pattern.negative);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
}, function()
{
- console.log('An error occurred.');
+ console.log('An error occurred.');
}, {type: 'decimal'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
The Date object for which the daylight savings time status will be checked.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be called when this function
successfully completes its execution.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method to be called in case of
errors occuring during this method's execution.
</li>
*/
navigator.globalization.isDayLightSavingsTime(new Date(), function(date)
{
- console.log('dst: ' + date.dst);
+ console.log('dst: ' + date.dst);
}, function()
{
- console.log('Error getting the DST state.');
+ console.log('Error getting the DST state.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">number</span>:
+<span class="name">number</span>:
The number that will be converted to a DOMString
in accordance with the client's user preferences.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback function executed when the conversion
is done successfully. The results of the conversion are passed
as a parameter to this callback function.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback function executed in case of errors
occuring during the conversion. The GlobalizationError object with
the details is passed as a parameter to this callback function.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of conversion.
It is a dictionary with a single property <var>type</var>.
The default value of this parameter is <var>{type: 'decimal'}</var>.
*/
navigator.globalization.numberToString(3.1415926, function(number)
{
- console.log('decimal number: ' + number.value);
+ console.log('decimal number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
navigator.globalization.numberToString(1000003, function(number)
{
- console.log('big decimal number: ' + number.value);
+ console.log('big decimal number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
navigator.globalization.numberToString(0.3183099, function(number)
{
- console.log('percentile: ' + number.value);
+ console.log('percentile: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'percent'});
navigator.globalization.numberToString(1099.95, function(number)
{
- console.log('currency: ' + number.value);
+ console.log('currency: ' + number.value);
}, function()
{
- console.log('Error getting number');
+ console.log('Error getting number');
}, {type: 'currency'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dateString</span>:
+<span class="name">dateString</span>:
a string containing the representation of a date to be converted
to a Date object.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method invoked when the conversion completes successfully.
The result of conversion is passed as a parameter to this callback.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors occuring during
the conversion. A GlobalizationError object is passed as a parameter
to this callback.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of the conversion.
The default value is <var>{formatLength: 'short', selector: 'date and time'}</var>.
</li>
*/
navigator.globalization.stringToDate('9/25/2012', function(date)
{
- console.log('month: ' + date.month +
- ', day: ' + date.day +
- ', year: ' + date.year)
+ console.log('month: ' + date.month +
+ ', day: ' + date.day +
+ ', year: ' + date.year)
}, function()
{
- console.log('Error getting date.');
+ console.log('Error getting date.');
}, {selector: 'date'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">numberString</span>:
+<span class="name">numberString</span>:
The DOMString containing a text representation of a number
to be converted to a double data type.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method called after a successful conversion.
The result of a conversion is passed as a parameter of this callback method.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors occuring during
the conversion. The error is passed as a parameter of this callback method.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of the conversion.
The default value is <var>{type: 'decimal'}</var> </li>
</ul>
*/
navigator.globalization.stringToNumber('1234.56', function(number)
{
- console.log('number: ' + number.value);
+ console.log('number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "dst" of boolean type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a DOMString type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
an object with the field "value"
containing an Array of DOMString values.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a long type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a double type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
a GlobalizationDate object containing the date information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a CurrencyPattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a DatePattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a NumberPattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">positionSuccessCallback</span>:
+<span class="name">positionSuccessCallback</span>:
The callback that is passed the current position in seconds.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span>:
The callback to execute if an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
positionSuccessCallback = function(position)
{
- console.log('Current position is ' + position);
+ console.log('Current position is ' + position);
}
var src = 'file:///home/app/content/Documents/play.mp3';
setTimeout(function()
{
- myMedia.getCurrentPosition(positionSuccessCallback);
+ myMedia.getCurrentPosition(positionSuccessCallback);
}, 2000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file:///home/app/content/Documents/play.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
statusCallback = function(status)
{
- if (status == Media.MEDIA_PAUSED)
- {
- console.log('Audio file has been paused');
- }
+ if (status == Media.MEDIA_PAUSED)
+ {
+ console.log('Audio file has been paused');
+ }
}
var src = 'file:///home/app/content/Documents/play.mp3';
/* Pause after 2 seconds */
setTimeout(function()
{
- myMedia.pause();
+ myMedia.pause();
}, 2000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file:///home/app/content/Documents/play.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been stopped or released.');
+ console.log('Audio file has been stopped or released.');
}
errorCallback = function(err)
{
- console.log('An error occurred: ' + err.message);
+ console.log('An error occurred: ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
The position to set the playback position within the audio, in milliseconds.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('An error occurred: ' + err.message);
+ console.log('An error occurred: ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* SeekTo to 10 seconds after 5 seconds */
setTimeout(function()
{
- myMedia.seekTo(10000);
- console.log('Playback position has been set to 10 seconds.');
+ myMedia.seekTo(10000);
+ console.log('Playback position has been set to 10 seconds.');
}, 5000);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
The volume to set for playback. The value must be within the range of 0.0 to 1.0.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* Mute volume after 2 seconds */
setTimeout(function()
{
- myMedia.setVolume(0.0);
- console.log('Playback volume has been muted.');
+ myMedia.setVolume(0.0);
+ console.log('Playback volume has been muted.');
}, 2000);
/* Set volume to 1.0 after 5 seconds */
setTimeout(function()
{
- myMedia.setVolume(1.0);
- console.log('Playback volume has been set to 1.0.');
+ myMedia.setVolume(1.0);
+ console.log('Playback volume has been set to 1.0.');
}, 5000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Started recording an audio file.');
+ console.log('Started recording an audio file.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'recordAudio.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Started recording an audio file.');
+ console.log('Started recording an audio file.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'recordAudio.mp3';
/* Stop recording after 10 seconds */
setTimeout(function()
{
- myRecMedia.stopRecord();
- console.log('Stopped recording an audio file.');
+ myRecMedia.stopRecord();
+ console.log('Stopped recording an audio file.');
}, 10000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been stopped.');
+ console.log('Audio file has been stopped.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* Stop after 10 seconds */
setTimeout(function()
{
- myMedia.stop();
+ myMedia.stop();
}, 10000);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Error object containing some information about the error.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">status</span>:
+<span class="name">status</span>:
The status of the <a href="media.html#Media">Media</a> object. It is equal to one of the Media interface constant: MEDIA_NONE, MEDIA_STARTING, MEDIA_RUNNING, MEDIA_PAUSED or MEDIA_STOPPED.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
The current position of the media file.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function checkConnection()
{
- var networkState = navigator.connection.type;
+ var networkState = navigator.connection.type;
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
- alert('Connection type: ' + states[networkState]);
+ var states = {};
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+ alert('Connection type: ' + states[networkState]);
}
checkConnection();
function onDeviceReady()
{
- document.addEventListener('online', onOnline, false);
+ document.addEventListener('online', onOnline, false);
}
function onOnline()
{
- /* Handle the online event */
+ /* Handle the online event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('offline', onOffline, false);
+ document.addEventListener('offline', onOffline, false);
}
function onOffline()
{
- /* Handle the offline event */
+ /* Handle the offline event */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">providerId</span>:
+<span class="name">providerId</span>:
A provider ID to use, which should be shared between the DataControl provider and DataControl consumer.
</li>
<li class="param">
-<span class="name">dataId</span>:
+<span class="name">dataId</span>:
A string for identifying specific data.
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The DataType to use.
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-/*
+/*
The data provider, a native application, should be pre-installed and launched
The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer)
In this example, the DictionaryDataControlProvider native sample application is used as a data control provider
/* Gets SQL type DataControlConsumerObject */
try
{
- var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
+ var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
}
catch (err)
{
- console.log(err.name +": " + err.message);
+ console.log(err.name +": " + err.message);
}
/* Gets MAP type DataControlConsumerObject */
try
{
- globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
+ globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
}
catch (err)
{
- console.log(err.name +": " + err.message);
+ console.log(err.name +": " + err.message);
}
</pre>
</div>
Since: </span>
2.4
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">insertionData</span>:
+<span class="name">insertionData</span>:
The data on columns and values to insert.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id, insertRowId)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- var rowData =
- {
- columns: ["WORD", "WORD_DESC"] ,
- values: ["'tizen1'", "'tizen2'"]
- };
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'tizen2'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">updateData</span>:
+<span class="name">updateData</span>:
The data on columns and values to update.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows to update. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- var rowData =
- {
- columns: ["WORD", "WORD_DESC"] ,
- values: ["'tizen1'", "'Web apps platform!'"]
- };
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'Web apps platform!'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows to remove. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">columns</span>:
+<span class="name">columns</span>:
The columns to select.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">page</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">page</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The page number of the result set. <br>It starts from <var>1</var>. If the number is out of page, DataControlSelectSuccessCallback is invoked with no result data.
</li>
<li class="param">
-<span class="name">maxNumberPerPage</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">maxNumberPerPage</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The maximum number of rows on a page. The maximum allowed value is equal to 1024.
</li>
<li class="param">
-<span class="name">order</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">order</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The sorting order of the selected rows. <br>It is an SQL <var>ORDER BY</var> clause excluding the <var>ORDER BY</var> itself such as <var>column1, column2 ASC</var>. If it is set to null, the order in which the rows are returned is undefined.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function getValueSuccessCB(result, id)
{
- console.log("getValueSuccessCB result.length: " + result.length);
- var length = result.length;
- for (var i = 0; i < length; i++)
- {
- var rowData = "| ";
- var j = 0;
- for (j = 0; j < result[i].columns.length; j++)
- {
- rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
- }
- console.log(rowData);
- }
+ console.log("getValueSuccessCB result.length: " + result.length);
+ var length = result.length;
+ for (var i = 0; i < length; i++)
+ {
+ var rowData = "| ";
+ var j = 0;
+ for (j = 0; j < result[i].columns.length; j++)
+ {
+ rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
+ }
+ console.log(rowData);
+ }
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* globalSQLConsumer and globalReqId should be defined before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- var columns = ["WORD", "WORD_DESC"];
- var whereClause = "1";
- console.log("----- Calling for ascending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC ASC");
- setTimeout(function()
- {
- console.log("----- Calling descending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC DESC");
- }, 1000);
+ /* globalSQLConsumer and globalReqId should be defined before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ var columns = ["WORD", "WORD_DESC"];
+ var whereClause = "1";
+ console.log("----- Calling for ascending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC ASC");
+ setTimeout(function()
+ {
+ console.log("----- Calling descending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC DESC");
+ }, 1000);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
Since: </span>
2.4
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
The value to add into a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation. <br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
The value to remove from a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function getValueSuccessCB(result, id)
{
- console.log(result.length + ":" + result[0]);
+ console.log(result.length + ":" + result[0]);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">oldValue</span>:
+<span class="name">oldValue</span>:
The value to update in a values array mapped by the key.
</li>
<li class="param">
-<span class="name">newValue</span>:
+<span class="name">newValue</span>:
The new value to replace in a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier of the successful operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier of the failed operation.
</li>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
An error message.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So it is recommended to increase the <em>reqId</em> value every time to guarantee uniqueness.
</li>
<li class="param">
-<span class="name">insertRowId</span>:
+<span class="name">insertRowId</span>:
The inserted row ID set by the data control provider if the specified providerResult is <var>true</var>, else <var>-1</var>.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">rows</span>:
+<span class="name">rows</span>:
Rows of SQL selection results from another application.<br>The array operation of rows would be different from general JavaScript array behavior depending on platform implementation. For example, Array.isArray(rows) returns <em>false</em>.
</li>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So it is recommended to increase the <em>reqId</em> value every time to guarantee uniqueness.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">values</span>:
+<span class="name">values</span>:
A list of values assigned to the requested key.
</li>
<li class="param">
-<span class="name">reqid</span>:
+<span class="name">reqid</span>:
A unique identifier of the successful operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadRequest</span>:
+<span class="name">downloadRequest</span>:
The URL and destination information of the object to download.
</li>
<li class="param">
-<span class="name">downloadCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">downloadCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the download state changes or an error occurs.
</li>
</ul>
var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
if (download_api_capability === false)
{
- console.log("Download API is not supported on this device.");
+ console.log("Download API is not supported on this device.");
- return;
+ return;
}
var listener =
{
- onprogress: function(id, receivedSize, totalSize)
- {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id)
- {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id)
- {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, fullPath)
- {
- console.log('Completed with id: ' + id + ', full path: ' + fullPath);
- },
- onfailed: function(id, error)
- {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, fullPath)
+ {
+ console.log('Completed with id: ' + id + ', full path: ' + fullPath);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
};
/* Starts downloading the file from the Web with the corresponding callbacks */
/* If you want to download a large file through Wi-Fi */
var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
var wifiDownloadRequest = new tizen.DownloadRequest(
- "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
+ "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
if (wifi_capability === true)
{
- var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
+ var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
}
else
{
- /* If you call tizen.download.start(), NotSupportedError will be thrown */
- console.log("This device doesn't support Download API through Wi-Fi.");
+ /* If you call tizen.download.start(), NotSupportedError will be thrown */
+ console.log("This device doesn't support Download API through Wi-Fi.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the ongoing download operation to stop.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the ongoing download operation to pause.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the paused download operation to resume.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the current state of the download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the download request information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the MIME type information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to set the download callback.
</li>
<li class="param">
-<span class="name">downloadCallback</span>:
+<span class="name">downloadCallback</span>:
The method to invoke when the download state changes or an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- onprogress: function(id, receivedSize, totalSize)
- {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id)
- {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id)
- {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, fileName)
- {
- console.log('Completed with id: ' + id + ', file name: ' + fileName);
- },
- onfailed: function(id, error)
- {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, fileName)
+ {
+ console.log('Completed with id: ' + id + ', file name: ' + fileName);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
};
/* Start downloading the html file on the web with the corresponding callbacks */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
<li class="param">
-<span class="name">receivedSize</span>:
+<span class="name">receivedSize</span>:
The size of data received in bytes.
</li>
<li class="param">
-<span class="name">totalSize</span>:
+<span class="name">totalSize</span>:
The total size of data to receive in bytes.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
<li class="param">
-<span class="name">path</span>:
+<span class="name">path</span>:
The final full path or virtual path for the downloaded file.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
The reason for download failure.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span>:
+<span class="name">uri</span>:
URI of the JPEG file, as available in ImageContent::contentURI or returned by File::toURI()
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method to be invoked when Exif information has been retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
/* Defines success callback */
function onSuccess(exifInfo)
{
- console.log("success to get Exif information object");
+ console.log("success to get Exif information object");
}
/* Defines error callback */
function onError(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">exifInfo</span>:
+<span class="name">exifInfo</span>:
Exif information object that contains the Exif data in the JPEG file
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when Exif data has been saved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
/* Defines success callback */
function onSaveSuccess()
{
- console.log("success to save Exif information");
+ console.log("success to save Exif information");
}
/* Defines error callback */
function onSaveError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
/* Defines success callback */
function onSuccess(exifInfo)
{
- console.log("success to get Exif information object");
- exifInfo.orientation = "ROTATE_90";
- tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
+ console.log("success to get Exif information object");
+ exifInfo.orientation = "ROTATE_90";
+ tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
}
/* Defines error callback */
function onError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span>:
+<span class="name">uri</span>:
URI of the JPEG file
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method to be invoked when thumbnail data has been retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
/* Defines success callback */
function onSuccess(thumbData)
{
- console.log("got thumbnail data of JPEG file");
- if (thumbData)
- {
- var img = new Image();
- img.src = thumbData;
- document.body.appendChild(img);
- }
+ console.log("got thumbnail data of JPEG file");
+ if (thumbData)
+ {
+ var img = new Image();
+ img.src = thumbData;
+ document.body.appendChild(img);
+ }
}
/* Defines error callback */
function onError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
+ tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">exifInfo</span>:
+<span class="name">exifInfo</span>:
<em>ExifInformation</em> to be retrieved
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span><span class="optional"> [nullable]</span>:
+<span class="name">uri</span><span class="optional"> [nullable]</span>:
URI for the thumbnail to be retrieved <br>If there is no thumbnail in the JPEG file, <var>null</var> is returned.
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- }
-
- var testFile = documentsDir.createFile("test.txt");
-
- if (testFile != null)
- {
- testFile.openStream("w", function(fs)
- {
- fs.write("HelloWorld");
- fs.close();
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">location</span>:
+<span class="name">location</span>:
Location to resolve that can be a virtual path or file URI
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the location has been successfully resolved, passing the newly created <em>File </em>object
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional value to indicate the file access mode on all files and directories that can be reached from the <em>File </em>object passed to onsuccess <br>Default value of this parameter is <var>rw</var> if absent or <var>null</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.filesystem.resolve('images', function(dir)
{
- console.log("Mount point Name is " + dir.path);
+ console.log("Mount point Name is " + dir.path);
}, function(e)
{
- console.log("Error: " + e.message);
+ console.log("Error: " + e.message);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
Storage label
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the list of storage is available, passing the storage list to the callback
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onStorage(storage)
{
- /* Do something */
+ /* Do something */
}
function onStorageError(e)
{
- console.log("Storage not found!" + e.message);
+ console.log("Storage not found!" + e.message);
}
tizen.filesystem.getStorage("music", onStorage, onStorageError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a list of storage is available, and passing the storage list to the callback
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function alertForCorruptedRemovableDrives(storages)
{
- for (var i = 0; i < storages.length; i++)
- {
- if (storages[i].type != "EXTERNAL")
- continue;
- if (storages[i].state == "UNMOUNTABLE")
- console.log("External drive " + storages[i].label + " is corrupted.");
- }
+ for (var i = 0; i < storages.length; i++)
+ {
+ if (storages[i].type != "EXTERNAL")
+ continue;
+ if (storages[i].state == "UNMOUNTABLE")
+ console.log("External drive " + storages[i].label + " is corrupted.");
+ }
}
tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when any change is made to storage state
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs during the watch process
</li>
</ul>
var watchID;
function onStorageStateChanged(storage)
{
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
}
watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
var watchID;
function onStorageStateChanged(storage)
{
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- tizen.filesystem.removeStorageStateChangeListener(watchID);
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+ tizen.filesystem.removeStorageStateChangeListener(watchID);
}
watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- /* Alerts each name of dir's contents */
- console.log(files[i].name);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ /* Alerts each name of dir's contents */
+ console.log(files[i].name);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
/* List directory contents */
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- /*
- Prints the file parent, must contain the
- same value for all the files in the loop
- */
- console.log("All the files should have the same parent " +
- files[i].parent);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ /*
+ Prints the file parent, must contain the
+ same value for all the files in the loop
+ */
+ console.log("All the files should have the same parent " +
+ files[i].parent);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
</pre>
</div>
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].readOnly)
- console.log("Cannot write to file " + files[i].name);
- else
- console.log("Can write to file " + files[i].name);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].readOnly)
+ console.log("Cannot write to file " + files[i].name);
+ else
+ console.log("Can write to file " + files[i].name);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
{
- var audio = new Audio(file.toURI());
- audio.play();
- console.log(file.toURI());
+ var audio = new Audio(file.toURI());
+ audio.play();
+ console.log(file.toURI());
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the list operation has been successfully completed
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Criteria to restrict the listed files
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- console.log("There are " + files.length + " in the selected folder");
+ console.log("There are " + files.length + " in the selected folder");
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve("documents", function(dir)
{
- dir.listFiles(onsuccess, onerror);
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error " + e.message);
+ console.log("Error " + e.message);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Mode in which the file is opened<br><b>"r"</b> for reading<br><b>"a"</b> for appending<br><b>"w"</b> for [over]writing<br><b>"rw"</b> for reading and writing<br> </li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a file has been opened
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Encoding to use for read/write operations on the file, at least the following encodings must be supported:<br>"<a href="http://www.ietf.org/rfc/rfc2279.txt">UTF-8</a>" default encoding<br>"<a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">ISO-8859-1</a>" latin1 encoding<br>If no encoding is passed by the developer, then the default platform encoding must be used.
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- }
-
- var testFile = documentsDir.createFile("test.txt");
- if (testFile != null)
- {
- testFile.openStream("w", function(fs)
- {
- fs.write("HelloWorld");
- fs.close();
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a file has been successfully read
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs while reading a file
</li>
<li class="param">
-<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Encoding for read/write operations on a file, at least the following encodings must be supported:<br>"<a href="http://www.ietf.org/rfc/rfc2279.txt">UTF-8</a>" default encoding<br>"<a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">ISO-8859-1</a>" latin1 encoding<br>If no encoding is passed by the developer, then the default platform encoding must be used.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- if (files[i].isDirectory == false)
- {
- files[i].readAsText(function(str)
- {
- console.log("The file content " + str);
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ if (files[i].isDirectory == false)
+ {
+ files[i].readAsText(function(str)
+ {
+ console.log("The file content " + str);
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
var documentsDir;
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">originFilePath</span>:
+<span class="name">originFilePath</span>:
Origin full virtual file or directory path and it must be under the current directory
</li>
<li class="param">
-<span class="name">destinationFilePath</span>:
+<span class="name">destinationFilePath</span>:
New full virtual file path or directory path
</li>
<li class="param">
-<span class="name">overwrite</span>:
+<span class="name">overwrite</span>:
Attribute to determine whether overwriting is allowed or not <br>If set to <var>true</var>, it enforces overwriting an existing file.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file has been copied
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory == false)
- {
- documentsDir.copyTo(files[i].fullPath,
- "images/backup/" + files[i].name, false,
- function() {console.log("file copied");});
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.copyTo(files[i].fullPath,
+ "images/backup/" + files[i].name, false,
+ function() {console.log("file copied");});
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">originFilePath</span>:
+<span class="name">originFilePath</span>:
Origin full virtual file or directory path, and it must be under the current directory
</li>
<li class="param">
-<span class="name">destinationFilePath</span>:
+<span class="name">destinationFilePath</span>:
New full virtual file path or directory path
</li>
<li class="param">
-<span class="name">overwrite</span>:
+<span class="name">overwrite</span>:
Flag indicating whether to overwrite an existing file.<br>When set to <var>true</var>, the files can be overwritten.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file has been moved
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory == false)
- {
- documentsDir.moveTo(files[i].fullPath,
- "images/newFolder/" + files[i].name, false,
- function() {console.log("file moved");});
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.moveTo(files[i].fullPath,
+ "images/newFolder/" + files[i].name, false,
+ function() {console.log("file moved");});
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred during listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred during listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dirPath</span>:
+<span class="name">dirPath</span>:
Relative directory path, and it only contains characters supported by the underlying filesystem
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">relativeFilePath</span>:
+<span class="name">relativeFilePath</span>:
New file path and it should only contain characters supported by the underlying Filesystem
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filePath</span>:
+<span class="name">filePath</span>:
Relative file path or file URI to resolve
</li>
</ul>
*/
tizen.filesystem.resolve('documents', function(dir)
{
- file = dir.resolve("helloWorld.doc");
+ file = dir.resolve("helloWorld.doc");
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">directoryPath</span>:
+<span class="name">directoryPath</span>:
Full virtual path to the directory to delete (must be under the current one)
</li>
<li class="param">
-<span class="name">recursive</span>:
+<span class="name">recursive</span>:
Flag indicating whether the deletion is recursive or not <br>When set to <var>true</var> recursive deletion is allowed. Also, this function deletes
all data in all subdirectories and so needs to be used with caution.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when a directory is successfully deleted
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory)
- {
- documentsDir.deleteDirectory(files[i].fullPath, false, function()
- {
- console.log("Directory Deleted");
- }, function(e)
- {
- console.log("Error" + e.message);
- });
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory)
+ {
+ documentsDir.deleteDirectory(files[i].fullPath, false, function()
+ {
+ console.log("Directory Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filePath</span>:
+<span class="name">filePath</span>:
Full virtual path to the file to delete (must be under the current directory)
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file is successfully deleted
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (!files[i].isDirectory)
- {
- documentsDir.deleteFile(files[i].fullPath, function()
- {
- console.log("File Deleted");
- }, function(e)
- {
- console.log("Error" + e.message);
- });
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (!files[i].isDirectory)
+ {
+ documentsDir.deleteFile(files[i].fullPath, function()
+ {
+ console.log("File Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
var documentsDir;
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess,onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
if (stream.eof)
{
- /* File has been read completely */
+ /* File has been read completely */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">charCount</span>:
+<span class="name">charCount</span>:
Number of characters being read
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">byteCount</span>:
+<span class="name">byteCount</span>:
Number of bytes to read
</li>
</ul>
var raw = stream.readBytes(256);
for (var i = 0; i < raw.length; i++)
{
- /* raw[i] contains the i-th byte of the current data chunk */
+ /* raw[i] contains the i-th byte of the current data chunk */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">byteCount</span>:
+<span class="name">byteCount</span>:
Number of bytes to read
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">stringData</span>:
+<span class="name">stringData</span>:
Actual string to write
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">byteData</span>:
+<span class="name">byteData</span>:
Byte data array being written
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">base64Data</span>:
+<span class="name">base64Data</span>:
The base64 data to written
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
File resulting from the asynchronous call
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">storages</span>:
+<span class="name">storages</span>:
List of available storage devices
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">storage</span>:
+<span class="name">storage</span>:
Storage device structure
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileStr</span>:
+<span class="name">fileStr</span>:
File represented as a DOMString resulting from the asynchronous call
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filestream</span>:
+<span class="name">filestream</span>:
Filestream to access file content
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">files</span>:
+<span class="name">files</span>:
Files resulting from the asynchronous call
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
- var iotClient = tizen.iotcon.getClient();
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
+ var iotClient = tizen.iotcon.getClient();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
- var iotServer = tizen.iotcon.getServer();
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
+ var iotServer = tizen.iotcon.getServer();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var watchId
function RandomPinSuccess(pin)
{
- console.log("Pin code: " + pin);
- tizen.iotcon.removeGeneratedPinListener(watchId);
+ console.log("Pin code: " + pin);
+ tizen.iotcon.removeGeneratedPinListener(watchId);
}
var cborPath = "App_installed_fullpath/iotcon-test.dat"
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(resource)
{
- if (resource)
- {
- console.log("######## Found a resource ########")
- console.log("URI: " + resource.uriPath);
- console.log("Host Address: " + resource.hostAddress);
- console.log("Device ID: " + resource.deviceId);
- var resourceTypes = resource.resourceTypes;
- console.log("Resource Types: ");
- for (var index in resourceTypes)
- {
- console.log(" " + resourceTypes[index]);
- }
- var resourceInterfaces = resource.resourceInterfaces;
- console.log("Resource interfaces: ");
- for (var index in resourceInterfaces)
- {
- console.log(" " + resourceInterfaces[index]);
- }
- }
+ if (resource)
+ {
+ console.log("######## Found a resource ########")
+ console.log("URI: " + resource.uriPath);
+ console.log("Host Address: " + resource.hostAddress);
+ console.log("Device ID: " + resource.deviceId);
+ var resourceTypes = resource.resourceTypes;
+ console.log("Resource Types: ");
+ for (var index in resourceTypes)
+ {
+ console.log(" " + resourceTypes[index]);
+ }
+ var resourceInterfaces = resource.resourceInterfaces;
+ console.log("Resource interfaces: ");
+ for (var index in resourceInterfaces)
+ {
+ console.log(" " + resourceInterfaces[index]);
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function presenceSuccess(presenceResponse)
{
- console.log("######## Get a presence response ########");
- if (presenceResponse.resultType != "OK")
- {
- console.log("the result is not OK")
-
- return;
- }
- console.log("Trigger type: " + presenceResponse.triggerType);
- console.log("Host address: " + presenceResponse.hostAddress);
- console.log("Connectivity type: " + presenceResponse.connectivityType);
- console.log("Presence resource type: " + presenceResponse.resourceType);
-
- client.removePresenceEventListener(watchID);
+ console.log("######## Get a presence response ########");
+ if (presenceResponse.resultType != "OK")
+ {
+ console.log("the result is not OK")
+
+ return;
+ }
+ console.log("Trigger type: " + presenceResponse.triggerType);
+ console.log("Host address: " + presenceResponse.hostAddress);
+ console.log("Connectivity type: " + presenceResponse.connectivityType);
+ console.log("Presence resource type: " + presenceResponse.resourceType);
+
+ client.removePresenceEventListener(watchID);
}
try
{
- client = tizen.iotcon.getClient();
- watchID = client.addPresenceEventListener(null, null, connectivityType, presenceSuccess);
+ client = tizen.iotcon.getClient();
+ watchID = client.addPresenceEventListener(null, null, connectivityType, presenceSuccess);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(deviceInfo)
{
- if (deviceInfo)
- {
- console.log("######## Get a device info ########");
- console.log("Name: " + deviceInfo.deviceName); /* Human friendly name for device */
- console.log("Spec version: " + deviceInfo.specVersion); /* Spec version of the core specification */
- console.log("ID: " + deviceInfo.oicDeviceId); /* Unique identifier for OIC device */
- console.log("Data model version: " + deviceInfo.dataModelVersion); /* Version of the specs this device data model is implemented to */
- }
+ if (deviceInfo)
+ {
+ console.log("######## Get a device info ########");
+ console.log("Name: " + deviceInfo.deviceName); /* Human friendly name for device */
+ console.log("Spec version: " + deviceInfo.specVersion); /* Spec version of the core specification */
+ console.log("ID: " + deviceInfo.oicDeviceId); /* Unique identifier for OIC device */
+ console.log("Data model version: " + deviceInfo.dataModelVersion); /* Version of the specs this device data model is implemented to */
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- client.findDeviceInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ client.findDeviceInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(platformInfo)
{
- console.log("######## Get a platform info ########");
- console.log("ID: " + platformInfo.platformId);
- console.log("Manufacturer name: " + platformInfo.manufacturerName);
- console.log("Manufacturer URL: " + platformInfo.manufacturerUrl);
- console.log("Model number: " + platformInfo.modelNumber);
- console.log("Date of manufacture: " + platformInfo.manufactureDate);
- console.log("Platform version: " + platformInfo.platformVersion);
- console.log("OS version: " + platformInfo.operatingSystemVersion);
- console.log("Hardware version: " + platformInfo.hardwareVersion);
- console.log("Firmware version: " + platformInfo.firmwareVersion);
- console.log("Support URL: " + platformInfo.supportUrl);
- console.log("System time: " + platformInfo.systemTime);
+ console.log("######## Get a platform info ########");
+ console.log("ID: " + platformInfo.platformId);
+ console.log("Manufacturer name: " + platformInfo.manufacturerName);
+ console.log("Manufacturer URL: " + platformInfo.manufacturerUrl);
+ console.log("Model number: " + platformInfo.modelNumber);
+ console.log("Date of manufacture: " + platformInfo.manufactureDate);
+ console.log("Platform version: " + platformInfo.platformVersion);
+ console.log("OS version: " + platformInfo.operatingSystemVersion);
+ console.log("Hardware version: " + platformInfo.hardwareVersion);
+ console.log("Firmware version: " + platformInfo.firmwareVersion);
+ console.log("Support URL: " + platformInfo.supportUrl);
+ console.log("System time: " + platformInfo.systemTime);
}
try
{
- var client = tizen.iotcon.getClient();
- client.findPlatformInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ client.findPlatformInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var attributes = {openstate: 'open'};
var policy =
{
- isObservable: true,
- isDiscoverable: true
+ isObservable: true,
+ isDiscoverable: true
};
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- if (remoteResponse.result != "SUCCESS")
- {
- console.log("the result is not SUCCESS");
-
- return;
- }
- var repr = remoteResponse.representation;
- console.log("Resource attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ if (remoteResponse.result != "SUCCESS")
+ {
+ console.log("the result is not SUCCESS");
+
+ return;
+ }
+ var repr = remoteResponse.representation;
+ console.log("Resource attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- query["filter"] = {openstate: 'open'};
- resource.methodGet(onresponse, query, onerror);
- }
+ if (resource)
+ {
+ query["filter"] = {openstate: 'open'};
+ resource.methodGet(onresponse, query, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- console.log("result is " + remoteResponse.result);
- var repr = remoteResponse.representation;
- console.log("representation attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ console.log("result is " + remoteResponse.result);
+ var repr = remoteResponse.representation;
+ console.log("representation attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- query["filter"] = {openstate: 'open'};
- representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.attributes = {openstate: 'closed'};
- resource.methodPut(representation, onresponse, query, onerror);
- }
+ if (resource)
+ {
+ query["filter"] = {openstate: 'open'};
+ representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.attributes = {openstate: 'closed'};
+ resource.methodPut(representation, onresponse, query, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- console.log("result is " + remoteResponse.result);
- var repr = remoteResponse.representation;
- console.log("representation attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ console.log("result is " + remoteResponse.result);
+ var repr = remoteResponse.representation;
+ console.log("representation attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.attributes = {openstate: 'closed'};
- resource.methodPost(representation, onresponse, null, onerror);
- }
+ if (resource)
+ {
+ representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.attributes = {openstate: 'closed'};
+ resource.methodPost(representation, onresponse, null, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- if (remoteResponse.result == "RESOURCE_DELETED" || remoteResponse.result == "SUCCESS")
- {
- console.log("Successfully deleted");
- }
+ if (remoteResponse.result == "RESOURCE_DELETED" || remoteResponse.result == "SUCCESS")
+ {
+ console.log("Successfully deleted");
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- resource.methodDelete(onresponse, onerror);
- }
+ if (resource)
+ {
+ resource.methodDelete(onresponse, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onchanged(remoteResponse)
{
- if (remoteResponse.result == "SUCCESS")
- {
- var attributes = remoteResponse.representation.attributes;
- console.log("start observing, door is " + attributes["openstate"]);
- }
- doorResource.stopObserving();
+ if (remoteResponse.result == "SUCCESS")
+ {
+ var attributes = remoteResponse.representation.attributes;
+ console.log("start observing, door is " + attributes["openstate"]);
+ }
+ doorResource.stopObserving();
}
function foundSuccess(resource)
{
- if (resource)
- {
- if (resource.uriPath == "/door")
- {
- doorResource = resource;
- try
- {
- doorResource.startObserving("IGNORE_OUT_OF_ORDER", onchanged);
- }
- catch (err)
- {
- console.log(err.name + ': ' + err.message);
- }
- }
- }
+ if (resource)
+ {
+ if (resource.uriPath == "/door")
+ {
+ doorResource = resource;
+ try
+ {
+ doorResource.startObserving("IGNORE_OUT_OF_ORDER", onchanged);
+ }
+ catch (err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onupdated(representation)
{
- console.log("######## updated representation ########");
- for (var key in representation.attributes)
- {
- console.log("key: " + key + ", value: " + representation.attributes[key]);
- }
- resource.stopCaching();
+ console.log("######## updated representation ########");
+ for (var key in representation.attributes)
+ {
+ console.log("key: " + key + ", value: " + representation.attributes[key]);
+ }
+ resource.stopCaching();
}
function foundSuccess(remoteResource)
{
- if (remoteResource)
- {
- resource = remoteResource;
- remoteResource.startCaching(onupdated); /* Start caching */
- }
+ if (remoteResource)
+ {
+ resource = remoteResource;
+ remoteResource.startCaching(onupdated); /* Start caching */
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onchanged(isAlive)
{
- if (isAlive == true)
- {
- console.log("Remote resource is alive");
- }
- else
- {
- console.log("Remote resource is lost");
- }
- doorResource.unsetResourceStateChangeListener();
+ if (isAlive == true)
+ {
+ console.log("Remote resource is alive");
+ }
+ else
+ {
+ console.log("Remote resource is lost");
+ }
+ doorResource.unsetResourceStateChangeListener();
}
function foundSuccess(resource)
{
- if (resource)
- {
- if (resource.uriPath == "/door")
- {
- try
- {
- resource.setResourceStateChangeListener(onchanged);
- }
- catch (err)
- {
- console.log(err.name + ': ' + err.message);
- }
- }
- }
+ if (resource)
+ {
+ if (resource.uriPath == "/door")
+ {
+ try
+ {
+ resource.setResourceStateChangeListener(onchanged);
+ }
+ catch (err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var doorAttributes = {openstate: 'open'};
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
var lockAttributes = {lockstate: 'closed'};
policy =
{
- isObservable: true,
- isDiscoverable: true
+ isObservable: true,
+ isDiscoverable: true
};
var lockRequestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(lockResource.uriPath);
- representation.resourceTypes = lockResource.resourceTypes;
- representation.resourceInterfaces = lockResource.resourceInterfaces;
- representation.attributes = lockResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(lockResource.uriPath);
+ representation.resourceTypes = lockResource.resourceTypes;
+ representation.resourceInterfaces = lockResource.resourceInterfaces;
+ representation.attributes = lockResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
lockResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, lockRequestListener, policy);
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
var newRequestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- var response = new tizen.Response(request);
- try
- {
- doorResource.attributes = request.representation.attributes;
- response.representation = request.representation;
- response.result = "RESOURCE_CHANGED";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "RESOURCE_DELETED";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- server.removeResource(doorResource);
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving observeType:" + observeType + ", observeId:" + observeId);
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ var response = new tizen.Response(request);
+ try
+ {
+ doorResource.attributes = request.representation.attributes;
+ response.representation = request.representation;
+ response.result = "RESOURCE_CHANGED";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "RESOURCE_DELETED";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ server.removeResource(doorResource);
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving observeType:" + observeType + ", observeId:" + observeId);
+ }
}
try
{
- server = tizen.iotcon.getServer();
- var uriPath = "/door";
- var resourceTypes = ["core.door"];
- var resourceInterfaces = ["oic.if.b"];
- var attributes = {openstate: 'open'};
- var policy =
- {
- isObservable: true,
- isDiscoverable: true
- };
-
- doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
- doorResource.attributes = attributes;
- doorResource.setRequestListener(newRequestListener);
+ server = tizen.iotcon.getServer();
+ var uriPath = "/door";
+ var resourceTypes = ["core.door"];
+ var resourceInterfaces = ["oic.if.b"];
+ var attributes = {openstate: 'open'};
+ var policy =
+ {
+ isObservable: true,
+ isDiscoverable: true
+ };
+
+ doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
+ doorResource.attributes = attributes;
+ doorResource.setRequestListener(newRequestListener);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var filter = {"openstate": "open"};
var query =
{
- resourceType: "core.door",
- resourceInterface: "oic.if.b"
+ resourceType: "core.door",
+ resourceInterface: "oic.if.b"
}
query["filter"] = filter;
</pre>
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
try
{
- server = tizen.iotcon.getServer();
- var uriPath = "/door";
- var resourceTypes = ["core.door"];
- var resourceInterfaces = ["oic.if.b"];
- var policy =
- {
- isObservable: true,
- isDiscoverable: true
- };
-
- doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
- doorResource.attributes = {openstate: 'open'};
+ server = tizen.iotcon.getServer();
+ var uriPath = "/door";
+ var resourceTypes = ["core.door"];
+ var resourceInterfaces = ["oic.if.b"];
+ var policy =
+ {
+ isObservable: true,
+ isDiscoverable: true
+ };
+
+ doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
+ doorResource.attributes = {openstate: 'open'};
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var uriPath = "/door";
- var representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.resourceInterfaces = ["oic.if.b"];
- representation.attributes = {"openstate": "open"};
-
- var response = new tizen.Response(request);
- response.representation = representation;
- response.result = "SUCCESS";
+ var uriPath = "/door";
+ var representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.resourceInterfaces = ["oic.if.b"];
+ representation.attributes = {"openstate": "open"};
+
+ var response = new tizen.Response(request);
+ response.representation = representation;
+ response.result = "SUCCESS";
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
- response.result = "ERROR";
+ console.log(err.name + ': ' + err.message);
+ response.result = "ERROR";
}
response.send();
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name to identify the data - this will be the <em>name</em> attribute of the <a href="#KeyManagerAlias">KeyManagerAlias</a> which this method adds, on success, into the KeyManager
</li>
<li class="param">
-<span class="name">rawData</span>:
+<span class="name">rawData</span>:
Raw data to be stored
</li>
<li class="param">
-<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Password to use for encrypting the data
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when data is successfully saved
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function onSave()
{
- console.log("Successfully saved data");
+ console.log("Successfully saved data");
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias of the data to remove
</li>
</ul>
function onSave()
{
- /* Do something */
+ /* Do something */
- /*
- Dictionary does not require package ID because the
- application which is calling removeData() saved "data1"
- */
- tizen.keymanager.removeData({"name": data_name});
+ /*
+ Dictionary does not require package ID because the
+ application which is calling removeData() saved "data1"
+ */
+ tizen.keymanager.removeData({"name": data_name});
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
if (aliases.length != 0)
{
- /*
- Assuming the application calling removeData() has permission
- to remove aliases[0]
- */
- var app_data = tizen.keymanager.removeData(aliases[0]);
+ /*
+ Assuming the application calling removeData() has permission
+ to remove aliases[0]
+ */
+ var app_data = tizen.keymanager.removeData(aliases[0]);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias of the data to get
</li>
<li class="param">
-<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Password which was used to encrypt the data
</li>
</ul>
function onSave()
{
- /*
- Dictionary does not require package ID because the
- application which is calling getData() saved "data1"
- */
- var app_data = tizen.keymanager.getData({"name": data_name});
- console.log("App data: " + app_data + " was retrieved");
+ /*
+ Dictionary does not require package ID because the
+ application which is calling getData() saved "data1"
+ */
+ var app_data = tizen.keymanager.getData({"name": data_name});
+ console.log("App data: " + app_data + " was retrieved");
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
if (aliases.length != 0)
{
- /*
- Assuming the application calling getData() has permission to read
- aliases[0]
- */
- var app_data = tizen.keymanager.getData(aliases[0]);
- console.log("App data: " + app_data + " was retrieved");
+ /*
+ Assuming the application calling getData() has permission to read
+ aliases[0]
+ */
+ var app_data = tizen.keymanager.getData(aliases[0]);
+ console.log("App data: " + app_data + " was retrieved");
}
</pre>
</div>
console.log("aliases: ");
for (var i = 0; i < aliases.length; i++)
{
- console.log("Package ID: " + aliases[i].packageId + ", Name: "
- + aliases[i].name);
+ console.log("Package ID: " + aliases[i].packageId + ", Name: "
+ + aliases[i].name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias the data for which permission will be set
</li>
<li class="param">
-<span class="name">packageId</span>:
+<span class="name">packageId</span>:
Package ID of the accessor application
</li>
<li class="param">
-<span class="name">permissionType</span>:
+<span class="name">permissionType</span>:
Permission to grant to the accessor application
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when permission is successfully set
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function onPermissionSet()
{
- console.log("Successfully set permission");
+ console.log("Successfully set permission");
}
function onSave()
{
- /*
- Dictionary does not require package ID because an
- application can only set permission for data which it saved
- */
- tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
+ /*
+ Dictionary does not require package ID because an
+ application can only set permission for data which it saved
+ */
+ tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
function onPermissionSet()
{
- console.log("Successfully set permssion");
+ console.log("Successfully set permssion");
}
if (aliases.length != 0)
{
- /*
- Check that the application calling setPermission() saved aliases[0] into
- the KeyManager
- */
- if (aliases[0].packageId === tizen.package.getPackageInfo().id)
- {
- tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
- }
- else
- {
- console.log("This application did not save aliases[0] into the KeyManager");
- }
+ /*
+ Check that the application calling setPermission() saved aliases[0] into
+ the KeyManager
+ */
+ if (aliases[0].packageId === tizen.package.getPackageInfo().id)
+ {
+ tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+ }
+ else
+ {
+ console.log("This application did not save aliases[0] into the KeyManager");
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">localMessagePortName</span>:
+<span class="name">localMessagePortName</span>:
Name of the local message port to retrieve <br>The LocalMessagePort instances are identical for the same message port name.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">localMessagePortName</span>:
+<span class="name">localMessagePortName</span>:
Name of local message port <br>The LocalMessagePort instances are identical for the same message port name.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the application to send messages
</li>
<li class="param">
-<span class="name">remoteMessagePortName</span>:
+<span class="name">remoteMessagePortName</span>:
Name of remote message port
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the application to send messages
</li>
<li class="param">
-<span class="name">remoteMessagePortName</span>:
+<span class="name">remoteMessagePortName</span>:
Name of remote message port
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Callback function that is called when a message is received
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onreceived(data, remoteMsgPort)
{
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
}
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
ID to identify the listener
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Array of data to send
</li>
<li class="param">
-<span class="name">localMessagePort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">localMessagePort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
<em>LocalMessagePort</em> object that gives local message port of the current application<br>It can be used to receive reply messages from the other end of the message port.<br>The order of items in this array is not guaranteed to be preserved during data transfer, and values of <em>key</em> within this
array must not be duplicated or empty.
</li>
var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
localMsgPort.addMessagePortListener(function(items, remoteport)
{
- /* ... */
- if (remoteport !== null)
- {
- remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
- }
+ /* ... */
+ if (remoteport !== null)
+ {
+ remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
+ }
});
/* stream - FileStream object */
var bytePockets = [], byteCount = 0, i = 0;
while (byteCount < stream.bytesAvailable - 256)
{
- bytePockets[i] = stream.readBytes(256);
- byteCount+=256;
- i++;
+ bytePockets[i] = stream.readBytes(256);
+ byteCount+=256;
+ i++;
}
bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
var messagePortPockets = [{key: "key1", value: "val1"},
- {key: "key2", value: ["val2", "val3", "val4"]},
- {key: "key3", value: bytePockets[0]},
- {key: "key4", value: bytePockets}];
+ {key: "key2", value: ["val2", "val3", "val4"]},
+ {key: "key3", value: bytePockets[0]},
+ {key: "key4", value: bytePockets}];
remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Array of data received from another application
</li>
<li class="param">
-<span class="name">remoteMessagePort</span><span class="optional"> [nullable]</span>:
+<span class="name">remoteMessagePort</span><span class="optional"> [nullable]</span>:
RemoteMessagePort port that can be used to reply for the received message
</li>
</ul>
/* MessagePortCallback instance */
function onreceived(data, remoteMsgPort)
{
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
}
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);\r
\r
\r
- void uninstall(<a href="#PackageId">PackageId</a> id, \r
+ void uninstall(<a href="#PackageId">PackageId</a> id,\r
<a href="#PackageProgressCallback">PackageProgressCallback</a> progressCallback,\r
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);\r
\r
\r
\r
void setPackageInfoEventListener(<a href="#PackageInformationEventCallback">PackageInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);\r
- \r
+\r
\r
void unsetPackageInfoEventListener() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);\r
- \r
+\r
};</pre>
<p><span class="version">
Since: </span>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">packageFileURI</span>:
+<span class="name">packageFileURI</span>:
The location of the package to install
</li>
<li class="param">
-<span class="name">progressCallback</span>:
+<span class="name">progressCallback</span>:
The method to invoke when the installation is in progress or has been completed
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var onInstallation =
{
- onprogress: function(packageId, percentage)
- {
- console.log("On installation(" + packageId + "): progress(" + percentage + ")");
- },
- oncomplete: function(packageId)
- {
- console.log("Installation(" + packageId + ") Complete");
- }
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On installation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Installation(" + packageId + ") Complete");
+ }
}
var onError = function(err)
{
- console.log("Error occurred on installation: " + err.name);
+ console.log("Error occurred on installation: " + err.name);
}
/* Let's assume that the "test.wgt" file exists in the downloads directory */
tizen.filesystem.resolve("downloads/test.wgt", function(file)
{
- console.log("file URI: " + file.toURI());
- tizen.package.install(file.toURI(), onInstallation, onError);
+ console.log("file URI: " + file.toURI());
+ tizen.package.install(file.toURI(), onInstallation, onError);
}, function(err)
{
- console.log("Error occurred on resolve: " + err.name);
+ console.log("Error occurred on resolve: " + err.name);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID to uninstall
</li>
<li class="param">
-<span class="name">progressCallback</span>:
+<span class="name">progressCallback</span>:
The method to invoke when uninstallation is in progress or has been completed
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var onUninstallation =
{
- onprogress: function(packageId, percentage)
- {
- console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
- },
- oncomplete: function(packageId)
- {
- console.log("Uninstallation(" + packageId + ") Complete");
- }
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Uninstallation(" + packageId + ") Complete");
+ }
};
var onError = function(err)
{
- console.log("Error occurred on installation: " + err.name);
+ console.log("Error occurred on installation: " + err.name);
};
/* Let's assume that the package ID to uninstall is "testapp001" */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when an invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledPackages(packages)
{
- for (var i = 0; i < packages.length; i++)
- {
- console.log("Package id[" + i + "]: " + packages[i].id);
- }
+ for (var i = 0; i < packages.length; i++)
+ {
+ console.log("Package id[" + i + "]: " + packages[i].id);
+ }
}
tizen.package.getPackagesInfo(onListInstalledPackages, function(err)
{
- console.log("Can't obtain packages list" + err.name);
+ console.log("Can't obtain packages list" + err.name);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing the package ID. If the ID is not provided, the package information of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">eventCallback</span>:
+<span class="name">eventCallback</span>:
The method to be called when any change is made to the list of installed packages.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var packageEventCallback =
{
- oninstalled: function(packageInfo)
- {
- console.log('The package ' + packageInfo.name + ' is installed');
- },
- onupdated: function(packageInfo)
- {
- console.log('The package ' + packageInfo.name + ' is updated');
- },
- onuninstalled: function(packageId)
- {
- console.log('The package ' + packageId + ' is uninstalled');
- }
+ oninstalled: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is installed');
+ },
+ onupdated: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is updated');
+ },
+ onuninstalled: function(packageId)
+ {
+ console.log('The package ' + packageId + ' is uninstalled');
+ }
};
tizen.package.setPackageInfoEventListener(packageEventCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed packages' information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID
</li>
<li class="param">
-<span class="name">progress</span>:
+<span class="name">progress</span>:
The progress in percentage.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The information of the installed package
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The information of the updated package
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the uninstalled package
</li>
</ul>
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);\r
\r
\r
- void uninstall(<a href="#PackageId">PackageId</a> id, \r
+ void uninstall(<a href="#PackageId">PackageId</a> id,\r
<a href="#PackageProgressCallback">PackageProgressCallback</a> progressCallback,\r
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);\r
\r
\r
\r
void setPackageInfoEventListener(<a href="#PackageInformationEventCallback">PackageInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);\r
- \r
+\r
\r
void unsetPackageInfoEventListener() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);\r
- \r
+\r
};\r
\r
\r
<div class="memitem">
<div class="memproto" style="border-bottom: 1px solid #A8B8D9; height: 15px;">
<div class="memname" style="float: right;">
-<a href="javascript:divallshow(true)" class="el">All Expand</a>
-<a href="javascript:divallshow(false)" class="el">All Collapse</a>
+<a href="javascript:divallshow(true)" class="el">All Expand</a>
+<a href="javascript:divallshow(false)" class="el">All Collapse</a>
</div>
</div>
</div>
<center>
<small>Except as noted, this content - excluding the Code Examples - is licensed under <a
href="http://creativecommons.org/licenses/by/3.0/legalcode">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a
- href="https://www.tizen.org/bsd-3-clause-license">BSD-3-Clause</a>. For details, see the <a href="https://www.tizen.org/content-license">Content License</a>. </small>
+ href="https://www.tizen.org/bsd-3-clause-license">BSD-3-Clause</a>. For details, see the <a href="https://www.tizen.org/content-license">Content License</a>. </small>
</center>
<script type="text/javascript">
<div class="memitem">
<div class="memproto" style="border-bottom: 1px solid #A8B8D9; height: 15px;">
<div class="memname" style="float: right;">
-<a href="javascript:divallshow(true)" class="el">All Expand</a>
-<a href="javascript:divallshow(false)" class="el">All Collapse</a>
+<a href="javascript:divallshow(true)" class="el">All Expand</a>
+<a href="javascript:divallshow(false)" class="el">All Collapse</a>
</div>
</div>
</div>
<center>
<small>Except as noted, this content - excluding the Code Examples - is licensed under <a
href="http://creativecommons.org/licenses/by/3.0/legalcode">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a
- href="https://www.tizen.org/bsd-3-clause-license">BSD-3-Clause</a>. For details, see the <a href="https://www.tizen.org/content-license">Content License</a>. </small>
+ href="https://www.tizen.org/bsd-3-clause-license">BSD-3-Clause</a>. For details, see the <a href="https://www.tizen.org/content-license">Content License</a>. </small>
</center>
<script type="text/javascript">
deviceCapabilities = tizen.systeminfo.getCapabilities();
if (deviceCapabilities.bluetooth)
{
- console.log("Bluetooth is supported");
+ console.log("Bluetooth is supported");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Checks if a device supports bluetooth API */
- var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
- console.log(" Bluetooth = " + bluetooth);
+ /* Checks if a device supports bluetooth API */
+ var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
+ console.log(" Bluetooth = " + bluetooth);
}
catch (error)
{
- console.log("Error name: " + error.name + ", message: " + error.message);
+ console.log("Error name: " + error.name + ", message: " + error.message);
}
</pre>
</div>
var count = tizen.systeminfo.getCount("SIM");
if (count === 0)
{
- console.log("There is no available SIM card.");
+ console.log("There is no available SIM card.");
}
else
{
- console.log("There is(are) " + count + " SIM card(s) available.");
+ console.log("There is(are) " + count + " SIM card(s) available.");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cpu)
{
- console.log("The cpu load is " + cpu.load);
+ console.log("The cpu load is " + cpu.load);
}
function onErrorCallback(error)
{
- console.log("An error occurred " + error.message);
+ console.log("An error occurred " + error.message);
}
tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cellular)
{
- console.log("The status of the cellular network is " + cellular.status);
+ console.log("The status of the cellular network is " + cellular.status);
}
function onErrorCallback(error)
{
- console.log("An error occurred " + error.message);
- /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
+ console.log("An error occurred " + error.message);
+ /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
}
var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
if (telephony_capability === true)
{
- /* onSuccessCallback will be invoked */
- tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
+ /* onSuccessCallback will be invoked */
+ tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
}
else
{
- console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
+ console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(property)
{
- console.log("The SIM's current state is " + property.state);
+ console.log("The SIM's current state is " + property.state);
}
function successArrayCB(properties)
{
- console.log("The number of the returned system properties is " + properties.length);
- for (var i = 0; i < properties.length; i++)
- {
- console.log("[" + i + "] SIM's state is " + properties[i].state);
- }
+ console.log("The number of the returned system properties is " + properties.length);
+ for (var i = 0; i < properties.length; i++)
+ {
+ console.log("[" + i + "] SIM's state is " + properties[i].state);
+ }
}
var count = tizen.systeminfo.getCount("SIM");
if (count === 0)
{
- console.log("This device does not provide SIM card.");
+ console.log("This device does not provide SIM card.");
}
else if (count > 1)
{
- tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
+ tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
}
else
{
- tizen.systeminfo.getPropertyValue("SIM", successCB);
+ tizen.systeminfo.getPropertyValue("SIM", successCB);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cpu)
{
- console.log("The cpu load: " + cpu.load);
+ console.log("The cpu load: " + cpu.load);
}
tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2});
var id = null;
function onSuccessCallback(cpu)
{
- console.log("New value for CPU load is " + cpu.load);
- if (id != null)
- {
- /* After receiving the first notification, clear it */
- tizen.systeminfo.removePropertyValueChangeListener(id);
- }
+ console.log("New value for CPU load is " + cpu.load);
+ if (id != null)
+ {
+ /* After receiving the first notification, clear it */
+ tizen.systeminfo.removePropertyValueChangeListener(id);
+ }
}
id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
{
- console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
+ console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
}, function(error)
{
- console.log("Error, name: " + error.name + ", message: " + error.message);
+ console.log("Error, name: " + error.name + ", message: " + error.message);
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
{
- try
- {
- flash.setBrightness(1);
- }
- catch (error)
- {
- console.log("Setting flash brightness failed: " + error.message);
- }
+ try
+ {
+ flash.setBrightness(1);
+ }
+ catch (error)
+ {
+ console.log("Setting flash brightness failed: " + error.message);
+ }
}, function(error)
{
- console.log("Error, name: " + error.name + ", message: " + error.message);
+ console.log("Error, name: " + error.name + ", message: " + error.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">shortformat</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">shortformat</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The flag indicating whether the user is interested in the short
date format (23/10/2011) instead of a long date format ("Monday, October 23 2011") <br>By default, this attribute is set to false.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
The year to check
</li>
</ul>
var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
if (is_leap)
{
- console.log("This year is a leap year.");
+ console.log("This year is a leap year.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changeCallback</span>:
+<span class="name">changeCallback</span>:
Callback method to be invoked when device time was set <br>It is not invoked when time passes naturally.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setDateTimeChangeListener(changedCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- tizen.time.unsetDateTimeChangeListener();
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ tizen.time.unsetDateTimeChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setDateTimeChangeListener(changedCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changeCallback</span>:
+<span class="name">changeCallback</span>:
Callback method that is invoked when the time zone has changed
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setTimezoneChangeListener(changedCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- tizen.time.unsetTimezoneChangeListener();
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ tizen.time.unsetTimezoneChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setTimezoneChangeListener(changedCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
Date to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
Year to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">hours</span>:
+<span class="name">hours</span>:
Hours to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ms</span>:
+<span class="name">ms</span>:
Milliseconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">minutes</span>:
+<span class="name">minutes</span>:
Minutes to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">month</span>:
+<span class="name">month</span>:
Month to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">seconds</span>:
+<span class="name">seconds</span>:
Seconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
Date to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
Year to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">hours</span>:
+<span class="name">hours</span>:
Hours to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ms</span>:
+<span class="name">ms</span>:
Milliseconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">minutes</span>:
+<span class="name">minutes</span>:
Minutes to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">month</span>:
+<span class="name">month</span>:
Month to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">seconds</span>:
+<span class="name">seconds</span>:
Seconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">tzid</span>:
+<span class="name">tzid</span>:
Timezone identifier to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">duration</span>:
+<span class="name">duration</span>:
TimeDuration to add
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
/* Computes event1.duration - event2.duration */
var diff = event1.duration.difference(event2.duration);
if (diff.length > 0)
- console.log("The event1 is longer than event2.");
+ console.log("The event1 is longer than event2.");
else if (diff.length == 0)
- console.log("The duration of two events is same.");
+ console.log("The duration of two events is same.");
else
- console.log("The event1 is shorter than the event2.");
+ console.log("The event1 is shorter than the event2.");
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
the Tizen Web Device API is instantiated (<em>window.tizen</em>).
</p>
<p>
-For more information on the Tizen features, see <a href="../../org.tizen.mobile.web.appprogramming/html/guide/tizen_guide/tizen.htm">Tizen Guide</a>.
+For more information on the Tizen features, see <a href="../../org.tizen.mobile.web.appprogramming/html/guide/tizen_guide/tizen.htm">Tizen Guide</a>.
</p>
</div>
<p><span class="version">
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The Joshua Tree:' + contents.length);
+ console.log('The Joshua Tree:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AttributeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AttributeFilter(DOMString attributeName, optional <a href="#FilterMatchFlag">FilterMatchFlag</a>? matchFlag, optional any matchValue);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The contents modified today:' + contents.length);
+ console.log('The contents modified today:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AttributeRangeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AttributeRangeFilter(DOMString attributeName, optional any initialValue, optional any endValue);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:' + contents.length);
+ console.log('The Joshua Tree by U2:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="CompositeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">CompositeFilter(<a href="#CompositeFilterType">CompositeFilterType</a> type, optional <a href="#AbstractFilter">AbstractFilter</a>[]? filters);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printContent(content, index, contents)
{
- console.log('Track: ' + content.trackNumber + ' Title: ' + content.title + 'Duration: ' + content.duration +
- 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
+ console.log('Track: ' + content.trackNumber + ' Title: ' + content.title + 'Duration: ' + content.duration +
+ 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:');
- contents.forEach(printContent);
- /* Increase the offset as much as the count and then find content again */
- if (contents.length == count)
- {
- offset += count;
- tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
- }
+ console.log('The Joshua Tree by U2:');
+ contents.forEach(printContent);
+ /* Increase the offset as much as the count and then find content again */
+ if (contents.length == count)
+ {
+ offset += count;
+ tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
+ }
}
tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
readonly attribute DOMString message;
const unsigned short INDEX_SIZE_ERR = 1;
- const unsigned short DOMSTRING_SIZE_ERR = 2;
+ const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
- const unsigned short NO_DATA_ALLOWED_ERR = 6;
+ const unsigned short NO_DATA_ALLOWED_ERR = 6;
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
- const unsigned short INUSE_ATTRIBUTE_ERR = 10;
+ const unsigned short INUSE_ATTRIBUTE_ERR = 10;
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short SYNTAX_ERR = 12;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short NAMESPACE_ERR = 14;
const unsigned short INVALID_ACCESS_ERR = 15;
- const unsigned short VALIDATION_ERR = 16;
+ const unsigned short VALIDATION_ERR = 16;
const unsigned short TYPE_MISMATCH_ERR = 17;
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess()
{
- console.log("Application launched successfully");
+ console.log("Application launched successfully");
}
tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
</pre>
/* Define the error callback */
function onerror(error)
{
- console.log(error.message);
+ console.log(error.message);
}
function onsuccess()
{
- console.log("The application has launched successfully");
+ console.log("The application has launched successfully");
}
tizen.application.launch("targetApp0.main", onsuccess, onerror);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Generic error.
</li>
</ul>
readonly attribute DOMString message;
const unsigned short INDEX_SIZE_ERR = 1;
- const unsigned short DOMSTRING_SIZE_ERR = 2;
+ const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
- const unsigned short NO_DATA_ALLOWED_ERR = 6;
+ const unsigned short NO_DATA_ALLOWED_ERR = 6;
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
- const unsigned short INUSE_ATTRIBUTE_ERR = 10;
+ const unsigned short INUSE_ATTRIBUTE_ERR = 10;
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short SYNTAX_ERR = 12;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short NAMESPACE_ERR = 14;
const unsigned short INVALID_ACCESS_ERR = 15;
- const unsigned short VALIDATION_ERR = 16;
+ const unsigned short VALIDATION_ERR = 16;
const unsigned short TYPE_MISMATCH_ERR = 17;
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mute</span>:
+<span class="name">mute</span>:
The mute state (true = turn on the silent mode, false = turn off the silent mode)
</li>
</ul>
/* Check if it is mute */
if (tizen.tvaudiocontrol.isMute())
{
- console.log("At this moment, the sound output of this device is turned off.");
+ console.log("At this moment, the sound output of this device is turned off.");
}
else
{
- alert("It's not possible!");
+ alert("It's not possible!");
}
</pre>
</div>
/* Check if it is mute */
if (tizen.tvaudiocontrol.isMute())
{
- alert("It's not possible! (API bug)");
+ alert("It's not possible! (API bug)");
}
else
{
- console.log("setVolumeUp() turns off the silent mode.");
+ console.log("setVolumeUp() turns off the silent mode.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
The volume (the available volume range is 0 ~100)
</li>
</ul>
try
{
- tizen.tvaudiocontrol.setVolume(-1);
+ tizen.tvaudiocontrol.setVolume(-1);
}
catch (e)
{
- if (e.name === "InvalidValuesError")
- {
- alert("The passed value value should be in the range of 0 to 100.");
- }
+ if (e.name === "InvalidValuesError")
+ {
+ alert("The passed value value should be in the range of 0 to 100.");
+ }
}
</pre>
</div>
/* Check if the current volume is 100 */
if (tizen.tvaudiocontrol.getVolume() === 100)
{
- alert("setVolumeUp() is successfully called.");
+ alert("setVolumeUp() is successfully called.");
}
tizen.tvaudiocontrol.setVolumeUp();
/* Check if the volume level has been changed at the maximum volume level */
if (tizen.tvaudiocontrol.getVolume() === 100)
{
- alert("setVolumeUp() is successfully called.");
+ alert("setVolumeUp() is successfully called.");
}
</pre>
</div>
/* Check if the current volume is 0 */
if (tizen.tvaudiocontrol.getVolume() === 0)
{
- alert("setVolumeDown() is successfully called.");
+ alert("setVolumeDown() is successfully called.");
}
tizen.tvaudiocontrol.setVolumeDown();
/* Check if the volume level has been changed at the minimum volume level */
if (tizen.tvaudiocontrol.getVolume() === 0)
{
- alert("setVolumeDown() is successfully called.");
+ alert("setVolumeDown() is successfully called.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
The method to invoke when the volume has been changed. It will not be triggered when the silent mode is changed.
</li>
</ul>
function onVolumeChanged(volume)
{
- if (volume === expectedVolumeLevel)
- {
- console.log("Succeeded! The volume level has been changed to " + volume + ". ");
- }
- else
- {
- alert("Failed. The volume level has been changed to " + volume + ". We expect 50.");
- }
+ if (volume === expectedVolumeLevel)
+ {
+ console.log("Succeeded! The volume level has been changed to " + volume + ". ");
+ }
+ else
+ {
+ alert("Failed. The volume level has been changed to " + volume + ". We expect 50.");
+ }
}
tizen.tvaudiocontrol.setVolume(0);
function onVolumeChanged(volume)
{
- alert("This function must not be called.");
+ alert("This function must not be called.");
}
tizen.tvaudiocontrol.setVolume(0);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The beep type to play
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
The changed volume
</li>
</ul>
<a href="#FavoriteList">FavoriteList</a>[] getFavorites() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
<a href="#BroadcastStandard">BroadcastStandard</a> getBroadcastStandard(optional <a href="tvwindow.html#WindowType">WindowType</a>? type) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};</pre>
<p><span class="version">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">tuneOption</span>:
+<span class="name">tuneOption</span>:
The tuning option. By default, this attribute is set to <b>null</b>.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the tunning operation is completed successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type. By default, this attribute is set to <var>MAIN</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var tuneCB =
{
- onsuccess: function()
- {
- console.log("Tune() is successfully done. And there is a signal.");
- }
- onnosignal: function()
- {
- console.log("Tune() is successfully done. But there is no signal.");
- }
+ onsuccess: function()
+ {
+ console.log("Tune() is successfully done. And there is a signal.");
+ }
+ onnosignal: function()
+ {
+ console.log("Tune() is successfully done. But there is no signal.");
+ }
};
function channelCB(channels)
{
- console.log("getting channels is successful. " + channels.length + " channels are retrieved.");
- if (channels.length === 0)
- {
- console.log("There is no found channel.");
-
- return;
- }
- try
- {
- tizen.tvchannel.tune({major: channels[0].major}, tuneCB);
- }
- catch (error)
- {
- console.log("Error name = " + error.name + ", Error message = " + error.message);
- }
+ console.log("getting channels is successful. " + channels.length + " channels are retrieved.");
+ if (channels.length === 0)
+ {
+ console.log("There is no found channel.");
+
+ return;
+ }
+ try
+ {
+ tizen.tvchannel.tune({major: channels[0].major}, tuneCB);
+ }
+ catch (error)
+ {
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
+ }
}
function errorCB(error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
try
{
- /* Requests to get information about 10 channels */
- tizen.tvchannel.getChannelList(channelCB, errorCB, "ALL", 0, 10);
+ /* Requests to get information about 10 channels */
+ tizen.tvchannel.getChannelList(channelCB, errorCB, "ALL", 0, 10);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the tunning operation is completed successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">tuneMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">tuneMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The tuning navigation mode. By default, this attribute is set to <var>ALL</var>.
</li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type. By default, this attribute is set to <var>MAIN</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var tuneCB =
{
- onsuccess: function()
- {
- console.log("tuneUp() is successfully done. And there is a signal.");
- }
- onnosignal: function()
- {
- console.log("tuneUp() is successfully done. But there is no signal.");
- }
+ onsuccess: function()
+ {
+ console.log("tuneUp() is successfully done. And there is a signal.");
+ }
+ onnosignal: function()
+ {
+ console.log("tuneUp() is successfully done. But there is no signal.");
+ }
};
try
{
- tizen.tvchannel.tuneUp(tuneCB, null, "ALL");
+ tizen.tvchannel.tuneUp(tuneCB, null, "ALL");
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the tunning operation is completed successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">tuneMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">tuneMode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The tuning navigation mode. By default, this attribute is set to <var>ALL</var>.
</li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type. By default, this attribute is set to <var>MAIN</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var tuneCB =
{
- onsuccess: function()
- {
- console.log("tuneDown() is successfully done. And there is a signal.");
- }
- onnosignal: function()
- {
- console.log("tuneDown() is successfully done. But there is no signal.");
- }
+ onsuccess: function()
+ {
+ console.log("tuneDown() is successfully done. And there is a signal.");
+ }
+ onnosignal: function()
+ {
+ console.log("tuneDown() is successfully done. But there is no signal.");
+ }
};
try
{
- /* Change the channel down according to 'ALL' navigation mode */
- tizen.tvchannel.tuneDown(tuneCB);
+ /* Change the channel down according to 'ALL' navigation mode */
+ tizen.tvchannel.tuneDown(tuneCB);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">major</span>:
+<span class="name">major</span>:
The major channel number
</li>
<li class="param">
-<span class="name">minor</span>:
+<span class="name">minor</span>:
The minor channel number
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the channel searching is done successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(channels)
{
- console.log("findChannel() is successfully done. Totally " + channels.length + " channels are found.");
- for (var i = 0; i < channels.length; i++)
- {
- console.log("----- Channel [" + i + "] -----");
- console.log("Major channel = " + channels[i].major);
- console.log("Minor channel = " + channels[i].minor);
- console.log("Channel Name = " + channels[i].channelName);
- console.log("Program Number = " + channels[i].programNumber);
- /* You can get other attributes provided in ChannelInfo */
- }
+ console.log("findChannel() is successfully done. Totally " + channels.length + " channels are found.");
+ for (var i = 0; i < channels.length; i++)
+ {
+ console.log("----- Channel [" + i + "] -----");
+ console.log("Major channel = " + channels[i].major);
+ console.log("Minor channel = " + channels[i].minor);
+ console.log("Channel Name = " + channels[i].channelName);
+ console.log("Program Number = " + channels[i].programNumber);
+ /* You can get other attributes provided in ChannelInfo */
+ }
}
try
{
- tizen.tvchannel.findChannel(9, 0, successCB);
+ tizen.tvchannel.findChannel(9, 0, successCB);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when a list of tv channels is retrieved successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The channel navigation mode. By default, this attribute is set to <var>ALL</var>.
</li>
<li class="param">
-<span class="name">nStart</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">nStart</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The starting index. By default, this attribute is set to <var>0</var>.
<br> If <var>nStart</var> is a negative number, InvalidValuesError will occur.
</li>
<li class="param">
-<span class="name">number</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">number</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The number of the channel informations to retrieve. Without <var>number</var>, all vailable channel informations will be retrieved.
<br> If <var>number</var> is a negative number, InvalidValuesError will occur.
</li>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(channels)
{
- console.log("getChannelList() is successfully done. Totally " + channels.length + " channels are retrieved.");
- for (var i = 0; i < channels.length; i++)
- {
- console.log("----- Channel [" + i + "] -----");
- console.log("Major channel = " + channels[i].major);
- console.log("Minor channel = " + channels[i].minor);
- console.log("Channel Name = " + channels[i].channelName);
- console.log("Program Number = " + channels[i].programNumber);
- /* You can get other attributes provided in ChannelInfo */
- }
+ console.log("getChannelList() is successfully done. Totally " + channels.length + " channels are retrieved.");
+ for (var i = 0; i < channels.length; i++)
+ {
+ console.log("----- Channel [" + i + "] -----");
+ console.log("Major channel = " + channels[i].major);
+ console.log("Minor channel = " + channels[i].minor);
+ console.log("Channel Name = " + channels[i].channelName);
+ console.log("Program Number = " + channels[i].programNumber);
+ /* You can get other attributes provided in ChannelInfo */
+ }
}
try
{
- /* Gets 10 channel information among all channels */
- tizen.tvchannel.getChannelList(successCB, null, "ALL", 0, 10);
+ /* Gets 10 channel information among all channels */
+ tizen.tvchannel.getChannelList(successCB, null, "ALL", 0, 10);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(channels)
{
- console.log("getChannelList() is successfully done. Totally " + channels.length + " channels are retrieved.");
- for (var i = 0; i < channels.length; i++)
- {
- console.log("----- Channel [" + i + "] -----");
- console.log("Major channel = " + channels[i].major);
- console.log("Minor channel = " + channels[i].minor);
- console.log("Channel Name = " + channels[i].channelName);
- console.log("Program Number = " + channels[i].programNumber);
- /* You can get other attributes provided in ChannelInfo */
- }
+ console.log("getChannelList() is successfully done. Totally " + channels.length + " channels are retrieved.");
+ for (var i = 0; i < channels.length; i++)
+ {
+ console.log("----- Channel [" + i + "] -----");
+ console.log("Major channel = " + channels[i].major);
+ console.log("Minor channel = " + channels[i].minor);
+ console.log("Channel Name = " + channels[i].channelName);
+ console.log("Program Number = " + channels[i].programNumber);
+ /* You can get other attributes provided in ChannelInfo */
+ }
}
try
{
- /* Gets one digital channel */
- tizen.tvchannel.getChannelList(successCB, null, "DIGITAL", 0, 1);
+ /* Gets one digital channel */
+ tizen.tvchannel.getChannelList(successCB, null, "DIGITAL", 0, 1);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type. By default, this attribute is set to <var>MAIN</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var channel = tizen.tvchannel.getCurrentChannel();
- console.log("The current channel name is " + channel.channelName);
- console.log("The current channel's major number is " + channel.major);
+ var channel = tizen.tvchannel.getCurrentChannel();
+ console.log("The current channel name is " + channel.channelName);
+ console.log("The current channel's major number is " + channel.major);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channelInfo</span>:
+<span class="name">channelInfo</span>:
The channel
</li>
<li class="param">
-<span class="name">startTime</span>:
+<span class="name">startTime</span>:
The starting time to search programs.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when a list of programs is retrieved successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">duration</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">duration</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The duration to search programs.(unit: hour) Without <var>duration</var> value, all available program informations are retrieved.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function programListCB(programInfos)
{
- console.log("getting all available programs is successfully retrieved.");
- for (var i = 0; i < programInfos.length; i++)
- {
- console.log("--------------- Program " + i + " ---------------");
- console.log("title = " + programInfos[i].title);
- console.log("duration = " + programInfos[i].duration);
- /* You can get other attributes in the retrieved ProgramInfo objects */
- }
+ console.log("getting all available programs is successfully retrieved.");
+ for (var i = 0; i < programInfos.length; i++)
+ {
+ console.log("--------------- Program " + i + " ---------------");
+ console.log("title = " + programInfos[i].title);
+ console.log("duration = " + programInfos[i].duration);
+ /* You can get other attributes in the retrieved ProgramInfo objects */
+ }
}
try
{
- var channel = tizen.tvchannel.getCurrentChannel();
- /* Get all available program information */
- tizen.tvchannel.getProgramList(channel, tizen.time.getCurrentDateTime(), programListCB);
+ var channel = tizen.tvchannel.getCurrentChannel();
+ /* Get all available program information */
+ tizen.tvchannel.getProgramList(channel, tizen.time.getCurrentDateTime(), programListCB);
}
catch (error)
{
- console.log(error.name);
+ console.log(error.name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type. By default, this attribute is set to <var>MAIN</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var program = tizen.tvchannel.getCurrentProgram();
- console.log("The current program is titled " + program.title);
+ var program = tizen.tvchannel.getCurrentProgram();
+ console.log("The current program is titled " + program.title);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
The method to invoke when the channel has been changed
</li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type. By default, this attribute is set to <var>MAIN</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function channelChangeCB(channelInfo, type)
{
- console.log("Switched to the new channel (major = " + channelInfo.major + ", minor = " + channelInfo.minor +
- ", channel name = " + channelInfo.channelName);
+ console.log("Switched to the new channel (major = " + channelInfo.major + ", minor = " + channelInfo.minor +
+ ", channel name = " + channelInfo.channelName);
}
try
{
- var channelListenerID = tizen.tvchannel.addChannelChangeListener(channelChangeCB);
+ var channelListenerID = tizen.tvchannel.addChannelChangeListener(channelChangeCB);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channelListenerId</span>:
+<span class="name">channelListenerId</span>:
The identifier of the listener for channel changes
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
The method to invoke when the signal state has been changed
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function signalStateChangeCB(state)
{
- console.log("Signal state changed to: " + state);
+ console.log("Signal state changed to: " + state);
}
try
{
- var signalStateChangeListenerID = tizen.tvchannel.addSignalStateChangeListener(signalStateChangeCB);
+ var signalStateChangeListenerID = tizen.tvchannel.addSignalStateChangeListener(signalStateChangeCB);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">signalListenerId</span>:
+<span class="name">signalListenerId</span>:
The identifier of the listener for signal state changes
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var favorites = tizen.tvchannel.getFavorites();
- for (var i = 0; i < favorites.length; ++i)
- {
- console.log("Favorite id: " + favorites[i].id);
- }
+ var favorites = tizen.tvchannel.getFavorites();
+ for (var i = 0; i < favorites.length; ++i)
+ {
+ console.log("Favorite id: " + favorites[i].id);
+ }
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type. By default, this attribute is set to <var>MAIN</var>.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">programInfos</span>:
+<span class="name">programInfos</span>:
A list of TV program informations of a channel
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channelInfos</span>:
+<span class="name">channelInfos</span>:
A list of channel Informations
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channelInfo</span>:
+<span class="name">channelInfo</span>:
The switched channel information
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The window type
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
The changed signal state.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channel</span>:
+<span class="name">channel</span>:
The tuned channel information
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The window type
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">program</span>:
+<span class="name">program</span>:
the information about program on offer from The tuned channel
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The window type
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channel</span>:
+<span class="name">channel</span>:
The channel to add.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the channel is added successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var favorites = tizen.tvchannel.getFavorites();
- var channel = tizen.tvchannel.getCurrentChannel();
- favorites[0].addChannel(channel, function()
- {
- console.log("Channel added");
- }, function(error)
- {
- console.log("Error callback: name = " + error.name + ", Error message = " + error.message);
- });
+ var favorites = tizen.tvchannel.getFavorites();
+ var channel = tizen.tvchannel.getCurrentChannel();
+ favorites[0].addChannel(channel, function()
+ {
+ console.log("Channel added");
+ }, function(error)
+ {
+ console.log("Error callback: name = " + error.name + ", Error message = " + error.message);
+ });
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channel</span>:
+<span class="name">channel</span>:
The channel to remove.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the channel is removed successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var favorites = tizen.tvchannel.getFavorites();
- var channel = tizen.tvchannel.getCurrentChannel();
- favorites[0].removeChannel(channel, function()
- {
- console.log("Channel removed");
- }, function(error)
- {
- console.log("Error callback: name = " + error.name + ", Error message = " + error.message);
- });
+ var favorites = tizen.tvchannel.getFavorites();
+ var channel = tizen.tvchannel.getCurrentChannel();
+ favorites[0].removeChannel(channel, function()
+ {
+ console.log("Channel removed");
+ }, function(error)
+ {
+ console.log("Error callback: name = " + error.name + ", Error message = " + error.message);
+ });
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when a list of TV channels is retrieved successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">nStart</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">nStart</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The starting index. By default, this attribute is set to <var>0</var>.
<br> If <var>nStart</var> is a negative number, the InvalidValuesError exception will occur
</li>
<li class="param">
-<span class="name">number</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">number</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The number of channels to retrieve. Without <var>number</var>, all channels in the favorite list will be retrieved..
<br> A negative nStart will cause InvalidValuesError.
</li>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(channels)
{
- console.log("Totally " + channels.length + " channels are retrieved.");
- for (var i = 0; i < channels.length; i++)
- {
- console.log("----- Channel [" + i + "] -----");
- console.log("Major channel = " + channels[i].major);
- console.log("Minor channel = " + channels[i].minor);
- console.log("Channel Name = " + channels[i].channelName);
- console.log("Program Number = " + channels[i].programNumber);
- /* You can get other attributes provided in ChannelInfo */
- }
+ console.log("Totally " + channels.length + " channels are retrieved.");
+ for (var i = 0; i < channels.length; i++)
+ {
+ console.log("----- Channel [" + i + "] -----");
+ console.log("Major channel = " + channels[i].major);
+ console.log("Minor channel = " + channels[i].minor);
+ console.log("Channel Name = " + channels[i].channelName);
+ console.log("Program Number = " + channels[i].programNumber);
+ /* You can get other attributes provided in ChannelInfo */
+ }
}
try
{
- var favorites = tizen.tvchannel.getFavorites();
- /* Gets channel information for 10 channels */
- favorites[0].getChannels(successCB, null, 0, 10);
+ var favorites = tizen.tvchannel.getFavorites();
+ /* Gets channel information for 10 channels */
+ favorites[0].getChannels(successCB, null, 0, 10);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<a href="#FavoriteList">FavoriteList</a>[] getFavorites() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
<a href="#BroadcastStandard">BroadcastStandard</a> getBroadcastStandard(optional <a href="tvwindow.html#WindowType">WindowType</a>? type) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var current3Dmode = tizen.tvdisplaycontrol.get3DEffectMode()
- console.log("The current 3D mode is " + current3Dmode + ".");
+ var current3Dmode = tizen.tvdisplaycontrol.get3DEffectMode()
+ console.log("The current 3D mode is " + current3Dmode + ".");
}
catch (error)
{
- console.log(error.name);
+ console.log(error.name);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- if (tizen.tvdisplaycontrol.is3DModeEnabled() === "NOT_SUPPORTED")
- {
- console.log("The current device does not support 3D mode.");
- }
- else if (tizen.tvdisplaycontrol.is3DModeEnabled() === "READY")
- {
- console.log("The current device supports 3D mode and can display 3D contents. Maybe it is a 3D TV device or is connected with 3D display device.");
- }
- else
- {
- console.log("The current device supports 3D mode but cannot display 3D contents. It may be a 3D Blu-ray player device which is not connected with 3D display device.");
- }
+ if (tizen.tvdisplaycontrol.is3DModeEnabled() === "NOT_SUPPORTED")
+ {
+ console.log("The current device does not support 3D mode.");
+ }
+ else if (tizen.tvdisplaycontrol.is3DModeEnabled() === "READY")
+ {
+ console.log("The current device supports 3D mode and can display 3D contents. Maybe it is a 3D TV device or is connected with 3D display device.");
+ }
+ else
+ {
+ console.log("The current device supports 3D mode but cannot display 3D contents. It may be a 3D Blu-ray player device which is not connected with 3D display device.");
+ }
}
catch (error)
{
- console.log(error.name);
+ console.log(error.name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when a list of supported 3D modes is retrieved successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(effects)
{
- for (var i = 0; i < effects.length; ++i)
- {
- console.log(effects[i] + ": this mode is supported on a device.");
- }
+ for (var i = 0; i < effects.length; ++i)
+ {
+ console.log(effects[i] + ": this mode is supported on a device.");
+ }
}
function errorCB(error)
{
- console.log("An error occurs when getSupported3DEffectModeList() is invoked. Error(name: "
- + error.name + " , message: " + error.message + ")");
+ console.log("An error occurs when getSupported3DEffectModeList() is invoked. Error(name: "
+ + error.name + " , message: " + error.message + ")");
}
try
{
- tizen.tvdisplaycontrol.getSupported3DEffectModeList(successCB, errorCB);
+ tizen.tvdisplaycontrol.getSupported3DEffectModeList(successCB, errorCB);
}
catch (error)
{
- console.log(error.name);
+ console.log(error.name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode3DEffects</span>:
+<span class="name">mode3DEffects</span>:
A list of supported 3D effect modes
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
Caption menu key which changes will be observed by this listener
</li>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback method to be invoked when the value changes
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var id = tizen.tvinfo.addCaptionValueChangeListener("CAPTION_ONOFF_KEY", function(value)
{
- console.log("Caption menu state changed: " + value);
+ console.log("Caption menu state changed: " + value);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Identifier of the subscription returned by addCaptionValueChangeListener()
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
Watched key.
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
New value of watched key.
</li>
</ul>
supportedKeys = tizen.tvinputdevice.getSupportedKeys();
for (i = 0; i < supportedKeys.length; i++)
{
- keyCode[supportedKeys[i].name] = supportedKeys[i].code;
+ keyCode[supportedKeys[i].name] = supportedKeys[i].code;
}
if (keyCode.hasOwnProperty("ChannelUp"))
{
- tizen.tvinputdevice.registerKey("ChannelUp");
+ tizen.tvinputdevice.registerKey("ChannelUp");
}
window.addEventListener("keydown", function(keyEvent)
{
- /* Identify the key by the numeric code from the keyEvent */
- if (keyEvent.keyCode === keyCode.ChannelUp)
- {
- console.log("The CHANNEL UP was pressed");
- }
+ /* Identify the key by the numeric code from the keyEvent */
+ if (keyEvent.keyCode === keyCode.ChannelUp)
+ {
+ console.log("The CHANNEL UP was pressed");
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key to retrieve
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key which should generate DOM key events when pressed
</li>
</ul>
var keys = ["VolumeUp", "VolumeDown"], i;
for (i = 0; i < keys.length; i++)
{
- try
- {
- tizen.tvinputdevice.registerKey(keys[i]);
- }
- catch (error)
- {
- console.log("failed to register " + keys[i] + ": " + error);
- }
+ try
+ {
+ tizen.tvinputdevice.registerKey(keys[i]);
+ }
+ catch (error)
+ {
+ console.log("failed to register " + keys[i] + ": " + error);
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key which should not be monitored any longer
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyNames</span>:
+<span class="name">keyNames</span>:
The array with the names of the keys which will generate DOM key events when they are pressed
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when keys are registered
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Registered successfully');
+ console.log('Registered successfully');
}
var keys = ["VolumeUp", "VolumeDown"];
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyNames</span>:
+<span class="name">keyNames</span>:
The array with the names of the keys to unregister
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when keys are unregistered
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Unregistered successfully');
+ console.log('Unregistered successfully');
}
var keys = ["VolumeUp", "VolumeDown"];
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when a list of the available windows is retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(availableWindows)
{
- for (var i = 0; i < availableWindows.length; i++)
- {
- console.log("Window [" + i + "] = " + availableWindows[i]);
- }
+ for (var i = 0; i < availableWindows.length; i++)
+ {
+ console.log("Window [" + i + "] = " + availableWindows[i]);
+ }
}
try
{
- tizen.tvwindow.getAvailableWindows(successCB);
+ tizen.tvwindow.getAvailableWindows(successCB);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">videoSource</span>:
+<span class="name">videoSource</span>:
The video source to set <br>The possible video sources can be obtained through <b>tizen.systeminfo.getPropertyValue("VIDEOSOURCE")</b>.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the intput source has been changed successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type - by default, this attribute is set to <var>MAIN</var> </li>
</ul>
</div>
var connectedVideoSources;
function successCB(source, type)
{
- console.log("setSource() is successfully done. source name = " + source.name + ", source port number = " + source.number);
+ console.log("setSource() is successfully done. source name = " + source.name + ", source port number = " + source.number);
}
function errorCB(error)
{
- console.log("setSource() is failed. Error name = " + error.name + ", Error message = " + error.message);
+ console.log("setSource() is failed. Error name = " + error.name + ", Error message = " + error.message);
}
function systemInfoSuccessCB(videoSource)
{
- connectedVideoSources = videoSource.connected;
- for (var i = 0; i < connectedVideoSources.length; i++)
- {
- console.log("--------------- Source " + i + " ---------------");
- console.log("type = " + connectedVideoSources[i].type);
- console.log("number = " + connectedVideoSources[i].number);
- if (connectedVideoSources[i].type === "HDMI")
- {
- /* Set HDMI as input source of the TV window */
- tizen.tvwindow.setSource(connectedVideoSources[i], successCB, errorCB);
- break;
- }
- }
+ connectedVideoSources = videoSource.connected;
+ for (var i = 0; i < connectedVideoSources.length; i++)
+ {
+ console.log("--------------- Source " + i + " ---------------");
+ console.log("type = " + connectedVideoSources[i].type);
+ console.log("number = " + connectedVideoSources[i].number);
+ if (connectedVideoSources[i].type === "HDMI")
+ {
+ /* Set HDMI as input source of the TV window */
+ tizen.tvwindow.setSource(connectedVideoSources[i], successCB, errorCB);
+ break;
+ }
+ }
}
function systemInfoErrorCB(error)
{
- console.log("getPropertyValue(VIDEOSOURCE) is failed. Error name = " + error.name + ", Error message = " + error.message);
+ console.log("getPropertyValue(VIDEOSOURCE) is failed. Error name = " + error.name + ", Error message = " + error.message);
}
try
{
- tizen.systeminfo.getPropertyValue("VIDEOSOURCE", systemInfoSuccessCB, systemInfoErrorCB);
+ tizen.systeminfo.getPropertyValue("VIDEOSOURCE", systemInfoSuccessCB, systemInfoErrorCB);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type - by default, this attribute is set to <var>MAIN</var> </li>
</ul>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var source = tizen.tvwindow.getSource();
- console.log("type = " + source.type);
- console.log("number = " + source.number);
+ var source = tizen.tvwindow.getSource();
+ console.log("type = " + source.type);
+ console.log("number = " + source.number);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method which will be invoked when the position and size of the TV window has been changed successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method which will be invoked when an error occurs
</li>
<li class="param">
-<span class="name">rectangle</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">rectangle</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An array that contains information about the position and size of a specified TV window as a string with units <br>Without this parameter, the TV window will have the same size and location as when this method last suceeded.<br>But, if a rectangle has never been specified, the TV window will be shown in full screen mode.
</li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type - by default, this attribute is set to <var>MAIN</var> </li>
<li class="param">
-<span class="name">zPosition</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">zPosition</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Specifies whether the TV window should be in front of or behind the Web Application since Tizen 2.4<br> By default, this parameter is set to <var>FRONT</var>.<br>If this parameter is set to null or <var>FRONT</var>, this method behaves in the same way as it did before Tizen 2.4.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(windowRect, type)
{
- /* You will get exactly what you put as rectangle argument of show() through windowRect */
- /* Expected result: ["0", "0px", "50%", "540px"] */
- console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+ /* You will get exactly what you put as rectangle argument of show() through windowRect */
+ /* Expected result: ["0", "0px", "50%", "540px"] */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
}
try
{
- tizen.tvwindow.show(successCB, null, ["0", "0px", "50%", "540px"], "MAIN");
+ tizen.tvwindow.show(successCB, null, ["0", "0px", "50%", "540px"], "MAIN");
}
catch (error)
{
- console.log("error: " + error.name);
+ console.log("error: " + error.name);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(windowRect, type)
{
- /* Expected result: ["0", "0", "50%", "50%"] */
- console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+ /* Expected result: ["0", "0", "50%", "50%"] */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
}
try
{
- tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"], "MAIN");
+ tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"], "MAIN");
}
catch (error)
{
- console.log("error: " + error.name);
+ console.log("error: " + error.name);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(windowRect, type)
{
- /* Expected result: ["10.5%", "10%", "900", "500px"] */
- console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+ /* Expected result: ["10.5%", "10%", "900", "500px"] */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
}
try
{
- tizen.tvwindow.show(successCB, null, ["10.5%", "10%", "900", "500px"]);
+ tizen.tvwindow.show(successCB, null, ["10.5%", "10%", "900", "500px"]);
}
catch (error)
{
- console.log("error: " + error.name);
+ console.log("error: " + error.name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the window is hidden successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type - by default, this attribute is set to <var>MAIN</var> </li>
</ul>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the position and size of the TV window has been obtained successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
<li class="param">
-<span class="name">unit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">unit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The measurement unit for specifying the display area - by default, this attribute is set to <em>"px"</em> </li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type - by default, this attribute is set to <var>MAIN</var> </li>
</ul>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function rectangleCB(windowRect, type)
{
- /* You call getRect() without specifying a unit, it expresses the area information with pixel unit */
- /* Expected result: ["0px", "0px", "960px", "540px"] if the screen resolution of a device is 1920 x 1080 */
- console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+ /* You call getRect() without specifying a unit, it expresses the area information with pixel unit */
+ /* Expected result: ["0px", "0px", "960px", "540px"] if the screen resolution of a device is 1920 x 1080 */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
}
function successCB(windowRect, type)
{
- /* You will get exactly what you put as rectangle argument through windowRect */
- /* Expected result: ["0", "0", "50%", "50%"] */
- console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
- tizen.tvwindow.getRect(rectangleCB);
+ /* You will get exactly what you put as rectangle argument through windowRect */
+ /* Expected result: ["0", "0", "50%", "50%"] */
+ console.log("Rectangle: [" + windowRect[0] + ", " + windowRect[1] + ", " + windowRect[2] + ", " + windowRect[3] + "]");
+ tizen.tvwindow.getRect(rectangleCB);
}
try
{
- tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"]);
+ tizen.tvwindow.show(successCB, null, ["0", "0", "50%", "50%"]);
}
catch (error)
{
- console.log("error: " + error.name);
+ console.log("error: " + error.name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type - by default, this attribute is set to <var>MAIN</var> </li>
</ul>
</div>
console.log("Frequency: " + res.frequency +"Hz");
if (res.aspectRatio === "ASPECT_RATIO_16x9")
{
- console.log("Widescreen on");
+ console.log("Widescreen on");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
The method to invoke when the resolution has been changed
</li>
<li class="param">
-<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">type</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The window type. By default, this parameter is set to <var>MAIN</var> </li>
</ul>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function change(res, type)
{
- console.log("Switched to new resolution: " + res.width + "x" + res.height);
- console.log("New frequency: " + res.frequency);
- if (res.aspectRatio === "ASPECT_RATIO_16x9")
- {
- console.log("Widescreen is now turned on");
- }
+ console.log("Switched to new resolution: " + res.width + "x" + res.height);
+ console.log("New frequency: " + res.frequency);
+ if (res.aspectRatio === "ASPECT_RATIO_16x9")
+ {
+ console.log("Widescreen is now turned on");
+ }
}
try
{
- var watch = tizen.tvwindow.addVideoResolutionChangeListener(change);
+ var watch = tizen.tvwindow.addVideoResolutionChangeListener(change);
}
catch (error)
{
- console.log("Error name = " + error.name + ", Error message = " + error.message);
+ console.log("Error name = " + error.name + ", Error message = " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listenerId</span>:
+<span class="name">listenerId</span>:
The identifier of the listener for resolution changes
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">resolution</span>:
+<span class="name">resolution</span>:
The resolution that the video has changed to
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The window type
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The available window types
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">windowRect</span>:
+<span class="name">windowRect</span>:
An array that contains information about the position and size of a specified TV window as a string with units
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The window type
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">source</span>:
+<span class="name">source</span>:
A descriptor object <em>SystemInfoVideoSourceInfo</em> that contains information about the source used by TV
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The window type
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">userAgent</span>:
+<span class="name">userAgent</span>:
User agent to set for the Web view in your Web application.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
To be invoked if the requested setting operation succeeds.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
To be invoked if the requested setting operation fails.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCallback()
{
- console.log("The requested user agent string has just been set successfully.");
+ console.log("The requested user agent string has just been set successfully.");
}
tizen.websetting.setUserAgentString("the new user agent string to set", successCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
To be invoked if the requested delete operation succeeds.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
To be invoked if the requested delete operation fails.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCallback()
{
- console.log("The cookies saved for your application have just been removed.");
+ console.log("The cookies saved for your application have just been removed.");
}
tizen.websetting.removeAllCookies(successCallback);
<div class="description">
<p>
Sets an alarm with the application ID to be run. You should definitely provide the application ID to run
-and the <a href="https://developer.tizen.org/development/guides/web-application/tizen-features/application/application#controls">application control</a>information if it is necessary.
+and the <a href="https://developer.tizen.org/development/guides/web-application/tizen-features/application/application#controls">application control</a>information if it is necessary.
For more information about the application control, see <a href="application.html">The Application API</a>.
</p>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">alarm</span>:
+<span class="name">alarm</span>:
An alarm to add. It can be either <em>AlarmRelative </em> or <em>AlarmAbsolute</em>.
</li>
<li class="param">
-<span class="name">applicationId</span>:
+<span class="name">applicationId</span>:
The application ID to run when the alarm is triggered.
</li>
<li class="param">
-<span class="name">appControl</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">appControl</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The data structure describing application control details.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">alarm</span>:
+<span class="name">alarm</span>:
An alarm to add. It can be either <em>AlarmRelative</em> or <em>AlarmAbsolute</em>.
</li>
<li class="param">
-<span class="name">notification</span>:
+<span class="name">notification</span>:
Notification to be added to the alarm.
</li>
</ul>
var alarm = new tizen.AlarmAbsolute(new Date(2017, 10, 4, 8, 0));
var notificationDict =
{
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3"
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3"
};
var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the alarm to remove
</li>
</ul>
/* Removes the first alarm */
if (alarms.length > 0)
{
- try
- {
- tizen.alarm.remove(alarms[0].id);
- console.log("Successfully removed the first alarm.");
- }
- catch (error)
- {
- console.log("Failed to remove the first alarm.");
- }
+ try
+ {
+ tizen.alarm.remove(alarms[0].id);
+ console.log("Successfully removed the first alarm.");
+ }
+ catch (error)
+ {
+ console.log("Failed to remove the first alarm.");
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The alarm ID to retrieve.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
ID which uniquely identifies a scheduled alarm.
</li>
</ul>
var notificationDict =
{
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3"
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3"
};
var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
tizen.alarm.add(alarm2, appId);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AlarmRelative::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AlarmRelative(long delay, optional long? period);</pre></dl>
tizen.alarm.add(alarm3, appId);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AlarmAbsolute::constructor">Constructors</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contextId</span>:
+<span class="name">contextId</span>:
The identifier of the application to kill
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an application is killed successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onKillSuccess()
{
- console.log("Application terminated successfully");
+ console.log("Application terminated successfully");
}
function onRunningAppsContext(contexts)
{
- /* Let's assume that the application "targetApp0.main" has been installed */
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++)
- {
- if (contexts[i].appId == targetId)
- {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
}
tizen.application.getAppsContext(onRunningAppsContext);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
A unique string representing the application ID
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess()
{
- console.log("The application has launched successfully");
+ console.log("The application has launched successfully");
}
/* Let's assume that application "targetApp0.main" has been installed */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
The data structure describing application control details
</li>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An identifier of the application to be launched. If the ID is <var>null </var>or not specified, then the system tries to find the application to be launched for the requested application control
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
<li class="param">
-<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the application gets back results from the launched application
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
-var appControlReplyCallback =
+var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
A data structure describing application control details
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call that returns a list of application information
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onRunningAppsContext(contexts)
{
- for (var i = 0; i < contexts.length; i++)
- console.log("ID: " + contexts[i].id);
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
}
tizen.application.getAppsContext(onRunningAppsContext);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contextId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">contextId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application context ID<br>If the ID is not provided, the application context of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when the invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID<br>If the ID is not provided, the application information of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the application certificate of the calling application is returned.
</li>
</ul>
for (var i = 0; i < appCerts.length; i++)
{
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the shared directory URI of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing an application ID. If the ID is not provided, the application metadata array of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">eventCallback</span>:
+<span class="name">eventCallback</span>:
The method to call when a change on the installed applications is made
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var appEventCallback =
+var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
An ID that identifies the listener
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var appEventCallback =
+var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
tizen.application.removeAppInfoEventListener(watchId);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
-if (reqAppControl)
+if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
}
</pre>
</div>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- });
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- if (watchId)
- {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var myCustomData =
+var myCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var myTrustedCustomData =
+var myTrustedCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
- null, "image/jpeg", null,
- [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
</pre>
</div>
<div class="constructors">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An array of ApplicationControlData objects
</li>
</ul>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
}
</pre>
</div>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- reqAppControl.replyFailure();
- }
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed applications
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed applications
</li>
<li class="param">
-<span class="name">appControl</span>:
+<span class="name">appControl</span>:
The application control that is passed to <em>ApplicationManager.findAppControl()</em> </li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* FindAppControlSuccessCallback instance */
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">contexts</span>:
+<span class="name">contexts</span>:
A list of running applications
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* ApplicationControlDataArrayReplyCallback instance */
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log('Selected image is ' + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
<div class="methods">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">data</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An array of <em>ApplicationControlData</em> objects
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is installed');
+ },
+ onupdated: function(appInfo)
+ {
+ console.log('The application ' + appInfo.name + ' is updated');
+ },
+ onuninstalled: function(appid)
+ {
+ console.log('The application ' + appid + ' is uninstalled');
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The application information of the installed application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The application information of the updated application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the uninstalled application
</li>
</ul>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- };
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCallback(archive)
{
- console.log("Success, can now read from archive " + archive);
+ console.log("Success, can now read from archive " + archive);
}
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
tizen.archive.open("downloads/some_archive.zip", "r", successCallback, errorCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function openSuccess(archive)
{
- operationId = archive.extractAll("downloads/extracted");
- tizen.archive.abort(operationId);
+ operationId = archive.extractAll("downloads/extracted");
+ tizen.archive.abort(operationId);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function successCallback()
{
- console.log("done");
+ console.log("done");
}
function progressCallback(opId, val, name)
{
- console.log("opId: " + opId + " with progress val: " + val);
+ console.log("opId: " + opId + " with progress val: " + val);
}
function createSuccess(archive)
{
- archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
+ archive.add("downloads/file.txt", successCallback, errorCallback, progressCallback);
}
tizen.archive.open("downloads/new_archive.zip", "w", createSuccess);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function successCallback()
{
- console.log("done");
+ console.log("done");
}
function progressCallback(opId, val, name)
{
- console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
+ console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
}
function openSuccess(archive)
{
- archive.extractAll("music", successCallback, errorCallback, progressCallback);
+ archive.extractAll("music", successCallback, errorCallback, progressCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function getEntriesSuccess(entries)
{
- console.log("Entries length: " + entries.length);
- for (var i = 0; i < entries.length; i++)
- {
- console.log(entries[i].name);
- }
+ console.log("Entries length: " + entries.length);
+ for (var i = 0; i < entries.length; i++)
+ {
+ console.log(entries[i].name);
+ }
}
function openSuccess(archive)
{
- archive.getEntries(getEntriesSuccess, errorCallback);
+ archive.getEntries(getEntriesSuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function getEntrySuccess(entry)
{
- console.log("Entry: " + entry.name + " size: " + entry.size);
+ console.log("Entry: " + entry.name + " size: " + entry.size);
}
function openSuccess(archive)
{
- archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
+ archive.getEntryByName("arch/my_file.txt", getEntrySuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error);
+ console.log(error);
}
function extractSuccessCallback()
{
- console.log("done");
+ console.log("done");
}
function getEntrySuccess(entry)
{
- entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
+ entry.extract("downloads/extract", extractSuccessCallback, errorCallback);
}
function openSuccess(archive)
{
- archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
+ archive.getEntryByName("my_file.txt", getEntrySuccess, errorCallback);
}
tizen.archive.open("downloads/some_archive.zip", "r", openSuccess, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the application to update the badge
</li>
<li class="param">
-<span class="name">count</span>:
+<span class="name">count</span>:
Number to display as the badge on the application icon<br>To remove the badge, set the value of this param to 0.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.badge.setBadgeCount("AVbg1ZHu6l.BadgeSample", 3);
+ tizen.badge.setBadgeCount("AVbg1ZHu6l.BadgeSample", 3);
}
catch (e)
{
- console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
+ console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the designated application
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var count = tizen.badge.getBadgeCount("AVbg1ZHu6l.BadgeSample");
+ var count = tizen.badge.getBadgeCount("AVbg1ZHu6l.BadgeSample");
}
catch (e)
{
- console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
+ console.log("Error Exception, error name: " + e.name + ", error message: " + e.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appIdList</span>:
+<span class="name">appIdList</span>:
Array of the ID of the designated application
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback method to be invoked when a badge number change notification is received
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function watcher(appId, count)
{
- console.log(appId + ' badge number were updated: ' + count);
+ console.log(appId + ' badge number were updated: ' + count);
}
/* Registers to be notified when the badge number changes */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appIdList</span>:
+<span class="name">appIdList</span>:
Array of the ID of the designated application
</li>
</ul>
/* Receives badge number changes */
function watcher(appId, count)
{
- console.log(appId + ' badge number were updated: ' + count);
+ console.log(appId + ' badge number were updated: ' + count);
}
/* Registers to be notified when the badge number changes */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the designated application
</li>
<li class="param">
-<span class="name">count</span>:
+<span class="name">count</span>:
Count of the badge
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var advertData =
+var advertData =
{
- includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
- appearance: 192, includeTxPowerLevel: false
+ includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
+ appearance: 192, includeTxPowerLevel: false
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var advertData =
{
- includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
- appearance: 192, includeTxPowerLevel: false
+ includeName: false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
+ appearance: 192, includeTxPowerLevel: false
}
var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter = tizen.bluetooth.getDefaultAdapter();
+ var adapter = tizen.bluetooth.getDefaultAdapter();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter = tizen.bluetooth.getLEAdapter();
+ var adapter = tizen.bluetooth.getLEAdapter();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name to set
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function changeName(newName)
{
- if (adapter.name != newName)
- {
- /* Initiate change name */
- adapter.setName(newName, function()
- {
- console.log("Adapter name changed to " + adapter.name);
- }, function(e)
- {
- console.log("Failed to change name: " + e.message);
- });
- }
+ if (adapter.name != newName)
+ {
+ /* Initiate change name */
+ adapter.setName(newName, function()
+ {
+ console.log("Adapter name changed to " + adapter.name);
+ }, function(e)
+ {
+ console.log("Failed to change name: " + e.message);
+ });
+ }
}
if (bt_always_on === false)
{
- changeName("myDevice");
+ changeName("myDevice");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
State to set: <var>true</var> to power on Bluetooth, <var>false</var> to power it off
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called on successful Bluetooth activation/deactivation
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called on failure of a Bluetooth activation/deactivation
</li>
</ul>
function powerOn()
{
- /* If adapter is not powered on */
- if (!adapter.powered)
- {
- /* Initiates power on */
- adapter.setPowered(true, function()
- {
- console.log("Bluetooth powered on success.");
- }, function(e)
- {
- console.log("Failed to power on Bluetooth: " + e.message);
- });
- }
+ /* If adapter is not powered on */
+ if (!adapter.powered)
+ {
+ /* Initiates power on */
+ adapter.setPowered(true, function()
+ {
+ console.log("Bluetooth powered on success.");
+ }, function(e)
+ {
+ console.log("Failed to power on Bluetooth: " + e.message);
+ });
+ }
}
function powerOff()
{
- /* If powered on */
- if (adapter.powered)
- {
- /* Initiates power off */
- adapter.setPowered(false, function()
- {
- console.log("Bluetooth powered off successfully.");
- }, function(e)
- {
- console.log("Failed to power off Bluetooth: " + e.message);
- });
- }
+ /* If powered on */
+ if (adapter.powered)
+ {
+ /* Initiates power off */
+ adapter.setPowered(false, function()
+ {
+ console.log("Bluetooth powered off successfully.");
+ }, function(e)
+ {
+ console.log("Failed to power off Bluetooth: " + e.message);
+ });
+ }
}
var bt_always_on = tizen.systeminfo.getCapability("http://tizen.org/capability/network.bluetooth.always_on");
if (bt_always_on === true)
{
- console.log("Bluetooth cannot be turn off or on because this device must be always enabled.");
+ console.log("Bluetooth cannot be turn off or on because this device must be always enabled.");
}
else
{
- powerOn();
+ powerOn();
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
The Bluetooth Adapter event listener to set
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changeListener =
{
- onstatechanged: function(powered)
- {
- console.log("Power state is changed into: " + powered);
- },
- onnamechanged: function(name)
- {
- console.log("Name is changed to: " + name);
- },
- onvisibilitychanged: function(visible)
- {
- console.log("Visibility is changed into: " + visible);
- }
+ onstatechanged: function(powered)
+ {
+ console.log("Power state is changed into: " + powered);
+ },
+ onnamechanged: function(name)
+ {
+ console.log("Name is changed to: " + name);
+ },
+ onvisibilitychanged: function(visible)
+ {
+ console.log("Visibility is changed into: " + visible);
+ }
};
var adapter = tizen.bluetooth.getDefaultAdapter();
var changeListener =
{
- onstatechanged: function(powered)
- {
- console.log("Power state is changed into: " + powered);
- if (!powered)
- adapter.unsetChangeListener();
- },
- onnamechanged: function(name)
- {
- console.log("Name is changed to: " + name);
- },
- onvisibilitychanged: function(visible)
- {
- console.log("Visibility is changed into: " + visible);
- }
+ onstatechanged: function(powered)
+ {
+ console.log("Power state is changed into: " + powered);
+ if (!powered)
+ adapter.unsetChangeListener();
+ },
+ onnamechanged: function(name)
+ {
+ console.log("Name is changed to: " + name);
+ },
+ onvisibilitychanged: function(visible)
+ {
+ console.log("Visibility is changed into: " + visible);
+ }
};
adapter.setChangeListener(changeListener);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function startDiscovery()
{
- var discoverDevicesSuccessCallback =
- {
- onstarted: function()
- {
- console.log("Device discovery started...");
- },
- ondevicefound: function(device)
- {
- console.log("Found device - name: " + device.name + ", Address: " + device.address);
- },
- ondevicedisappeared: function(address)
- {
- console.log("Device disappeared: " + address);
- },
- onfinished: function(devices)
- {
- console.log("Found Devices");
- for (var i = 0; i < devices.length; i++)
- {
- console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
- };
-
- /* Starts searching for nearby devices, for about 12 sec */
- adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
- {
- console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
- });
+ var discoverDevicesSuccessCallback =
+ {
+ onstarted: function()
+ {
+ console.log("Device discovery started...");
+ },
+ ondevicefound: function(device)
+ {
+ console.log("Found device - name: " + device.name + ", Address: " + device.address);
+ },
+ ondevicedisappeared: function(address)
+ {
+ console.log("Device disappeared: " + address);
+ },
+ onfinished: function(devices)
+ {
+ console.log("Found Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+ }
+ };
+
+ /* Starts searching for nearby devices, for about 12 sec */
+ adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
+ {
+ console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
+ });
}
function onSetPoweredError(e)
{
- console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
+ console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
}
adapter.setPowered(true, startDiscovery, onSetPoweredError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function to invoke when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function to invoke when an error occurs
</li>
</ul>
/* Calls this method whenever user finds one of the device */
function cancelDiscovery()
{
- adapter.stopDiscovery(function()
- {
- console.log("Stop discovery success.");
- }, function(e)
- {
- console.log("Error while stopDiscovery:" + e.message);
- });
+ adapter.stopDiscovery(function()
+ {
+ console.log("Stop discovery success.");
+ }, function(e)
+ {
+ console.log("Error while stopDiscovery:" + e.message);
+ });
}
function startDiscovery()
{
- var discoverDevicesSuccessCallback =
- {
- onstarted: function()
- {
- console.log("Device discovery started...");
- },
- ondevicefound: function(device)
- {
- console.log("Found device - name: " + device.name + ", Address: " + device.address);
- /* Shows the device to user to check if this is the device user is looking for */
- /* For example, add this to list view */
-
- cancelDiscovery();
- },
- ondevicedisappeared: function(address)
- {
- console.log("Device disappeared: " + address);
- /* Removes from list, as it is no longer valid */
- },
- onfinished: function(devices)
- {
- console.log("Found Devices");
- for (var i = 0; i < devices.length; i++)
- {
- console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
- }
- };
-
- /* Starts searching for nearby devices, for about 12 sec */
- adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
- {
- console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
- });
+ var discoverDevicesSuccessCallback =
+ {
+ onstarted: function()
+ {
+ console.log("Device discovery started...");
+ },
+ ondevicefound: function(device)
+ {
+ console.log("Found device - name: " + device.name + ", Address: " + device.address);
+ /* Shows the device to user to check if this is the device user is looking for */
+ /* For example, add this to list view */
+
+ cancelDiscovery();
+ },
+ ondevicedisappeared: function(address)
+ {
+ console.log("Device disappeared: " + address);
+ /* Removes from list, as it is no longer valid */
+ },
+ onfinished: function(devices)
+ {
+ console.log("Found Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log("Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
+ }
+ };
+
+ /* Starts searching for nearby devices, for about 12 sec */
+ adapter.discoverDevices(discoverDevicesSuccessCallback, function(e)
+ {
+ console.log("Failed to search devices: " + e.message + "(" + e.name + ")");
+ });
}
function onSetPoweredError(e)
{
- console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
+ console.log("Could not turn on device, reason: " + e.message + "(" + e.name + ")");
}
adapter.setPowered(true, startDiscovery, onSetPoweredError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function to invoke at retrieval of a list of Bluetooth devices that were bonded (paired) to the local Bluetooth adapter
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function to invoke in case of failure in finding bonded devices
</li>
</ul>
function onGotDevices(devices)
{
- console.log("Devices");
- for (var i = 0; i < devices.length; i++)
- {
- console.log(" Name: " + devices[i].name + ", Address: " + devices[i].address);
- }
- console.log("Total: " + devices.length);
+ console.log("Devices");
+ for (var i = 0; i < devices.length; i++)
+ {
+ console.log(" Name: " + devices[i].name + ", Address: " + devices[i].address);
+ }
+ console.log("Total: " + devices.length);
}
function onError(e)
{
- console.log("Error: " + e.message);
+ console.log("Error: " + e.message);
}
function onBluetoothsetPowered()
{
- adapter.getKnownDevices(onGotDevices, onError);
+ adapter.getKnownDevices(onGotDevices, onError);
}
/* Turns on Bluetooth */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">address</span>:
+<span class="name">address</span>:
Address of a remote Bluetooth device to get
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function gotDeviceInfo(device)
{
- console.log("Device Name: " + device.name);
- console.log("Device Address: " + device.address);
- console.log("Device Class: " + device.deviceClass.major);
- console.log("Is Bonded: " + (device.isBonded ? "Yes" : "No"));
+ console.log("Device Name: " + device.name);
+ console.log("Device Address: " + device.address);
+ console.log("Device Class: " + device.deviceClass.major);
+ console.log("Is Bonded: " + (device.isBonded ? "Yes" : "No"));
}
function onError(e)
{
- console.log("Could not get device info:" + e.message);
+ console.log("Could not get device info:" + e.message);
}
var adapter = tizen.bluetooth.getDefaultAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">address</span>:
+<span class="name">address</span>:
MAC address of remote Bluetooth address to bond with
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onBondingSuccess(device)
{
- console.log("Device Name:" + device.name);
- console.log("Device Address:" + device.address);
- console.log("Device Service UUIDs:" + device.uuids.join("\n"));
+ console.log("Device Name:" + device.name);
+ console.log("Device Address:" + device.address);
+ console.log("Device Service UUIDs:" + device.uuids.join("\n"));
}
function onError(e)
{
- console.log("Could not create bonding, reason:" + e.message);
+ console.log("Could not create bonding, reason:" + e.message);
}
var adapter = tizen.bluetooth.getDefaultAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">address</span>:
+<span class="name">address</span>:
Address of a bonded device
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function gotDevice(device)
{
- if (device.isBonded)
- {
- /* Initiates destroying bonding */
- adapter.destroyBonding(device.address, function()
- {
- console.log("Succeeded to destroy the bond success with:" + device.address);
- }, function(e)
- {
- console.log("Failed to destroy the bond with " + device.address + ", reason: " + e.message);
- });
- }
+ if (device.isBonded)
+ {
+ /* Initiates destroying bonding */
+ adapter.destroyBonding(device.address, function()
+ {
+ console.log("Succeeded to destroy the bond success with:" + device.address);
+ }, function(e)
+ {
+ console.log("Failed to destroy the bond with " + device.address + ", reason: " + e.message);
+ });
+ }
}
var deviceAddress = "35:F4:59:D1:7A:03";
adapter.getDevice(deviceAddress, gotDevice, function(e)
{
- console.log("Failed to get device info for " + deviceAddress + ", reason: " + e.message);
+ console.log("Failed to get device info for " + deviceAddress + ", reason: " + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uuid</span>:
+<span class="name">uuid</span>:
UUID of the new service, to which clients connect
</li>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name of a service
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called on successful service registration
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function chatServiceSuccessCb(recordHandler)
{
- console.log("Chat service registration succeeds!");
- chatServiceHandler = recordHandler;
- recordHandler.onconnect = function(socket)
- {
- console.log("Client connected: " + socket.peer.name + "," + socket.peer.address);
- serviceSocket = socket;
- /* Messages received from remote device */
- socket.onmessage = function()
- {
- var data = socket.readData();
- /* Handles message code goes here */
- };
-
- socket.onclose = function()
- {
- console.log('The socket is closed.');
- serviceSocket = null;
- };
- };
+ console.log("Chat service registration succeeds!");
+ chatServiceHandler = recordHandler;
+ recordHandler.onconnect = function(socket)
+ {
+ console.log("Client connected: " + socket.peer.name + "," + socket.peer.address);
+ serviceSocket = socket;
+ /* Messages received from remote device */
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handles message code goes here */
+ };
+
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ serviceSocket = null;
+ };
+ };
};
function publishChatService()
{
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
- /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
+ var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+ adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
+ /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
}
-function unregisterChatService()
-{
- if (chatServiceHandler != null)
- {
- chatServiceHandler.unregister(function()
- {
- console.log("Chat service is unregistered");
- chatServiceHandler = null;
- }, function(e)
- {
- console.log("Failed to unregister service: " + e.message);
- });
- }
+function unregisterChatService()
+{
+ if (chatServiceHandler != null)
+ {
+ chatServiceHandler.unregister(function()
+ {
+ console.log("Chat service is unregistered");
+ chatServiceHandler = null;
+ }, function(e)
+ {
+ console.log("Failed to unregister service: " + e.message);
+ });
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">profileType</span>:
+<span class="name">profileType</span>:
Bluetooth Profile type
</li>
</ul>
if (healthCapability)
{
- healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+ healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
}
else
{
- console.log("Bluetooth Health Profile is not supported on this device.");
+ console.log("Bluetooth Health Profile is not supported on this device.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
called when advertisement is found.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("[Found device] address: " + device.address);
+ console.log("[Found device] address: " + device.address);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- adapter.stopScan();
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ adapter.stopScan();
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">advertiseData</span>:
+<span class="name">advertiseData</span>:
BluetoothLEAdvertiseData object to be added
</li>
<li class="param">
-<span class="name">packetType</span>:
+<span class="name">packetType</span>:
The bluetooth LE packet type
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when advertise is started successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The power and latency mode of advertising. The default mode is "BALANCED".
</li>
<li class="param">
-<span class="name">connectable</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">connectable</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The connectable status. It's true if the advertisement will be connectable. The default value of the parameter is <var>true</var>.
</li>
</ul>
var heart_rate_svc_uuid_16 = "180d"; /* Service solicitation UUID, 16-bit UUID is supported (e.g. 180d) */
var advertiseOptions =
{
- includeName: true, /* Whether the device name should be included */
- includeTxPowerLevel: true, /* Whether the transmission power level should be included */
- appearance: 192, /* External appearance of device, 192 - Generic Watch */
- uuids: [battery_svc_uuid_16],
- solicitationuuids: [heart_rate_svc_uuid_16]
+ includeName: true, /* Whether the device name should be included */
+ includeTxPowerLevel: true, /* Whether the transmission power level should be included */
+ appearance: 192, /* External appearance of device, 192 - Generic Watch */
+ uuids: [battery_svc_uuid_16],
+ solicitationuuids: [heart_rate_svc_uuid_16]
};
var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
adapter.startAdvertise(advertiseData, "ADVERTISE", function onstate(state)
{
- console.log("Advertiser state: " + state);
+ console.log("Advertiser state: " + state);
}, function(e)
{
- console.log("Failed to startAdvertise: " + e.message);
+ console.log("Failed to startAdvertise: " + e.message);
}, "LOW_LATENCY", connectable);
</pre>
</div>
var heart_rate_svc_uuid_16 = "180d"; /* Service solicitation UUID, 16-bit UUID is supported (e.g. 180d) */
var advertiseOptions =
{
- includeName: true, /* Whether the device name should be included */
- includeTxPowerLevel: true, /* Whether the transmission power level should be included */
- appearance: 192, /* External appearance of device, 192 - Generic Watch */
- uuids: [battery_svc_uuid_16],
- solicitationuuids: [heart_rate_svc_uuid_16]
+ includeName: true, /* Whether the device name should be included */
+ includeTxPowerLevel: true, /* Whether the transmission power level should be included */
+ appearance: 192, /* External appearance of device, 192 - Generic Watch */
+ uuids: [battery_svc_uuid_16],
+ solicitationuuids: [heart_rate_svc_uuid_16]
};
var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
adapter.startAdvertise(advertiseData, "ADVERTISE", function onstate(state)
{
- console.log("Advertiser state: " + state);
+ console.log("Advertiser state: " + state);
});
adapter.stopAdvertise();
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onconnected(device)
{
- console.log("Connected to device");
- var service = device.getService(device.uuids[0]);
- console.log("Service got");
+ console.log("Connected to device");
+ var service = device.getService(device.uuids[0]);
+ console.log("Service got");
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("[Found device] address: " + device.address);
- device.connect(onconnected.bind(null, device), onerror);
+ console.log("[Found device] address: " + device.address);
+ device.connect(onconnected.bind(null, device), onerror);
});
</pre>
</div>
var service = device.getService(device.uuids[0]);
for (var i = 0; i service.services.length; ++i)
{
- console.log("Subservices UUID " + service.services[i].uuid);
+ console.log("Subservices UUID " + service.services[i].uuid);
}
</pre>
</div>
var service = device.getService(device.uuids[0]);
for (var i = 0; i service.characteristics.length; ++i)
{
- console.log("Subservices UUID " + service.characteristics[i].isWritable);
+ console.log("Subservices UUID " + service.characteristics[i].isWritable);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the characteristic value is read successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function proccessDevice(device)
{
- device.connect(onConnected, onerror);
- function onConnected()
- {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- characteristic.readValue(function(val)
- {
- console.log("Value read: " + val);
- device.disconnect();
- });
- }
- }
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ characteristic.readValue(function(val)
+ {
+ console.log("Value read: " + val);
+ device.disconnect();
+ });
+ }
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
the characteristic value to write
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the characteristic value is written successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function proccessDevice(device)
{
- device.connect(onConnected, onerror);
- function onConnected()
- {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- var data = new Array(1, 2, 3, 4, 5, 6);
- characteristic.writeValue(data, function()
- {
- console.log("Value written");
- device.disconnect();
- }, function(e)
- {
- console.log("Failed to write: " + e.message);
- });
- }
- }
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var data = new Array(1, 2, 3, 4, 5, 6);
+ characteristic.writeValue(data, function()
+ {
+ console.log("Value written");
+ device.disconnect();
+ }, function(e)
+ {
+ console.log("Failed to write: " + e.message);
+ });
+ }
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Listener function that is called when the connection state changes
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function proccessDevice(device)
{
- function onConnected()
- {
- var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- var watchID;
-
- watchID = characteristic.addValueChangeListener(function(value)
- {
- console.log("Characteristic value changed: " + value);
- characteristic.removeValueChangeListener(watchID);
- device.disconnect();
- });
- }
- }
-
- device.connect(onConnected);
+ function onConnected()
+ {
+ var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var watchID;
+
+ watchID = characteristic.addValueChangeListener(function(value)
+ {
+ console.log("Characteristic value changed: " + value);
+ characteristic.removeValueChangeListener(watchID);
+ device.disconnect();
+ });
+ }
+ }
+
+ device.connect(onConnected);
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- adapter.stopScan();
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ adapter.stopScan();
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchID</span>:
+<span class="name">watchID</span>:
The watchID identifier returned by the addValueChangeListener() method.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the descriptor value is read successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function proccessDevice(device)
{
- device.connect(onConnected, onerror);
- function onConnected()
- {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- var descriptor = characteristic.descriptors[0];
- descriptor.readValue(function(val)
- {
- console.log("Value read: " + val);
- device.disconnect();
- });
- }
- }
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var descriptor = characteristic.descriptors[0];
+ descriptor.readValue(function(val)
+ {
+ console.log("Value read: " + val);
+ device.disconnect();
+ });
+ }
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
the descriptor value to write
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the descriptor value is written successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function proccessDevice(device)
{
- device.connect(onConnected, onerror);
- function onConnected()
- {
- var service = device.getService(device.uuids[0]);
- if (service.characteristics.length > 0)
- {
- var characteristic = service.characteristics[0];
- var data = new Array(1, 2, 3, 4, 5, 6);
- var descriptor = characteristic.descriptors[0];
- descriptor.writeValue(data, function()
- {
- console.log("Value written");
- device.disconnect();
- }, function(e)
- {
- console.log("Failed to write: " + e.message);
- });
- }
- }
+ device.connect(onConnected, onerror);
+ function onConnected()
+ {
+ var service = device.getService(device.uuids[0]);
+ if (service.characteristics.length > 0)
+ {
+ var characteristic = service.characteristics[0];
+ var data = new Array(1, 2, 3, 4, 5, 6);
+ var descriptor = characteristic.descriptors[0];
+ descriptor.writeValue(data, function()
+ {
+ console.log("Value written");
+ device.disconnect();
+ }, function(e)
+ {
+ console.log("Failed to write: " + e.message);
+ });
+ }
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- proccessDevice(device);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ proccessDevice(device);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">device</span>:
+<span class="name">device</span>:
Device that is found
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
State that is Advertising process
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
Read characteristic value
</li>
</ul>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Device Name: " + device.name);
+ console.log("Device Name: " + device.name);
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Device Address: " + device.address);
+ console.log("Device Address: " + device.address);
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Device Major Class: " + device.deviceClass.major);
+ console.log("Device Major Class: " + device.deviceClass.major);
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
+ console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
+ console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
});
</pre>
</div>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
+ console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
});
</pre>
</div>
var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
adapter.getDevice("11:22:33:44:55:66", function(device)
{
- var uuids = device.uuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++)
- {
- services += uuids[i] + "\n";
- }
- console.log("Services found: " + services);
- if (uuids.indexOf(CHAT_SERVICE_UUID) != -1)
- {
- /* Connects to service */
- device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket)
- {
- /* Connected to service, handle socket */
- }, function(e)
- {
- console.log("Could not connect to chat service !!!. Error: " + e.message);
- });
- }
+ var uuids = device.uuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Services found: " + services);
+ if (uuids.indexOf(CHAT_SERVICE_UUID) != -1)
+ {
+ /* Connects to service */
+ device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket)
+ {
+ /* Connected to service, handle socket */
+ }, function(e)
+ {
+ console.log("Could not connect to chat service !!!. Error: " + e.message);
+ });
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uuid</span>:
+<span class="name">uuid</span>:
128 bit unique identifier, which specifies the service on the remote device
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when an asynchronous call completes successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when opening of a socket fails
</li>
</ul>
/* Calls a method that is invoked when user wants to send a message to a remote device */
function sendMessage(msg)
{
- /* Validates socket state, if everything is ok */
- if (clientSocket != null && clientSocket.state == "OPEN")
- {
- /* Sends the message */
- clientSocket.writeData(msg);
- }
+ /* Validates socket state, if everything is ok */
+ if (clientSocket != null && clientSocket.state == "OPEN")
+ {
+ /* Sends the message */
+ clientSocket.writeData(msg);
+ }
}
/* Calls a method that is invoked when a socket is open */
function onSocketConnected(socket)
{
- clientSocket = socket;
- console.log("Opening a socket successfully!!!");
- socket.onmessage = function()
- {
- var data = socket.readData();
- var recvmsg = "";
- for (var i = 0; i < data.length; i++)
- {
- recvmsg += String.fromCharCode(data[i]);
- }
- console.log("server msg >> " + recvmsg);
- };
-
- socket.onclose = function()
- {
- console.log("socket disconnected.");
- };
+ clientSocket = socket;
+ console.log("Opening a socket successfully!!!");
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ var recvmsg = "";
+ for (var i = 0; i < data.length; i++)
+ {
+ recvmsg += String.fromCharCode(data[i]);
+ }
+ console.log("server msg >> " + recvmsg);
+ };
+
+ socket.onclose = function()
+ {
+ console.log("socket disconnected.");
+ };
}
function onDeviceReady(device)
{
- /* Validates device and service uuid */
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
- {
- /* Opens socket */
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e)
- {
- console.log("Error connecting to service. Reason: " + e.message);
- });
- }
- else
- {
- console.log("Chat service is not supported by this device");
- }
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e)
+ {
+ console.log("Error connecting to service. Reason: " + e.message);
+ });
+ }
+ else
+ {
+ console.log("Chat service is not supported by this device");
+ }
}
function onSetPowered()
{
- /* Gets the BluetoothDevice object */
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
}
adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message); });
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.address);
+ console.log("Found device: " + device.address);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.name);
+ console.log("Found device: " + device.name);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.txpowerlevel);
+ console.log("Found device: " + device.txpowerlevel);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.appearance);
+ console.log("Found device: " + device.appearance);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- var uuids = device.uuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++)
- {
- services += uuids[i] + "\n";
- }
- console.log("Service found: " + services);
+ var uuids = device.uuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Service found: " + services);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- var uuids = device.solicitationuuids;
- var services = "";
- for (var i = 0; i < uuids.length; i++)
- {
- services += uuids[i] + "\n";
- }
- console.log("Service solicitations found: " + services);
+ var uuids = device.solicitationuuids;
+ var services = "";
+ for (var i = 0; i < uuids.length; i++)
+ {
+ services += uuids[i] + "\n";
+ }
+ console.log("Service solicitations found: " + services);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- var serviceData = device.serviceData;
- var data = "";
- for (var i = 0; i < serviceData.length; i++)
- {
- data += serviceData[i].id + serviceData[i].data + "\n";
- }
- console.log("Service data found: " + data);
+ var serviceData = device.serviceData;
+ var data = "";
+ for (var i = 0; i < serviceData.length; i++)
+ {
+ data += serviceData[i].id + serviceData[i].data + "\n";
+ }
+ console.log("Service data found: " + data);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- var manufacturerData = device.manufacturerData;
- console.log("Manufacture id: " + manufacturerData.id);
- console.log("Manufacture data: " + manufacturerData.data);
+ var manufacturerData = device.manufacturerData;
+ console.log("Manufacture id: " + manufacturerData.id);
+ console.log("Manufacture data: " + manufacturerData.data);
});
</pre>
</div>
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- console.log("Found device: " + device.name);
- console.log("RSSI: " + device.rssi);
+ console.log("Found device: " + device.name);
+ console.log("RSSI: " + device.rssi);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the connection is established successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Failed to connect to device: " + e.message);
+ console.log("Failed to connect to device: " + e.message);
}
function onconnected()
{
- console.log("Connected to device");
+ console.log("Connected to device");
}
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan(function onsuccess(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.connect(onconnected, onerror);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected, onerror);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the connection is finished successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- function ondisconnect()
- {
- console.log("Disconnected");
- }
-
- function onconnected()
- {
- console.log("Connected to device");
- device.disconnect(ondisconnect, onerror);
- }
-
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.connect(onconnected, onerror);
- }
+ function ondisconnect()
+ {
+ console.log("Disconnected");
+ }
+
+ function onconnected()
+ {
+ console.log("Connected to device");
+ device.disconnect(ondisconnect, onerror);
+ }
+
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected, onerror);
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uuid</span>:
+<span class="name">uuid</span>:
UUID of the service
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onconnected(device)
{
- console.log("Connected to device");
- var service = device.getService(device.uuids[0]);
- console.log("Service got");
+ console.log("Connected to device");
+ var service = device.getService(device.uuids[0]);
+ console.log("Service got");
}
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- if (device.address == "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.connect(onconnected.bind(null, device), onerror);
- }
+ if (device.address == "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.connect(onconnected.bind(null, device), onerror);
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
function onconnected(device)
{
- console.log("Connected to device");
- var services = device.getServiceAllUuids();
- console.log("Services length " + services.length);
+ console.log("Connected to device");
+ var services = device.getServiceAllUuids();
+ console.log("Services length " + services.length);
}
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- if (device.address == remoteAddress)
- {
- device.connect(onconnected.bind(null, device), onerror);
- }
+ if (device.address == remoteAddress)
+ {
+ device.connect(onconnected.bind(null, device), onerror);
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Listener functions that are called when the connection state changes
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- var onConnectionStateChange =
- {
- onconnected: function(device)
- {
- console.log("Device " + device.name + " connected");
- },
- ondisconnected: function(device)
- {
- console.log("Device " + device.name + " disconnected");
- }
- }
-
- if (device.address === "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- device.addConnectStateChangeListener(onConnectionStateChange);
- device.connect();
- }
+ var onConnectionStateChange =
+ {
+ onconnected: function(device)
+ {
+ console.log("Device " + device.name + " connected");
+ },
+ ondisconnected: function(device)
+ {
+ console.log("Device " + device.name + " disconnected");
+ }
+ }
+
+ if (device.address === "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ device.addConnectStateChangeListener(onConnectionStateChange);
+ device.connect();
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchID</span>:
+<span class="name">watchID</span>:
The watchID identifier returned by the addConnectStateChangeListener() method.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(e)
{
- console.log("Error occurred: " + e.message);
+ console.log("Error occurred: " + e.message);
}
function onDeviceFound(device)
{
- var onConnectionStateChange =
- {
- onconnected: function(device)
- {
- console.log("Device " + device.name + " connected");
- },
- ondisconnected: function(device)
- {
- console.log("Device " + device.name + " disconnected");
- device.removeConnectStateChangeListener(listenerID);
- }
- }
-
- if (device.address === "11:22:33:44:55:66")
- {
- console.log("Found device: " + device.name);
- listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
- device.connect();
- }
+ var onConnectionStateChange =
+ {
+ onconnected: function(device)
+ {
+ console.log("Device " + device.name + " connected");
+ },
+ ondisconnected: function(device)
+ {
+ console.log("Device " + device.name + " disconnected");
+ device.removeConnectStateChangeListener(listenerID);
+ }
+ }
+
+ if (device.address === "11:22:33:44:55:66")
+ {
+ console.log("Found device: " + device.name);
+ listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
+ device.connect();
+ }
}
var adapter = tizen.bluetooth.getLEAdapter();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The data to send
</li>
</ul>
function onSocketConnected(socket)
{
- console.log("Opened connection to remote device");
- socket.onmessage = function()
- {
- console.log("Message received: " + socket.readData());
- };
-
- socket.onclose = function()
- {
- console.log("Socket closed with " + socket.peer.name);
- };
-
- /* Sends data to peer */
- var textmsg = "Test";
- var sendtextmsg = new Array();
- for (var i = 0; i < textmsg.length; i++)
- {
- sendtextmsg[i] = textmsg.charCodeAt(i);
- }
- socket.writeData(sendtextmsg);
+ console.log("Opened connection to remote device");
+ socket.onmessage = function()
+ {
+ console.log("Message received: " + socket.readData());
+ };
+
+ socket.onclose = function()
+ {
+ console.log("Socket closed with " + socket.peer.name);
+ };
+
+ /* Sends data to peer */
+ var textmsg = "Test";
+ var sendtextmsg = new Array();
+ for (var i = 0; i < textmsg.length; i++)
+ {
+ sendtextmsg[i] = textmsg.charCodeAt(i);
+ }
+ socket.writeData(sendtextmsg);
}
function onSocketError(e)
{
- console.log("Error connecting to service. Reason: " + e.message);
+ console.log("Error connecting to service. Reason: " + e.message);
}
function onDeviceReady(device)
{
- /* Validates device and service uuid */
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
- {
- /* Opens socket */
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onSocketError);
- }
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onSocketError);
+ }
}
function onSetPowered()
{
- /* Gets the BluetoothDevice object */
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
}
adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message);});
function onError(e)
{
- console.log("Error connecting to service. Reason: " + e.message);
+ console.log("Error connecting to service. Reason: " + e.message);
}
function onSocketConnected(socket)
{
- console.log("Opening socket success!!!");
+ console.log("Opening socket success!!!");
- socket.onmessage = function()
- {
- /* Gets a message from peer, reads it */
- var data = socket.readData();
+ socket.onmessage = function()
+ {
+ /* Gets a message from peer, reads it */
+ var data = socket.readData();
- /* Code to evaluate message goes here */
- };
+ /* Code to evaluate message goes here */
+ };
- socket.onclose = function()
- {
- console.log("Socket closed with " + socket.peer.name);
- };
+ socket.onclose = function()
+ {
+ console.log("Socket closed with " + socket.peer.name);
+ };
}
function onDeviceReady(device)
{
- /* Validates device and service uuid */
- if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
- {
- /* Opens socket */
- device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onError);
- }
+ /* Validates device and service uuid */
+ if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1)
+ {
+ /* Opens socket */
+ device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, onError);
+ }
}
function onSetPowered()
{
- /* Gets the BluetoothDevice object */
- adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
+ /* Gets the BluetoothDevice object */
+ adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) {console.log("Error: " + e.message);});
}
adapter.setPowered(true, onSetPowered, function(e) {console.log("Could not turn on Bluetooth adapter. reason: " + e.message);});
function evaluateDevice(address)
{
- adapter.getDevice(address, function(device)
- {
- if (device.deviceClass.major == tizen.bluetooth.deviceMajor.COMPUTER)
- {
- /* Shows computer icon for this device */
- console.log("Device is computer");
- }
- else if (device.deviceClass.major == tizen.bluetooth.deviceMajor.PHONE)
- {
- /* Shows phone icon */
- console.log("Device is a Phone");
- }
- }, function(e)
- {
- console.log("Couldn't get any device with the given address: " + e.message);
- });
+ adapter.getDevice(address, function(device)
+ {
+ if (device.deviceClass.major == tizen.bluetooth.deviceMajor.COMPUTER)
+ {
+ /* Shows computer icon for this device */
+ console.log("Device is computer");
+ }
+ else if (device.deviceClass.major == tizen.bluetooth.deviceMajor.PHONE)
+ {
+ /* Shows phone icon */
+ console.log("Device is a Phone");
+ }
+ }, function(e)
+ {
+ console.log("Couldn't get any device with the given address: " + e.message);
+ });
}
evaluateDevice("11:22:33:44:55:66");
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
Service to check
</li>
</ul>
var adapter = tizen.bluetooth.getDefaultAdapter();
adapter.getDevice("12:34:56:78:9A:BC", function(device)
{
- if (device.deviceClass.hasService(tizen.bluetooth.deviceService.POSITIONING))
- {
- console.log("Device supports Positioning service");
- }
+ if (device.deviceClass.hasService(tizen.bluetooth.deviceService.POSITIONING))
+ {
+ console.log("Device supports Positioning service");
+ }
}, function(e)
{
- console.log("Couldn't get device for given address: " + e.message);
+ console.log("Couldn't get device for given address: " + e.message);
});
</pre>
</div>
function chatServiceSuccessCb(handler)
{
- console.log("Chat service " + handler.name + " with UUID " + handler.uuid + " is successfully registered!");
- console.log("There is " + (handler.isConnected ? "a" : "no") + " device using this service");
-
- handler.onconnect = function(socket)
- {
- console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
- socket.onmessage = function()
- {
- var data = socket.readData();
- /* Handle message code here */
- };
-
- /* Expected close */
- socket.onclose = function()
- {
- console.log('The socket is closed.');
- };
- };
+ console.log("Chat service " + handler.name + " with UUID " + handler.uuid + " is successfully registered!");
+ console.log("There is " + (handler.isConnected ? "a" : "no") + " device using this service");
+
+ handler.onconnect = function(socket)
+ {
+ console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handle message code here */
+ };
+
+ /* Expected close */
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ };
+ };
}
function errorCb(e)
{
- console.log("Could not register service record, Error: " + e.message);
+ console.log("Could not register service record, Error: " + e.message);
}
var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the record is removed successfully from the service records database
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called in case of failure (to unregister)
</li>
</ul>
function chatServiceSuccessCb(handler)
{
- console.log("Chat service registration was successful!");
-
- chatServiceHandler = handler;
- handler.onconnect = function(socket)
- {
- console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
- socket.onmessage = function()
- {
- var data = socket.readData();
- /* Handle message code here */
- };
-
- /* Expected close */
- socket.onclose = function()
- {
- console.log('The socket is closed.');
- };
- };
+ console.log("Chat service registration was successful!");
+
+ chatServiceHandler = handler;
+ handler.onconnect = function(socket)
+ {
+ console.log("Client is connected: " + socket.peer.name + "," + socket.peer.address);
+ socket.onmessage = function()
+ {
+ var data = socket.readData();
+ /* Handle message code here */
+ };
+
+ /* Expected close */
+ socket.onclose = function()
+ {
+ console.log('The socket is closed.');
+ };
+ };
}
function publishChatService()
{
- var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
- adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
- /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
+ var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
+ adapter.registerRFCOMMServiceByUUID(CHAT_SERVICE_UUID, "Chat service", chatServiceSuccessCb,
+ /* Error handler: function(e) {console.log("Could not register service record, Error: " + e.message);} */);
}
function unRegisterChatService()
{
- if (chatServiceHandler != null)
- {
- chatServiceHandler.unregister(function()
- {
- chatServiceHandler = null;
- console.log("Chat service is unregistered.");
- }, function(e)
- {
- console.log("Error: " + e.message);
- });
- }
+ if (chatServiceHandler != null)
+ {
+ chatServiceHandler.unregister(function()
+ {
+ chatServiceHandler = null;
+ console.log("Chat service is unregistered.");
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
}
</pre>
</div>
if (healthCapability)
{
- var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
- console.log("Bluetooth profile type is " + healthProfileHandler.profileType);
+ var healthProfileHandler = adapter.getBluetoothProfileHandler("HEALTH");
+ console.log("Bluetooth profile type is " + healthProfileHandler.profileType);
}
else
{
- console.log("Bluetooth Health Profile is not supported on this device.");
+ console.log("Bluetooth Health Profile is not supported on this device.");
}
</pre>
</div>
Since: </span>
2.3.1
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataType</span>:
+<span class="name">dataType</span>:
MDEP data type used for communication, which is referenced in the ISO/IEEE 11073-20601 spec
For example, pulse oximeter is 4100 and blood pressure monitor is 4103.
</li>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Friendly name associated with sink application
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when a sink application is registered successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
+ console.log("Registered application: " + app.name);
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">peer</span>:
+<span class="name">peer</span>:
Remote device which acts as the Source role
</li>
<li class="param">
-<span class="name">application</span>:
+<span class="name">application</span>:
Registered application for the Sink role
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when a connection is established successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function healthConnectSuccess(channel)
{
- console.log("Health device is connected");
- var status = "Name of remote device: " + channel.peer.name +
- "channel type of device profile: " + channel.channelType +
- "health application name: " + channel.appication.name;
- console.log(status);
+ console.log("Health device is connected");
+ var status = "Name of remote device: " + channel.peer.name +
+ "channel type of device profile: " + channel.channelType +
+ "health application name: " + channel.appication.name;
+ console.log(status);
}
function healthConnectError(e)
{
- console.log("Failed to connect to source: " + e.message);
+ console.log("Failed to connect to source: " + e.message);
};
function gotDeviceInfo(device)
{
- healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess, healthConnectError);
+ healthProfileHandler.connectToSource(device, registerHealthApp, healthConnectSuccess, healthConnectError);
}
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- registerHealthApp = app;
- adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo);
+ console.log("Registered application: " + app.name);
+ registerHealthApp = app;
+ adapter.getDevice("35:F4:59:D1:7A:03", gotDeviceInfo);
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- console.log("Data type used for communication is " + app.dataType);
+ console.log("Registered application: " + app.name);
+ console.log("Data type used for communication is " + app.dataType);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- }
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when a sink application is registered successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- healthApp = app;
- healthApp.onconnect = function(channel)
- {
- console.log("Connected!!");
- };
+ console.log("Registered application: " + app.name);
+ healthApp = app;
+ healthApp.onconnect = function(channel)
+ {
+ console.log("Connected!!");
+ };
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
function startSink()
{
- try
- {
- healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
- }
- catch (e)
- {
- console.log("Error: " + e.message);
- }
+ try
+ {
+ healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
+ }
+ catch (e)
+ {
+ console.log("Error: " + e.message);
+ }
}
function stopSink()
{
- try
- {
- if (healthApp != null)
- {
- healthApp.unregister(function()
- {
- healthApp = null;
- console.log("Health application is unregistered.");
- }, function(e)
- {
- console.log("Error: " + e.message);
- });
- }
- }
- catch (err)
- {
- console.log("Error: " + err.message);
- }
+ try
+ {
+ if (healthApp != null)
+ {
+ healthApp.unregister(function()
+ {
+ healthApp = null;
+ console.log("Health application is unregistered.");
+ }, function(e)
+ {
+ console.log("Error: " + e.message);
+ });
+ }
+ }
+ catch (err)
+ {
+ console.log("Error: " + err.message);
+ }
}
</pre>
</div>
function healthRegisterSuccess(app)
{
- app.onconnect = function(channel)
- {
- console.log("Health device " + (channel.isConnected ? "is" : "is not") + " connected to " + channel.peer.name + " remote device");
- console.log("Channel type is " + channel.channelType + " and health application name used for communication is " + channel.application.name);
- }
+ app.onconnect = function(channel)
+ {
+ console.log("Health device " + (channel.isConnected ? "is" : "is not") + " connected to " + channel.peer.name + " remote device");
+ console.log("Channel type is " + channel.channelType + " and health application name used for communication is " + channel.application.name);
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- channel.close();
- }
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.close();
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Data to send
</li>
</ul>
var dataToSend = new Array();
for (var i = 0; i < textmsg.length; i++)
{
- dataToSend[i] = textmsg.charCodeAt(i);
+ dataToSend[i] = textmsg.charCodeAt(i);
}
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- channel.sendData(dataToSend);
- }
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.sendData(dataToSend);
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Event listener of Bluetooth health channel
</li>
</ul>
var channelCallback =
{
- onmessage: function(data)
- {
- console.log("data is received")
- },
- onclose: function()
- {
- console.log("channel is closed");
- }
+ onmessage: function(data)
+ {
+ console.log("data is received")
+ },
+ onclose: function()
+ {
+ console.log("channel is closed");
+ }
};
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- channel.setListener(channelCallback);
- }
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ channel.setListener(channelCallback);
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
var channelCallback =
{
- onmessage: function(data)
- {
- console.log("data is received")
- },
- onclose: function()
- {
- console.log("channel is closed");
- connectedChannel.unsetListener();
- }
+ onmessage: function(data)
+ {
+ console.log("data is received")
+ },
+ onclose: function()
+ {
+ console.log("channel is closed");
+ connectedChannel.unsetListener();
+ }
};
function healthRegisterSuccess(app)
{
- console.log("Registered application: " + app.name);
- app.onconnect = function(channel)
- {
- console.log("Health device is connected");
- connectedChannel = channel;
- connectedChannel.setListener(channelCallback);
- }
+ console.log("Registered application: " + app.name);
+ app.onconnect = function(channel)
+ {
+ console.log("Health device is connected");
+ connectedChannel = channel;
+ connectedChannel.setListener(channelCallback);
+ }
}
function healthRegisterError(e)
{
- console.log("Failed to register application: " + e.message);
+ console.log("Failed to register application: " + e.message);
};
healthProfileHandler.registerSinkApplication(4100, "testSinkApp", healthRegisterSuccess, healthRegisterError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">powered</span>:
+<span class="name">powered</span>:
Flag indicating power state of local Bluetooth: <var>true</var> means power-on, <var>false</var> means power-off
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name of local Bluetooth
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">visible</span>:
+<span class="name">visible</span>:
Flag indicating visibility of local Bluetooth: <var>true</var> means that local Bluetooth is discoverable, <var>false</var> means that local Bluetooth is hidden from other devices
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">device</span>:
+<span class="name">device</span>:
BluetoothDevice object
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">devices</span>:
+<span class="name">devices</span>:
List of devices known to local Bluetooth adapter
Each element is a BluetoothDevice.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">device</span>:
+<span class="name">device</span>:
Device that is found
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">address</span>:
+<span class="name">address</span>:
Address of the device that is no longer in range or visible
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">foundDevices</span>:
+<span class="name">foundDevices</span>:
Array of devices found in this discovery session
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">socket</span>:
+<span class="name">socket</span>:
Socket to connect to the specified service on a remote device
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">handler</span>:
+<span class="name">handler</span>:
Bluetooth service handler
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">application</span>:
+<span class="name">application</span>:
Registered health application
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">channel</span>:
+<span class="name">channel</span>:
Connected health channel
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Received data
</li>
</ul>
/* Check the description is editable, and then set a description */
if (content.editableAttributes.indexOf("description") >= 0)
{
- content.description = "Sample content";
+ content.description = "Sample content";
}
tizen.content.update(content);
</pre>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Attributes set successfully');
+ console.log('Attributes set successfully');
}
/* Assume the content is a Content object as a result of find method */
/* Check the rating is editable, and then increase by 1 */
if (content.editableAttributes.indexOf("rating") >= 0)
{
- content.rating++;
+ content.rating++;
}
tizen.content.updateBatch([content], successCB, errorCB);
</pre>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printDirectory(directory, index, directories)
{
- console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
+ console.log('directoryURI: ' + directory.directoryURI + ' Title: ' + directory.title);
}
function getDirectoriesCB(directories)
{
- directories.forEach(printDirectory);
+ directories.forEach(printDirectory);
}
tizen.content.getDirectories(getDirectoriesCB, errorCB);
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printContent(content, index, contents)
{
- console.log('Name: ' + content.name + ' Title: ' + content.title +
- 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
+ console.log('Name: ' + content.name + ' Title: ' + content.title +
+ 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:');
- contents.forEach(printContent);
- /* Increase the offset as much as the count and then find content again */
- if (contents.length === count)
- {
- offset += count;
- tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
- }
+ console.log('The Joshua Tree by U2:');
+ contents.forEach(printContent);
+ /* Increase the offset as much as the count and then find content again */
+ if (contents.length === count)
+ {
+ offset += count;
+ tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
+ }
}
tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB(path)
{
- console.log('scanning is completed');
+ console.log('scanning is completed');
}
tizen.filesystem.resolve("images/tizen.jpg", function(imageFile)
{
- tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
+ tizen.content.scanFile(imageFile.toURI(), successCB, errorCB);
});
</pre>
</div>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB(path)
{
- console.log('scanning is completed');
+ console.log('scanning is completed');
}
tizen.filesystem.resolve("images", function(directory)
{
- tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
+ tizen.content.scanDirectory(directory.toURI(), true, successCB, errorCB);
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
/* Adds the listener */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
var listenerId = tizen.content.addChangeListener(listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- oncontentadded: function(content)
- {
- console.log(content.contentURI + ' content is added');
- },
- oncontentupdated: function(content)
- {
- console.log(content.contentURI + ' content is updated');
- },
- oncontentremoved: function(id)
- {
- console.log(id + ' is removed');
- },
- oncontentdiradded: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is added');
- },
- oncontentdirupdated: function(contentDir)
- {
- console.log(contentDir.directoryURI + ' content directory is updated');
- },
- oncontentdirremoved: function(id)
- {
- console.log(id + ' directory is removed');
- }
+ oncontentadded: function(content)
+ {
+ console.log(content.contentURI + ' content is added');
+ },
+ oncontentupdated: function(content)
+ {
+ console.log(content.contentURI + ' content is updated');
+ },
+ oncontentremoved: function(id)
+ {
+ console.log(id + ' is removed');
+ },
+ oncontentdiradded: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is added');
+ },
+ oncontentdirupdated: function(contentDir)
+ {
+ console.log(contentDir.directoryURI + ' content directory is updated');
+ },
+ oncontentdirremoved: function(id)
+ {
+ console.log(id + ' directory is removed');
+ }
};
/* Registers to be notified when the content changes */
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err.message);
+ console.log("getPlaylists failed: " + err.message);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
}
function findSuccess(contents)
{
- if (contents.length > 0)
- {
- gPlaylist.add(contents[0]);
- }
+ if (contents.length > 0)
+ {
+ gPlaylist.add(contents[0]);
+ }
- tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
+ tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
}
function findFail(err)
{
- console.log("find FAIL: " + err.message);
+ console.log("find FAIL: " + err.message);
}
function createSuccess(playlist)
{
- console.log("create SUCCESS");
+ console.log("create SUCCESS");
- gPlaylist = playlist;
- tizen.content.find(findSuccess, findFail, null,
- new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
+ gPlaylist = playlist;
+ tizen.content.find(findSuccess, findFail, null,
+ new tizen.AttributeFilter("type", "EXACTLY", "AUDIO"));
}
function createFail(err)
{
- console.log("create FAIL: " + err.message);
+ console.log("create FAIL: " + err.message);
}
tizen.content.createPlaylist("My new playlist", createSuccess, createFail);
function removePlaylistSuccess()
{
- console.log("removePlaylist SUCCESS");
+ console.log("removePlaylist SUCCESS");
}
function removePlaylistFail(err)
{
- console.log("removePlaylist FAIL: " + err);
+ console.log("removePlaylist FAIL: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- var cur, i;
- gPlaylists = playlists;
- for (i = 0; i < gPlaylists.length; ++i)
- {
- cur = gPlaylists[i];
- console.log("[" + i + "] name:" + cur.name + " num tracks:" +
- cur.numberOfTracks);
- }
+ var cur, i;
+ gPlaylists = playlists;
+ for (i = 0; i < gPlaylists.length; ++i)
+ {
+ cur = gPlaylists[i];
+ console.log("[" + i + "] name:" + cur.name + " num tracks:" +
+ cur.numberOfTracks);
+ }
- if (gPlaylists.length < 1)
- {
- console.log("Please add at least 1 playlist");
+ if (gPlaylists.length < 1)
+ {
+ console.log("Please add at least 1 playlist");
- return;
- }
+ return;
+ }
- console.log("will remove playlist at index [0] name:"
- + gPlaylists[0].name);
+ console.log("will remove playlist at index [0] name:"
+ + gPlaylists[0].name);
- tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
- removePlaylistFail);
+ tizen.content.removePlaylist(gPlaylists[0].id, removePlaylistSuccess,
+ removePlaylistFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function createCB(path)
{
- console.log("The thumbnail path is " + path);
+ console.log("The thumbnail path is " + path);
}
function findCB(contents)
{
- if (contents.length > 0)
- {
- tizen.content.createThumbnail(contents[0], createCB);
- }
+ if (contents.length > 0)
+ {
+ tizen.content.createThumbnail(contents[0], createCB);
+ }
}
tizen.content.find(findCB);
function get2Fail(err)
{
- console.log("get items (after remove) failed: " + err);
+ console.log("get items (after remove) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist items:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 1)
- {
- console.log("Please add at least 1 tracks to playlist!");
+ if (gItems.length < 1)
+ {
+ console.log("Please add at least 1 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original playlist:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will remove item at index [0] name:" + gItems[0].content.name);
- gCurPlaylist.remove(gItems[0]);
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("Will remove item at index [0] name:" + gItems[0].content.name);
+ gCurPlaylist.remove(gItems[0]);
+ gCurPlaylist.get(get2Success, get2Fail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after remove batch) failed: " + err);
+ console.log("get items (after remove batch) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist after remove batch:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist after remove batch:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function removeBatchSuccess()
{
- console.log("removeBatch success");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("removeBatch success");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function removeBatchFail(err)
{
- console.log("removeBatch failed: " + err);
+ console.log("removeBatch failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 4)
- {
- console.log("Please add at least 4 tracks to playlist!");
+ if (gItems.length < 4)
+ {
+ console.log("Please add at least 4 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original playlist:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original playlist:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will remove items at index [0](name:" + gItems[0].content.name
- + ") and at index [2](name:" + gItems[2].content.name + ")");
- gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
+ console.log("Will remove items at index [0](name:" + gItems[0].content.name
+ + ") and at index [2](name:" + gItems[2].content.name + ")");
+ gCurPlaylist.removeBatch([gItems[2], gItems[0]], removeBatchSuccess, removeBatchFail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function getSuccess(items)
{
- gItems = items;
- console.log("Playlist items:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].name);
- }
+ gItems = items;
+ console.log("Playlist items:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].name);
+ }
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- /* To retrieve all playlist items of 'gCurPlaylist' playlist */
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ /* To retrieve all playlist items of 'gCurPlaylist' playlist */
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after set order) failed: " + err);
+ console.log("get items (after set order) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist order after setOrder:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist order after setOrder:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function setOrderSuccess()
{
- console.log("set items order SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("set items order SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function setOrderFail(err)
{
- console.log("set items order failed: " + err);
+ console.log("set items order failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 2)
- {
- console.log("Please add at least 2 tracks to playlist!");
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original order:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- gExpectedOrder = gItems.slice(0);
- gExpectedOrder.reverse();
+ gExpectedOrder = gItems.slice(0);
+ gExpectedOrder.reverse();
- console.log("New order:");
- for (var i = 0; i < gExpectedOrder.length; ++i)
- {
- console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
- }
+ console.log("New order:");
+ for (var i = 0; i < gExpectedOrder.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gExpectedOrder[i].content.name);
+ }
- gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
+ gCurPlaylist.setOrder(gExpectedOrder, setOrderSuccess, setOrderFail);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
function get2Fail(err)
{
- console.log("get items (after move item) failed: " + err);
+ console.log("get items (after move item) failed: " + err);
}
function get2Success(items)
{
- console.log("Playlist order after move:");
- for (var i = 0; i < items.length; ++i)
- {
- console.log("[" + i + "]: name:" + items[i].content.name);
- }
+ console.log("Playlist order after move:");
+ for (var i = 0; i < items.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + items[i].content.name);
+ }
}
function moveSuccess()
{
- console.log("move item SUCCESS");
- gCurPlaylist.get(get2Success, get2Fail);
+ console.log("move item SUCCESS");
+ gCurPlaylist.get(get2Success, get2Fail);
}
function moveFail(err)
{
- console.log("move item failed: " + err);
+ console.log("move item failed: " + err);
}
function getSuccess(items)
{
- gItems = items;
+ gItems = items;
- if (gItems.length < 2)
- {
- console.log("Please add at least 2 tracks to playlist!");
+ if (gItems.length < 2)
+ {
+ console.log("Please add at least 2 tracks to playlist!");
- return;
- }
+ return;
+ }
- console.log("Original order:");
- for (var i = 0; i < gItems.length; ++i)
- {
- console.log("[" + i + "]: name:" + gItems[i].content.name);
- }
+ console.log("Original order:");
+ for (var i = 0; i < gItems.length; ++i)
+ {
+ console.log("[" + i + "]: name:" + gItems[i].content.name);
+ }
- console.log("Will move item at index [1] (name: " +
- gItems[1].content.name + ") up by one place (to [0])");
+ console.log("Will move item at index [1] (name: " +
+ gItems[1].content.name + ") up by one place (to [0])");
- gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
- gItems.unshift(gItems.splice(1, 1)[0]);
+ gCurPlaylist.move(gItems[1], -1, moveSuccess, moveFail);
+ gItems.unshift(gItems.splice(1, 1)[0]);
}
function getFail(err)
{
- console.log("get items failed: " + err);
+ console.log("get items failed: " + err);
}
function getPlaylistsFail(err)
{
- console.log("getPlaylists failed: " + err);
+ console.log("getPlaylists failed: " + err);
}
function getPlaylistsSuccess(playlists)
{
- gPlaylists = playlists;
- if (gPlaylists.length === 0)
- {
- console.log("Please create at least 1 playlist!");
+ gPlaylists = playlists;
+ if (gPlaylists.length === 0)
+ {
+ console.log("Please create at least 1 playlist!");
- return;
- }
+ return;
+ }
- gCurPlaylist = gPlaylists[0];
- gCurPlaylist.get(getSuccess, getFail);
+ gCurPlaylist = gPlaylists[0];
+ gCurPlaylist.get(getSuccess, getFail);
}
tizen.content.getPlaylists(getPlaylistsSuccess, getPlaylistsFail);
/* Handling device discovery results */
var discoveryCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- /* Do something with the discovered device */
- /* If desired device is found, stop discovery with following call */
- tizen.convergence.stopDiscovery();
- },
-
- onfinished: function(foundDevices)
- {
- console.log('Device discovery has finished');
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ /* Do something with the discovered device */
+ /* If desired device is found, stop discovery with following call */
+ tizen.convergence.stopDiscovery();
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log('Device discovery has finished');
+ }
};
/* Running device discovery procedure */
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoveryCallback, function(err)
- {
- console.log(err.name + ': ' + err.message);
- }, 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoveryCallback, function(err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }, 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(channelinfo, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channelinfo.uri);
- console.log('channel id: ' + channelinfo.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channelinfo.uri);
+ console.log('channel id: ' + channelinfo.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
/* Create an instance of application communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(channelinfo, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channelinfo.uri);
- console.log('channel id: ' + channelinfo.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channelinfo.uri);
+ console.log('channel id: ' + channelinfo.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess(clientinfolist)
{
- console.log('get client list');
- for (i in clientinfolist)
- {
- console.log('isHost: ' + clientinfolist[i].isHost);
- console.log('client id: ' + clientinfolist[i].clientId);
- console.log('connection time: ' + clientinfolist[i].connectionTime);
- }
+ console.log('get client list');
+ for (i in clientinfolist)
+ {
+ console.log('isHost: ' + clientinfolist[i].isHost);
+ console.log('client id: ' + clientinfolist[i].clientId);
+ console.log('connection time: ' + clientinfolist[i].connectionTime);
+ }
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri' + channel.uri);
- console.log('channel id ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- service.getClientList(requestChannel, onsuccess, onerror);
+ console.log('Channel started');
+ console.log('channel uri' + channel.uri);
+ console.log('channel id ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ service.getClientList(requestChannel, onsuccess, onerror);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess(clientinfolist)
{
- console.log('get client list');
- for (i in clientinfolist)
- {
- console.log('isHost: ' + clientinfolist[i].isHost);
- console.log('client id: ' + clientinfolist[i].clientId);
- console.log('connection time: ' + clientinfolist[i].connectionTime);
- }
+ console.log('get client list');
+ for (i in clientinfolist)
+ {
+ console.log('isHost: ' + clientinfolist[i].isHost);
+ console.log('client id: ' + clientinfolist[i].clientId);
+ console.log('connection time: ' + clientinfolist[i].connectionTime);
+ }
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri' + channel.uri);
- console.log('channel id ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- clientService.getClientList(requestChannel, onsuccess, onerror);
+ console.log('Channel started');
+ console.log('channel uri' + channel.uri);
+ console.log('channel id ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ clientService.getClientList(requestChannel, onsuccess, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function sendSuccessCallback(channelinfo)
{
- console.log('requestPayload sent');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('requestPayload sent');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by Multi Screen server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- /* Send data to the remote service */
- service.send(channel, requestPayload, sendSuccessCallback, onerror);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by Multi Screen server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ /* Send data to the remote service */
+ service.send(channel, requestPayload, sendSuccessCallback, onerror);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function sendSuccessCallback(channel)
{
- console.log('requestPayload sent');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('requestPayload sent');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- /* Send data to the remote service */
- clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ /* Send data to the remote service */
+ clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- clientService = device.service[i];
- clientService.start(requestChannel, onstarted, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ clientService = device.service[i];
+ clientService.start(requestChannel, onstarted, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped(channel)
{
- console.log('Channel stopped');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('Channel stopped');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('clienti id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- if (channel id == 'chB')
- {
- service.stop(requestChannel2, onstopped);
- }
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('clienti id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ if (channel id == 'chB')
+ {
+ service.stop(requestChannel2, onstopped);
+ }
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped(channel)
{
- console.log('Channel stopped');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
+ console.log('Channel stopped');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
- if (channel id == 'chB')
- {
- clientService.stop(requestChannel2, onstopped);
- }
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
+ if (channel id == 'chB')
+ {
+ clientService.stop(requestChannel2, onstopped);
+ }
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- clientService = service;
- service.start(requestChannel, onstarted, onerror);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ clientService = service;
+ service.start(requestChannel, onstarted, onerror);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onnotify(channel, payload, senderclientid)
{
- console.log('On service notification');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- /* clientid of the sender of the payload */
- console.log('client id of sender: ' + senderclientid);
- for (i in payload)
- {
- console.log('payload: ' + payload[i].key + '-' + payload[i].value);
- }
- /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
- service.unsetListener();
+ console.log('On service notification');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ /* clientid of the sender of the payload */
+ console.log('client id of sender: ' + senderclientid);
+ for (i in payload)
+ {
+ console.log('payload: ' + payload[i].key + '-' + payload[i].value);
+ }
+ /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
+ service.unsetListener();
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by Multi Screen server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by Multi Screen server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
/* Create an instance of app communication server service object */
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onnotify(channel, payload, senderclientid)
{
- console.log('On service notification');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- /* clientid of the sender of the payload */
- console.log('client id of sender: ' + senderclientid);
- for (i in payload)
- {
- console.log('payload ' + payload[i].key + ': ' + payload[i].value);
- }
- /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
- clientService.unsetListener();
+ console.log('On service notification');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ /* clientid of the sender of the payload */
+ console.log('client id of sender: ' + senderclientid);
+ for (i in payload)
+ {
+ console.log('payload ' + payload[i].key + ': ' + payload[i].value);
+ }
+ /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
+ clientService.unsetListener();
}
function onstarted(channel, clientinfo)
{
- console.log('Channel started');
- console.log('channel uri: ' + channel.uri);
- console.log('channel id: ' + channel.id);
- console.log('clientinfo');
- console.log('isHost: ' + clientinfo.isHost);
- /* Remote DeviceId generated by remote server */
- console.log('client id: ' + clientinfo.clientId);
- console.log('connection time: ' + clientinfo.connectionTime);
+ console.log('Channel started');
+ console.log('channel uri: ' + channel.uri);
+ console.log('channel id: ' + channel.id);
+ console.log('clientinfo');
+ console.log('isHost: ' + clientinfo.isHost);
+ /* Remote DeviceId generated by remote server */
+ console.log('client id: ' + clientinfo.clientId);
+ console.log('connection time: ' + clientinfo.connectionTime);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- service.start(requestChannel, onstarted, onerror);
- /* Register listener to receive notifications from remote service */
- service.setListener(onnotify);
- }
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ service.start(requestChannel, onstarted, onerror);
+ /* Register listener to receive notifications from remote service */
+ service.setListener(onnotify);
+ }
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onconnected(service)
{
- console.log('Connected to the service');
- if (service.type === "APP_COMM_CLIENT")
- {
- console.log('Connected to the app communication client service');
- }
- else if (service.type === "REMOTE_APP_CONTROL")
- {
- console.log('Connected to the remote app control service');
- }
- service.disconnect();
+ console.log('Connected to the service');
+ if (service.type === "APP_COMM_CLIENT")
+ {
+ console.log('Connected to the app communication client service');
+ }
+ else if (service.type === "REMOTE_APP_CONTROL")
+ {
+ console.log('Connected to the remote app control service');
+ }
+ service.disconnect();
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "APP_COMM_CLIENT")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- else if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "APP_COMM_CLIENT")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ else if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke on success
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstarted(service)
{
- console.log('Remote app control service started');
- service.disconnect();
+ console.log('Remote app control service started');
+ service.disconnect();
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.start(onstarted, onerror);
+ console.log('Connected to the remote app control service');
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- device.services[i].start(onstarted, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ device.services[i].start(onstarted, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
<div class="output">
<span class="title"><p>Output example:</p></span><pre> >> STARTING DEVICE DISCOVERY
<< Found a device
- - id: de2bea-ddvia
- - name : deviceA
- - type : TV
- - service amount: 2
+ - id: de2bea-ddvia
+ - name : deviceA
+ - type : TV
+ - service amount: 2
<< Device discovery has finished
Connected to the remote app control service
Remote app control service started
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on success
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onstopped()
{
- console.log('Remote App Control service stopped');
- /* Disconnect */
- service.disconnect();
+ console.log('Remote App Control service stopped');
+ /* Disconnect */
+ service.disconnect();
}
function onstarted(service)
{
- console.log('Remote App Control service started');
- /* Stop the service */
- service.stop(onstopped, onerror);
+ console.log('Remote App Control service started');
+ /* Stop the service */
+ service.stop(onstopped, onerror);
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.start(onstarted, onerror);
+ console.log('Connected to the remote app control service');
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- else
- {
- device.services[i].start(onstarted, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ else
+ {
+ device.services[i].start(onstarted, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
<div class="output">
<span class="title"><p>Output example:</p></span><pre> >> STARTING DEVICE DISCOVERY
<< Found a device
- - id: de2bea-ddvia
- - name : deviceA
- - type : TV
- - service amount: 2
+ - id: de2bea-ddvia
+ - name : deviceA
+ - type : TV
+ - service amount: 2
<< Device discovery has finished
Connected to the remote app control service
Remote App Control service started
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onconnected(service)
{
- console.log('Connected to the remote app control service');
- service.disconnect();
+ console.log('Connected to the remote app control service');
+ service.disconnect();
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
console.log('>> STARTING DEVICE DISCOVERY');
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function ondisconnected()
{
- console.log('Disconnected to the service');
+ console.log('Disconnected to the service');
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log('Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState == "CONNECTED")
- {
- device.services[i].disconnect(ondisconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log('Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log('Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState == "CONNECTED")
+ {
+ device.services[i].disconnect(ondisconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log('Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
function onsuccess()
{
- console.log('The application has launched successfully');
+ console.log('The application has launched successfully');
}
function onstarted(service)
{
- console.log('Service started');
+ console.log('Service started');
- /* Launching server app remotely */
- service.launch(requestAppId, remoteAppControlCallback, onerror);
+ /* Launching server app remotely */
+ service.launch(requestAppId, remoteAppControlCallback, onerror);
}
function onconnected(service)
{
- console.log('Connected to the service');
- /* Start the service */
- service.start(onstarted, onerror);
+ console.log('Connected to the service');
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- tizen.convergence.stopDiscovery();
- }
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
console.log('>> STARTING DEVICE DISCOVERY');
The method to invoke on failure.
</li>
<li class="param">
-<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the application gets back result from the remote service.
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var requestAppControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/view',
- null, 'image/jpeg', null,
- [new tizen.ApplicationControlData('images', [testImgData])]);
+ null, 'image/jpeg', null,
+ [new tizen.ApplicationControlData('images', [testImgData])]);
function onsuccess()
{
- console.log('Launch application control succeed');
+ console.log('Launch application control succeed');
}
function onerror(err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
var remoteAppControlCallback =
{
- onsuccess: function(data)
- {
- console.log('On remote app control service reply');
- for(var i = 0; i < data.length; i++)
- {
- console.log("key : " + data[i].key + "value : " + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ onsuccess: function(data)
+ {
+ console.log('On remote app control service reply');
+ for(var i = 0; i < data.length; i++)
+ {
+ console.log("key : " + data[i].key + "value : " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log('The launch application control failed');
+ }
}
function onstarted(service)
{
- console.log('Service started');
+ console.log('Service started');
- /* Send data to the remote service */
- service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
+ /* Send data to the remote service */
+ service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
}
function onconnected(service)
{
- console.log('Connected to the service');
+ console.log('Connected to the service');
- /* Start the service */
- service.start(onstarted, onerror);
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
{
- onfound: function(device)
- {
- console.log(' Found a device');
- console.log(" - id: " + device.id);
- console.log(" - name: " + device.name);
- console.log(" - type: " + device.type);
- console.log(" - service amount: " + device.services.length);
- for (i in device.services)
- {
- if (device.services[i].type === "REMOTE_APP_CONTROL")
- {
- if (device.services[i].connectionState != "CONNECTED")
- {
- device.services[i].connect(onconnected, onerror);
- }
- }
- tizen.convergence.stopDiscovery();
- }
- },
-
- onfinished: function(foundDevices)
- {
- console.log(' Device discovery has finished');
- console.log(" - devices found: " + foundDevices.length);
- }
+ onfound: function(device)
+ {
+ console.log(' Found a device');
+ console.log(" - id: " + device.id);
+ console.log(" - name: " + device.name);
+ console.log(" - type: " + device.type);
+ console.log(" - service amount: " + device.services.length);
+ for (i in device.services)
+ {
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
+ {
+ if (device.services[i].connectionState != "CONNECTED")
+ {
+ device.services[i].connect(onconnected, onerror);
+ }
+ }
+ tizen.convergence.stopDiscovery();
+ }
+ },
+
+ onfinished: function(foundDevices)
+ {
+ console.log(' Device discovery has finished');
+ console.log(" - devices found: " + foundDevices.length);
+ }
};
try
{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
+ console.log('>> STARTING DEVICE DISCOVERY');
+ tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">text</span>:
+<span class="name">text</span>:
The text to be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">expression</span>:
+<span class="name">expression</span>:
The expression to be evaluated.
</li>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be displayed if an expression is false.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">obj</span>:
+<span class="name">obj</span>:
An object whose JavaScript representation will be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">obj</span>:
+<span class="name">obj</span>:
An object whose XML/HTML Element representation will be printed.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
The label to start timing with.
</li>
</ul>
var array = new Array(1000000);
for (var i = array.length - 1; i >= 0; i -= 1)
{
- array[i] = new Object();
+ array[i] = new Object();
};
console.timeEnd("Big array initialization");
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
The label associated to the timing (with the use of <var>console.time()</var>method).
</li>
</ul>
var array = new Array(1000000);
for (var i = array.length - 1; i >= 0; i -= 1)
{
- array[i] = new Object();
+ array[i] = new Object();
};
console.timeEnd("Big array initialization");
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Error object containing some information about the error.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked with current acceleration values.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked with current acceleration values.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Specifies the interval of calling successcallback in miliseconds. If not provided, default value for frequency is 10000 (10 seconds).
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- console.log('Please wait 3 seconds for the next measurement...');
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ console.log('Please wait 3 seconds for the next measurement...');
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
var options = {frequency: 3000}; /* Update every 3 seconds */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchID</span>:
+<span class="name">watchID</span>:
The id of the watch returned from <a href="device-motion.html#Accelerometer::watchAcceleration">watchAcceleration</a>.
</li>
</ul>
function onSuccess(acceleration)
{
- console.log('Acceleration X: ' + acceleration.x + '\n' +
- 'Acceleration Y: ' + acceleration.y + '\n' +
- 'Acceleration Z: ' + acceleration.z + '\n' +
- 'Timestamp: ' + acceleration.timestamp);
- if (3 == ++counter)
- {
- navigator.accelerometer.clearWatch(watchID);
- }
+ console.log('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp);
+ if (3 == ++counter)
+ {
+ navigator.accelerometer.clearWatch(watchID);
+ }
};
function onError()
{
- console.log('onError!');
+ console.log('onError!');
};
var options = {frequency: 30}; /* Update every 0.03 seconds */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">acceleration</span>:
+<span class="name">acceleration</span>:
The acceleration at a single moment in time.
</li>
</ul>
function onDeviceReady()
{
- console.log('Device Cordova: ' + device.cordova);
+ console.log('Device Cordova: ' + device.cordova);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Model: ' + device.model);
+ console.log('Device Model: ' + device.model);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Platform: ' + device.platform);
+ console.log('Device Platform: ' + device.platform);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device UUID: ' + device.uuid);
+ console.log('Device UUID: ' + device.uuid);
}
</pre>
</div>
function onDeviceReady()
{
- console.log('Device Version: ' + device.version);
+ console.log('Device Version: ' + device.version);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog dialog.
</li>
<li class="param">
-<span class="name">alertCallback</span>:
+<span class="name">alertCallback</span>:
The callback to be invoked when alert dialog would be dismissed.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Dialog'.
</li>
<li class="param">
-<span class="name">buttonName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button name to be shown on dialog box. Default value is 'OK'.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var alertDismissed = function()
{
- console.log('Alert was dismissed');
+ console.log('Alert was dismissed');
}
navigator.notification.alert('Please click OK button', alertDismissed,
- 'OK click alert', 'OK');
+ 'OK click alert', 'OK');
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog box.
</li>
<li class="param">
-<span class="name">confirmCallback</span>:
+<span class="name">confirmCallback</span>:
The callback to be invoked when user perform an action on dialog box.
Callback provides index of button pressed (1,2,3 etc.) or 0, if dialog was dismissed without button press.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Confirm'.
</li>
<li class="param">
-<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button names to be shown on dialog box. Default values are ['OK', 'Cancel'].
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var confirmCallback = function(buttonIndex)
{
- console.log('Selected option was ' + buttonIndex);
+ console.log('Selected option was ' + buttonIndex);
}
navigator.notification.confirm('Choose one option', confirmCallback,
- 'Options', ['Option1', 'Option2']);
+ 'Options', ['Option1', 'Option2']);
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">message</span>:
+<span class="name">message</span>:
The message to be shown to the user by dialog box.
</li>
<li class="param">
-<span class="name">promptCallback</span>:
+<span class="name">promptCallback</span>:
The callback to be invoked when user perform an action on dialog box.
Callback provides <em>PromptData</em> object, which holds all data provided by user.
</li>
<li class="param">
-<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">title</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The title of dialog box. Default value is 'Prompt'.
</li>
<li class="param">
-<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">buttonNames</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Button names to be shown on dialog box. Default values are ['OK', 'Cancel'].
</li>
<li class="param">
-<span class="name">defaultText</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">defaultText</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Default text to be shown in textbox of dialog box. Default value is an empty string ('').
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var promptCallback = function(results)
{
- console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
+ console.log('Hello ' + results.input1 + ', you selected option ' + results.buttonIndex);
}
navigator.notification.prompt('Please enter your name', promptCallback,
- 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
+ 'Registration Box', ['Ok', 'Exit'], 'e.g. Jane Doe');
</pre>
</div>
<div class="output">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">times</span>:
+<span class="name">times</span>:
The number of times to repeat the beep.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">buttonIndex</span>:
+<span class="name">buttonIndex</span>:
The index of button, which was pressed by user.
the index uses one-based indexing, so the values could be 1, 2, 3, etc.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The data input into dialog box.
</li>
</ul>
function onDeviceReady()
{
- /* Now safe to use device APIs */
+ /* Now safe to use device APIs */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('pause', onPause, false);
+ document.addEventListener('pause', onPause, false);
}
function onPause()
{
- /* Handle the pause event */
+ /* Handle the pause event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('resume', onResume, false);
+ document.addEventListener('resume', onResume, false);
}
function onResume()
{
- /* Handle the resume event */
+ /* Handle the resume event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('backbutton', onBackKeyDown, false);
+ document.addEventListener('backbutton', onBackKeyDown, false);
}
function onBackKeyDown()
{
- /* Handle the back button */
+ /* Handle the back button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('menubutton', onMenuKeyDown, false);
+ document.addEventListener('menubutton', onMenuKeyDown, false);
}
function onMenuKeyDown()
{
- /* Handle the back button */
+ /* Handle the back button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('searchbutton', onSearchKeyDown, false);
+ document.addEventListener('searchbutton', onSearchKeyDown, false);
}
function onSearchKeyDown()
{
- /* Handle the search button */
+ /* Handle the search button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('startcallbutton', onStartCallKeyDown, false);
+ document.addEventListener('startcallbutton', onStartCallKeyDown, false);
}
function onStartCallKeyDown()
{
- /* Handle the start call button */
+ /* Handle the start call button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('endcallbutton', onEndCallKeyDown, false);
+ document.addEventListener('endcallbutton', onEndCallKeyDown, false);
}
function onEndCallKeyDown()
{
- /* Handle the end call button */
+ /* Handle the end call button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
+ document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
}
function onVolumeDownKeyDown()
{
- /* Handle the volume down button */
+ /* Handle the volume down button */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
+ document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
}
function onVolumeUpKeyDown()
{
- /* Handle the volume up button */
+ /* Handle the volume up button */
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var eventInit =
{
- loaded: 128,
- total: 1024
+ loaded: 128,
+ total: 1024
};
var event = new ProgressEvent('submit', eventInit);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fileSystem)
{
- console.log('Name of the filesystem: ' + fileSystem.name);
+ console.log('Name of the filesystem: ' + fileSystem.name);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Local file system type, either TEMPORARY or PERSISTENT.
</li>
<li class="param">
-<span class="name">size</span>:
+<span class="name">size</span>:
Indicates how much storage space, in bytes, the application expects to need.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked with a <em>FileSystem</em> object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked if error occurs retrieving file system.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(fs)
{
- console.log('File system name ' + fs.name);
+ console.log('File system name ' + fs.name);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
requestFileSystem(TEMPORARY, 1024 * 1024, successCallback, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">uri</span>:
+<span class="name">uri</span>:
URI referring to a local file or directory.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked with <em>Entry</em> object corresponding to URI.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Invoked if error occurs retrieving file system entry.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(entry)
{
- console.log('Entry name ' + entry.name);
+ console.log('Entry name ' + entry.name);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
var uri = 'file:///home/owner/content/Documents/example.txt';
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the time of the last modification.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called when errors happen.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getMetadata(function(metadata)
- {
- console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
- });
+ fs.root.getMetadata(function(metadata)
+ {
+ console.log("Last modification time: " + metadata.modificationTime); /* Get metadata successfully */
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">parent</span>:
+<span class="name">parent</span>:
The directory to which to move the entry.
</li>
<li class="param">
-<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The new name of the entry. Defaults to the Entry's current name if unspecified.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called with the Entry for the new location.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
- {
- fs.root.getFile("aa.txt", {create:true}, function(fileentry)
- {
- console.log('Full path before move: ' + fileentry.fullPath);
- fileentry.moveTo(direntry, 'newname.txt', successCallback);
- });
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("aa.txt", {create:true}, function(fileentry)
+ {
+ console.log('Full path before move: ' + fileentry.fullPath);
+ fileentry.moveTo(direntry, 'newname.txt', successCallback);
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">parent</span>:
+<span class="name">parent</span>:
The directory to which to copy the entry.
</li>
<li class="param">
-<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">newName</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The new name of the entry. Defaults to the Entry's current name if unspecified.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called with the Entry for the new location.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
- {
- fs.root.getFile("test.txt", {create:true}, function(fileentry)
- {
- fileentry.copyTo(direntry, 'newname.txt', successCallback);
- });
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(direntry)
+ {
+ fs.root.getFile("test.txt", {create:true}, function(fileentry)
+ {
+ fileentry.copyTo(direntry, 'newname.txt', successCallback);
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called to return the parent Entry.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getParent(function(entry)
- {
- console.log("success");
- });
+ fs.root.getParent(function(entry)
+ {
+ console.log("success");
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called on success.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile('test.txt', {create: true}, function(fileEntry)
- {
- fileEntry.remove(function()
- {
- console.log("success");
- });
- });
+ fs.root.getFile('test.txt', {create: true}, function(fileEntry)
+ {
+ fileEntry.remove(function()
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory('testDirectory', {create:true}, function(entry)
- {
- var url = entry.toURL();
- console.log('URL: ' + url);
- });
+ fs.root.getDirectory('testDirectory', {create:true}, function(entry)
+ {
+ var url = entry.toURL();
+ console.log('URL: ' + url);
+ });
});
</pre>
</div>
Since: </span>
3.0
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(entry)
{
- entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
- {
- var directoryReader = dirEntry.createReader();
- });
+ entry.root.getDirectory("MyDocument", {create:true}, function(dirEntry)
+ {
+ var directoryReader = dirEntry.createReader();
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">path</span>:
+<span class="name">path</span>:
Either an absolute path or a relative path from this DirectoryEntry to the directory to be looked up or created. It is an error to attempt to create a directory whose immediate parent does not yet exist.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flags
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called to return the DirectoryEntry selected or created.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory("ert", {create:true}, function(dir)
- {
- console.log('Created dir: ' + dir.name);
- })
+ fs.root.getDirectory("ert", {create:true}, function(dir)
+ {
+ console.log('Created dir: ' + dir.name);
+ })
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">path</span>:
+<span class="name">path</span>:
Either an absolute path or a relative path from this DirectoryEntry to the file to be looked up or created. It is an error to attempt to create a file whose immediate parent does not yet exist.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Flags
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is called to return the File selected or created.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("qa.txt", {create:true}, function(file)
- {
- console.log('Created file: ' + file.name);
- });
+ fs.root.getFile("qa.txt", {create:true}, function(file)
+ {
+ console.log('Created file: ' + file.name);
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called on success.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
- {
- directoryEntry.removeRecursively(function()
- {
- console.log("success");
- });
- });
+ fs.root.getDirectory("testDirectory", {create:true}, function(directoryEntry)
+ {
+ directoryEntry.removeRecursively(function()
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Called once per successful call to readEntries to deliver the next previously-unreported set of Entries in the associated Directory. If all Entries have already been returned from previous invocations of readEntries, successCallback must be called with a zero-length array as an argument.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback indicating that there was an error reading from the Directory.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- var a = fs.root.createReader();
- a.readEntries(function successCallback(entries)
- {
- console.log("success");
- });
+ var a = fs.root.createReader();
+ a.readEntries(function successCallback(entries)
+ {
+ console.log("success");
+ });
});
</pre>
</div>
void file (<a href="#FileCallback">FileCallback</a> onsuccess, optional <a href="#ErrorCallback">ErrorCallback</a> onerror);
};</pre>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the new FileWriter.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("logFile.txt", {create: true}, function(f)
- {
- f.createWriter(function(fileWriter)
- {
- fileWriter.write(new Blob(['hello']));
- fileWriter.onerror = function(e)
- {
- console.log('Write file failed:' + e);
- };
- fileWriter.onwriteend = function()
- {
- console.log("success");
- };
- });
- });
+ fs.root.getFile("logFile.txt", {create: true}, function(f)
+ {
+ f.createWriter(function(fileWriter)
+ {
+ fileWriter.write(new Blob(['hello']));
+ fileWriter.onerror = function(e)
+ {
+ console.log('Write file failed:' + e);
+ };
+ fileWriter.onwriteend = function()
+ {
+ console.log("success");
+ };
+ });
+ });
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
A callback that is called with the File.
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
requestFileSystem(TEMPORARY, 100, function(fs)
{
- fs.root.getFile("abcdz.txt", {create: true}, function(f)
- {
- f.file(function(file)
- {
- console.log("success");
- });
- });
+ fs.root.getFile("abcdz.txt", {create: true}, function(f)
+ {
+ f.file(function(file)
+ {
+ console.log("success");
+ });
+ });
});
</pre>
</div>
var deviceReady, fileReader;
deviceReady = function()
{
- fileReader = new FileReader();
+ fileReader = new FileReader();
};
document.addEventListener('deviceready', deviceReady, true);
</pre>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded');
+ console.log('Loaded');
};
fileReader.onabort = function()
{
- console.log('aborted');
+ console.log('aborted');
};
fileReader.readAsDataURL(blob);
fileReader.abort();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as data URL.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsDataURL(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as text.
</li>
<li class="param">
-<span class="name">label</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">label</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
An optional argument, that represents the label of an encoding
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsText(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as binary.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- console.log('Loaded, result = ' + fileReader.result);
+ console.log('Loaded, result = ' + fileReader.result);
};
fileReader.readAsBinaryString(blob);
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">blob</span>:
+<span class="name">blob</span>:
The <em>Blob</em> object to be read as array buffer.
</li>
</ul>
var fileReader = new FileReader();
fileReader.onload = function()
{
- resultValue = fileReader.result;
- console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
+ resultValue = fileReader.result;
+ console.log("Result: " + resultValue.toString() + '<br>' + 'ByteLength: ' + resultValue.byteLength);
};
fileReader.readAsArrayBuffer(blob);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('write success');
- };
- writer.onabort = function(e)
- {
- console.log('abort');
- };
- writer.write('some sample text');
- writer.abort();
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
+ writer.onabort = function(e)
+ {
+ console.log('abort');
+ };
+ writer.write('some sample text');
+ writer.abort();
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">offset</span>:
+<span class="name">offset</span>:
Location to move the file pointer to.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- /* Fast forwards file pointer to the end of file */
- writer.seek(writer.length);
+ /* Fast forwards file pointer to the end of file */
+ writer.seek(writer.length);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">size</span>:
+<span class="name">size</span>:
Size to chop the file at.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('truncate success');
- };
+ writer.onwrite = function(evt)
+ {
+ console.log('truncate success');
+ };
- writer.truncate(10);
+ writer.truncate(10);
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Text or Blob to be written.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function(writer)
{
- writer.onwrite = function(evt)
- {
- console.log('write success');
- };
+ writer.onwrite = function(evt)
+ {
+ console.log('write success');
+ };
- writer.write('some sample text');
+ writer.write('some sample text');
};
errorCallback = function(err)
{
- console.log(err.code);
+ console.log(err.code);
};
/* entry is FileEntry object retrieved by getFile() method of DirectoryEntry interface */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
A progress event.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filesystem</span>:
+<span class="name">filesystem</span>:
FileSystem The file systems to which the app is granted access.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entry</span>:
+<span class="name">entry</span>:
Entry
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">entries</span>:
+<span class="name">entries</span>:
Entry[]
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">metadata</span>:
+<span class="name">metadata</span>:
Metadata
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileWriter</span>:
+<span class="name">fileWriter</span>:
FileWriter
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
File
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">err</span>:
+<span class="name">err</span>:
FileError
</li>
</ul>
var win = function(r)
{
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
}
var fail = function(error)
{
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
}
var options = new FileUploadOptions();
var win = function(r)
{
- console.log('Success. File uploaded.');
+ console.log('Success. File uploaded.');
}
var fail = function(error)
{
- /* error.code == FileTransferError.ABORT_ERR */
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
};
var ft = new FileTransfer();
ft.onprogress = function(event)
{
- console.log('uploaded: ' + event.loaded);
+ console.log('uploaded: ' + event.loaded);
};
ft.upload(fileURL, encodeURI('http://some.server.com/upload.php'), win, fail);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileURL</span>:
+<span class="name">fileURL</span>:
Filesystem URL representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
</li>
<li class="param">
-<span class="name">server</span>:
+<span class="name">server</span>:
URL of the server to receive the file, as encoded by encodeURI().
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is passed a FileUploadResult object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
: A callback that executes if an error occurs retrieving the FileUploadResult. Invoked with a FileTransferError object.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameters
</li>
<li class="param">
-<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameter, defaults to false. If set to true, it accepts all security certificates.
</li>
</ul>
var win = function(r)
{
- console.log('Code = ' + r.responseCode);
- console.log('Response = ' + r.response);
- console.log('Sent = ' + r.bytesSent);
+ console.log('Code = ' + r.responseCode);
+ console.log('Response = ' + r.response);
+ console.log('Sent = ' + r.bytesSent);
}
var fail = function(error)
{
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
}
var ft = new FileTransfer();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">source</span>:
+<span class="name">source</span>:
URL of the server to download the file, as encoded by encodeURI().
</li>
<li class="param">
-<span class="name">target</span>:
+<span class="name">target</span>:
Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that is passed a FileEntry object.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A callback that executes if an error occurs when retrieving the FileEntry. Invoked with a FileTransferError object.
</li>
<li class="param">
-<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">trustAllHosts</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameter, defaults to false. If set to true, it accepts all security certificates.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
</li>
</ul>
fileTransfer.download(uri, fileURL, function(entry)
{
- console.log('download complete: ' + entry.toURL());
+ console.log('download complete: ' + entry.toURL());
}, function(error)
{
- console.log('download error source ' + error.source);
- console.log('download error target ' + error.target);
- console.log('upload error code' + error.code);
+ console.log('download error source ' + error.source);
+ console.log('download error target ' + error.target);
+ console.log('upload error code' + error.code);
}, false,
{
- headers:
- {
- 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
- }
+ headers:
+ {
+ 'Authorization': 'Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=='
+ }
});
</pre>
</div>
var win = function(r)
{
- console.log('Should not be called.');
+ console.log('Should not be called.');
}
var fail = function(error)
{
- /* error.code == FileTransferError.ABORT_ERR */
- alert('An error has occurred: Code = ' + error.code);
- console.log('upload error source ' + error.source);
- console.log('upload error target ' + error.target);
+ /* error.code == FileTransferError.ABORT_ERR */
+ alert('An error has occurred: Code = ' + error.code);
+ console.log('upload error source ' + error.source);
+ console.log('upload error target ' + error.target);
};
var ft = new FileTransfer();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">result</span>:
+<span class="name">result</span>:
A result object that defines an upload result.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
An object that defines a downloaded file.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
An object that defines details of the error
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked if the preferred language
is obtained successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called when errors occur
during this method's execution.
</li>
*/
navigator.globalization.getPreferredLanguage(function(language)
{
- console.log('Language: ' + language.value);
+ console.log('Language: ' + language.value);
}, function()
{
- console.log('Error getting language.');
+ console.log('Error getting language.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback function called when the locale name
has been obtained successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors
occuring while getting a locale name.
</li>
*/
navigator.globalization.getLocaleName(function(locale)
{
- console.log('Locale: ' + locale.value);
+ console.log('Locale: ' + locale.value);
}, function()
{
- console.log('Error getting locale.');
+ console.log('Error getting locale.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
The date to be converted to a DOMString. It should be of type Date.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method called after a successful conversion.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called if errors occur during conversion.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Optional parameter defining conversion options. The default values are:
<var>{formatLength : 'short', selector : 'date and time'}</var>.
</li>
*/
navigator.globalization.dateToString(new Date(), function(date)
{
- console.log('Date: ' + date.value);
+ console.log('Date: ' + date.value);
}, function()
{
- console.log('Error getting dateString.');
+ console.log('Error getting dateString.');
}, {formatLength: 'short', selector: 'date and time'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">currencyCode</span>:
+<span class="name">currencyCode</span>:
ISO 4217 compliant currency code provided as a DOMString,
for example 'USD'.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method invoked after a successful conversion.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method called if errors occur during the conversion.
</li>
</ul>
*/
navigator.globalization.getCurrencyPattern('USD', function(pattern)
{
- console.log('pattern: ' + pattern.pattern);
- console.log('code: ' + pattern.code);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
+ console.log('pattern: ' + pattern.pattern);
+ console.log('code: ' + pattern.code);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
}, function()
{
- console.log('Error getting pattern.');
+ console.log('Error getting pattern.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The function to be called if this method returns the names correctly.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The function to be called in case of error occuring.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
An optional parameter specifying additional options.
The default value is <var>{type: 'wide', item: 'months'}</var> </li>
</ul>
*/
navigator.globalization.getDateNames(function(names)
{
- for (var i = 0; i < names.value.length; i++)
- {
- console.log('month: ' + names.value[i]);
- }
+ for (var i = 0; i < names.value.length; i++)
+ {
+ console.log('month: ' + names.value[i]);
+ }
}, function()
{
- console.log('Error getting names.');
+ console.log('Error getting names.');
}, {type: 'wide', item: 'months'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to be invoked when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The function to be invoked in case of errors occuring.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
The DateOptions object containing additional options.
The default value is <var>{formatLength: 'short', selector: 'date and time'}</var>.
</li>
*/
function checkDatePattern()
{
- navigator.globalization.getDatePattern(function(date)
- {
- console.log('Date pattern: ' + date.pattern);
- }, function()
- {
- console.log('Error getting pattern');
- }, {formatLength: 'short', selector: 'date and time'});
+ navigator.globalization.getDatePattern(function(date)
+ {
+ console.log('Date pattern: ' + date.pattern);
+ }, function()
+ {
+ console.log('Error getting pattern');
+ }, {formatLength: 'short', selector: 'date and time'});
}
checkDatePattern();
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to be called when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The method to be invoked in case of errors occuring.
</li>
</ul>
*/
navigator.globalization.getFirstDayOfWeek(function(day)
{
- console.log('day: ' + day.value);
+ console.log('day: ' + day.value);
}, function()
{
- console.log('Error getting first day of week.');
+ console.log('Error getting first day of week.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be invoked
when this function executes successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method to be invoked
in case of errors occuring during this method's execution.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Defines the type of numeric value for which
the pattern will be returned.
</li>
*/
navigator.globalization.getNumberPattern(function(pattern)
{
- console.log('pattern: ' + pattern.pattern);
- console.log('symbol: ' + pattern.symbol);
- console.log('fraction: ' + pattern.fraction);
- console.log('rounding: ' + pattern.rounding);
- console.log('positive: ' + pattern.positive);
- console.log('negative: ' + pattern.negative);
- console.log('decimal: ' + pattern.decimal);
- console.log('grouping: ' + pattern.grouping);
+ console.log('pattern: ' + pattern.pattern);
+ console.log('symbol: ' + pattern.symbol);
+ console.log('fraction: ' + pattern.fraction);
+ console.log('rounding: ' + pattern.rounding);
+ console.log('positive: ' + pattern.positive);
+ console.log('negative: ' + pattern.negative);
+ console.log('decimal: ' + pattern.decimal);
+ console.log('grouping: ' + pattern.grouping);
}, function()
{
- console.log('An error occurred.');
+ console.log('An error occurred.');
}, {type: 'decimal'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
The Date object for which the daylight savings time status will be checked.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method to be called when this function
successfully completes its execution.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method to be called in case of
errors occuring during this method's execution.
</li>
*/
navigator.globalization.isDayLightSavingsTime(new Date(), function(date)
{
- console.log('dst: ' + date.dst);
+ console.log('dst: ' + date.dst);
}, function()
{
- console.log('Error getting the DST state.');
+ console.log('Error getting the DST state.');
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">number</span>:
+<span class="name">number</span>:
The number that will be converted to a DOMString
in accordance with the client's user preferences.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback function executed when the conversion
is done successfully. The results of the conversion are passed
as a parameter to this callback function.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback function executed in case of errors
occuring during the conversion. The GlobalizationError object with
the details is passed as a parameter to this callback function.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of conversion.
It is a dictionary with a single property <var>type</var>.
The default value of this parameter is <var>{type: 'decimal'}</var>.
*/
navigator.globalization.numberToString(3.1415926, function(number)
{
- console.log('decimal number: ' + number.value);
+ console.log('decimal number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
navigator.globalization.numberToString(1000003, function(number)
{
- console.log('big decimal number: ' + number.value);
+ console.log('big decimal number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
navigator.globalization.numberToString(0.3183099, function(number)
{
- console.log('percentile: ' + number.value);
+ console.log('percentile: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'percent'});
navigator.globalization.numberToString(1099.95, function(number)
{
- console.log('currency: ' + number.value);
+ console.log('currency: ' + number.value);
}, function()
{
- console.log('Error getting number');
+ console.log('Error getting number');
}, {type: 'currency'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dateString</span>:
+<span class="name">dateString</span>:
a string containing the representation of a date to be converted
to a Date object.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method invoked when the conversion completes successfully.
The result of conversion is passed as a parameter to this callback.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors occuring during
the conversion. A GlobalizationError object is passed as a parameter
to this callback.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of the conversion.
The default value is <var>{formatLength: 'short', selector: 'date and time'}</var>.
</li>
*/
navigator.globalization.stringToDate('9/25/2012', function(date)
{
- console.log('month: ' + date.month +
- ', day: ' + date.day +
- ', year: ' + date.year)
+ console.log('month: ' + date.month +
+ ', day: ' + date.day +
+ ', year: ' + date.year)
}, function()
{
- console.log('Error getting date.');
+ console.log('Error getting date.');
}, {selector: 'date'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">numberString</span>:
+<span class="name">numberString</span>:
The DOMString containing a text representation of a number
to be converted to a double data type.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The callback method called after a successful conversion.
The result of a conversion is passed as a parameter of this callback method.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The callback method invoked in case of errors occuring during
the conversion. The error is passed as a parameter of this callback method.
</li>
<li class="param">
-<span class="name">options</span><span class="optional"> [optional]</span>:
+<span class="name">options</span><span class="optional"> [optional]</span>:
Additional options specifying the details of the conversion.
The default value is <var>{type: 'decimal'}</var> </li>
</ul>
*/
navigator.globalization.stringToNumber('1234.56', function(number)
{
- console.log('number: ' + number.value);
+ console.log('number: ' + number.value);
}, function()
{
- console.log('Error getting number.');
+ console.log('Error getting number.');
}, {type: 'decimal'});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "dst" of boolean type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a DOMString type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
an object with the field "value"
containing an Array of DOMString values.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a long type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">properties</span>:
+<span class="name">properties</span>:
An object containing the field "value" of a double type.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
a GlobalizationDate object containing the date information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a CurrencyPattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a DatePattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">pattern</span>:
+<span class="name">pattern</span>:
a NumberPattern object containing retrieved information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">positionSuccessCallback</span>:
+<span class="name">positionSuccessCallback</span>:
The callback that is passed the current position in seconds.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span>:
The callback to execute if an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
positionSuccessCallback = function(position)
{
- console.log('Current position is ' + position);
+ console.log('Current position is ' + position);
}
var src = 'file:///home/app/content/Documents/play.mp3';
setTimeout(function()
{
- myMedia.getCurrentPosition(positionSuccessCallback);
+ myMedia.getCurrentPosition(positionSuccessCallback);
}, 2000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file:///home/app/content/Documents/play.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
statusCallback = function(status)
{
- if (status == Media.MEDIA_PAUSED)
- {
- console.log('Audio file has been paused');
- }
+ if (status == Media.MEDIA_PAUSED)
+ {
+ console.log('Audio file has been paused');
+ }
}
var src = 'file:///home/app/content/Documents/play.mp3';
/* Pause after 2 seconds */
setTimeout(function()
{
- myMedia.pause();
+ myMedia.pause();
}, 2000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file:///home/app/content/Documents/play.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been stopped or released.');
+ console.log('Audio file has been stopped or released.');
}
errorCallback = function(err)
{
- console.log('An error occurred: ' + err.message);
+ console.log('An error occurred: ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
The position to set the playback position within the audio, in milliseconds.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('An error occurred: ' + err.message);
+ console.log('An error occurred: ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* SeekTo to 10 seconds after 5 seconds */
setTimeout(function()
{
- myMedia.seekTo(10000);
- console.log('Playback position has been set to 10 seconds.');
+ myMedia.seekTo(10000);
+ console.log('Playback position has been set to 10 seconds.');
}, 5000);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
The volume to set for playback. The value must be within the range of 0.0 to 1.0.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been played back.');
+ console.log('Audio file has been played back.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* Mute volume after 2 seconds */
setTimeout(function()
{
- myMedia.setVolume(0.0);
- console.log('Playback volume has been muted.');
+ myMedia.setVolume(0.0);
+ console.log('Playback volume has been muted.');
}, 2000);
/* Set volume to 1.0 after 5 seconds */
setTimeout(function()
{
- myMedia.setVolume(1.0);
- console.log('Playback volume has been set to 1.0.');
+ myMedia.setVolume(1.0);
+ console.log('Playback volume has been set to 1.0.');
}, 5000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Started recording an audio file.');
+ console.log('Started recording an audio file.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'recordAudio.mp3';
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Started recording an audio file.');
+ console.log('Started recording an audio file.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'recordAudio.mp3';
/* Stop recording after 10 seconds */
setTimeout(function()
{
- myRecMedia.stopRecord();
- console.log('Stopped recording an audio file.');
+ myRecMedia.stopRecord();
+ console.log('Stopped recording an audio file.');
}, 10000);
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
successCallback = function()
{
- console.log('Audio file has been stopped.');
+ console.log('Audio file has been stopped.');
}
errorCallback = function(err)
{
- console.log('Error occurred ' + err.message);
+ console.log('Error occurred ' + err.message);
}
var src = 'file://home/app/content/Documents/play.mp3';
/* Stop after 10 seconds */
setTimeout(function()
{
- myMedia.stop();
+ myMedia.stop();
}, 10000);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Error object containing some information about the error.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">status</span>:
+<span class="name">status</span>:
The status of the <a href="media.html#Media">Media</a> object. It is equal to one of the Media interface constant: MEDIA_NONE, MEDIA_STARTING, MEDIA_RUNNING, MEDIA_PAUSED or MEDIA_STOPPED.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
The current position of the media file.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function checkConnection()
{
- var networkState = navigator.connection.type;
+ var networkState = navigator.connection.type;
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
- alert('Connection type: ' + states[networkState]);
+ var states = {};
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+ alert('Connection type: ' + states[networkState]);
}
checkConnection();
function onDeviceReady()
{
- document.addEventListener('online', onOnline, false);
+ document.addEventListener('online', onOnline, false);
}
function onOnline()
{
- /* Handle the online event */
+ /* Handle the online event */
}
</pre>
</div>
function onDeviceReady()
{
- document.addEventListener('offline', onOffline, false);
+ document.addEventListener('offline', onOffline, false);
}
function onOffline()
{
- /* Handle the offline event */
+ /* Handle the offline event */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">providerId</span>:
+<span class="name">providerId</span>:
A provider ID to use, which should be shared between the DataControl provider and DataControl consumer.
</li>
<li class="param">
-<span class="name">dataId</span>:
+<span class="name">dataId</span>:
A string for identifying specific data.
</li>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The DataType to use.
</li>
</ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-/*
+/*
The data provider, a native application, should be pre-installed and launched
The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer)
In this example, the DictionaryDataControlProvider native sample application is used as a data control provider
/* Gets SQL type DataControlConsumerObject */
try
{
- var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
+ var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL");
}
catch (err)
{
- console.log(err.name +": " + err.message);
+ console.log(err.name +": " + err.message);
}
/* Gets MAP type DataControlConsumerObject */
try
{
- globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
- "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
+ globalMappedConsumer = tizen.datacontrol.getDataControlConsumer(
+ "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP");
}
catch (err)
{
- console.log(err.name +": " + err.message);
+ console.log(err.name +": " + err.message);
}
</pre>
</div>
Since: </span>
3.0
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">insertionData</span>:
+<span class="name">insertionData</span>:
The data on columns and values to insert.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id, insertRowId)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- var rowData =
- {
- columns: ["WORD", "WORD_DESC"] ,
- values: ["'tizen1'", "'tizen2'"]
- };
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'tizen2'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">updateData</span>:
+<span class="name">updateData</span>:
The data on columns and values to update.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows to update. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- var rowData =
- {
- columns: ["WORD", "WORD_DESC"] ,
- values: ["'tizen1'", "'Web apps platform!'"]
- };
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
+ var rowData =
+ {
+ columns: ["WORD", "WORD_DESC"] ,
+ values: ["'tizen1'", "'Web apps platform!'"]
+ };
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows to remove. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">columns</span>:
+<span class="name">columns</span>:
The columns to select.
</li>
<li class="param">
-<span class="name">where</span>:
+<span class="name">where</span>:
A filter to select desired rows. <br>It is an SQL <var>WHERE</var> clause excluding the <var>WHERE</var> itself such as <var>column1 = 'stringValue' AND column2 = numericValue</var>.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
<li class="param">
-<span class="name">page</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">page</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The page number of the result set. <br>It starts from <var>1</var>. If the number is out of page, DataControlSelectSuccessCallback is invoked with no result data.
</li>
<li class="param">
-<span class="name">maxNumberPerPage</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">maxNumberPerPage</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The maximum number of rows on a page. The maximum allowed value is equal to 1024.
</li>
<li class="param">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function getValueSuccessCB(result, id)
{
- console.log("getValueSuccessCB result.length: " + result.length);
- var length = result.length;
- for (var i = 0; i < length; i++)
- {
- var rowData = "| ";
- var j = 0;
- for (j = 0; j < result[i].columns.length; j++)
- {
- rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
- }
- console.log(rowData);
- }
+ console.log("getValueSuccessCB result.length: " + result.length);
+ var length = result.length;
+ for (var i = 0; i < length; i++)
+ {
+ var rowData = "| ";
+ var j = 0;
+ for (j = 0; j < result[i].columns.length; j++)
+ {
+ rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
+ }
+ console.log(rowData);
+ }
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* globalSQLConsumer and globalReqId should be defined before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- var columns = ["WORD", "WORD_DESC"];
- var whereClause = "1";
- console.log("----- Calling for ascending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC ASC");
- setTimeout(function()
- {
- console.log("----- Calling descending order -----");
- globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
- null, null, "WORD_DESC DESC");
- }, 1000);
+ /* globalSQLConsumer and globalReqId should be defined before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ var columns = ["WORD", "WORD_DESC"];
+ var whereClause = "1";
+ console.log("----- Calling for ascending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC ASC");
+ setTimeout(function()
+ {
+ console.log("----- Calling descending order -----");
+ globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
+ null, null, "WORD_DESC DESC");
+ }, 1000);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
Since: </span>
3.0
</p>
-
+
<div class="methods">
<h4>Methods</h4>
<dl>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
The value to add into a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation. <br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
The value to remove from a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function getValueSuccessCB(result, id)
{
- console.log(result.length + ":" + result[0]);
+ console.log(result.length + ":" + result[0]);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So a developer should increase the <em>reqId </em>value to ensure it is unique for each method.
</li>
<li class="param">
-<span class="name">key</span>:
+<span class="name">key</span>:
The key to search mapped data.
</li>
<li class="param">
-<span class="name">oldValue</span>:
+<span class="name">oldValue</span>:
The value to update in a values array mapped by the key.
</li>
<li class="param">
-<span class="name">newValue</span>:
+<span class="name">newValue</span>:
The new value to replace in a values array mapped by the key.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when the asynchronous call completes successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successcb(id)
{
- console.log("ok: reqid " + id);
+ console.log("ok: reqid " + id);
}
function errorcb(id, error)
{
- console.log("error id: " + id + ", error msg: " + error.message);
+ console.log("error id: " + id + ", error msg: " + error.message);
}
try
{
- /* Defines globalReqId before */
- /* Increases globalReqId for uniqueness */
- globalReqId++;
- globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
+ /* Defines globalReqId before */
+ /* Increases globalReqId for uniqueness */
+ globalReqId++;
+ globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier of the successful operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier of the failed operation.
</li>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
An error message.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So it is recommended to increase the <em>reqId</em> value every time to guarantee uniqueness.
</li>
<li class="param">
-<span class="name">insertRowId</span>:
+<span class="name">insertRowId</span>:
The inserted row ID set by the data control provider if the specified providerResult is <var>true</var>, else <var>-1</var>.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">rows</span>:
+<span class="name">rows</span>:
Rows of SQL selection results from another application.<br>The array operation of rows would be different from general JavaScript array behavior depending on platform implementation. For example, Array.isArray(rows) returns <em>false</em>.
</li>
<li class="param">
-<span class="name">reqId</span>:
+<span class="name">reqId</span>:
A unique identifier for the current operation.<br>So it is recommended to increase the <em>reqId</em> value every time to guarantee uniqueness.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">values</span>:
+<span class="name">values</span>:
A list of values assigned to the requested key.
</li>
<li class="param">
-<span class="name">reqid</span>:
+<span class="name">reqid</span>:
A unique identifier of the successful operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadRequest</span>:
+<span class="name">downloadRequest</span>:
The URL and destination information of the object to download.
</li>
<li class="param">
-<span class="name">downloadCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">downloadCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when the download state changes or an error occurs.
</li>
</ul>
var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
if (download_api_capability === false)
{
- console.log("Download API is not supported on this device.");
+ console.log("Download API is not supported on this device.");
- return;
+ return;
}
var listener =
{
- onprogress: function(id, receivedSize, totalSize)
- {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id)
- {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id)
- {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, path)
- {
- console.log('Completed with id: ' + id + ', path: ' + path);
- },
- onfailed: function(id, error)
- {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, path)
+ {
+ console.log('Completed with id: ' + id + ', path: ' + path);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
};
/* Starts downloading the file from the Web with the corresponding callbacks */
/* If you want to download a large file through Wi-Fi */
var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");
var wifiDownloadRequest = new tizen.DownloadRequest(
- "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
+ "http://download.tizen.org/tools/archive/14.02.2/Ubuntu_12.04/qemu_1.6.0rc3.orig.tar.gz", "downloads", null, "WIFI");
if (wifi_capability === true)
{
- var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
+ var downlodId_wifi = tizen.download.start(wifiDownloadRequest, listener);
}
else
{
- /* If you call tizen.download.start(), NotSupportedError will be thrown */
- console.log("This device doesn't support Download API through Wi-Fi.");
+ /* If you call tizen.download.start(), NotSupportedError will be thrown */
+ console.log("This device doesn't support Download API through Wi-Fi.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the ongoing download operation to stop.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the ongoing download operation to pause.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the paused download operation to resume.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the current state of the download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the download request information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to get the MIME type information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID to set the download callback.
</li>
<li class="param">
-<span class="name">downloadCallback</span>:
+<span class="name">downloadCallback</span>:
The method to invoke when the download state changes or an error occurs.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- onprogress: function(id, receivedSize, totalSize)
- {
- console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
- },
- onpaused: function(id)
- {
- console.log('Paused with id: ' + id);
- },
- oncanceled: function(id)
- {
- console.log('Canceled with id: ' + id);
- },
- oncompleted: function(id, fileName)
- {
- console.log('Completed with id: ' + id + ', file name: ' + fileName);
- },
- onfailed: function(id, error)
- {
- console.log('Failed with id: ' + id + ', error name: ' + error.name);
- }
+ onprogress: function(id, receivedSize, totalSize)
+ {
+ console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
+ },
+ onpaused: function(id)
+ {
+ console.log('Paused with id: ' + id);
+ },
+ oncanceled: function(id)
+ {
+ console.log('Canceled with id: ' + id);
+ },
+ oncompleted: function(id, fileName)
+ {
+ console.log('Completed with id: ' + id + ', file name: ' + fileName);
+ },
+ onfailed: function(id, error)
+ {
+ console.log('Failed with id: ' + id + ', error name: ' + error.name);
+ }
};
/* Start downloading the html file on the web with the corresponding callbacks */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
<li class="param">
-<span class="name">receivedSize</span>:
+<span class="name">receivedSize</span>:
The size of data received in bytes.
</li>
<li class="param">
-<span class="name">totalSize</span>:
+<span class="name">totalSize</span>:
The total size of data to receive in bytes.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
<li class="param">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">downloadId</span>:
+<span class="name">downloadId</span>:
The ID of the corresponding download operation.
</li>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
The reason for download failure.
</li>
</ul>
/* Defines success callback */
function onSuccess(exifInfo)
{
- console.log("success to get Exif information object");
+ console.log("success to get Exif information object");
}
/* Defines error callback */
function onError(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
/* Defines success callback */
function onSaveSuccess()
{
- console.log("success to save Exif information");
+ console.log("success to save Exif information");
}
/* Defines error callback */
function onSaveError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
/* Defines success callback */
function onSuccess(exifInfo)
{
- console.log("success to get Exif information object");
- exifInfo.orientation = "ROTATE_90";
- tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
+ console.log("success to get Exif information object");
+ exifInfo.orientation = "ROTATE_90";
+ tizen.exif.saveExifInfo(exifInfo, onSaveSuccess, onSaveError);
}
/* Defines error callback */
function onError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
+ tizen.exif.getExifInfo(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
/* Defines success callback */
function onSuccess(thumbData)
{
- console.log("got thumbnail data of JPEG file");
- if (thumbData)
- {
- var img = new Image();
- img.src = thumbData;
- document.body.appendChild(img);
- }
+ console.log("got thumbnail data of JPEG file");
+ if (thumbData)
+ {
+ var img = new Image();
+ img.src = thumbData;
+ document.body.appendChild(img);
+ }
}
/* Defines error callback */
function onError(error)
{
- console.log("error occur" + error.name);
+ console.log("error occur" + error.name);
}
function resolveSuccess(file)
{
- tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
+ tizen.exif.getThumbnail(file.toURI(), onSuccess, onError);
}
function resolveFail(error)
{
- console.log("error occurred: " + error.name);
+ console.log("error occurred: " + error.name);
}
tizen.filesystem.resolve("images/tizen.jpg", resolveSuccess, resolveFail);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
+ tizen.feedback.play("CHARGERCONN", "TYPE_SOUND");
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
- tizen.feedback.stop();
+ tizen.feedback.play("BT_CONNECTED", "TYPE_VIBRATION");
+ tizen.feedback.stop();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var isSupported = "";
if (!isPatternSupported)
{
- isSupported = " not";
+ isSupported = " not";
}
console.log("pattern " + pattern + " is" + isSupported + " supported");
</pre>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- }
-
- var testFile = documentsDir.createFile("test.txt");
-
- if (testFile != null)
- {
- testFile.openStream("w", function(fs)
- {
- fs.write("HelloWorld");
- fs.close();
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">location</span>:
+<span class="name">location</span>:
Location to resolve that can be a virtual path or file URI
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the location has been successfully resolved, passing the newly created <em>File </em>object
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">mode</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Optional value to indicate the file access mode on all files and directories that can be reached from the <em>File </em>object passed to onsuccess <br>Default value of this parameter is <var>rw</var> if absent or <var>null</var>.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.filesystem.resolve('images', function(dir)
{
- console.log("Mount point Name is " + dir.path);
+ console.log("Mount point Name is " + dir.path);
}, function(e)
{
- console.log("Error: " + e.message);
+ console.log("Error: " + e.message);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">label</span>:
+<span class="name">label</span>:
Storage label
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the list of storage is available, passing the storage list to the callback
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onStorage(storage)
{
- /* Do something */
+ /* Do something */
}
function onStorageError(e)
{
- console.log("Storage not found!" + e.message);
+ console.log("Storage not found!" + e.message);
}
tizen.filesystem.getStorage("music", onStorage, onStorageError);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a list of storage is available, and passing the storage list to the callback
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function alertForCorruptedRemovableDrives(storages)
{
- for (var i = 0; i < storages.length; i++)
- {
- if (storages[i].type != "EXTERNAL")
- continue;
- if (storages[i].state == "UNMOUNTABLE")
- console.log("External drive " + storages[i].label + " is corrupted.");
- }
+ for (var i = 0; i < storages.length; i++)
+ {
+ if (storages[i].type != "EXTERNAL")
+ continue;
+ if (storages[i].state == "UNMOUNTABLE")
+ console.log("External drive " + storages[i].label + " is corrupted.");
+ }
}
tizen.filesystem.listStorages(alertForCorruptedRemovableDrives);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when any change is made to storage state
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs during the watch process
</li>
</ul>
var watchID;
function onStorageStateChanged(storage)
{
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
}
watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
var watchID;
function onStorageStateChanged(storage)
{
- if (storage.state == "MOUNTED")
- console.log("Storage " + storage.label + " was added!");
- tizen.filesystem.removeStorageStateChangeListener(watchID);
+ if (storage.state == "MOUNTED")
+ console.log("Storage " + storage.label + " was added!");
+ tizen.filesystem.removeStorageStateChangeListener(watchID);
}
watchID = tizen.filesystem.addStorageStateChangeListener(onStorageStateChanged);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- /* Alerts each name of dir's contents */
- console.log(files[i].name);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ /* Alerts each name of dir's contents */
+ console.log(files[i].name);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
/* List directory contents */
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- /*
- Prints the file parent, must contain the
- same value for all the files in the loop
- */
- console.log("All the files should have the same parent " +
- files[i].parent);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ /*
+ Prints the file parent, must contain the
+ same value for all the files in the loop
+ */
+ console.log("All the files should have the same parent " +
+ files[i].parent);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
</pre>
</div>
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].readOnly)
- console.log("Cannot write to file " + files[i].name);
- else
- console.log("Can write to file " + files[i].name);
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].readOnly)
+ console.log("Cannot write to file " + files[i].name);
+ else
+ console.log("Can write to file " + files[i].name);
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.filesystem.resolve('music/ramones/RockawayBeach.mp3', function(file)
{
- var audio = new Audio(file.toURI());
- audio.play();
- console.log(file.toURI());
+ var audio = new Audio(file.toURI());
+ audio.play();
+ console.log(file.toURI());
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when the list operation has been successfully completed
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">filter</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Criteria to restrict the listed files
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- console.log("There are " + files.length + " in the selected folder");
+ console.log("There are " + files.length + " in the selected folder");
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve("documents", function(dir)
{
- dir.listFiles(onsuccess, onerror);
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error " + e.message);
+ console.log("Error " + e.message);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Mode in which the file is opened<br><b>"r"</b> for reading<br><b>"a"</b> for appending<br><b>"w"</b> for [over]writing<br><b>"rw"</b> for reading and writing<br> </li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a file has been opened
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
<li class="param">
-<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Encoding to use for read/write operations on the file, at least the following encodings must be supported:<br>"<a href="http://www.ietf.org/rfc/rfc2279.txt">UTF-8</a>" default encoding<br>"<a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">ISO-8859-1</a>" latin1 encoding<br>If no encoding is passed by the developer, then the default platform encoding must be used.
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- }
-
- var testFile = documentsDir.createFile("test.txt");
- if (testFile != null)
- {
- testFile.openStream("w", function(fs)
- {
- fs.write("HelloWorld");
- fs.close();
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ }
+
+ var testFile = documentsDir.createFile("test.txt");
+ if (testFile != null)
+ {
+ testFile.openStream("w", function(fs)
+ {
+ fs.write("HelloWorld");
+ fs.close();
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
Callback method to be invoked when a file has been successfully read
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error occurs while reading a file
</li>
<li class="param">
-<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">encoding</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Encoding for read/write operations on a file, at least the following encodings must be supported:<br>"<a href="http://www.ietf.org/rfc/rfc2279.txt">UTF-8</a>" default encoding<br>"<a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">ISO-8859-1</a>" latin1 encoding<br>If no encoding is passed by the developer, then the default platform encoding must be used.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- console.log("File Name is " + files[i].name); /* Displays file name */
- if (files[i].isDirectory == false)
- {
- files[i].readAsText(function(str)
- {
- console.log("The file content " + str);
- }, function(e)
- {
- console.log("Error " + e.message);
- }, "UTF-8");
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ console.log("File Name is " + files[i].name); /* Displays file name */
+ if (files[i].isDirectory == false)
+ {
+ files[i].readAsText(function(str)
+ {
+ console.log("The file content " + str);
+ }, function(e)
+ {
+ console.log("Error " + e.message);
+ }, "UTF-8");
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
var documentsDir;
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">originFilePath</span>:
+<span class="name">originFilePath</span>:
Origin full virtual file or directory path and it must be under the current directory
</li>
<li class="param">
-<span class="name">destinationFilePath</span>:
+<span class="name">destinationFilePath</span>:
New full virtual file path or directory path
</li>
<li class="param">
-<span class="name">overwrite</span>:
+<span class="name">overwrite</span>:
Attribute to determine whether overwriting is allowed or not <br>If set to <var>true</var>, it enforces overwriting an existing file.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file has been copied
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory == false)
- {
- documentsDir.copyTo(files[i].fullPath,
- "images/backup/" + files[i].name, false,
- function() {console.log("file copied");});
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.copyTo(files[i].fullPath,
+ "images/backup/" + files[i].name, false,
+ function() {console.log("file copied");});
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">originFilePath</span>:
+<span class="name">originFilePath</span>:
Origin full virtual file or directory path, and it must be under the current directory
</li>
<li class="param">
-<span class="name">destinationFilePath</span>:
+<span class="name">destinationFilePath</span>:
New full virtual file path or directory path
</li>
<li class="param">
-<span class="name">overwrite</span>:
+<span class="name">overwrite</span>:
Flag indicating whether to overwrite an existing file.<br>When set to <var>true</var>, the files can be overwritten.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file has been moved
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory == false)
- {
- documentsDir.moveTo(files[i].fullPath,
- "images/newFolder/" + files[i].name, false,
- function() {console.log("file moved");});
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory == false)
+ {
+ documentsDir.moveTo(files[i].fullPath,
+ "images/newFolder/" + files[i].name, false,
+ function() {console.log("file moved");});
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message +
- " occurred during listing the files in the selected folder");
+ console.log("The error " + error.message +
+ " occurred during listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dirPath</span>:
+<span class="name">dirPath</span>:
Relative directory path, and it only contains characters supported by the underlying filesystem
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">relativeFilePath</span>:
+<span class="name">relativeFilePath</span>:
New file path and it should only contain characters supported by the underlying Filesystem
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filePath</span>:
+<span class="name">filePath</span>:
Relative file/directory path/file URI to resolve
</li>
</ul>
*/
tizen.filesystem.resolve('documents', function(dir)
{
- file = dir.resolve("helloWorld.doc");
+ file = dir.resolve("helloWorld.doc");
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">directoryPath</span>:
+<span class="name">directoryPath</span>:
Full virtual path to the directory to delete (must be under the current one)
</li>
<li class="param">
-<span class="name">recursive</span>:
+<span class="name">recursive</span>:
Flag indicating whether the deletion is recursive or not <br>When set to <var>true</var> recursive deletion is allowed. Also, this function deletes
all data in all subdirectories and so needs to be used with caution.
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when a directory is successfully deleted
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
var documentsDir;
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory)
- {
- documentsDir.deleteDirectory(files[i].fullPath, false, function()
- {
- console.log("Directory Deleted");
- }, function(e)
- {
- console.log("Error" + e.message);
- });
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory)
+ {
+ documentsDir.deleteDirectory(files[i].fullPath, false, function()
+ {
+ console.log("Directory Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess, onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filePath</span>:
+<span class="name">filePath</span>:
Full virtual path to the file to delete (must be under the current directory)
</li>
<li class="param">
-<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onsuccess</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when the file is successfully deleted
</li>
<li class="param">
-<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">onerror</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess(files)
{
- for (var i = 0; i < files.length; i++)
- {
- if (!files[i].isDirectory)
- {
- documentsDir.deleteFile(files[i].fullPath, function()
- {
- console.log("File Deleted");
- }, function(e)
- {
- console.log("Error" + e.message);
- });
- }
- }
+ for (var i = 0; i < files.length; i++)
+ {
+ if (!files[i].isDirectory)
+ {
+ documentsDir.deleteFile(files[i].fullPath, function()
+ {
+ console.log("File Deleted");
+ }, function(e)
+ {
+ console.log("Error" + e.message);
+ });
+ }
+ }
}
function onerror(error)
{
- console.log("The error " + error.message + " occurred when listing the files in the selected folder");
+ console.log("The error " + error.message + " occurred when listing the files in the selected folder");
}
var documentsDir;
tizen.filesystem.resolve('documents', function(dir)
{
- documentsDir = dir;
- dir.listFiles(onsuccess,onerror);
+ documentsDir = dir;
+ dir.listFiles(onsuccess,onerror);
}, function(e)
{
- console.log("Error" + e.message);
+ console.log("Error" + e.message);
}, "rw");
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
if (stream.eof)
{
- /* File has been read completely */
+ /* File has been read completely */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">charCount</span>:
+<span class="name">charCount</span>:
Number of characters being read
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">byteCount</span>:
+<span class="name">byteCount</span>:
Number of bytes to read
</li>
</ul>
var raw = stream.readBytes(256);
for (var i = 0; i < raw.length; i++)
{
- /* raw[i] contains the i-th byte of the current data chunk */
+ /* raw[i] contains the i-th byte of the current data chunk */
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">stringData</span>:
+<span class="name">stringData</span>:
Actual string to write
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">byteData</span>:
+<span class="name">byteData</span>:
Byte data array being written
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">base64Data</span>:
+<span class="name">base64Data</span>:
The base64 data to written
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">file</span>:
+<span class="name">file</span>:
File resulting from the asynchronous call
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">storages</span>:
+<span class="name">storages</span>:
List of available storage devices
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">storage</span>:
+<span class="name">storage</span>:
Storage device structure
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">fileStr</span>:
+<span class="name">fileStr</span>:
File represented as a DOMString resulting from the asynchronous call
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">filestream</span>:
+<span class="name">filestream</span>:
Filestream to access file content
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">files</span>:
+<span class="name">files</span>:
Files resulting from the asynchronous call
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onchangedCB(sleepInfo)
{
- console.log("Sleep status: " + sleepInfo.status);
- console.log("Timestamp: " + sleepInfo.timestamp);
+ console.log("Sleep status: " + sleepInfo.status);
+ console.log("Timestamp: " + sleepInfo.timestamp);
}
tizen.humanactivitymonitor.start("SLEEP_MONITOR", onchangedCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccessCB(pedometerInfo)
{
- console.log("Step status: " + pedometerInfo.stepStatus);
- console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
}
function onerrorCB(error)
{
- console.log("Error occurs. name:" + error.name + ", message: " + error.message);
+ console.log("Error occurs. name:" + error.name + ", message: " + error.message);
}
function onchangedCB(pedometerdata)
{
- console.log("From now on, you will be notified when the pedometer data changes.");
- /* To get the current data information */
- tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
+ console.log("From now on, you will be notified when the pedometer data changes.");
+ /* To get the current data information */
+ tizen.humanactivitymonitor.getHumanActivityData("PEDOMETER", onsuccessCB, onerrorCB);
}
tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onchangedCB(pedometerInfo)
{
- console.log("Step status: " + pedometerInfo.stepStatus);
- console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Cumulative total step count: " + pedometerInfo.cumulativeTotalStepCount);
}
tizen.humanactivitymonitor.start("PEDOMETER", onchangedCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onchangedCB(info)
{
- var gpsInfo = info.gpsInfo;
- for (var index = 0; index < gpsInfo.length; index++)
- {
- console.log("latitude: " + gpsInfo[index].latitude);
- console.log("longitude: " + gpsInfo[index].longitude);
- }
+ var gpsInfo = info.gpsInfo;
+ for (var index = 0; index < gpsInfo.length; index++)
+ {
+ console.log("latitude: " + gpsInfo[index].latitude);
+ console.log("longitude: " + gpsInfo[index].longitude);
+ }
}
function onerrorCB(error)
{
- console.log("Error occurred. Name:" + error.name + ", message: " + error.message);
+ console.log("Error occurred. Name:" + error.name + ", message: " + error.message);
}
try
{
- tizen.humanactivitymonitor.start("GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000});
+ tizen.humanactivitymonitor.start("GPS", onchangedCB, onerrorCB, {callbackInterval: 150000, sampleInterval: 1000});
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onchangedCB(pedometerInfo)
{
- console.log("Step status: " + pedometerInfo.stepStatus);
- console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount);
+ console.log("Step status: " + pedometerInfo.stepStatus);
+ console.log("Accumulative total step count: " + pedometerInfo.accumulativeTotalStepCount);
}
tizen.humanactivitymonitor.setAccumulativePedometerListener(onchangedCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCallback(error)
{
- console.log(error.name + ': ' + error.message);
+ console.log(error.name + ': ' + error.message);
}
function listener(info)
{
- console.log('type: ' + info.type);
- console.log('timestamp: ' + info.timestamp);
- console.log('accuracy: ' + info.accuracy);
+ console.log('type: ' + info.type);
+ console.log('timestamp: ' + info.timestamp);
+ console.log('accuracy: ' + info.accuracy);
}
try
{
- var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
+ var listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
}
catch (error)
{
- console.log(error.name + ': ' + error.message);
+ console.log(error.name + ': ' + error.message);
}
</pre>
</div>
function errorCallback(error)
{
- console.log(error.name + ': ' + error.message);
+ console.log(error.name + ': ' + error.message);
}
function listener(info)
{
- console.log('type: ' + info.type);
- console.log('timestamp: ' + info.timestamp);
- console.log('accuracy: ' + info.accuracy);
+ console.log('type: ' + info.type);
+ console.log('timestamp: ' + info.timestamp);
+ console.log('accuracy: ' + info.accuracy);
- tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback);
+ tizen.humanactivitymonitor.removeActivityRecognitionListener(listenerId, errorCallback);
}
try
{
- listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
+ listenerId = tizen.humanactivitymonitor.addActivityRecognitionListener("WALKING", listener, errorCallback);
}
catch (error)
{
- console.log(error.name + ': ' + error.message);
+ console.log(error.name + ': ' + error.message);
}
</pre>
</div>
var type = 'PRESSURE';
var options =
{
- retentionPeriod: 1 /* 1 hour */
+ retentionPeriod: 1 /* 1 hour */
};
try
{
- tizen.humanactivitymonitor.startRecorder(type, options);
+ tizen.humanactivitymonitor.startRecorder(type, options);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var type = 'PRESSURE';
try
{
- tizen.humanactivitymonitor.startRecorder(type);
+ tizen.humanactivitymonitor.startRecorder(type);
- /* Do something */
+ /* Do something */
- tizen.humanactivitymonitor.stopRecorder(type);
+ tizen.humanactivitymonitor.stopRecorder(type);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(error)
{
- console.log(error.name + ": " + error.message);
+ console.log(error.name + ": " + error.message);
}
function onread(data)
{
- for (var idx = 0; idx < data.length; ++idx)
- {
- console.log('startTime: ' + data[idx].startTime);
- console.log('endTime: ' + data[idx].endTime);
- console.log('calories: ' + data[idx].calorie);
- }
+ for (var idx = 0; idx < data.length; ++idx)
+ {
+ console.log('startTime: ' + data[idx].startTime);
+ console.log('endTime: ' + data[idx].endTime);
+ console.log('calories: ' + data[idx].calorie);
+ }
}
var type = 'PEDOMETER';
var query = {};
try
{
- tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror);
+ tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var option =
{
- interval: 10,
- retentionPeriod: 1
+ interval: 10,
+ retentionPeriod: 1
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(error)
{
- console.log(error.name + ": " + error.message);
+ console.log(error.name + ": " + error.message);
}
function onread(data)
{
- for (var idx = 0; idx < data.length; ++idx)
- {
- console.log("*** " + idx);
- console.log('totalStepCount: ' + data[idx].totalStepCount);
- }
+ for (var idx = 0; idx < data.length; ++idx)
+ {
+ console.log("*** " + idx);
+ console.log('totalStepCount: ' + data[idx].totalStepCount);
+ }
}
var type = 'PEDOMETER';
var anchorTime = (new Date(2000, 1, 2, 6)).getTime();
var query =
{
- startTime: startTime / 1000,
- anchorTime: anchorTime / 1000,
- interval: 1440 /* 1 day */
+ startTime: startTime / 1000,
+ anchorTime: anchorTime / 1000,
+ interval: 1440 /* 1 day */
};
try
{
- tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror);
+ tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
supportedKeys = tizen.inputdevice.getSupportedKeys();
for (i = 0; i < supportedKeys.length; i++)
{
- keyCode[supportedKeys[i].name] = supportedKeys[i].code;
+ keyCode[supportedKeys[i].name] = supportedKeys[i].code;
}
if (keyCode.hasOwnProperty("VolumeUp"))
{
- tizen.inputdevice.registerKey("VolumeUp");
+ tizen.inputdevice.registerKey("VolumeUp");
}
window.addEventListener("keydown", function(keyEvent)
{
- /* Identify the key by the numeric code from the keyEvent */
- if (keyEvent.keyCode === keyCode.VolumeUp)
- {
- console.log("The VOLUME UP was pressed");
- }
+ /* Identify the key by the numeric code from the keyEvent */
+ if (keyEvent.keyCode === keyCode.VolumeUp)
+ {
+ console.log("The VOLUME UP was pressed");
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key to retrieve
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key which should generate DOM key events when pressed
</li>
</ul>
var keys = ["VolumeUp", "VolumeDown"], i;
for (i = 0; i < keys.length; i++)
{
- try
- {
- tizen.inputdevice.registerKey(keys[i]);
- }
- catch (error)
- {
- console.log("failed to register " + keys[i] + ": " + error);
- }
+ try
+ {
+ tizen.inputdevice.registerKey(keys[i]);
+ }
+ catch (error)
+ {
+ console.log("failed to register " + keys[i] + ": " + error);
+ }
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyName</span>:
+<span class="name">keyName</span>:
The name of the key which should not be monitored any longer
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyNames</span>:
+<span class="name">keyNames</span>:
The array with key names of keys which should generate DOM key events when pressed
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when keys are registered.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Registered successfully');
+ console.log('Registered successfully');
}
var keys = ["VolumeUp", "VolumeDown"];
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">keyNames</span>:
+<span class="name">keyNames</span>:
The array containing names of keys which should not be monitored any longer
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when keys are unregistered.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback method to be invoked when an error has occurred.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function successCB()
{
- console.log('Unregistsered successfully');
+ console.log('Unregistsered successfully');
}
var keys = ["VolumeUp", "VolumeDown"];
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
- var iotClient = tizen.iotcon.getClient();
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
+ var iotClient = tizen.iotcon.getClient();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var cborPath = "App_installed_fullpath/iotcon-test.dat"
- tizen.iotcon.initialize(cborPath);
- tizen.iotcon.deviceName = "my_test";
- var iotServer = tizen.iotcon.getServer();
+ var cborPath = "App_installed_fullpath/iotcon-test.dat"
+ tizen.iotcon.initialize(cborPath);
+ tizen.iotcon.deviceName = "my_test";
+ var iotServer = tizen.iotcon.getServer();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var watchId
function RandomPinSuccess(pin)
{
- console.log("Pin code: " + pin);
- tizen.iotcon.removeGeneratedPinListener(watchId);
+ console.log("Pin code: " + pin);
+ tizen.iotcon.removeGeneratedPinListener(watchId);
}
var cborPath = "App_installed_fullpath/iotcon-test.dat"
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(resource)
{
- if (resource)
- {
- console.log("######## Found a resource ########")
- console.log("URI: " + resource.uriPath);
- console.log("Host Address: " + resource.hostAddress);
- console.log("Device ID: " + resource.deviceId);
- var resourceTypes = resource.resourceTypes;
- console.log("Resource Types: ");
- for (var index in resourceTypes)
- {
- console.log(" " + resourceTypes[index]);
- }
- var resourceInterfaces = resource.resourceInterfaces;
- console.log("Resource interfaces: ");
- for (var index in resourceInterfaces)
- {
- console.log(" " + resourceInterfaces[index]);
- }
- }
+ if (resource)
+ {
+ console.log("######## Found a resource ########")
+ console.log("URI: " + resource.uriPath);
+ console.log("Host Address: " + resource.hostAddress);
+ console.log("Device ID: " + resource.deviceId);
+ var resourceTypes = resource.resourceTypes;
+ console.log("Resource Types: ");
+ for (var index in resourceTypes)
+ {
+ console.log(" " + resourceTypes[index]);
+ }
+ var resourceInterfaces = resource.resourceInterfaces;
+ console.log("Resource interfaces: ");
+ for (var index in resourceInterfaces)
+ {
+ console.log(" " + resourceInterfaces[index]);
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function presenceSuccess(presenceResponse)
{
- console.log("######## Get a presence response ########");
- if (presenceResponse.resultType != "OK")
- {
- console.log("the result is not OK")
-
- return;
- }
- console.log("Trigger type: " + presenceResponse.triggerType);
- console.log("Host address: " + presenceResponse.hostAddress);
- console.log("Connectivity type: " + presenceResponse.connectivityType);
- console.log("Presence resource type: " + presenceResponse.resourceType);
-
- client.removePresenceEventListener(watchID);
+ console.log("######## Get a presence response ########");
+ if (presenceResponse.resultType != "OK")
+ {
+ console.log("the result is not OK")
+
+ return;
+ }
+ console.log("Trigger type: " + presenceResponse.triggerType);
+ console.log("Host address: " + presenceResponse.hostAddress);
+ console.log("Connectivity type: " + presenceResponse.connectivityType);
+ console.log("Presence resource type: " + presenceResponse.resourceType);
+
+ client.removePresenceEventListener(watchID);
}
try
{
- client = tizen.iotcon.getClient();
- watchID = client.addPresenceEventListener(null, null, connectivityType, presenceSuccess);
+ client = tizen.iotcon.getClient();
+ watchID = client.addPresenceEventListener(null, null, connectivityType, presenceSuccess);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(deviceInfo)
{
- if (deviceInfo)
- {
- console.log("######## Get a device info ########");
- console.log("Name: " + deviceInfo.deviceName); /* Human friendly name for device */
- console.log("Spec version: " + deviceInfo.specVersion); /* Spec version of the core specification */
- console.log("ID: " + deviceInfo.oicDeviceId); /* Unique identifier for OIC device */
- console.log("Data model version: " + deviceInfo.dataModelVersion); /* Version of the specs this device data model is implemented to */
- }
+ if (deviceInfo)
+ {
+ console.log("######## Get a device info ########");
+ console.log("Name: " + deviceInfo.deviceName); /* Human friendly name for device */
+ console.log("Spec version: " + deviceInfo.specVersion); /* Spec version of the core specification */
+ console.log("ID: " + deviceInfo.oicDeviceId); /* Unique identifier for OIC device */
+ console.log("Data model version: " + deviceInfo.dataModelVersion); /* Version of the specs this device data model is implemented to */
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- client.findDeviceInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ client.findDeviceInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Failed to find resource: " + err.message);
+ console.log("Failed to find resource: " + err.message);
}
function foundSuccess(platformInfo)
{
- console.log("######## Get a platform info ########");
- console.log("ID: " + platformInfo.platformId);
- console.log("Manufacturer name: " + platformInfo.manufacturerName);
- console.log("Manufacturer URL: " + platformInfo.manufacturerUrl);
- console.log("Model number: " + platformInfo.modelNumber);
- console.log("Date of manufacture: " + platformInfo.manufactureDate);
- console.log("Platform version: " + platformInfo.platformVersion);
- console.log("OS version: " + platformInfo.operatingSystemVersion);
- console.log("Hardware version: " + platformInfo.hardwareVersion);
- console.log("Firmware version: " + platformInfo.firmwareVersion);
- console.log("Support URL: " + platformInfo.supportUrl);
- console.log("System time: " + platformInfo.systemTime);
+ console.log("######## Get a platform info ########");
+ console.log("ID: " + platformInfo.platformId);
+ console.log("Manufacturer name: " + platformInfo.manufacturerName);
+ console.log("Manufacturer URL: " + platformInfo.manufacturerUrl);
+ console.log("Model number: " + platformInfo.modelNumber);
+ console.log("Date of manufacture: " + platformInfo.manufactureDate);
+ console.log("Platform version: " + platformInfo.platformVersion);
+ console.log("OS version: " + platformInfo.operatingSystemVersion);
+ console.log("Hardware version: " + platformInfo.hardwareVersion);
+ console.log("Firmware version: " + platformInfo.firmwareVersion);
+ console.log("Support URL: " + platformInfo.supportUrl);
+ console.log("System time: " + platformInfo.systemTime);
}
try
{
- var client = tizen.iotcon.getClient();
- client.findPlatformInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ client.findPlatformInfo(hostDeviceIpAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var attributes = {openstate: 'open'};
var policy =
{
- isObservable: true,
- isDiscoverable: true
+ isObservable: true,
+ isDiscoverable: true
};
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- if (remoteResponse.result != "SUCCESS")
- {
- console.log("the result is not SUCCESS");
-
- return;
- }
- var repr = remoteResponse.representation;
- console.log("Resource attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ if (remoteResponse.result != "SUCCESS")
+ {
+ console.log("the result is not SUCCESS");
+
+ return;
+ }
+ var repr = remoteResponse.representation;
+ console.log("Resource attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- query["filter"] = {openstate: 'open'};
- resource.methodGet(onresponse, query, onerror);
- }
+ if (resource)
+ {
+ query["filter"] = {openstate: 'open'};
+ resource.methodGet(onresponse, query, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- console.log("result is " + remoteResponse.result);
- var repr = remoteResponse.representation;
- console.log("representation attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ console.log("result is " + remoteResponse.result);
+ var repr = remoteResponse.representation;
+ console.log("representation attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- query["filter"] = {openstate: 'open'};
- representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.attributes = {openstate: 'closed'};
- resource.methodPut(representation, onresponse, query, onerror);
- }
+ if (resource)
+ {
+ query["filter"] = {openstate: 'open'};
+ representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.attributes = {openstate: 'closed'};
+ resource.methodPut(representation, onresponse, query, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- console.log("result is " + remoteResponse.result);
- var repr = remoteResponse.representation;
- console.log("representation attributes: ")
- for (var key in repr.attributes)
- {
- console.log(" key: " + key + ", value: " + repr.attributes[key]);
- }
+ console.log("result is " + remoteResponse.result);
+ var repr = remoteResponse.representation;
+ console.log("representation attributes: ")
+ for (var key in repr.attributes)
+ {
+ console.log(" key: " + key + ", value: " + repr.attributes[key]);
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.attributes = {openstate: 'closed'};
- resource.methodPost(representation, onresponse, null, onerror);
- }
+ if (resource)
+ {
+ representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.attributes = {openstate: 'closed'};
+ resource.methodPost(representation, onresponse, null, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onresponse(remoteResponse)
{
- if (remoteResponse.result == "RESOURCE_DELETED" || remoteResponse.result == "SUCCESS")
- {
- console.log("Successfully deleted");
- }
+ if (remoteResponse.result == "RESOURCE_DELETED" || remoteResponse.result == "SUCCESS")
+ {
+ console.log("Successfully deleted");
+ }
}
function foundSuccess(resource)
{
- if (resource)
- {
- resource.methodDelete(onresponse, onerror);
- }
+ if (resource)
+ {
+ resource.methodDelete(onresponse, onerror);
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onchanged(remoteResponse)
{
- if (remoteResponse.result == "SUCCESS")
- {
- var attributes = remoteResponse.representation.attributes;
- console.log("start observing, door is " + attributes["openstate"]);
- }
- doorResource.stopObserving();
+ if (remoteResponse.result == "SUCCESS")
+ {
+ var attributes = remoteResponse.representation.attributes;
+ console.log("start observing, door is " + attributes["openstate"]);
+ }
+ doorResource.stopObserving();
}
function foundSuccess(resource)
{
- if (resource)
- {
- if (resource.uriPath == "/door")
- {
- doorResource = resource;
- try
- {
- doorResource.startObserving("IGNORE_OUT_OF_ORDER", onchanged);
- }
- catch (err)
- {
- console.log(err.name + ': ' + err.message);
- }
- }
- }
+ if (resource)
+ {
+ if (resource.uriPath == "/door")
+ {
+ doorResource = resource;
+ try
+ {
+ doorResource.startObserving("IGNORE_OUT_OF_ORDER", onchanged);
+ }
+ catch (err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onerror(err)
{
- console.log("Error occurred: " + err.message);
+ console.log("Error occurred: " + err.message);
}
function onupdated(representation)
{
- console.log("######## updated representation ########");
- for (var key in representation.attributes)
- {
- console.log("key: " + key + ", value: " + representation.attributes[key]);
- }
- resource.stopCaching();
+ console.log("######## updated representation ########");
+ for (var key in representation.attributes)
+ {
+ console.log("key: " + key + ", value: " + representation.attributes[key]);
+ }
+ resource.stopCaching();
}
function foundSuccess(remoteResource)
{
- if (remoteResource)
- {
- resource = remoteResource;
- remoteResource.startCaching(onupdated); /* Start caching */
- }
+ if (remoteResource)
+ {
+ resource = remoteResource;
+ remoteResource.startCaching(onupdated); /* Start caching */
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
function onchanged(isAlive)
{
- if (isAlive == true)
- {
- console.log("Remote resource is alive");
- }
- else
- {
- console.log("Remote resource is lost");
- }
- doorResource.unsetResourceStateChangeListener();
+ if (isAlive == true)
+ {
+ console.log("Remote resource is alive");
+ }
+ else
+ {
+ console.log("Remote resource is lost");
+ }
+ doorResource.unsetResourceStateChangeListener();
}
function foundSuccess(resource)
{
- if (resource)
- {
- if (resource.uriPath == "/door")
- {
- try
- {
- resource.setResourceStateChangeListener(onchanged);
- }
- catch (err)
- {
- console.log(err.name + ': ' + err.message);
- }
- }
- }
+ if (resource)
+ {
+ if (resource.uriPath == "/door")
+ {
+ try
+ {
+ resource.setResourceStateChangeListener(onchanged);
+ }
+ catch (err)
+ {
+ console.log(err.name + ': ' + err.message);
+ }
+ }
+ }
}
try
{
- var client = tizen.iotcon.getClient();
- var hostAddress = null;
- var query = {resourceType: "core.door"};
- var connectivityType = "IP";
- client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
+ var client = tizen.iotcon.getClient();
+ var hostAddress = null;
+ var query = {resourceType: "core.door"};
+ var connectivityType = "IP";
+ client.findResource(hostAddress, query, connectivityType, foundSuccess, onerror);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var doorAttributes = {openstate: 'open'};
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
var lockAttributes = {lockstate: 'closed'};
policy =
{
- isObservable: true,
- isDiscoverable: true
+ isObservable: true,
+ isDiscoverable: true
};
var lockRequestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(lockResource.uriPath);
- representation.resourceTypes = lockResource.resourceTypes;
- representation.resourceInterfaces = lockResource.resourceInterfaces;
- representation.attributes = lockResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(lockResource.uriPath);
+ representation.resourceTypes = lockResource.resourceTypes;
+ representation.resourceInterfaces = lockResource.resourceInterfaces;
+ representation.attributes = lockResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
lockResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, lockRequestListener, policy);
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
var newRequestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- var response = new tizen.Response(request);
- try
- {
- doorResource.attributes = request.representation.attributes;
- response.representation = request.representation;
- response.result = "RESOURCE_CHANGED";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "RESOURCE_DELETED";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- server.removeResource(doorResource);
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving observeType:" + observeType + ", observeId:" + observeId);
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ var response = new tizen.Response(request);
+ try
+ {
+ doorResource.attributes = request.representation.attributes;
+ response.representation = request.representation;
+ response.result = "RESOURCE_CHANGED";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "RESOURCE_DELETED";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ server.removeResource(doorResource);
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving observeType:" + observeType + ", observeId:" + observeId);
+ }
}
try
{
- server = tizen.iotcon.getServer();
- var uriPath = "/door";
- var resourceTypes = ["core.door"];
- var resourceInterfaces = ["oic.if.b"];
- var attributes = {openstate: 'open'};
- var policy =
- {
- isObservable: true,
- isDiscoverable: true
- };
-
- doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
- doorResource.attributes = attributes;
- doorResource.setRequestListener(newRequestListener);
+ server = tizen.iotcon.getServer();
+ var uriPath = "/door";
+ var resourceTypes = ["core.door"];
+ var resourceInterfaces = ["oic.if.b"];
+ var attributes = {openstate: 'open'};
+ var policy =
+ {
+ isObservable: true,
+ isDiscoverable: true
+ };
+
+ doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
+ doorResource.attributes = attributes;
+ doorResource.setRequestListener(newRequestListener);
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
var filter = {"openstate": "open"};
var query =
{
- resourceType: "core.door",
- resourceInterface: "oic.if.b"
+ resourceType: "core.door",
+ resourceInterface: "oic.if.b"
}
query["filter"] = filter;
</pre>
var requestListener =
{
- onget: function(request)
- {
- console.log("onget");
- var response = new tizen.Response(request);
- try
- {
- var representation = new tizen.Representation(doorResource.uriPath);
- representation.resourceTypes = doorResource.resourceTypes;
- representation.resourceInterfaces = doorResource.resourceInterfaces;
- representation.attributes = doorResource.attributes;
- response.representation = representation;
- response.result = "SUCCESS";
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- response.result = "ERROR";
- }
- response.send();
- },
- onput: function(request)
- {
- console.log("onput");
- /* Add request handler code */
- },
- onpost: function(request)
- {
- console.log("onpost");
- /* Add request handler code */
- },
- ondelete: function(request)
- {
- console.log("ondelete");
- /* Add request handler code */
- },
- onobserving: function(request, observeType, observeId)
- {
- console.log("onobserving");
- /* Add request handler code */
- }
+ onget: function(request)
+ {
+ console.log("onget");
+ var response = new tizen.Response(request);
+ try
+ {
+ var representation = new tizen.Representation(doorResource.uriPath);
+ representation.resourceTypes = doorResource.resourceTypes;
+ representation.resourceInterfaces = doorResource.resourceInterfaces;
+ representation.attributes = doorResource.attributes;
+ response.representation = representation;
+ response.result = "SUCCESS";
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ response.result = "ERROR";
+ }
+ response.send();
+ },
+ onput: function(request)
+ {
+ console.log("onput");
+ /* Add request handler code */
+ },
+ onpost: function(request)
+ {
+ console.log("onpost");
+ /* Add request handler code */
+ },
+ ondelete: function(request)
+ {
+ console.log("ondelete");
+ /* Add request handler code */
+ },
+ onobserving: function(request, observeType, observeId)
+ {
+ console.log("onobserving");
+ /* Add request handler code */
+ }
}
try
{
- server = tizen.iotcon.getServer();
- var uriPath = "/door";
- var resourceTypes = ["core.door"];
- var resourceInterfaces = ["oic.if.b"];
- var policy =
- {
- isObservable: true,
- isDiscoverable: true
- };
-
- doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
- doorResource.attributes = {openstate: 'open'};
+ server = tizen.iotcon.getServer();
+ var uriPath = "/door";
+ var resourceTypes = ["core.door"];
+ var resourceInterfaces = ["oic.if.b"];
+ var policy =
+ {
+ isObservable: true,
+ isDiscoverable: true
+ };
+
+ doorResource = server.createResource(uriPath, resourceTypes, resourceInterfaces, requestListener, policy);
+ doorResource.attributes = {openstate: 'open'};
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var uriPath = "/door";
- var representation = new tizen.Representation(uriPath);
- representation.resourceTypes = ["core.door"];
- representation.resourceInterfaces = ["oic.if.b"];
- representation.attributes = {"openstate": "open"};
-
- var response = new tizen.Response(request);
- response.representation = representation;
- response.result = "SUCCESS";
+ var uriPath = "/door";
+ var representation = new tizen.Representation(uriPath);
+ representation.resourceTypes = ["core.door"];
+ representation.resourceInterfaces = ["oic.if.b"];
+ representation.attributes = {"openstate": "open"};
+
+ var response = new tizen.Response(request);
+ response.representation = representation;
+ response.result = "SUCCESS";
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
- response.result = "ERROR";
+ console.log(err.name + ': ' + err.message);
+ response.result = "ERROR";
}
response.send();
</pre>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
Name to identify the data - this will be the <em>name</em> attribute of the <a href="#KeyManagerAlias">KeyManagerAlias</a> which this method adds, on success, into the KeyManager
</li>
<li class="param">
-<span class="name">rawData</span>:
+<span class="name">rawData</span>:
Raw data to be stored
</li>
<li class="param">
-<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Password to use for encrypting the data
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when data is successfully saved
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function onSave()
{
- console.log("Successfully saved data");
+ console.log("Successfully saved data");
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias of the data to remove
</li>
</ul>
function onSave()
{
- /* Do something */
+ /* Do something */
- /*
- Dictionary does not require package ID because the
- application which is calling removeData() saved "data1"
- */
- tizen.keymanager.removeData({"name": data_name});
+ /*
+ Dictionary does not require package ID because the
+ application which is calling removeData() saved "data1"
+ */
+ tizen.keymanager.removeData({"name": data_name});
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
if (aliases.length != 0)
{
- /*
- Assuming the application calling removeData() has permission
- to remove aliases[0]
- */
- var app_data = tizen.keymanager.removeData(aliases[0]);
+ /*
+ Assuming the application calling removeData() has permission
+ to remove aliases[0]
+ */
+ var app_data = tizen.keymanager.removeData(aliases[0]);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias of the data to get
</li>
<li class="param">
-<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">password</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Password which was used to encrypt the data
</li>
</ul>
function onSave()
{
- /*
- Dictionary does not require package ID because the
- application which is calling getData() saved "data1"
- */
- var app_data = tizen.keymanager.getData({"name": data_name});
- console.log("App data: " + app_data + " was retrieved");
+ /*
+ Dictionary does not require package ID because the
+ application which is calling getData() saved "data1"
+ */
+ var app_data = tizen.keymanager.getData({"name": data_name});
+ console.log("App data: " + app_data + " was retrieved");
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
if (aliases.length != 0)
{
- /*
- Assuming the application calling getData() has permission to read
- aliases[0]
- */
- var app_data = tizen.keymanager.getData(aliases[0]);
- console.log("App data: " + app_data + " was retrieved");
+ /*
+ Assuming the application calling getData() has permission to read
+ aliases[0]
+ */
+ var app_data = tizen.keymanager.getData(aliases[0]);
+ console.log("App data: " + app_data + " was retrieved");
}
</pre>
</div>
console.log("aliases: ");
for (var i = 0; i < aliases.length; i++)
{
- console.log("Package ID: " + aliases[i].packageId + ", Name: "
- + aliases[i].name);
+ console.log("Package ID: " + aliases[i].packageId + ", Name: "
+ + aliases[i].name);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">dataAlias</span>:
+<span class="name">dataAlias</span>:
Alias the data for which permission will be set
</li>
<li class="param">
-<span class="name">packageId</span>:
+<span class="name">packageId</span>:
Package ID of the accessor application
</li>
<li class="param">
-<span class="name">permissionType</span>:
+<span class="name">permissionType</span>:
Permission to grant to the accessor application
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when permission is successfully set
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when an error occurs
</li>
</ul>
function onPermissionSet()
{
- console.log("Successfully set permission");
+ console.log("Successfully set permission");
}
function onSave()
{
- /*
- Dictionary does not require package ID because an
- application can only set permission for data which it saved
- */
- tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
+ /*
+ Dictionary does not require package ID because an
+ application can only set permission for data which it saved
+ */
+ tizen.keymanager.setPermission({"name": data_name}, "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
}
tizen.keymanager.saveData(data_name, raw_data, null, onSave);
function onPermissionSet()
{
- console.log("Successfully set permssion");
+ console.log("Successfully set permssion");
}
if (aliases.length != 0)
{
- /*
- Check that the application calling setPermission() saved aliases[0] into
- the KeyManager
- */
- if (aliases[0].packageId === tizen.package.getPackageInfo().id)
- {
- tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
- onPermissionSet);
- }
- else
- {
- console.log("This application did not save aliases[0] into the KeyManager");
- }
+ /*
+ Check that the application calling setPermission() saved aliases[0] into
+ the KeyManager
+ */
+ if (aliases[0].packageId === tizen.package.getPackageInfo().id)
+ {
+ tizen.keymanager.setPermission(aliases[0], "9PdoiICQ4c", "READ_REMOVE",
+ onPermissionSet);
+ }
+ else
+ {
+ console.log("This application did not save aliases[0] into the KeyManager");
+ }
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var mcClient = tizen.mediacontroller.getClient();
+ var mcClient = tizen.mediacontroller.getClient();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var mcServer = tizen.mediacontroller.createServer();
+ var mcServer = tizen.mediacontroller.createServer();
}
catch (err)
{
- console.log(err.name + ': ' + err.message);
+ console.log(err.name + ': ' + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Playback state.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
Playback position.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Shuffle mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Repeat mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">metadata</span>:
+<span class="name">metadata</span>:
Metadata object.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Change request listener to add.
</li>
</ul>
var playbackRequestListener =
{
- onplaybackstaterequest: function(state)
- {
- console.log('Playback state requested to: ' + state);
- },
- onplaybackpositionrequest: function(position)
- {
- console.log('Playback position requested to: ' + position);
- },
- onshufflemoderequest: function(mode)
- {
- console.log('Shuffle mode requested to: ' + mode);
- },
- onrepeatmoderequest: function(mode)
- {
- console.log('Repeat mode requested to: ' + mode);
- }
+ onplaybackstaterequest: function(state)
+ {
+ console.log('Playback state requested to: ' + state);
+ },
+ onplaybackpositionrequest: function(position)
+ {
+ console.log('Playback position requested to: ' + position);
+ },
+ onshufflemoderequest: function(mode)
+ {
+ console.log('Shuffle mode requested to: ' + mode);
+ },
+ onrepeatmoderequest: function(mode)
+ {
+ console.log('Repeat mode requested to: ' + mode);
+ }
};
/* Registers to receive playback info change requests from client */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
var playbackRequestListener =
{
- onplaybackstaterequest: function(state)
- {
- console.log('Playback state requested to: ' + state);
- },
- onplaybackpositionrequest: function(position)
- {
- console.log('Playback position requested to: ' + position);
- },
- onshufflemoderequest: function(mode)
- {
- console.log('Shuffle mode requested to: ' + mode);
- },
- onrepeatmoderequest: function(mode)
- {
- console.log('Repeat mode requested to: ' + mode);
- }
+ onplaybackstaterequest: function(state)
+ {
+ console.log('Playback state requested to: ' + state);
+ },
+ onplaybackpositionrequest: function(position)
+ {
+ console.log('Playback position requested to: ' + position);
+ },
+ onshufflemoderequest: function(mode)
+ {
+ console.log('Shuffle mode requested to: ' + mode);
+ },
+ onrepeatmoderequest: function(mode)
+ {
+ console.log('Repeat mode requested to: ' + mode);
+ }
};
/* Registers to receive playback info change requests */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Custom commands listener to add.
</li>
</ul>
var commandReceiveListener = function(clientName, command, data)
{
- console.log('Command ' + command + ' received from: ' + clientName +
- ' with data: ' + JSON.stringify(data));
+ console.log('Command ' + command + ' received from: ' + clientName +
+ ' with data: ' + JSON.stringify(data));
- var reply = {myReply: 'someValue'};
+ var reply = {myReply: 'someValue'};
- return reply;
+ return reply;
};
/* Registers to receive custom commands from client */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
var commandReceiveListener = function(clientName, command, data)
{
- console.log('Command ' + command + ' received from: ' + clientName +
- ' with data: ' + JSON.stringify(data));
+ console.log('Command ' + command + ' received from: ' + clientName +
+ ' with data: ' + JSON.stringify(data));
- var reply = {myReply: 'someValue'};
+ var reply = {myReply: 'someValue'};
- return reply;
+ return reply;
};
/* Registers to receive custom commands from client */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoked when all of the registered media controller servers was fund.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure of retrieving servers list.
</li>
</ul>
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
console.log('Latest server name is: ' + mcServerInfo.name +
- ', server state: ' + mcServerInfo.name);
+ ', server state: ' + mcServerInfo.name);
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Playback state.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoked when playback state was changed.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendPlaybackState('STOP', function()
{
- console.log('Playback has stopped');
+ console.log('Playback has stopped');
}, function(e)
{
- console.log('Unable to change playback state: ' + e.message);
+ console.log('Unable to change playback state: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
Playback position.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoked when playback position was changed.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendPlaybackPosition(164, function()
{
- console.log('Playback position changed');
+ console.log('Playback position changed');
}, function(e)
{
- console.log('Unable to change playback position: ' + e.message);
+ console.log('Unable to change playback position: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Shuffle mode.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoked when shuffle mode was changed.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendShuffleMode(true, function()
{
- console.log('Shuffle mode changed');
+ console.log('Shuffle mode changed');
}, function(e)
{
- console.log('Unable to change shuffle mode: ' + e.message);
+ console.log('Unable to change shuffle mode: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Repeat mode.
</li>
<li class="param">
-<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoked when repeat mode was changed.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendRepeatMode(false, function()
{
- console.log('Repeat mode changed');
+ console.log('Repeat mode changed');
}, function(e)
{
- console.log('Unable to change repeat mode: ' + e.message);
+ console.log('Unable to change repeat mode: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">command</span>:
+<span class="name">command</span>:
Custom command name which is handled on server side.
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Additional data for custom command which is send to server.
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoked when server responded to custom command.
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on operation failure.
</li>
</ul>
mcServerInfo.sendCommand('myPlaylistFilter', exampleCustomCommandData, function(response)
{
- console.log('Command executed with result: ' + JSON.stringify(response));
+ console.log('Command executed with result: ' + JSON.stringify(response));
}, function(e)
{
- console.log('Error executing command: ' + e.message);
+ console.log('Error executing command: ' + e.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Status change listener to add.
</li>
</ul>
/* Registers to be notified when server status changes */
watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
{
- console.log(mcServerInfo.name + ' server status changed to ' + status);
+ console.log(mcServerInfo.name + ' server status changed to ' + status);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
/* Registers to be notified when server status changes */
watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
{
- console.log(mcServerInfo.name + ' server status changed to ' + status);
+ console.log(mcServerInfo.name + ' server status changed to ' + status);
});
/* Cancels the watch operation */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Status change listener to add.
</li>
</ul>
var playbackListener =
{
- onplaybackchanged: function(state, position)
- {
- console.log('Current playback state: ' + state);
- console.log('Current playback position: ' + position);
- },
- onshufflemodechanged: function(mode)
- {
- console.log('Shuffle mode changed to: ' + mode);
- },
- onrepeatmodechanged: function(mode)
- {
- console.log('Repeat mode changed to: ' + mode);
- },
- onmetadatachanged: function(metadata)
- {
- console.log('Playback metadata changed: ' + JSON.stringify(metadata));
- }
+ onplaybackchanged: function(state, position)
+ {
+ console.log('Current playback state: ' + state);
+ console.log('Current playback position: ' + position);
+ },
+ onshufflemodechanged: function(mode)
+ {
+ console.log('Shuffle mode changed to: ' + mode);
+ },
+ onrepeatmodechanged: function(mode)
+ {
+ console.log('Repeat mode changed to: ' + mode);
+ },
+ onmetadatachanged: function(metadata)
+ {
+ console.log('Playback metadata changed: ' + JSON.stringify(metadata));
+ }
};
/* Registers to be notified when playback state changes */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
Subscription identifier
</li>
</ul>
/* Receives playback state changes */
var playbackListener =
{
- onplaybackchanged: function(state, position)
- {
- console.log('Current playback state: ' + state);
- console.log('Current playback position: ' + position);
- },
- onshufflemodechanged: function(mode)
- {
- console.log('Shuffle mode changed to: ' + mode);
- },
- onrepeatmodechanged: function(mode)
- {
- console.log('Repeat mode changed to: ' + mode);
- },
- onmetadatachanged: function(metadata)
- {
- console.log('Playback metadata changed: ' + JSON.stringify(metadata));
- }
+ onplaybackchanged: function(state, position)
+ {
+ console.log('Current playback state: ' + state);
+ console.log('Current playback position: ' + position);
+ },
+ onshufflemodechanged: function(mode)
+ {
+ console.log('Shuffle mode changed to: ' + mode);
+ },
+ onrepeatmodechanged: function(mode)
+ {
+ console.log('Repeat mode changed to: ' + mode);
+ },
+ onmetadatachanged: function(metadata)
+ {
+ console.log('Playback metadata changed: ' + JSON.stringify(metadata));
+ }
};
/* Registers to be notified when playback state changes */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">servers</span>:
+<span class="name">servers</span>:
List of registered media controller servers
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span><span class="optional"> [nullable]</span>:
+<span class="name">data</span><span class="optional"> [nullable]</span>:
Response object sent from server.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">clientName</span>:
+<span class="name">clientName</span>:
Client application id which sent command.
</li>
<li class="param">
-<span class="name">command</span>:
+<span class="name">command</span>:
Custom command sent from client.
</li>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Response object sent from client.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">status</span>:
+<span class="name">status</span>:
Current server status
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Current playback state.
</li>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
Current playback position.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Current shuffle mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Current repeat mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">metadata</span>:
+<span class="name">metadata</span>:
Current playback metadata.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Current playback state.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">position</span>:
+<span class="name">position</span>:
Current playback position.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Current shuffle mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Current repeat mode.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback method to be invoked when a media key has been pressed or released.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.mediakey.setMediaKeyEventListener(
{
- onpressed: function(key)
- {
- console.log("Pressed key: " + key);
- },
- onreleased: function(key)
- {
- console.log("Released key: " + key);
- }
+ onpressed: function(key)
+ {
+ console.log("Pressed key: " + key);
+ },
+ onreleased: function(key)
+ {
+ console.log("Released key: " + key);
+ }
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The pressed media key
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The released media key
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">localMessagePortName</span>:
+<span class="name">localMessagePortName</span>:
Name of the local message port to retrieve <br>The LocalMessagePort instances are identical for the same message port name.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">localMessagePortName</span>:
+<span class="name">localMessagePortName</span>:
Name of local message port <br>The LocalMessagePort instances are identical for the same message port name.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the application to send messages
</li>
<li class="param">
-<span class="name">remoteMessagePortName</span>:
+<span class="name">remoteMessagePortName</span>:
Name of remote message port
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">appId</span>:
+<span class="name">appId</span>:
ID of the application to send messages
</li>
<li class="param">
-<span class="name">remoteMessagePortName</span>:
+<span class="name">remoteMessagePortName</span>:
Name of remote message port
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Callback function that is called when a message is received
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onreceived(data, remoteMsgPort)
{
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
}
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
ID to identify the listener
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Array of data to send
</li>
<li class="param">
-<span class="name">localMessagePort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">localMessagePort</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
<em>LocalMessagePort</em> object that gives local message port of the current application<br>It can be used to receive reply messages from the other end of the message port.<br>The order of items in this array is not guaranteed to be preserved during data transfer, and values of <em>key</em> within this
array must not be duplicated or empty.
</li>
var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortB');
localMsgPort.addMessagePortListener(function(items, remoteport)
{
- /* ... */
- if (remoteport !== null)
- {
- remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
- }
+ /* ... */
+ if (remoteport !== null)
+ {
+ remoteport.sendMessage([{key:'RESULT', value:'OK'}]);
+ }
});
/* stream - FileStream object */
var bytePockets = [], byteCount = 0, i = 0;
while (byteCount < stream.bytesAvailable - 256)
{
- bytePockets[i] = stream.readBytes(256);
- byteCount+=256;
- i++;
+ bytePockets[i] = stream.readBytes(256);
+ byteCount+=256;
+ i++;
}
bytePockets[i] = stream.readBytes(stream.bytesAvailable - byteCount);
var messagePortPockets = [{key: "key1", value: "val1"},
- {key: "key2", value: ["val2", "val3", "val4"]},
- {key: "key3", value: bytePockets[0]},
- {key: "key4", value: bytePockets}];
+ {key: "key2", value: ["val2", "val3", "val4"]},
+ {key: "key3", value: bytePockets[0]},
+ {key: "key4", value: bytePockets}];
remoteMsgPort.sendMessage(messagePortPockets, localMsgPort);
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Array of data received from another application
</li>
<li class="param">
-<span class="name">remoteMessagePort</span><span class="optional"> [nullable]</span>:
+<span class="name">remoteMessagePort</span><span class="optional"> [nullable]</span>:
RemoteMessagePort port that can be used to reply for the received message
</li>
</ul>
/* MessagePortCallback instance */
function onreceived(data, remoteMsgPort)
{
- console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
+ console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
}
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var adapter = tizen.nfc.getDefaultAdapter();
+ var adapter = tizen.nfc.getDefaultAdapter();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.nfc.setExclusiveMode(true);
+ tizen.nfc.setExclusiveMode(true);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var gNfcAdapter;
var onPowerOn = function()
{
- /* Called when NFC adapter is powered on */
- try
- {
- console.log("Power on succeed");
- /* Implement NFC communication routines */
- gNfcAdapter.setPowered(false, /* Disable NFC adapter */
- function() {console.log("Power off succeed");}, /* Handle success */
- function() {console.log("Power off failed");}); /* Handle failure */
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ /* Called when NFC adapter is powered on */
+ try
+ {
+ console.log("Power on succeed");
+ /* Implement NFC communication routines */
+ gNfcAdapter.setPowered(false, /* Disable NFC adapter */
+ function() {console.log("Power off succeed");}, /* Handle success */
+ function() {console.log("Power off failed");}); /* Handle failure */
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
try
{
- gNfcAdapter = tizen.nfc.getDefaultAdapter();
- if (!gNfcAdapter.powered)
- {
- gNfcAdapter.setPowered(true, /* Enable NFC adapter */
- onPowerOn, /* Handle success */
- function() {console.log("Power on failed")}); /* Handle failure */
- }
- else
- {
- onPowerOn();
- }
+ gNfcAdapter = tizen.nfc.getDefaultAdapter();
+ if (!gNfcAdapter.powered)
+ {
+ gNfcAdapter.setPowered(true, /* Enable NFC adapter */
+ onPowerOn, /* Handle success */
+ function() {console.log("Power on failed")}); /* Handle failure */
+ }
+ else
+ {
+ onPowerOn();
+ }
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var adapter = tizen.nfc.getDefaultAdapter();
var onSuccessCB =
{
- onattach: function(nfcTag)
- {
- console.log("NFC Tag's type is " + nfcTag.type);
- },
- ondetach: function()
- {
- console.log("NFC Tag is detached");
- }
+ onattach: function(nfcTag)
+ {
+ console.log("NFC Tag's type is " + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ console.log("NFC Tag is detached");
+ }
};
adapter.setTagListener(onSuccessCB);
</pre>
var adapter = tizen.nfc.getDefaultAdapter();
var onSuccessCB =
{
- onattach: function(nfcPeer)
- {
- console.log("NFC Target is detected");
- },
- ondetach: function()
- {
- console.log("NFC Target is detached");
- }
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
};
adapter.setPeerListener(onSuccessCB);
</pre>
/* Receives NFCTag */
var onSuccessCB =
{
- onattach: function(nfcTag)
- {
- console.log("The attached NFC tag's type is " + nfcTag.type);
- },
- ondetach: function()
- {
- console.log("NFC tag is detached.");
-
- /* Unregister the listener when the NFC tag is detached */
- adapter.unsetTagListener();
- }
+ onattach: function(nfcTag)
+ {
+ console.log("The attached NFC tag's type is " + nfcTag.type);
+ },
+ ondetach: function()
+ {
+ console.log("NFC tag is detached.");
+
+ /* Unregister the listener when the NFC tag is detached */
+ adapter.unsetTagListener();
+ }
};
/* Registers to be notified when NFC tag is detected */
/* Receives an NFC peer */
var onSuccessCB =
{
- onattach: function(nfcPeer)
- {
- console.log("NFC peer target is attached.");
- },
- ondetach: function()
- {
- console.log("NFC peer target is detached.");
-
- /* Unregisters the listener when NFC peer target is detached */
- adapter.unsetPeerListener();
- }
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC peer target is attached.");
+ },
+ ondetach: function()
+ {
+ console.log("NFC peer target is detached.");
+
+ /* Unregisters the listener when NFC peer target is detached */
+ adapter.unsetPeerListener();
+ }
};
/* Registers to be notified when NFC peer target is detected */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onSuccessCB = function(mode)
- {
- console.log("The card emulation mode is " + mode);
- };
- var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
+ var onSuccessCB = function(mode)
+ {
+ console.log("The card emulation mode is " + mode);
+ };
+ var listenerId = adapter.addCardEmulationModeChangeListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.removeCardEmulationModeChangeListener(listenerId);
+ adapter.removeCardEmulationModeChangeListener(listenerId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data) {console.log("transaction event occurs");});
+ var listenerId = adapter.addTransactionEventListener("UICC", function(aid, data) {console.log("transaction event occurs");});
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.removeTransactionEventListener(listenerId);
+ adapter.removeTransactionEventListener(listenerId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onSuccessCB = function(seType)
- {
- console.log("Active secure element is " + seType);
- };
- var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
+ var onSuccessCB = function(seType)
+ {
+ console.log("Active secure element is " + seType);
+ };
+ var listenerId = adapter.addActiveSecureElementChangeListener(onSuccessCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.removeActiveSecureElementChangeListener(listenerId);
+ adapter.removeActiveSecureElementChangeListener(listenerId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.setExclusiveModeForTransaction(true);
+ adapter.setExclusiveModeForTransaction(true);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var onDetectedCB = function(event_data)
- {
- console.log("HCE event type is " + event_data.eventType);
- console.log("APDU is " + event_data.apdu);
- };
- var listenerId = adapter.addHCEEventListener(onDetectedCB);
+ var onDetectedCB = function(event_data)
+ {
+ console.log("HCE event type is " + event_data.eventType);
+ console.log("APDU is " + event_data.apdu);
+ };
+ var listenerId = adapter.addHCEEventListener(onDetectedCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- adapter.removeHCEEventListener(listenerId);
+ adapter.removeHCEEventListener(listenerId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var successCB = function()
- {
- console.log("Sending APDU response was successful.");
- };
-
- var errorCB = function()
- {
- console.log("Sending APDU response failed.");
- };
-
- var apdu_response= [0x00,0xA4,0x04,0x00,0x04,0x11,0x12, 0x13, 0x14]; /* Set apdu response */
- adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB);
+ var successCB = function()
+ {
+ console.log("Sending APDU response was successful.");
+ };
+
+ var errorCB = function()
+ {
+ console.log("Sending APDU response failed.");
+ };
+
+ var apdu_response= [0x00,0xA4,0x04,0x00,0x04,0x11,0x12, 0x13, 0x14]; /* Set apdu response */
+ adapter.sendHostAPDUResponse(apdu_response, successCB, errorCB);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var aid = "ABC0012345";
- var isActiveHandler = adapter.isActivatedHandlerForAID("HCE", aid);
- if (isActiveHandler)
- {
- console.log("current application is activated handler for the AID");
- }
+ var aid = "ABC0012345";
+ var isActiveHandler = adapter.isActivatedHandlerForAID("HCE", aid);
+ if (isActiveHandler)
+ {
+ console.log("current application is activated handler for the AID");
+ }
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var isActiveHandler = adapter.isActivatedHandlerForCategory("ESE", "PAYMENT");
- if (isActiveHandler)
- {
- console.log("current application is activated handler for the category");
- }
+ var isActiveHandler = adapter.isActivatedHandlerForCategory("ESE", "PAYMENT");
+ if (isActiveHandler)
+ {
+ console.log("current application is activated handler for the category");
+ }
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var aid = "ABC0012345";
- adapter.registerAID("HCE", aid, "PAYMENT");
+ var aid = "ABC0012345";
+ adapter.registerAID("HCE", aid, "PAYMENT");
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var aid = "ABC0012345";
- adapter.unregisterAID("HCE", aid, "PAYMENT");
+ var aid = "ABC0012345";
+ adapter.unregisterAID("HCE", aid, "PAYMENT");
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The secure element type
</li>
<li class="param">
var adapter = tizen.nfc.getDefaultAdapter();
var onSuccessCB =
{
- onattach: function(nfcTag)
- {
- console.log("NFC Tag's type is " + nfcTag.type);
- for (var i in nfcTag.properties)
- {
- console.log("key:" + i + " value:" + nfcTag.properties[i]);
- }
- },
- ondetach: function()
- {
- console.log("NFC Tag is detached");
- }
+ onattach: function(nfcTag)
+ {
+ console.log("NFC Tag's type is " + nfcTag.type);
+ for (var i in nfcTag.properties)
+ {
+ console.log("key:" + i + " value:" + nfcTag.properties[i]);
+ }
+ },
+ ondetach: function()
+ {
+ console.log("NFC Tag is detached");
+ }
};
adapter.setTagListener(onSuccessCB);
</pre>
/* Receives NFCPeer */
var onSuccessCB =
{
- onattach: function(nfcPeer)
- {
- console.log("NFC Target is detected");
- nfcPeer.setReceiveNDEFListener(function(message)
- {
- console.log("Receive message");
- });
- },
- ondetach: function()
- {
- console.log("NFC Target is detached");
- }
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ nfcPeer.setReceiveNDEFListener(function(message)
+ {
+ console.log("Receive message");
+ });
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
};
adapter.setPeerListener(onSuccessCB);
var adapter = tizen.nfc.getDefaultAdapter();
var onSuccessCB =
{
- onattach: function(nfcPeer)
- {
- console.log("NFC Target is detected");
- nfcPeer.setReceiveNDEFListener(function(message)
- {
- console.log("Receive message");
- nfcPeer.unsetReceiveNDEFListener();
- });
- },
- ondetach: function()
- {
- console.log("NFC Target is detached");
- }
+ onattach: function(nfcPeer)
+ {
+ console.log("NFC Target is detected");
+ nfcPeer.setReceiveNDEFListener(function(message)
+ {
+ console.log("Receive message");
+ nfcPeer.unsetReceiveNDEFListener();
+ });
+ },
+ ondetach: function()
+ {
+ console.log("NFC Target is detached");
+ }
};
adapter.setPeerListener(onSuccessCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
- null, "image/jpg", null);
- var notificationDict =
- {
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3",
- vibration: true,
- appControl: appControl
- };
-
- var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
+ null, "image/jpg", null);
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appControl: appControl
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Uses a variable for the previously posted notification */
- notification.content = "My notification";
- tizen.notification.update(notification);
+ /* Uses a variable for the previously posted notification */
+ notification.content = "My notification";
+ tizen.notification.update(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Uses a variable for the previously posted notification */
- tizen.notification.remove(notification.id);
+ /* Uses a variable for the previously posted notification */
+ tizen.notification.remove(notification.id);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.notification.removeAll();
+ tizen.notification.removeAll();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Uses a variable for the previously posted notification */
- /* Saves the notification ID for future use */
- var myId = notification.id;
+ /* Uses a variable for the previously posted notification */
+ /* Saves the notification ID for future use */
+ var myId = notification.id;
- var myNotification = tizen.notification.get(myId);
+ var myNotification = tizen.notification.get(myId);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var notifications = tizen.notification.getAll();
- var index = 0;
-
- for (index = 0; index < notifications.length; index++)
- {
- console.log(notifications[index].id);
- console.log(notifications[index].title);
- console.log(notifications[index].statusType);
- console.log(notifications[index].type);
- console.log(notifications[index].content);
- console.log(notifications[index].postedTime);
- console.log(notifications[index].iconPath);
- console.log(notifications[index].soundPath);
- console.log(notifications[index].vibration);
- console.log(notifications[index].appControl);
- }
+ var notifications = tizen.notification.getAll();
+ var index = 0;
+
+ for (index = 0; index < notifications.length; index++)
+ {
+ console.log(notifications[index].id);
+ console.log(notifications[index].title);
+ console.log(notifications[index].statusType);
+ console.log(notifications[index].type);
+ console.log(notifications[index].content);
+ console.log(notifications[index].postedTime);
+ console.log(notifications[index].iconPath);
+ console.log(notifications[index].soundPath);
+ console.log(notifications[index].vibration);
+ console.log(notifications[index].appControl);
+ }
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
</pre>
</div>
<dt class="method" id="NotificationManager::saveNotificationAsTemplate">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
The name of template to be saved.
</li>
<li class="param">
-<span class="name">notification</span>:
+<span class="name">notification</span>:
A notification to be saved as a template.
</li>
</ul>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try {
- var notificationDict = {
- content : "This is a simple notification.",
- iconPath : "images/image1.jpg",
- soundPath : "music/Over the horizon.mp3",
- vibration : true
- };
+ var notificationDict = {
+ content : "This is a simple notification.",
+ iconPath : "images/image1.jpg",
+ soundPath : "music/Over the horizon.mp3",
+ vibration : true
+ };
- var notification = new tizen.StatusNotification("SIMPLE",
- "Simple notification", notificationDict);
+ var notification = new tizen.StatusNotification("SIMPLE",
+ "Simple notification", notificationDict);
- tizen.notification.saveNotificationAsTemplate("SIMPLE_TEMPLATE", notification);
+ tizen.notification.saveNotificationAsTemplate("SIMPLE_TEMPLATE", notification);
} catch (err) {
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">name</span>:
+<span class="name">name</span>:
The name of template to be used as source of notification.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
/* the template with name "SIMPLE_TEMPLATE" should be previously created */
try {
- var notification = tizen.notification.createNotificationFromTemplate("SIMPLE_TEMPLATE");
+ var notification = tizen.notification.createNotificationFromTemplate("SIMPLE_TEMPLATE");
} catch (err) {
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var notificationDict =
- {
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3",
- vibration: true,
- ledColor: "#FFFF00",
- ledOnPeriod: 1000,
- ledOffPeriod: 500
- };
-
- var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
-
- tizen.notification.post(notification);
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ ledColor: "#FFFF00",
+ ledOnPeriod: 1000,
+ ledOffPeriod: 500
+ };
+
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+ tizen.notification.post(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Gets the current application information with tizen.application.getAppInfo */
- var myappInfo = tizen.application.getAppInfo();
+ /* Gets the current application information with tizen.application.getAppInfo */
+ var myappInfo = tizen.application.getAppInfo();
- var notificationDict =
- {
- content: "This is a simple notification.",
- iconPath: "images/image1.jpg",
- soundPath: "music/Over the horizon.mp3",
- vibration: true,
- appId: myappInfo.id
- };
+ var notificationDict =
+ {
+ content: "This is a simple notification.",
+ iconPath: "images/image1.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appId: myappInfo.id
+ };
- var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+ var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
- tizen.notification.post(notification);
+ tizen.notification.post(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
- null, "image/jpg", null);
-
- var notificationDict =
- {
- content: "This is a progress notification.",
- iconPath: "images/image2.jpg",
- soundPath: "music/Over the horizon.mp3",
- vibration: true,
- appControl: appControl,
- progressValue: 20
- };
- /* Constructs the progress notification */
- var notification = new tizen.StatusNotification("PROGRESS", "Progress notification", notificationDict);
- /* Posts the notification */
- tizen.notification.post(notification);
-
- /* Updates the progress value of the notification */
- notification.progressValue = 59;
- tizen.notification.update(notification);
+ var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content",
+ null, "image/jpg", null);
+
+ var notificationDict =
+ {
+ content: "This is a progress notification.",
+ iconPath: "images/image2.jpg",
+ soundPath: "music/Over the horizon.mp3",
+ vibration: true,
+ appControl: appControl,
+ progressValue: 20
+ };
+ /* Constructs the progress notification */
+ var notification = new tizen.StatusNotification("PROGRESS", "Progress notification", notificationDict);
+ /* Posts the notification */
+ tizen.notification.post(notification);
+
+ /* Updates the progress value of the notification */
+ notification.progressValue = 59;
+ tizen.notification.update(notification);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void uninstall(<a href="#PackageId">PackageId</a> id,
+ void uninstall(<a href="#PackageId">PackageId</a> id,
<a href="#PackageProgressCallback">PackageProgressCallback</a> progressCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void setPackageInfoEventListener(<a href="#PackageInformationEventCallback">PackageInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
void unsetPackageInfoEventListener() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
};</pre>
<p><span class="version">
Since: </span>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">packageFileURI</span>:
+<span class="name">packageFileURI</span>:
The location of the package to install
</li>
<li class="param">
-<span class="name">progressCallback</span>:
+<span class="name">progressCallback</span>:
The method to invoke when the installation is in progress or has been completed
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var onInstallation =
{
- onprogress: function(packageId, percentage)
- {
- console.log("On installation(" + packageId + "): progress(" + percentage + ")");
- },
- oncomplete: function(packageId)
- {
- console.log("Installation(" + packageId + ") Complete");
- }
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On installation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Installation(" + packageId + ") Complete");
+ }
}
var onError = function(err)
{
- console.log("Error occurred on installation: " + err.name);
+ console.log("Error occurred on installation: " + err.name);
}
/* Let's assume that the "test.wgt" file exists in the downloads directory */
tizen.filesystem.resolve("downloads/test.wgt", function(file)
{
- console.log("file URI: " + file.toURI());
- tizen.package.install(file.toURI(), onInstallation, onError);
+ console.log("file URI: " + file.toURI());
+ tizen.package.install(file.toURI(), onInstallation, onError);
}, function(err)
{
- console.log("Error occurred on resolve: " + err.name);
+ console.log("Error occurred on resolve: " + err.name);
}, "r");
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID to uninstall
</li>
<li class="param">
-<span class="name">progressCallback</span>:
+<span class="name">progressCallback</span>:
The method to invoke when uninstallation is in progress or has been completed
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var onUninstallation =
{
- onprogress: function(packageId, percentage)
- {
- console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
- },
- oncomplete: function(packageId)
- {
- console.log("Uninstallation(" + packageId + ") Complete");
- }
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On Uninstallation(" + packageId + "): progress(" + percentage + ")");
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Uninstallation(" + packageId + ") Complete");
+ }
};
var onError = function(err)
{
- console.log("Error occurred on installation: " + err.name);
+ console.log("Error occurred on installation: " + err.name);
};
/* Let's assume that the package ID to uninstall is "testapp001" */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to call when an invocation ends successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledPackages(packages)
{
- for (var i = 0; i < packages.length; i++)
- {
- console.log("Package id[" + i + "]: " + packages[i].id);
- }
+ for (var i = 0; i < packages.length; i++)
+ {
+ console.log("Package id[" + i + "]: " + packages[i].id);
+ }
}
tizen.package.getPackagesInfo(onListInstalledPackages, function(err)
{
- console.log("Can't obtain packages list" + err.name);
+ console.log("Can't obtain packages list" + err.name);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">id</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A string representing the package ID. If the ID is not provided, the package information of the calling application is returned.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">eventCallback</span>:
+<span class="name">eventCallback</span>:
The method to be called when any change is made to the list of installed packages.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var packageEventCallback =
{
- oninstalled: function(packageInfo)
- {
- console.log('The package ' + packageInfo.name + ' is installed');
- },
- onupdated: function(packageInfo)
- {
- console.log('The package ' + packageInfo.name + ' is updated');
- },
- onuninstalled: function(packageId)
- {
- console.log('The package ' + packageId + ' is uninstalled');
- }
+ oninstalled: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is installed');
+ },
+ onupdated: function(packageInfo)
+ {
+ console.log('The package ' + packageInfo.name + ' is updated');
+ },
+ onuninstalled: function(packageId)
+ {
+ console.log('The package ' + packageId + ' is uninstalled');
+ }
};
tizen.package.setPackageInfoEventListener(packageEventCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">informationArray</span>:
+<span class="name">informationArray</span>:
A list of installed packages' information.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID
</li>
<li class="param">
-<span class="name">progress</span>:
+<span class="name">progress</span>:
The progress in percentage.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The package ID
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The information of the installed package
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">info</span>:
+<span class="name">info</span>:
The information of the updated package
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
The ID of the uninstalled package
</li>
</ul>
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void uninstall(<a href="#PackageId">PackageId</a> id,
+ void uninstall(<a href="#PackageId">PackageId</a> id,
<a href="#PackageProgressCallback">PackageProgressCallback</a> progressCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void setPackageInfoEventListener(<a href="#PackageInformationEventCallback">PackageInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
void unsetPackageInfoEventListener() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
-
+
};
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Latency mode to set.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">resource</span>:
+<span class="name">resource</span>:
Power resource for which the request is made
</li>
<li class="param">
-<span class="name">state</span>:
+<span class="name">state</span>:
Minimal power state in which the power resource is desired to be
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">resource</span>:
+<span class="name">resource</span>:
Resource for which requests are to be removed
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
Screen state change callback
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onScreenStateChanged(previousState, changedState)
{
- console.log("Screen state changed from " + previousState + " to " + changedState);
+ console.log("Screen state changed from " + previousState + " to " + changedState);
}
/* Sets the screen state change listener */
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">brightness</span>:
+<span class="name">brightness</span>:
The screen brightness value to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">previousState</span>:
+<span class="name">previousState</span>:
Previous screen state
</li>
<li class="param">
-<span class="name">changedState</span>:
+<span class="name">changedState</span>:
Changed screen state
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var successCB = function(preferences)
{
- if (preferences.length)
- {
- console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
- }
+ if (preferences.length)
+ {
+ console.log('The first preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
+ }
};
tizen.preference.getAll(successCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
if (tizen.preference.exists('key1'))
{
- console.log('Preference with the key key1 exists');
+ console.log('Preference with the key key1 exists');
}
else
{
- console.log('Preference with the key key1 doesn't exist');
+ console.log('Preference with the key key1 doesn't exist');
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener = function(data)
{
- console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
+ console.log('Preference with the key: ' + data.key + ' has a new value: ' + data.value);
};
tizen.preference.setChangeListener('key1', listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener = function(data)
{
- tizen.preference.unsetChangeListener(data.key);
+ tizen.preference.unsetChangeListener(data.key);
};
tizen.preference.setChangeListener('key1', listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener = function(data)
{
- tizen.preference.unsetChangeListener(data.key);
+ tizen.preference.unsetChangeListener(data.key);
};
tizen.preference.setChangeListener('key1', listener);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var successCB = function(preferences)
{
- if (preferences.length)
- {
- console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
- }
+ if (preferences.length)
+ {
+ console.log('First preference - key: ' + preferences[0].key + ' value: ' + preferences[0].value);
+ }
};
tizen.preference.getAll(successCB);
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the registration success callback */
function registerSuccessCallback(id)
{
- console.log("Registration succeeded with id: " + id);
+ console.log("Registration succeeded with id: " + id);
}
/* Requests registration */
/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the registration success callback */
function registerSuccessCallback(id)
{
- console.log("Registration succeeded with id: " + id);
+ console.log("Registration succeeded with id: " + id);
}
/* Defines the state change callback */
function stateChangeCallback(state)
{
- console.log("The state is changed to: " + state);
+ console.log("The state is changed to: " + state);
- if (state == "UNREGISTERED")
- {
- /* Requests application registration */
- tizen.push.register(registerSuccessCallback, errorCallback);
- }
+ if (state == "UNREGISTERED")
+ {
+ /* Requests application registration */
+ tizen.push.register(registerSuccessCallback, errorCallback);
+ }
}
/* Defines the notification callback */
function notificationCallback(notification)
{
- console.log("A notification arrives.");
+ console.log("A notification arrives.");
}
/* Connects to push service */
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the unregistration success callback */
function unregisterSuccessCallback()
{
- console.log("Unregistration succeeded.");
+ console.log("Unregistration succeeded.");
}
/* Requests unregistration */
/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the unregistration success callback */
function unregisterSuccessCallback()
{
- console.log("Unregistration succeeded.");
+ console.log("Unregistration succeeded.");
}
/* Requests unregistration */
/* Defines the connect success callback */
function notificationCallback(noti)
{
- console.log("Notification received with alert message: " + noti.alertMessage);
+ console.log("Notification received with alert message: " + noti.alertMessage);
}
/* Defines the data to be used when this process is launched by notification service */
/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the registration success callback */
function registerSuccessCallback(id)
{
- console.log("Registration succeeded with id: " + id);
+ console.log("Registration succeeded with id: " + id);
- /* Requests for push service connection */
- tizen.push.connectService(notificationCallback);
+ /* Requests for push service connection */
+ tizen.push.connectService(notificationCallback);
}
/* Requests registration */
/* Defines the state change callback */
function stateChangeCallback(state)
{
- console.log("The state is changed to: " + state);
+ console.log("The state is changed to: " + state);
}
/* Defines the notification callback */
function notificationCallback(notification)
{
- console.log("A notification arrives.");
+ console.log("A notification arrives.");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("The following error occurred: " + error.name);
+ console.log("The following error occurred: " + error.name);
}
/* Requests for push service connection */
var registrationId = tizen.push.getRegistrationId();
if (registrationId != null)
{
- console.log("The registration id: " + registrationId);
+ console.log("The registration id: " + registrationId);
}
</pre>
</div>
/* Defines the state change callback */
function stateChangeCallback(state)
{
- console.log("The state is changed to: " + state);
+ console.log("The state is changed to: " + state);
- var id = tizen.push.getRegisterationId();
- console.log("The registration ID: " + id);
+ var id = tizen.push.getRegisterationId();
+ console.log("The registration ID: " + id);
}
/* Defines the notification callback */
function notificationCallback(notification)
{
- console.log("A notification arrives.");
+ console.log("A notification arrives.");
}
/* Requests for push service connection */
/* Defines the connect success callback */
function notificationCallback(message)
{
- console.log("New push message: " + message.alertMessage + ", date: " + message.date + ", data: " + message.appData);
+ console.log("New push message: " + message.alertMessage + ", date: " + message.date + ", data: " + message.appData);
}
/* Requests for push service connection */
/* Defines the state change callback */
function stateChangeCallback(state)
{
- console.log("The state is changed to: " + state);
+ console.log("The state is changed to: " + state);
- if (state === "REGISTERED")
- {
- /* Gets unread push notifications */
- tizen.push.getUnreadNotifications();
- }
+ if (state === "REGISTERED")
+ {
+ /* Gets unread push notifications */
+ tizen.push.getUnreadNotifications();
+ }
}
/* Defines the notification callback */
function notificationCallback(notification)
{
- console.log("A notification arrives.");
+ console.log("A notification arrives.");
}
/* Requests for push service connection */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- var message = tizen.push.getPushMessage();
- console.log('Message received from: ' + message.sender);
+ var message = tizen.push.getPushMessage();
+ console.log('Message received from: ' + message.sender);
}
catch (err)
{
- console.log('Exception - code: ' + err.name + ' message: ' + err.message);
+ console.log('Exception - code: ' + err.name + ' message: ' + err.message);
}
</pre>
</div>
/* Defines the connect success callback */
function notificationCallback(noti)
{
- console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
- console.log('Details:');
- console.log(' - data: ' + noti.appData);
- console.log(' - alert message: ' + noti.alertMessage);
- console.log(' - message: ' + noti.message);
- console.log(' - session: ' + noti.sessionInfo);
- console.log(' - request ID: ' + noti.requestId);
+ console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
+ console.log('Details:');
+ console.log(' - data: ' + noti.appData);
+ console.log(' - alert message: ' + noti.alertMessage);
+ console.log(' - message: ' + noti.message);
+ console.log(' - session: ' + noti.sessionInfo);
+ console.log(' - request ID: ' + noti.requestId);
}
/* Requests for push service connection */
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- function success(readers)
- {
- for (var i = 0; i < readers.length; i++)
- {
- if (readers[i].isPresent)
- {
- console.log("Reader Name: " + readers[i].getName());
- }
- }
- }
- function error(err)
- {
- console.log(err.name + ": " + err.message);
- }
- tizen.seService.getReaders(success, error);
+ function success(readers)
+ {
+ for (var i = 0; i < readers.length; i++)
+ {
+ if (readers[i].isPresent)
+ {
+ console.log("Reader Name: " + readers[i].getName());
+ }
+ }
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ tizen.seService.getReaders(success, error);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var listener =
{
- onSEReady: function(reader)
- {
- console.log(reader.getName() + " is ready.");
- },
- onSENotReady: function(reader)
- {
- console.log(reader.getName() + " is not ready.");
- },
- onSEError: function(reader, error)
- {
- console.log(reader.getName() + ": error occurred: " + error.message);
- }
+ onSEReady: function(reader)
+ {
+ console.log(reader.getName() + " is ready.");
+ },
+ onSENotReady: function(reader)
+ {
+ console.log(reader.getName() + " is not ready.");
+ },
+ onSEError: function(reader, error)
+ {
+ console.log(reader.getName() + ": error occurred: " + error.message);
+ }
};
try
{
- var seListener = tizen.seService.registerSEListener(listener);
+ var seListener = tizen.seService.registerSEListener(listener);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var seListener; /* seListener obtained from registerSEListener */
try
{
- tizen.seService.unregisterSEListener(seListener);
+ tizen.seService.unregisterSEListener(seListener);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- tizen.seService.shutdown();
+ tizen.seService.shutdown();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- function success(readers)
- {
- for (var i = 0; i < readers.length; i++)
- {
- if (readers[i].isPresent)
- {
- console.log("Reader Name: " + readers[i].getName());
- }
- }
- }
- function error(err)
- {
- console.log(err.name + ": " + err.message);
- }
- tizen.seService.getReaders(success, error);
+ function success(readers)
+ {
+ for (var i = 0; i < readers.length; i++)
+ {
+ if (readers[i].isPresent)
+ {
+ console.log("Reader Name: " + readers[i].getName());
+ }
+ }
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ tizen.seService.getReaders(success, error);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- function success(session)
- {
- console.log("Open Session Success: " + !session.isClosed);
- }
- function error(err)
- {
- console.log(err.name + ": " + err.message);
- }
- reader.openSession(success, error);
+ function success(session)
+ {
+ console.log("Open Session Success: " + !session.isClosed);
+ }
+ function error(err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
+ reader.openSession(success, error);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- reader.closeSessions();
+ reader.closeSessions();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- function successChannel(channel)
- {
- if (channel.isBasicChannel)
- {
- console.log("Basic channel is opened.");
- }
- else
- {
- console.log("Logical channel is opened.");
- }
- }
- function errorChannel(err)
- {
- console.log("openBasicChannel Error:" + err.name +": " + err.message);
- }
+ function successChannel(channel)
+ {
+ if (channel.isBasicChannel)
+ {
+ console.log("Basic channel is opened.");
+ }
+ else
+ {
+ console.log("Logical channel is opened.");
+ }
+ }
+ function errorChannel(err)
+ {
+ console.log("openBasicChannel Error:" + err.name +": " + err.message);
+ }
- function successSession(session)
- {
- console.log("Open Session Success: " + !session.isClosed);
- /* This aid is for test. Use aid for your applet in secure element */
- session.openBasicChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
- }
- function errorSession(err)
- {
- console.log("openSession Error: " + err.name + ": " + err.message);
- }
- reader.openSession(successSession, errorSession);
+ function successSession(session)
+ {
+ console.log("Open Session Success: " + !session.isClosed);
+ /* This aid is for test. Use aid for your applet in secure element */
+ session.openBasicChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
+ }
+ function errorSession(err)
+ {
+ console.log("openSession Error: " + err.name + ": " + err.message);
+ }
+ reader.openSession(successSession, errorSession);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var session; /* Session obtained from openSession callback */
try
{
- function successChannel(channel)
- {
- if (channel.isBasicChannel)
- {
- console.log("Basic channel is opened.");
- }
- else
- {
- console.log("Logical channel is opened.");
- }
- }
- function errorChannel(err)
- {
- console.log("openLogicalChannel Error:" + err.name + ": " + err.message);
- }
+ function successChannel(channel)
+ {
+ if (channel.isBasicChannel)
+ {
+ console.log("Basic channel is opened.");
+ }
+ else
+ {
+ console.log("Logical channel is opened.");
+ }
+ }
+ function errorChannel(err)
+ {
+ console.log("openLogicalChannel Error:" + err.name + ": " + err.message);
+ }
- /* This aid is for test. Use aid for your applet in secure element */
- session.openLogicalChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
+ /* This aid is for test. Use aid for your applet in secure element */
+ session.openLogicalChannel([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe], successChannel, errorChannel);
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var session; /* Session obtained from openSession callback */
try
{
- var atr = session.getATR();
+ var atr = session.getATR();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var session; /* Session obtained from openSession callback */
try
{
- session.close();
+ session.close();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var session; /* Session obtained from openSession callback */
try
{
- session.closeChannels();
+ session.closeChannels();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
var channel; /* Obtained from openLogicalChannel or openBasicChannel */
try
{
- channel.close();
+ channel.close();
}
catch (err)
{
- console.log(err.name + ": " + err.message);
+ console.log(err.name + ": " + err.message);
}
</pre>
</div>
if (proximityCapability === true)
{
- /* Device supports proximity sensor and you can get proximity sensor's data */
- var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
+ /* Device supports proximity sensor and you can get proximity sensor's data */
+ var proximitySensor = tizen.sensorservice.getDefaultSensor("PROXIMITY");
}
else
{
- /* If tizen.sensorservice.getDefaultSensor("PROXIMITY") is used, NotSupportedError is thrown */
- console.log("Proximity sensor is not supported on this device.");
+ /* If tizen.sensorservice.getDefaultSensor("PROXIMITY") is used, NotSupportedError is thrown */
+ console.log("Proximity sensor is not supported on this device.");
}
</pre>
</div>
function onsuccessCB()
{
- console.log("The proximity sensor started successfully.");
+ console.log("The proximity sensor started successfully.");
}
proximitySensor.start(onsuccessCB);
function onsuccessCB()
{
- console.log("proximity sensor start");
- proximitySensor.stop();
+ console.log("proximity sensor start");
+ proximitySensor.stop();
}
proximitySensor.start(onsuccessCB);
function onchangedCB(sensorData)
{
- console.log("proximity distance: " + sensorData.proximityState);
+ console.log("proximity distance: " + sensorData.proximityState);
}
proximitySensor.setChangeListener(onchangedCB);
function onsuccessCB(hardwareInfo)
{
- console.log("name: " + hardwareInfo.name);
- console.log("type: " + hardwareInfo.type);
- console.log("vendor: " + hardwareInfo.vendor);
- console.log("minValue: " + hardwareInfo.minValue);
- console.log("maxValue: " + hardwareInfo.maxValue);
- console.log("resolution: " + hardwareInfo.resolution);
- console.log("minInterval: " + hardwareInfo.minInterval);
- console.log("maxBatchCount: " + hardwareInfo.maxBatchCount);
+ console.log("name: " + hardwareInfo.name);
+ console.log("type: " + hardwareInfo.type);
+ console.log("vendor: " + hardwareInfo.vendor);
+ console.log("minValue: " + hardwareInfo.minValue);
+ console.log("maxValue: " + hardwareInfo.maxValue);
+ console.log("resolution: " + hardwareInfo.resolution);
+ console.log("minInterval: " + hardwareInfo.minInterval);
+ console.log("maxBatchCount: " + hardwareInfo.maxBatchCount);
}
</pre>
</div>
function onGetSuccessCB(sensorData)
{
- console.log("light level: " + sensorData.lightLevel);
+ console.log("light level: " + sensorData.lightLevel);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- lightSensor.getLightSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ lightSensor.getLightSensorData(onGetSuccessCB, onerrorCB);
}
lightSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("magnetic field of the X axis: " + sensorData.x);
- console.log("magnetic field of the Y axis: " + sensorData.y);
- console.log("magnetic field of the Z axis: " + sensorData.z);
+ console.log("magnetic field of the X axis: " + sensorData.x);
+ console.log("magnetic field of the Y axis: " + sensorData.y);
+ console.log("magnetic field of the Z axis: " + sensorData.z);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- magneticSensor.getMagneticSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ magneticSensor.getMagneticSensorData(onGetSuccessCB, onerrorCB);
}
magneticSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("pressure: " + sensorData.pressure);
+ console.log("pressure: " + sensorData.pressure);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ pressureSensor.getPressureSensorData(onGetSuccessCB, onerrorCB);
}
pressureSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("proximity state: " + sensorData.proximityState);
+ console.log("proximity state: " + sensorData.proximityState);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("proximity sensor start");
- proximitySensor.getProximitySensorData(onGetSuccessCB, onerrorCB);
+ console.log("proximity sensor start");
+ proximitySensor.getProximitySensorData(onGetSuccessCB, onerrorCB);
}
proximitySensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("ultraviolet level: " + sensorData.ultravioletLevel);
+ console.log("ultraviolet level: " + sensorData.ultravioletLevel);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("ultraviolet sensor start");
- ultravioletSensor.getUltravioletSensorData(onGetSuccessCB, onerrorCB);
+ console.log("ultraviolet sensor start");
+ ultravioletSensor.getUltravioletSensorData(onGetSuccessCB, onerrorCB);
}
ultravioletSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("HRMRaw light intensity: " + sensorData.lightIntensity);
+ console.log("HRMRaw light intensity: " + sensorData.lightIntensity);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("HRMRaw sensor start");
- HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
+ console.log("HRMRaw sensor start");
+ HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
}
HRMrawsensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("######## Get the gravity sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
+ console.log("######## Get the gravity sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- gravitySensor.getGravitySensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ gravitySensor.getGravitySensorData(onGetSuccessCB, onerrorCB);
}
gravitySensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("######## Get the gyroscope sensor date ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
+ console.log("######## Get the gyroscope sensor date ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- gyroscopeSensor.getGyroscopeSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ gyroscopeSensor.getGyroscopeSensorData(onGetSuccessCB, onerrorCB);
}
gyroscopeSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("######## Get the gyroscope rotation vector sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
- console.log("w: " + sensorData.w);
+ console.log("######## Get the gyroscope rotation vector sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
+ console.log("w: " + sensorData.w);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("sensor start");
- gyroscopeRotationVectorSensor.getGyroscopeRotationVectorSensorData(onGetSuccessCB, onerrorCB);
+ console.log("sensor start");
+ gyroscopeRotationVectorSensor.getGyroscopeRotationVectorSensorData(onGetSuccessCB, onerrorCB);
}
gyroscopeRotationVectorSensor.start(onsuccessCB);
function onGetSuccessCB(sensorData)
{
- console.log("######## Get the linear acceleration sensor data ########");
- console.log("x: " + sensorData.x);
- console.log("y: " + sensorData.y);
- console.log("z: " + sensorData.z);
+ console.log("######## Get the linear acceleration sensor data ########");
+ console.log("x: " + sensorData.x);
+ console.log("y: " + sensorData.y);
+ console.log("z: " + sensorData.z);
}
function onerrorCB(error)
{
- console.log("error occurred");
+ console.log("error occurred");
}
function onsuccessCB()
{
- console.log("linear acceleration sensor start");
- linearAccelerationSensor.getLinearAccelerationSensorData(onGetSuccessCB, onerrorCB);
+ console.log("linear acceleration sensor start");
+ linearAccelerationSensor.getLinearAccelerationSensorData(onGetSuccessCB, onerrorCB);
}
linearAccelerationSensor.start(onsuccessCB);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The sound type
</li>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
The volume level to set <br>The level ranges from 0 to 1.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
The sound type
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback method to be invoked when the sound mode is changed
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">callback</span>:
+<span class="name">callback</span>:
Callback method to be invoked when the volume level is changed
</li>
</ul>
for (var i = 0; i < infoArr.length; i++)
{
- console.log(infoArr[i].device);
+ console.log(infoArr[i].device);
}
</pre>
</div>
for (var i = 0; i < infoArr.length; i++)
{
- console.log(infoArr[i].device);
+ console.log(infoArr[i].device);
}
</pre>
</div>
/* Callback */
var onChanged = function(info)
{
- /* Some code to execute when a sound device state is changed */
- if (info.isConnected)
- {
- /* Some code to execute if the device is connected */
- console.log(info.device + " is connected");
- }
- else
- {
- /* Some code to execute if the device is not connected */
- console.log(info.device + " is not connected");
- }
+ /* Some code to execute when a sound device state is changed */
+ if (info.isConnected)
+ {
+ /* Some code to execute if the device is connected */
+ console.log(info.device + " is connected");
+ }
+ else
+ {
+ /* Some code to execute if the device is not connected */
+ console.log(info.device + " is not connected");
+ }
- if (info.isActivated)
- {
- /* Some code to execute if the device is activated */
- console.log(info.device + " is activated");
- }
- else
- {
- /* Some code to execute if the device is not activated */
- console.log(info.device + " is not activated");
- }
+ if (info.isActivated)
+ {
+ /* Some code to execute if the device is activated */
+ console.log(info.device + " is activated");
+ }
+ else
+ {
+ /* Some code to execute if the device is not activated */
+ console.log(info.device + " is not activated");
+ }
}
var id = tizen.sound.addDeviceStateChangeListener(onChanged);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">mode</span>:
+<span class="name">mode</span>:
Sound mode
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Sound type
</li>
<li class="param">
-<span class="name">volume</span>:
+<span class="name">volume</span>:
New volume level
</li>
</ul>
deviceCapabilities = tizen.systeminfo.getCapabilities();
if (deviceCapabilities.bluetooth)
{
- console.log("Bluetooth is supported");
+ console.log("Bluetooth is supported");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
try
{
- /* Checks if a device supports bluetooth API */
- var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
- console.log(" Bluetooth = " + bluetooth);
+ /* Checks if a device supports bluetooth API */
+ var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth");
+ console.log(" Bluetooth = " + bluetooth);
}
catch (error)
{
- console.log("Error name: " + error.name + ", message: " + error.message);
+ console.log("Error name: " + error.name + ", message: " + error.message);
}
</pre>
</div>
var count = tizen.systeminfo.getCount("SIM");
if (count === 0)
{
- console.log("There is no available SIM card.");
+ console.log("There is no available SIM card.");
}
else
{
- console.log("There is(are) " + count + " SIM card(s) available.");
+ console.log("There is(are) " + count + " SIM card(s) available.");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cpu)
{
- console.log("The cpu load is " + cpu.load);
+ console.log("The cpu load is " + cpu.load);
}
function onErrorCallback(error)
{
- console.log("An error occurred " + error.message);
+ console.log("An error occurred " + error.message);
}
tizen.systeminfo.getPropertyValue("CPU", onSuccessCallback, onErrorCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cellular)
{
- console.log("The status of the cellular network is " + cellular.status);
+ console.log("The status of the cellular network is " + cellular.status);
}
function onErrorCallback(error)
{
- console.log("An error occurred " + error.message);
- /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
+ console.log("An error occurred " + error.message);
+ /* If telephony_capability is false but getPropertyValue("CELLULAR_NETWORK, ..) is called, NotSupportedError is passed */
}
var telephony_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.telephony");
if (telephony_capability === true)
{
- /* onSuccessCallback will be invoked */
- tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
+ /* onSuccessCallback will be invoked */
+ tizen.systeminfo.getPropertyValue("CELLULAR_NETWORK", onSuccessCallback, onErrorCallback);
}
else
{
- console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
+ console.log("Telephony feature is not supported. Cellular network related information cannot be retrieved.");
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function successCB(property)
{
- console.log("The SIM's current state is " + property.state);
+ console.log("The SIM's current state is " + property.state);
}
function successArrayCB(properties)
{
- console.log("The number of the returned system properties is " + properties.length);
- for (var i = 0; i < properties.length; i++)
- {
- console.log("[" + i + "] SIM's state is " + properties[i].state);
- }
+ console.log("The number of the returned system properties is " + properties.length);
+ for (var i = 0; i < properties.length; i++)
+ {
+ console.log("[" + i + "] SIM's state is " + properties[i].state);
+ }
}
var count = tizen.systeminfo.getCount("SIM");
if (count === 0)
{
- console.log("This device does not provide SIM card.");
+ console.log("This device does not provide SIM card.");
}
else if (count > 1)
{
- tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
+ tizen.systeminfo.getPropertyValueArray("SIM", successArrayCB);
}
else
{
- tizen.systeminfo.getPropertyValue("SIM", successCB);
+ tizen.systeminfo.getPropertyValue("SIM", successCB);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccessCallback(cpu)
{
- console.log("The cpu load: " + cpu.load);
+ console.log("The cpu load: " + cpu.load);
}
tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback, {lowThreshold: 0.2});
var id = null;
function onSuccessCallback(cpu)
{
- console.log("New value for CPU load is " + cpu.load);
- if (id != null)
- {
- /* After receiving the first notification, clear it */
- tizen.systeminfo.removePropertyValueChangeListener(id);
- }
+ console.log("New value for CPU load is " + cpu.load);
+ if (id != null)
+ {
+ /* After receiving the first notification, clear it */
+ tizen.systeminfo.removePropertyValueChangeListener(id);
+ }
}
id = tizen.systeminfo.addPropertyValueChangeListener("CPU", onSuccessCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
{
- console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
+ console.log("Flash brightness is set to: " + (flash.brightness * 100).toFixed(0) + "%");
}, function(error)
{
- console.log("Error, name: " + error.name + ", message: " + error.message);
+ console.log("Error, name: " + error.name + ", message: " + error.message);
});
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.systeminfo.getPropertyValue("CAMERA_FLASH", function(flash)
{
- try
- {
- flash.setBrightness(1);
- }
- catch (error)
- {
- console.log("Setting flash brightness failed: " + error.message);
- }
+ try
+ {
+ flash.setBrightness(1);
+ }
+ catch (error)
+ {
+ console.log("Setting flash brightness failed: " + error.message);
+ }
}, function(error)
{
- console.log("Error, name: " + error.name + ", message: " + error.message);
+ console.log("Error, name: " + error.name + ", message: " + error.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Setting type to set
</li>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
Location path of a wallpaper or ringtone file
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the setting value is successfully set
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the setting value cannot be set
</li>
</ul>
/* Defines the success callback */
function successCallback()
{
- console.log("Succeeded in changing the property");
+ console.log("Succeeded in changing the property");
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Failed to change the property. Error: " + error.message);
+ console.log("Failed to change the property. Error: " + error.message);
}
if (systemsetting_api_supported === true)
{
- /* tizen.systemsetting will be available */
- if (home_screen_system_setting === true)
- {
- /* Sets the home screen image */
- /* newHomeScreenImagePath variable should hold the path of the image to be set as home screen background */
- tizen.systemsetting.setProperty("HOME_SCREEN", newHomeScreenImagePath, successCallback, errorCallback);
- }
- else
- {
- /* if tizen.systemsetting.setProperty("HOME_SCREEN", ..) is invoked, NotSupportedError is returned through ErrorCallback */
- }
+ /* tizen.systemsetting will be available */
+ if (home_screen_system_setting === true)
+ {
+ /* Sets the home screen image */
+ /* newHomeScreenImagePath variable should hold the path of the image to be set as home screen background */
+ tizen.systemsetting.setProperty("HOME_SCREEN", newHomeScreenImagePath, successCallback, errorCallback);
+ }
+ else
+ {
+ /* if tizen.systemsetting.setProperty("HOME_SCREEN", ..) is invoked, NotSupportedError is returned through ErrorCallback */
+ }
}
else
{
- /* tizen.systemsetting will be 'undefined' */
- console.log("SystemSetting API is not supported on the device.");
+ /* tizen.systemsetting will be 'undefined' */
+ console.log("SystemSetting API is not supported on the device.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">type</span>:
+<span class="name">type</span>:
Type of the property to get
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
Callback function that is called when the setting value is successfully retrieved
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Callback function that is called when the setting value cannot be retrieved
</li>
</ul>
/* Defines the success callback */
function getPropertySuccessCallback(value)
{
- /* Case: tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen") returns 'true' */
- console.log("Succeeded in retrieving the property. The value is " + value);
+ /* Case: tizen.systeminfo.getCapability("http://tizen.org/feature/systemsetting.home_screen") returns 'true' */
+ console.log("Succeeded in retrieving the property. The value is " + value);
}
/* Defines the error callback */
function errorCallback(error)
{
- console.log("Failed to get the property. Error: " + error.message);
- /* If the device does not support to get the image on home screen, NotSupportedError is thrown */
+ console.log("Failed to get the property. Error: " + error.message);
+ /* If the device does not support to get the image on home screen, NotSupportedError is thrown */
}
tizen.systemsetting.getProperty("HOME_SCREEN", getPropertySuccessCallback, errorCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">value</span>:
+<span class="name">value</span>:
The value of the requested property.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">shortformat</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">shortformat</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The flag indicating whether the user is interested in the short
date format (23/10/2011) instead of a long date format ("Monday, October 23 2011") <br>By default, this attribute is set to false.
</li>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
The year to check
</li>
</ul>
var is_leap = tizen.time.isLeapYear(current_dt.getFullYear());
if (is_leap)
{
- console.log("This year is a leap year.");
+ console.log("This year is a leap year.");
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changeCallback</span>:
+<span class="name">changeCallback</span>:
Callback method to be invoked when device time was set <br>It is not invoked when time passes naturally.
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setDateTimeChangeListener(changedCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var current_dt = tizen.time.getCurrentDateTime();
- console.log("current date/time is " + current_dt.toLocaleString());
- tizen.time.unsetDateTimeChangeListener();
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var current_dt = tizen.time.getCurrentDateTime();
+ console.log("current date/time is " + current_dt.toLocaleString());
+ tizen.time.unsetDateTimeChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setDateTimeChangeListener(changedCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">changeCallback</span>:
+<span class="name">changeCallback</span>:
Callback method that is invoked when the time zone has changed
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ /* New time zone can be retrieved through tizen.time.getLocalTimezone() */
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setTimezoneChangeListener(changedCallback);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var changedCallback = function()
{
- try
- {
- var zone = tizen.time.getLocalTimezone();
- console.log("current time zone is " + zone);
- tizen.time.unsetTimezoneChangeListener();
- }
- catch (err)
- {
- console.log(err.name + ": " + err.message);
- }
+ try
+ {
+ var zone = tizen.time.getLocalTimezone();
+ console.log("current time zone is " + zone);
+ tizen.time.unsetTimezoneChangeListener();
+ }
+ catch (err)
+ {
+ console.log(err.name + ": " + err.message);
+ }
};
tizen.time.setTimezoneChangeListener(changedCallback);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
Date to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
Year to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">hours</span>:
+<span class="name">hours</span>:
Hours to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ms</span>:
+<span class="name">ms</span>:
Milliseconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">minutes</span>:
+<span class="name">minutes</span>:
Minutes to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">month</span>:
+<span class="name">month</span>:
Month to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">seconds</span>:
+<span class="name">seconds</span>:
Seconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">date</span>:
+<span class="name">date</span>:
Date to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">year</span>:
+<span class="name">year</span>:
Year to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">hours</span>:
+<span class="name">hours</span>:
Hours to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">ms</span>:
+<span class="name">ms</span>:
Milliseconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">minutes</span>:
+<span class="name">minutes</span>:
Minutes to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">month</span>:
+<span class="name">month</span>:
Month to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">seconds</span>:
+<span class="name">seconds</span>:
Seconds to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">tzid</span>:
+<span class="name">tzid</span>:
Timezone identifier to set
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
The other Date/Time to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">duration</span>:
+<span class="name">duration</span>:
TimeDuration to add
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
/* Computes event1.duration - event2.duration */
var diff = event1.duration.difference(event2.duration);
if (diff.length > 0)
- console.log("The event1 is longer than event2.");
+ console.log("The event1 is longer than event2.");
else if (diff.length == 0)
- console.log("The duration of two events is same.");
+ console.log("The duration of two events is same.");
else
- console.log("The event1 is shorter than the event2.");
+ console.log("The event1 is shorter than the event2.");
</pre>
</div>
</dd>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">other</span>:
+<span class="name">other</span>:
Other TimeDuration object to compare to
</li>
</ul>
the Tizen Web Device API is instantiated (<em>window.tizen</em>).
</p>
<p>
-For more information on the Tizen features, see <a href="https://developer.tizen.org/development/guides/web-application/tizen-features/base/tizen">Tizen Guide</a>.
+For more information on the Tizen features, see <a href="https://developer.tizen.org/development/guides/web-application/tizen-features/base/tizen">Tizen Guide</a>.
</p>
</div>
<p><span class="version">
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The Joshua Tree:' + contents.length);
+ console.log('The Joshua Tree:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, albumFilter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AttributeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AttributeFilter(DOMString attributeName, optional <a href="#FilterMatchFlag">FilterMatchFlag</a>? matchFlag, optional any matchValue);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The contents modified today:' + contents.length);
+ console.log('The contents modified today:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, dateRangeFilter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="AttributeRangeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">AttributeRangeFilter(DOMString attributeName, optional any initialValue, optional any endValue);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:' + contents.length);
+ console.log('The Joshua Tree by U2:' + contents.length);
}
tizen.content.find(findCB, errorCB, null, filter, null, count, offset);
</pre>
</div>
-
+
<div class="constructors">
<h4 id="CompositeFilter::constructor">Constructors</h4>
<dl><pre class="webidl prettyprint">CompositeFilter(<a href="#CompositeFilterType">CompositeFilterType</a> type, optional <a href="#AbstractFilter">AbstractFilter</a>[]? filters);</pre></dl>
function errorCB(err)
{
- console.log('The following error occurred: ' + err.name);
+ console.log('The following error occurred: ' + err.name);
}
function printContent(content, index, contents)
{
- console.log('Track: ' + content.trackNumber + ' Title: ' + content.title + 'Duration: ' + content.duration +
- 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
+ console.log('Track: ' + content.trackNumber + ' Title: ' + content.title + 'Duration: ' + content.duration +
+ 'URL: ' + content.contentURI + 'MIME: ' + content.mimeType);
}
function findCB(contents)
{
- console.log('The Joshua Tree by U2:');
- contents.forEach(printContent);
- /* Increase the offset as much as the count and then find content again */
- if (contents.length == count)
- {
- offset += count;
- tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
- }
+ console.log('The Joshua Tree by U2:');
+ contents.forEach(printContent);
+ /* Increase the offset as much as the count and then find content again */
+ if (contents.length == count)
+ {
+ offset += count;
+ tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
+ }
}
tizen.content.find(findCB, errorCB, null, filter, sortMode, count, offset);
readonly attribute DOMString message;
const unsigned short INDEX_SIZE_ERR = 1;
- const unsigned short DOMSTRING_SIZE_ERR = 2;
+ const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
- const unsigned short NO_DATA_ALLOWED_ERR = 6;
+ const unsigned short NO_DATA_ALLOWED_ERR = 6;
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
- const unsigned short INUSE_ATTRIBUTE_ERR = 10;
+ const unsigned short INUSE_ATTRIBUTE_ERR = 10;
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short SYNTAX_ERR = 12;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short NAMESPACE_ERR = 14;
const unsigned short INVALID_ACCESS_ERR = 15;
- const unsigned short VALIDATION_ERR = 16;
+ const unsigned short VALIDATION_ERR = 16;
const unsigned short TYPE_MISMATCH_ERR = 17;
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onSuccess()
{
- console.log("Application launched successfully");
+ console.log("Application launched successfully");
}
tizen.application.launch('0pnxz8hbsr.MyFiles', onSuccess);
</pre>
/* Define the error callback */
function onerror(error)
{
- console.log(error.message);
+ console.log(error.message);
}
function onsuccess()
{
- console.log("The application has launched successfully");
+ console.log("The application has launched successfully");
}
tizen.application.launch("targetApp0.main", onsuccess, onerror);
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Generic error.
</li>
</ul>
readonly attribute DOMString message;
const unsigned short INDEX_SIZE_ERR = 1;
- const unsigned short DOMSTRING_SIZE_ERR = 2;
+ const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
- const unsigned short NO_DATA_ALLOWED_ERR = 6;
+ const unsigned short NO_DATA_ALLOWED_ERR = 6;
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
- const unsigned short INUSE_ATTRIBUTE_ERR = 10;
+ const unsigned short INUSE_ATTRIBUTE_ERR = 10;
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short SYNTAX_ERR = 12;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short NAMESPACE_ERR = 14;
const unsigned short INVALID_ACCESS_ERR = 15;
- const unsigned short VALIDATION_ERR = 16;
+ const unsigned short VALIDATION_ERR = 16;
const unsigned short TYPE_MISMATCH_ERR = 17;
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">widgetId</span>:
+<span class="name">widgetId</span>:
The ID of the Widget to retrieve
</li>
</ul>
var id = "org.tizen.gallery.widget";
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- console.log("Widget id is " + myWidget.id);
- console.log("Widget details:");
- console.log("Main application id: " + myWidget.applicationId);
- console.log("Package id: " + myWidget.packageId);
- console.log("Is hidden in the list of widgets: " + myWidget.noDisplay);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ console.log("Widget id is " + myWidget.id);
+ console.log("Widget details:");
+ console.log("Main application id: " + myWidget.applicationId);
+ console.log("Package id: " + myWidget.packageId);
+ console.log("Is hidden in the list of widgets: " + myWidget.noDisplay);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A function to call when widgets are retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A function to call when an error occurs
</li>
<li class="param">
-<span class="name">packageId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">packageId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
If this parameter is given, then only widgets belonging to the given package are returned
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
tizen.widgetservice.getWidgets(function(widgets)
{
- console.log("There are " + widgets.length + " available widgets");
+ console.log("There are " + widgets.length + " available widgets");
}, function(error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
});
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">id</span>:
+<span class="name">id</span>:
Package or Application ID
</li>
</ul>
var id = "org.tizen.gallery";
try
{
- var widgetId = tizen.widgetservice.getPrimaryWidgetId(id);
- console.log("Widget id is " + widgetId);
+ var widgetId = tizen.widgetservice.getPrimaryWidgetId(id);
+ console.log("Widget id is " + widgetId);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">sizeType</span>:
+<span class="name">sizeType</span>:
<em>WidgetSizeType</em> used for retrieving corresponding pixel size object.
</li>
</ul>
var sizeType = "4x4";
try
{
- var widgetSize = tizen.widgetservice.getSize(sizeType);
- console.log("Widget size width: " + widgetSize.width + ", height: " + widgetSize.height);
+ var widgetSize = tizen.widgetservice.getSize(sizeType);
+ console.log("Widget size width: " + widgetSize.width + ", height: " + widgetSize.height);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">locale</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">locale</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Locale ("en-us", "ko-kr", ...). If <var>null</var>, then the default system locale is used.
</li>
</ul>
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- var name = myWidget.getName("en-us");
- console.log("Widget name is " + name);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var name = myWidget.getName("en-us");
+ console.log("Widget name is " + name);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A function to call when widgets are retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A function to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
widgetSuccessCb = function(instances)
{
- console.log("Instances array size: " + instances.length);
+ console.log("Instances array size: " + instances.length);
}
widgetErrorCb = function(error)
{
- console.log("Error occurred: " + error.name + ": " + error.message);
+ console.log("Error occurred: " + error.name + ": " + error.message);
}
/* Variable id should contain valid id of the installed widget */
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- myWidget.getInstances(widgetSuccessCb, widgetErrorCb);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ myWidget.getInstances(widgetSuccessCb, widgetErrorCb);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">sizeType</span>:
+<span class="name">sizeType</span>:
<em>WidgetSizeType</em> value that information will be returned about.
</li>
</ul>
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- var variant = myWidget.getVariant("4x4");
- console.log("Variant preview image path is " + variant.previewImagePath);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var variant = myWidget.getVariant("4x4");
+ console.log("Variant preview image path is " + variant.previewImagePath);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A function to call when widgets are retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
A function to call when an error occurs
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
widgetSuccessCb = function(variants)
{
- console.log("Variants array size: " + variants.length);
+ console.log("Variants array size: " + variants.length);
}
widgetErrorCb = function(error)
{
- console.log("Error occurred: " + error.name + ": " + error.message);
+ console.log("Error occurred: " + error.name + ": " + error.message);
}
/* Variable id should contain valid id of the installed widget */
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- myWidget.getVariants(widgetSuccessCb, widgetErrorCb);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ myWidget.getVariants(widgetSuccessCb, widgetErrorCb);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">listener</span>:
+<span class="name">listener</span>:
The callback
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
widgetChangeCb = function(instance, event)
{
- console.log("Instance " + instance.id + " is " + event);
+ console.log("Instance " + instance.id + " is " + event);
}
/* Variable id should contain valid id of the installed widget */
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- var watchId = myWidget.addStateChangeListener(widgetChangeCb);
- console.log("Listener with id " + watchId + " has been added");
+ var myWidget = tizen.widgetservice.getWidget(id);
+ var watchId = myWidget.addStateChangeListener(widgetChangeCb);
+ console.log("Listener with id " + watchId + " has been added");
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">watchId</span>:
+<span class="name">watchId</span>:
The ID of the registered listener
</li>
</ul>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
widgetChangeCb = function(instance, event)
{
- console.log("Instance " + instance.id + " is " + event);
- myWidget.removeStateChangeListener(watchId);
- console.log("Listener with id " + watchId + " has been removed");
+ console.log("Instance " + instance.id + " is " + event);
+ myWidget.removeStateChangeListener(watchId);
+ console.log("Listener with id " + watchId + " has been removed");
}
/* Variable id should contain valid id of the installed widget */
try
{
- var myWidget = tizen.widgetservice.getWidget(id);
- watchId = myWidget.addStateChangeListener(widgetChangeCb);
+ var myWidget = tizen.widgetservice.getWidget(id);
+ watchId = myWidget.addStateChangeListener(widgetChangeCb);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">seconds</span>:
+<span class="name">seconds</span>:
The interval in seconds
</li>
</ul>
try
{
- instance.changeUpdatePeriod(period);
- console.log("Update period has been set to " + period + " seconds");
+ instance.changeUpdatePeriod(period);
+ console.log("Update period has been set to " + period + " seconds");
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
The new content data
</li>
<li class="param">
-<span class="name">updateIfPaused</span>:
+<span class="name">updateIfPaused</span>:
<var>true</var> if you want to update your widget even if the provider is paused
</li>
</ul>
var data =
{
- data1: 'test1',
- data2: 'test2'
+ data1: 'test1',
+ data2: 'test2'
};
try
{
- instance.sendContent(data, true);
- console.log("Data has been successfully sent");
+ instance.sendContent(data, true);
+ console.log("Data has been successfully sent");
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
A function to call when data is retrieved successfully
</li>
<li class="param">
-<span class="name">errorCallback</span>:
+<span class="name">errorCallback</span>:
A function to call when an error occurs
</li>
</ul>
contentSuccessCb = function(data)
{
- console.log("Data has been obtained successfully");
- for (var prop in data)
- {
- console.log(prop + ": " + data[prop]);
- }
+ console.log("Data has been obtained successfully");
+ for (var prop in data)
+ {
+ console.log(prop + ": " + data[prop]);
+ }
}
contentErrorCb = function(error)
{
- console.log("Error occurred: " + error.name + ":" + error.message);
+ console.log("Error occurred: " + error.name + ":" + error.message);
}
try
{
- instance.getContent(contentSuccessCb, contentErrorCb);
+ instance.getContent(contentSuccessCb, contentErrorCb);
}
catch (error)
{
- console.log("Error: " + error.message);
+ console.log("Error: " + error.message);
}
</pre>
</div>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">widgets</span>:
+<span class="name">widgets</span>:
Array of <em>Widget</em> objects.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">instances</span>:
+<span class="name">instances</span>:
Array of <em>WidgetInstance</em> objects.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">instances</span>:
+<span class="name">instances</span>:
Array of <em>WidgetVariants</em> objects.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">data</span>:
+<span class="name">data</span>:
Content of the given widget instance.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">instance</span>:
+<span class="name">instance</span>:
Widget instance id that change is related to.
</li>
<li class="param">
-<span class="name">event</span>:
+<span class="name">event</span>:
Event of widget life cycle.
</li>
</ul>
<pre class="prettyprint">
<!--Page layout-->
<div class="ui-page ui-page-active">
- <header class="ui-header"></header>
- <div class="ui-content"></div>
- <footer class="ui-footer"></footer>
+ <header class="ui-header"></header>
+ <div class="ui-content"></div>
+ <footer class="ui-footer"></footer>
</div>
<!--Page layout with more button in header-->
<div class="ui-page ui-page-active">
- <header class="ui-header ui-has-more">
- <h2 class="ui-title">Call menu</h2>
- <button type="button" class="ui-more ui-icon-overflow">More Options</button>
- </header>
- <div class="ui-content">Content message</div>
- <footer class="ui-footer">
- <button type="button" class="ui-btn">Footer Button</button>
- </footer>
+ <header class="ui-header ui-has-more">
+ <h2 class="ui-title">Call menu</h2>
+ <button type="button" class="ui-more ui-icon-overflow">More Options</button>
+ </header>
+ <div class="ui-content">Content message</div>
+ <footer class="ui-footer">
+ <button type="button" class="ui-btn">Footer Button</button>
+ </footer>
</div>
</pre>
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><!--HTML code-->
<div id="1btnPopup" class="ui-popup">
- <div class="ui-popup-header">Power saving mode</div>
- <div class="ui-popup-content"></div>
- <div class="ui-popup-footer">
- <button id="1btnPopup-cancel" class="ui-btn">Cancel</button>
- </div>
+ <div class="ui-popup-header">Power saving mode</div>
+ <div class="ui-popup-content"></div>
+ <div class="ui-popup-footer">
+ <button id="1btnPopup-cancel" class="ui-btn">Cancel</button>
+ </div>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<script>
- /* Popup opens with button click */
- button.addEventListener("click", function(ev)
- {
- tau.openPopup("#1btnPopup");
- });
+ /* Popup opens with button click */
+ button.addEventListener("click", function(ev)
+ {
+ tau.openPopup("#1btnPopup");
+ });
- /* Popup closes with Cancel button click */
- document.getElementById('1btnPopup-cancel').addEventListener('click', function(ev)
- {
- tau.closePopup();
- });
+ /* Popup closes with Cancel button click */
+ document.getElementById('1btnPopup-cancel').addEventListener('click', function(ev)
+ {
+ tau.closePopup();
+ });
</script>
</pre></pre>
<h2 id="popup-events">Popup Events</h2>
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px"><!--Popup html code-->
<div id="popup" class="ui-popup">
- <div class="ui-popup-header"></div>
- <div class="ui-popup-content"></div>
+ <div class="ui-popup-header"></div>
+ <div class="ui-popup-content"></div>
</div>
</pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<script>
- /* Use popup events */
- var popup = document.getElementById("popup");
- popup.addEventListener("popupbeforecreate", function(ev)
- {
- /* Implement code for popupbeforecreate event */
- });
+ /* Use popup events */
+ var popup = document.getElementById("popup");
+ popup.addEventListener("popupbeforecreate", function(ev)
+ {
+ /* Implement code for popupbeforecreate event */
+ });
</script>
</pre></pre>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
- <head>
+ <head>
<script type="text/javascript" src="../snippet.js"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
- <title>Drag Event</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ <title>Drag Event</title>
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Drag Event</h1>
<p>Drag event is a set of events that are triggered when the user drags on a gesture-enabled element. The following table defines the triggered events.
<pre class="prettyprint">
<div class="ui-page ui-page-active" id="pageDrag">
- <header class="ui-header">
- <h2 class="ui-title">Drag Event</h2>
- </header>
- <div id="content" class="ui-content content-padding"></div>
+ <header class="ui-header">
+ <h2 class="ui-title">Drag Event</h2>
+ </header>
+ <div id="content" class="ui-content content-padding"></div>
</div>
</pre>
<pre class="prettyprint">
(function()
{
- var page = document.getElementById("pageDrag");
- page.addEventListener("pagebeforeshow", function()
- {
- var content = document.getElementById("content");
- tau.event.enableGesture(content, new tau.event.gesture.Drag(
- {
- blockVertical: true
- }));
-
- content.addEventListener("dragstart", function(e)
- {
- console.log("drag start");
- });
-
- content.addEventListener("drag", function(e)
- {
- console.log("direction = " + e.detail.direction);
- });
-
- content.addEventListener("dragend", function(e)
- {
- console.log("drag end");
- });
- });
+ var page = document.getElementById("pageDrag");
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var content = document.getElementById("content");
+ tau.event.enableGesture(content, new tau.event.gesture.Drag(
+ {
+ blockVertical: true
+ }));
+
+ content.addEventListener("dragstart", function(e)
+ {
+ console.log("drag start");
+ });
+
+ content.addEventListener("drag", function(e)
+ {
+ console.log("direction = " + e.detail.direction);
+ });
+
+ content.addEventListener("dragend", function(e)
+ {
+ console.log("drag end");
+ });
+ });
}());
</pre>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
- <head>
+ <head>
<script type="text/javascript" src="../snippet.js"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
- <title>Gesture Events</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ <title>Gesture Events</title>
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Gesture Events</h1>
<p>The Tizen Advanced UI (TAU) framework provides gesture events optimized for the Tizen Web application.<p>
<tr>
<td><a href="swipe.htm">Swipe</a></td>
<td>Triggered when the user swipes on a gesture-enabled element.</td>
- </tr>
+ </tr>
</tbody>
</table>
-<table class="note">
- <tbody>
- <tr>
- <th class="note">Note</th>
- </tr>
- <tr>
- <td class="note"><p>The drag and swipe gestures differ in their speed. A swipe is quick drag, which animates, for example, a block translation. A drag, on the other hand, connects elements with a finger position, and waits for the end event to do something during or at the end of dragging.
-</p></td>
- </tr>
- </tbody>
+<table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note"><p>The drag and swipe gestures differ in their speed. A swipe is quick drag, which animates, for example, a block translation. A drag, on the other hand, connects elements with a finger position, and waits for the end event to do something during or at the end of dragging.
+</p></td>
+ </tr>
+ </tbody>
</table>
<h2><a id='method'></a>Methods</h2><p>
tau.event.enableGesture(element, new tau.event.gesture.Drag(), new tau.event.gesture.Swipe());
element.addEventListener("drag", function(e)
{
- console.log("drag event fired");
+ console.log("drag event fired");
});
element.addEventListener("swipe", function(e)
{
- console.log("swipe event fired");
+ console.log("swipe event fired");
});
</pre>
<tr>
<td><span style="font-family: Courier New,Courier,monospace">startEvent</span></td>
<td>Same properties as above, but calculated from the first touch. The value is used to calculate, for example, distances, deltaTime, and scaling.</td>
- </tr>
+ </tr>
</tbody>
</table>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
- <head>
+ <head>
<script type="text/javascript" src="../snippet.js"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
- <title>Swipe Event</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ <title>Swipe Event</title>
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Swipe Event</h1>
<p>Swipe event is triggered when the user swipes on a gesture-enabled element. The following table defines the triggered event.
<tr>
<td><span style="font-family: Courier New,Courier,monospace">orientation</span></td>
<td>String</td>
- <td>Swipe orientation.
+ <td>Swipe orientation.
<p>The possible values are <span style="font-family: Courier New,Courier,monospace">vertical</span> and <span style="font-family: Courier New,Courier,monospace">horizontal</span>.</p></td>
</tr>
<tr>
<pre class="prettyprint">
<div class="ui-page ui-page-active" id="pageSwipe">
- <header class="ui-header">
- <h2 class="ui-title">Swipe Event</h2>
- </header>
- <div id="content" class="ui-content content-padding"></div>
+ <header class="ui-header">
+ <h2 class="ui-title">Swipe Event</h2>
+ </header>
+ <div id="content" class="ui-content content-padding"></div>
</div>
</pre>
<pre class="prettyprint">
(function()
{
- var page = document.getElementById("pageSwipe");
- page.addEventListener("pagebeforeshow", function()
- {
- var content = document.getElementById("content");
- tau.event.enableGesture(content, new tau.event.gesture.Swipe(
- {
- orientation: "horizontal"
- }));
-
- content.addEventListener("swipe", function(e)
- {
- console.log("swipe direction = " + e.detail.direction);
- });
- });
+ var page = document.getElementById("pageSwipe");
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var content = document.getElementById("content");
+ tau.event.enableGesture(content, new tau.event.gesture.Swipe(
+ {
+ orientation: "horizontal"
+ }));
+
+ content.addEventListener("swipe", function(e)
+ {
+ console.log("swipe direction = " + e.detail.direction);
+ });
+ });
}());
</pre>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<p>To add an autodividers component to the application, use the following code:</p>
<pre class="prettyprint"><ul data-role="listview" data-autodividers="true">
- <li><a href="#">Amy</a></li>
- <li><a href="#">Arabella</a></li>
- <li><a href="#">Barry</a></li>
+ <li><a href="#">Amy</a></li>
+ <li><a href="#">Arabella</a></li>
+ <li><a href="#">Barry</a></li>
</ul>
</pre>
</td>
<td><p>Disables the component.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the component.</p></td>
</tr>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-getCheckedElement">getCheckedElement</a>() </pre>
</td>
<td><p>Returns a checked checkbox radio element.</p></td>
- </tr>
-
+ </tr>
+
</tbody>
</table>
<dl>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-disable">disable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">disable() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
<label for="checkbox-1">Normal</label>
<script>
- var element = document.getElementById("checkbox-1"),
- checkboxWidget = tau.widget.Checkboxradio(element);
- checkboxWidget.disable();
+ var element = document.getElementById("checkbox-1"),
+ checkboxWidget = tau.widget.Checkboxradio(element);
+ checkboxWidget.disable();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-enable">enable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">enable() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
<label for="checkbox-1">Normal</label>
<script>
- var element = document.getElementById("checkbox-1"),
- checkboxWidget = tau.widget.Checkboxradio(element);
- checkboxWidget.enable();
+ var element = document.getElementById("checkbox-1"),
+ checkboxWidget = tau.widget.Checkboxradio(element);
+ checkboxWidget.enable();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-getCheckedElement">getCheckedElement</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">HTMLElement getCheckedElement() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
<label for="checkbox-1">Normal</label>
<script>
- var element = document.getElementById("checkbox-1"),
- checkboxWidget = tau.widget.Checkboxradio(element);
- checkboxWidget.getCheckedElement();
- /* Returns checked checkbox element */
+ var element = document.getElementById("checkbox-1"),
+ checkboxWidget = tau.widget.Checkboxradio(element);
+ checkboxWidget.getCheckedElement();
+ /* Returns checked checkbox element */
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
<p>To manually create a collapsible component, use the component constructor from the <code>tau</code> namespace:</p>
<pre class="prettyprint"><script>
- var collapsibleElement = document.getElementById("collapsible"),
- collapsible = tau.widget.Collapsible(collapsibleElement);
+ var collapsibleElement = document.getElementById("collapsible"),
+ collapsible = tau.widget.Collapsible(collapsibleElement);
</script>
</pre>
<p>If the jQuery library is loaded, you can use its method:</p>
<pre class="prettyprint"><script>
- var collapsible = $("#collapsible").collapsible();
+ var collapsible = $("#collapsible").collapsible();
</script>
</pre>
<p>To create a collapsible <code>div</code> element using the <code>data-role</code> attribute:</p>
<pre class="prettyprint"><div id="collapsible" data-role="collapsible" data-inset="false">
- <h1>Collapsible head</h1>
- <div>Content</div>
+ <h1>Collapsible head</h1>
+ <div>Content</div>
</div>
</pre></li>
<li>
<p>To create a collapsible list using the <code>data-role</code> attribute:</p>
<pre class="prettyprint">
<ul data-role="listview">
- <li data-role="collapsible" data-inset="false">
- <h2>Collapsible head</h2>
- <!--Sub list in collapsible li-->
- <ul data-role="listview">
- <li>sub list item1</li>
- <li>sub list item2</li>
- </ul>
- </li>
- <!--List item in 1st depth-->
- <li>other list item</li>
- <li>other list item</li>
+ <li data-role="collapsible" data-inset="false">
+ <h2>Collapsible head</h2>
+ <!--Sub list in collapsible li-->
+ <ul data-role="listview">
+ <li>sub list item1</li>
+ <li>sub list item2</li>
+ </ul>
+ </li>
+ <!--List item in 1st depth-->
+ <li>other list item</li>
+ <li>other list item</li>
</ul>
</pre></li></ul>
<p>TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint">var collapsibleElement = document.getElementById("collapsible"),
- collapsible = tau.widget.Collapsible(collapsibleElement);
+ collapsible = tau.widget.Collapsible(collapsibleElement);
collapsible.methodName(methodArgument1, methodArgument2, ...);
</pre>
<pre name="code" class="examplecode
prettyprint">
<div id="collapsible" data-role="collapsible" data-inset="false">
- <h6>Collapsible head</h6>
- <div>Content</div>
+ <h6>Collapsible head</h6>
+ <div>Content</div>
</div>
<script>
- var collapsibleWidget = tau.widget.Collapsible(document.getElementById("collapsible"));
- collapsibleWidget.disable();
+ var collapsibleWidget = tau.widget.Collapsible(document.getElementById("collapsible"));
+ collapsibleWidget.disable();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<div id="collapsible" data-role="collapsible" data-inset="false">
- <h6>Collapsible head</h6>
- <div>Content</div>
+ <h6>Collapsible head</h6>
+ <div>Content</div>
</div>
<script>
- $("#collapsible").collapsible("disable");
+ $("#collapsible").collapsible("disable");
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<div id="collapsible" data-role="collapsible" data-inset="false">
- <h6>Collapsible head</h6>
- <div>Content</div>
+ <h6>Collapsible head</h6>
+ <div>Content</div>
</div>
<script>
- var collapsibleWidget = tau.widget.Collapsible(document.getElementById("collapsible"));
- collapsibleWidget.enable();
+ var collapsibleWidget = tau.widget.Collapsible(document.getElementById("collapsible"));
+ collapsibleWidget.enable();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<div id="collapsible" data-role="collapsible" data-inset="false">
- <h6>Collapsible head</h6>
- <div>Content</div>
+ <h6>Collapsible head</h6>
+ <div>Content</div>
</div>
<script>
- $("#collapsible").collapsible("enable");
+ $("#collapsible").collapsible("enable");
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<div id="collapsible" data-role="collapsible" data-inset="false">
- <h6>Collapsible head</h6>
- <div>Content</div>
+ <h6>Collapsible head</h6>
+ <div>Content</div>
</div>
<script>
- var collapsibleWidget = tau.widget.Collapsible(document.getElementById("collapsible"));
- collapsibleWidget.refresh();
+ var collapsibleWidget = tau.widget.Collapsible(document.getElementById("collapsible"));
+ collapsibleWidget.refresh();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<div id="collapsible" data-role="collapsible" data-inset="false">
- <h6>Collapsible head</h6>
- <div>Content</div>
+ <h6>Collapsible head</h6>
+ <div>Content</div>
</div>
<script>
- $("#collapsible").collapsible("refresh");
+ $("#collapsible").collapsible("refresh");
</script>
</pre>
</div>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.7005437843035907">Default Selectors</a></li>
-
+
<li><a href="#html-examples0.07567197550088167">HTML Examples</a></li>
-
+
<li><a href="#options-list">Options</a></li>
</ol>
<p>To create a control group, use the following code:</p>
<pre class="prettyprint"><div data-role="controlgroup">
- <a href="#" data-role="button">Yes</a>
- <a href="#" data-role="button">No</a>
- <a href="#" data-role="button">Cancel</a>
+ <a href="#" data-role="button">Yes</a>
+ <a href="#" data-role="button">No</a>
+ <a href="#" data-role="button">Cancel</a>
</div>
</pre>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-type</span></td>
<td class="option">"vertical" | "horizontal"</td>
<td class="option">"vertical"</td>
<td class="option">Direction of the control group.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-excludeInvisible</span></td>
<td class="option"> true | false</td>
<td class="option">false</td>
<td class="option">Flag specifying exclusion of invisible elements.</td>
</tr>
-
+
</tbody>
</table>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#html-examples0.07567197550088167">HTML Examples</a></li>
-
+
</ol>
<pre class="prettyprint">
<div data-role="content">
- <ul data-role="listview">
- <li><div data-role="fieldcontain">
- <label for="month">Month:</label>
- <input type="month" name="month" id="month" value="" />
- </div></li>
- <li><div data-role="fieldcontain">
- <label for="week">Week:</label>
- <input type="week" name="week" id="week" value="" />
- </div></li>
- <li><div data-role="fieldcontain">
- <label for="date">Date:</label>
- <input type="date" name="date" id="date" value="" />
- </div></li>
- <li><div data-role="fieldcontain">
- <label for="time">Time:</label>
- <input type="time" name="time" id="time" value="" />
- </div></li>
- <li><div data-role="fieldcontain">
- <label for="datetime-l">Datetime local:</label>
- <input type="datetime-local" name="datetime-l" id="datetime-l" value="" />
- </div></li>
- </ul>
+ <ul data-role="listview">
+ <li><div data-role="fieldcontain">
+ <label for="month">Month:</label>
+ <input type="month" name="month" id="month" value="" />
+ </div></li>
+ <li><div data-role="fieldcontain">
+ <label for="week">Week:</label>
+ <input type="week" name="week" id="week" value="" />
+ </div></li>
+ <li><div data-role="fieldcontain">
+ <label for="date">Date:</label>
+ <input type="date" name="date" id="date" value="" />
+ </div></li>
+ <li><div data-role="fieldcontain">
+ <label for="time">Time:</label>
+ <input type="time" name="time" id="time" value="" />
+ </div></li>
+ <li><div data-role="fieldcontain">
+ <label for="datetime-l">Datetime local:</label>
+ <input type="datetime-local" name="datetime-l" id="datetime-l" value="" />
+ </div></li>
+ </ul>
</div>
</pre>
<p>To manually create a fast scroll component, use the component constructor from the <code>tau</code> namespace (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><div data-role="page" id="main">
- <div data-role="content">
- <ul id="list" data-role="listview" data-fastscroll="true">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul id="list" data-role="listview" data-fastscroll="true">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- var fastscroll = tau.widget.FastScroll(document.getElementById("list"));
+ var fastscroll = tau.widget.FastScroll(document.getElementById("list"));
</script>
</pre>
<p>If the jQuery library is loaded, you can use its method (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><div data-role="page" id="main">
- <div data-role="content">
- <ul id="list" data-role="listview" data-fastscroll="true">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul id="list" data-role="listview" data-fastscroll="true">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- var fastscroll = $("#list").fastscroll();
+ var fastscroll = $("#list").fastscroll();
</script>
</pre>
<th>Default value</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-fastscroll</span></td>
<td class="option">boolean</td>
<td class="option">false</td>
<td class="option">Sets whether the component is enabled.</td>
</tr>
-
+
</tbody>
</table>
<td class="option"><span style="font-family: Courier New,Courier,monospace">destroyed</span></td>
<td><p>Triggered after the <code>destroy()</code> method is called.</p></td>
</tr>
-
+
</tbody>
</table>
<p>To call a method on the component, use the TAU API:</p>
<pre class="prettyprint"><div data-role="page" id="main">
- <div data-role="content">
- <ul id="contacts" data-role="listview" data-fastscroll="true">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul id="contacts" data-role="listview" data-fastscroll="true">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- var element = document.getElementById("contacts"),
- contacts = tau.widget.FastScroll(element, {fastscroll: true});
- contacts.methodName(methodArgument1, methodArgument2, ...);
+ var element = document.getElementById("contacts"),
+ contacts = tau.widget.FastScroll(element, {fastscroll: true});
+ contacts.methodName(methodArgument1, methodArgument2, ...);
</script>
</pre>
</td>
<td><p>Destroys the component.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">string <a href="#method-indexString">indexString</a>(string? indexAlphabet) </pre>
<td><p>Gets or sets an index string.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-refresh">refresh</a>() </pre>
<p><span class="version">Since: </span>
2.0
</p>
-
+
<div class="description">
<p>
<p>This method destroys the current fast scroll component.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="page" id="main">
- <div data-role="content">
- <ul id="list" data-role="listview" data-fastscroll="true">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul id="list" data-role="listview" data-fastscroll="true">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- var element = document.getElementById("list"),
- fastscroll = tau.widget.FastScroll(element);
- fastscroll.destroy();
+ var element = document.getElementById("list"),
+ fastscroll = tau.widget.FastScroll(element);
+ fastscroll.destroy();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="page" id="main">
- <div data-role="content">
- <ul data-role="listview" data-fastscroll="true" id="fastscroll">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul data-role="listview" data-fastscroll="true" id="fastscroll">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- $("#list").fastscroll("destroy");
+ $("#list").fastscroll("destroy");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-indexString">indexString</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">?string indexString(string? indexAlphabet) </pre>
</div>
-
+
<p><span class="version">Since: </span>
2.1
</p>
-
+
<div class="description">
<p>
<p>This method manages the values to be used in the shortcut items.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">indexAlphabet</span></td>
<td>string</td>
<td></td>
<td>Values to be used in the shortcut items.</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="page" id="main">
- <div data-role="content">
- <ul id="fastscroll" data-role="listview" data-fastscroll="true">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul id="fastscroll" data-role="listview" data-fastscroll="true">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- /* Get index string */
- var element = document.getElementById("fastscroll"),
- fastscroll = tau.widget.FastScroll(element, {fastscroll: true});
- fastscroll.indexString();
+ /* Get index string */
+ var element = document.getElementById("fastscroll"),
+ fastscroll = tau.widget.FastScroll(element, {fastscroll: true});
+ fastscroll.indexString();
- /* Set index string */
- fastscroll.indexString("A,D,J,P,W,Z");
+ /* Set index string */
+ fastscroll.indexString("A,D,J,P,W,Z");
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="page" id="main">
- <div data-role="content">
- <ul data-role="listview" data-fastscroll="true" id="fastscroll">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul data-role="listview" data-fastscroll="true" id="fastscroll">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- $("#fastscroll").fastscroll("indexString", "A,D,J,P,W,Z");
+ $("#fastscroll").fastscroll("indexString", "A,D,J,P,W,Z");
</script>
</pre>
</div>
<div class="synopsis">
<pre class="signature prettyprint">refresh() </pre>
</div>
-
+
<p><span class="version">Since: </span>
2.0
</p>
-
+
<div class="description">
<p>
<p>The method updates and redraws the current fast scroll component.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="page" id="main">
- <div data-role="content">
- <ul id="list" data-role="listview" data-fastscroll="true">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul id="list" data-role="listview" data-fastscroll="true">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- var element = document.getElementById("list"),
- fastscroll = tau.widget.FastScroll(element);
+ var element = document.getElementById("list"),
+ fastscroll = tau.widget.FastScroll(element);
- element.insertAdjacentHTML("beforeend", "<li>Bruce</li>");
- fastscroll.refresh();
+ element.insertAdjacentHTML("beforeend", "<li>Bruce</li>");
+ fastscroll.refresh();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="page" id="main">
- <div data-role="content">
- <ul data-role="listview" data-fastscroll="true" id="fastscroll">
- <li data-role="list-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li data-role="list-divider">B</li>
- <li>Barry</li>
- <li>Bily</li>
- </ul>
- </div>
+ <div data-role="content">
+ <ul data-role="listview" data-fastscroll="true" id="fastscroll">
+ <li data-role="list-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li data-role="list-divider">B</li>
+ <li>Barry</li>
+ <li>Bily</li>
+ </ul>
+ </div>
</div>
<script>
- $("#fastscroll").append("<li>Bruno</li>");
- $("#fastscroll").fastscroll("refresh");
+ $("#fastscroll").append("<li>Bruno</li>");
+ $("#fastscroll").fastscroll("refresh");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
</dl>
<ol class="toc">
<li><a href="#default">Default Selectors</a></li>
-
+
<li><a href="#html">HTML Examples</a></li>
<li><a href="#options">Options</a></li>
-
+
<li><a href="#methods">Methods</a></li>
-
+
</ol>
<pre class="prettyprint">
<div data-role="content" data-scroll="none">
- <div data-role="gallery" id="gallery" data-vertical-align="middle">
- </div>
+ <div data-role="gallery" id="gallery" data-vertical-align="middle">
+ </div>
</div> <!--Content-->
<div data-role="footer" data-position ="fixed">
- <div data-role="controlgroup" data-type="horizontal">
- <a href="#" data-role="button" id="gallery-add">ADD</a>
- <a href="#" data-role="button" id="gallery-del">DELETE</a>
- </div> <!--Navbar-->
+ <div data-role="controlgroup" data-type="horizontal">
+ <a href="#" data-role="button" id="gallery-add">ADD</a>
+ <a href="#" data-role="button" id="gallery-del">DELETE</a>
+ </div> <!--Navbar-->
</div>
</pre>
<td class="option">500</td>
<td class="option">The duration each gallery image is shown.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-flicking</span></td>
<td class="option">boolean</td>
<td class="option">false</td>
<td class="option">Sets whether flicking is enabled.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-index</span></td>
<td class="option">number</td>
<td class="option">0</td>
<td class="option">Index of the gallery image to be shown.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-vertical-align</span></td>
<td class="option">"top" | "middle" | "bottom"</td>
<td class="option">"top"</td>
<td class="option"><p>Object with default options.</p></td>
</tr>
-
+
</tbody>
</table>
<h2><a id="methods"></a>Methods</h2>
<th>Description</th>
</tr>
</thead>
- <tbody>
+ <tbody>
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-add">add</a>(string file) </pre>
</td>
<td><p>Adds an image to the gallery.</p></td>
</tr>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-empty">empty</a>() </pre>
</td>
<td><p>Removes all images from the gallery.</p></td>
</tr>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-hide">hide</a>() </pre>
</td>
<td><p>Deletes a specific image from the gallery.<br />If no parameter is defined, the current image is deleted.</p></td>
</tr>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-show">show</a>() </pre>
</td>
<td><p>Gets or sets the current index of the gallery.</p></td>
</tr>
-
+
</tbody>
</table>
<dl>
<div class="synopsis">
<pre class="signature prettyprint">add(string file) </pre>
</div>
-
+
<div class="description">
<p>
<p>The file URL of the image must be passed as a parameter.</p>
<p>The <code>refresh</code> method must be called after adding. Otherwise, the file is only added, but not displayed.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">file</span></td>
<td>string</td>
<td></td>
<td>Image file URL.</td>
</tr>
-
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
galleryWidget.add("./images/01.jpg"); /* Image with attribute src="./images/01.jpg" is added */
galleryWidget.refresh();
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
$("#gallery").gallery("refresh"); /* To see changes, "refresh" method must be called */
</pre>
</div>
-
+
</dd>
-
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-empty">empty</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">empty() </pre>
</div>
-
+
<div class="description">
<p>
</p>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
galleryWidget.empty(); /* All images are deleted */
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
$("#gallery").gallery("empty");
</pre>
</div>
-
+
</dd>
<dt class="method" id="addidp28072"><code><b><span class="methodName"
<div class="synopsis">
<pre class="signature prettyprint">hide() </pre>
</div>
-
+
<div class="description">
<p>
- <p>The method makes all images invisible and unbinds all touch events.</p>
+ <p>The method makes all images invisible and unbinds all touch events.</p>
</p>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
galleryWidget.hide(); /* Gallery is hidden */
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
$("#gallery").gallery("hide");
</pre>
</div>
-
+
</dd>
<dt class="method" id="addidp28072"><code><b><span class="methodName"
<div class="synopsis">
<pre class="signature prettyprint">number length() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery")),
- imagesItems;
+ imagesItems;
imagesLength = galleryWidget.length(); /* Number of images */
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
imagesLength = $("#gallery").gallery("length");
</pre>
</div>
-
+
</dd>
<dt class="method" id="addidp28072"><code><b><span class="methodName"
<div class="synopsis">
<pre class="signature prettyprint">?number refresh(number? startIndex) </pre>
</div>
-
+
<div class="description">
<p>
<p>The method must be called after adding images to the gallery. It is called automatically after changing any component options and calling the <code>value</code> method with a non-empty parameter.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">startIndex</span></td>
<td>number</td>
<td></td>
<td>Index of the first image.</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
galleryWidget.option("flicking", true);
galleryWidget.value(0);
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
galleryWidget.value(0);
</pre>
</div>
-
+
</dd>
-
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-remove">remove</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">remove(number? index) </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">index</span></td>
<td>number</td>
<td></td>
<td>Index of the image to be deleted.</td>
</tr>
-
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
galleryWidget.remove(0); /* First image is removed */
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
$("#gallery").gallery("remove", 0);
</pre>
</div>
-
+
</dd>
<dt class="method" id="addidp28072"><code><b><span class="methodName"
<div class="synopsis">
<pre class="signature prettyprint">show() </pre>
</div>
-
+
<div class="description">
<p>
- <p>The method is called on <code>pageshow</code> event and during refreshing.</p>
+ <p>The method is called on <code>pageshow</code> event and during refreshing.</p>
</p>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
galleryWidget.show();
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
$("#gallery").gallery("show");
</pre>
</div>
-
+
</dd>
<dt class="method" id="addidp28072"><code><b><span class="methodName"
<div class="synopsis">
<pre class="signature prettyprint">?number value(number index) </pre>
</div>
-
+
<div class="description">
<p>
<p>If the parameter is not defined, the current index is returned. Otherwise, the index of the image is set and the proper image is displayed.</p>
-<p>The image index is counted from 0. If a new index is less than 0 or greater than or equal to the length of the images, the index is not changed.</p>
+<p>The image index is counted from 0. If a new index is less than 0 or greater than or equal to the length of the images, the index is not changed.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">index</span></td>
<td>number</td>
<td></td>
<td>Index of the image to be displayed</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
var galleryWidget = tau.widget.Gallery(document.getElementById("gallery")),
- value = galleryWidget.value(); /* Value contains the index of the current image */
+ value = galleryWidget.value(); /* Value contains the index of the current image */
galleryWidget.value(0); /* First image is displayed */
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
$("#gallery").gallery("value", 0); /* First image is displayed */
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
<div id="footer">
<li><a href="#manual-constructor0.4427847310435027">Manual Constructor</a></li>
- <li><a href="#examples">HTML Examples</a></li>
+ <li><a href="#examples">HTML Examples</a></li>
- <li><a href="#options0.6772414387669414">Options</a></li>
+ <li><a href="#options0.6772414387669414">Options</a></li>
</ol>
<p>By default, all elements with the <code>data-role="listdivider"</code> or <code>class="ui-listdivider"</code> attribute are displayed as list dividers.</p>
<pre class="prettyprint"><ul data-role="listview">
- <li data-role="list-divider">Item styles</li>
- <li><a href="#">Normal lists</a></li>
- <li><a href="#">Normal lists</a></li>
- <li><a href="#">Normal lists</a></li>
+ <li data-role="list-divider">Item styles</li>
+ <li><a href="#">Normal lists</a></li>
+ <li><a href="#">Normal lists</a></li>
+ <li><a href="#">Normal lists</a></li>
</ul>
</pre>
<p>To manually create a list divider component, use the component constructor from the <code>tau</code> namespace:</p>
<pre class="prettyprint"><ul data-role="listview">
- <li>Item</li>
- <li id="listdivider">Divider</li>
- <li>Item</li>
- <li>Item</li>
+ <li>Item</li>
+ <li id="listdivider">Divider</li>
+ <li>Item</li>
+ <li>Item</li>
</ul>
<script>
- var listdivider = tau.widget.ListDivider(document.getElementById("listdivider"));
+ var listdivider = tau.widget.ListDivider(document.getElementById("listdivider"));
</script>
</pre>
<p>If the jQuery library is loaded, you can use its method:</p>
<pre class="prettyprint"><ul data-role="listview">
- <li>Item</li>
- <li id="listdivider">Divider</li>
- <li>Item</li>
- <li>Item</li>
+ <li>Item</li>
+ <li id="listdivider">Divider</li>
+ <li>Item</li>
+ <li>Item</li>
</ul>
<script>
- $("#listdivider").listdivider();
+ $("#listdivider").listdivider();
</script>
</pre>
<p>To create a list divider that shows the divider press effect (<code>data-folded="true"</code>) and no divider line (<code>data-line="false"</code>):</p>
<pre class="prettyprint"><ul data-role="listview">
- <li data-role="list-divider" data-folded="true" data-line="false">Item styles</li>
- <li>Item</li>
- <li>Item</li>
- <li>Item</li>
+ <li data-role="list-divider" data-folded="true" data-line="false">Item styles</li>
+ <li>Item</li>
+ <li>Item</li>
+ <li>Item</li>
</ul>
</pre>
<p>To create a list divider that uses the checkbox style:</p>
<pre class="prettyprint"><ul data-role="listview">
- <li data-role="list-divider" data-style="check" class="ui-li-checkbox">
- <a href="#"><input type="checkbox" name="check">Select All</a>
- </li>
- <li><a href="#"><input type="checkbox" name="select-check2">Item</a></li>
- <li><a href="#"><input type="checkbox" name="select-check1">Item</a></li>
- <li><a href="#"><input type="checkbox" name="select-check3">Item</a></li>
+ <li data-role="list-divider" data-style="check" class="ui-li-checkbox">
+ <a href="#"><input type="checkbox" name="check">Select All</a>
+ </li>
+ <li><a href="#"><input type="checkbox" name="select-check2">Item</a></li>
+ <li><a href="#"><input type="checkbox" name="select-check1">Item</a></li>
+ <li><a href="#"><input type="checkbox" name="select-check3">Item</a></li>
</ul>
<script>
- var selectAll = tau.widget.Checkboxradio(document.getElementsByName("check")[0]),
- check = [];
-
- check[0] = tau.widget.Checkboxradio(document.getElementsByName("select-check1")[0]);
- check[1] = tau.widget.Checkboxradio(document.getElementsByName("select-check2")[0]);
- check[2] = tau.widget.Checkboxradio(document.getElementsByName("select-check3")[0]);
-
- function checkAllCheckbox()
- {
- var val = selectAll.value() === null ? false : true;
- for (var i in check)
- {
- if (check.hasOwnProperty(i))
- {
- check[i].element.checked = val;
- check[i].refresh();
- }
- }
- }
- selectAll.on("change", checkAllCheckbox);
+ var selectAll = tau.widget.Checkboxradio(document.getElementsByName("check")[0]),
+ check = [];
+
+ check[0] = tau.widget.Checkboxradio(document.getElementsByName("select-check1")[0]);
+ check[1] = tau.widget.Checkboxradio(document.getElementsByName("select-check2")[0]);
+ check[2] = tau.widget.Checkboxradio(document.getElementsByName("select-check3")[0]);
+
+ function checkAllCheckbox()
+ {
+ var val = selectAll.value() === null ? false : true;
+ for (var i in check)
+ {
+ if (check.hasOwnProperty(i))
+ {
+ check[i].element.checked = val;
+ check[i].refresh();
+ }
+ }
+ }
+ selectAll.on("change", checkAllCheckbox);
</script>
</pre>
<p>To create a list divider that uses the dialogue style:</p>
<pre class="prettyprint"><ul data-role="listview">
- <li data-role="list-divider" data-style="dialogue">Items</li>
- <li class="ui-li-dialogue">Item</li>
- <li class="ui-li-dialogue">Item</li>
- <li class="ui-li-dialogue">Item</li>
+ <li data-role="list-divider" data-style="dialogue">Items</li>
+ <li class="ui-li-dialogue">Item</li>
+ <li class="ui-li-dialogue">Item</li>
+ <li class="ui-li-dialogue">Item</li>
</ul>
</pre>
<th>Default value</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-folded</span></td>
<td class="option">false</td>
<td class="option">Sets whether to show the divider press effect.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-line</span></td>
<td class="option">boolean</td>
<td class="option">true</td>
<td class="option">Sets whether to show the divider line.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-style</span></td>
<td class="option">"normal" | "checkbox" | "dialogue"</td>
<td class="option">Style of the list divider.</td>
</tr>
-
+
</tbody>
</table>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#html-examples">HTML Examples</a></li>
-
+
</ol>
<pre class="prettyprint">
<div data-role="content">
- <video data-controls="true" style="width:100%;" controls>
- <source src="Color_short_version.mp4" type="video/mp4"/>
- <p>Your browser does not support the video tag.</p>
- </video>
+ <video data-controls="true" style="width:100%;" controls>
+ <source src="Color_short_version.mp4" type="video/mp4"/>
+ <p>Your browser does not support the video tag.</p>
+ </video>
</div>
</pre></li>
<li>To create an audio view:
<pre class="prettyprint">
<div data-role="content">
- <audio data-controls="true" style="width:100%;" controls>
- <source src="Color_short_version.mp3" type="audio/mpeg"/>
- <p>Your browser does not support the audio tag.</p>
- </audio>
+ <audio data-controls="true" style="width:100%;" controls>
+ <source src="Color_short_version.mp3" type="audio/mpeg"/>
+ <p>Your browser does not support the audio tag.</p>
+ </audio>
</div>
</pre></li></ul>
<pre class="prettyprint">
<div data-role="notification" id="notification" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- var notification = tau.widget.Notification(document.getElementById("notification"));
+ var notification = tau.widget.Notification(document.getElementById("notification"));
</script>
</pre>
<pre class="prettyprint">
<div data-role="notification" id="notification" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- var notification = $("#notification").notification();
+ var notification = $("#notification").notification();
</script>
</pre>
<pre class="prettyprint">
<div data-role="notification" id="notification" data-type="smallpopup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- /* Get component instance or create new instance if component does not exist */
- var notification = tau.widget.Notification(document.getElementById("notification"));
+ /* Get component instance or create new instance if component does not exist */
+ var notification = tau.widget.Notification(document.getElementById("notification"));
- /* Open notification */
- notification.open();
+ /* Open notification */
+ notification.open();
</script>
</pre>
<pre class="prettyprint">
<div data-role="notification" id="notification" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- /* Open component using jQuery notation */
- $("#notification").notification("open")
+ /* Open component using jQuery notation */
+ $("#notification").notification("open")
</script>
</pre>
<p>To create a ticker notification using the TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker">
- <p>First line of message</p>
- <p>Second line of message</p>
+ <p>First line of message</p>
+ <p>Second line of message</p>
</div>
<script>
- /* Get component instance or create new instance if component does not exist */
- var notification = tau.widget.Notification(document.getElementById("notification"));
+ /* Get component instance or create new instance if component does not exist */
+ var notification = tau.widget.Notification(document.getElementById("notification"));
- /* Open notification */
- notification.open();
+ /* Open notification */
+ notification.open();
</script>
</pre>
<p>To create a ticker notification using the jQuery API (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker">
- <p>First line of message</p>
- <p>Second line of message</p>
+ <p>First line of message</p>
+ <p>Second line of message</p>
</div>
<script>
- /* Open component using jQuery notation */
- $("#notification").notification("open")
+ /* Open component using jQuery notation */
+ $("#notification").notification("open")
</script>
</pre>
<p>To create a ticker notification with an icon using the TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker">
- <img src="icon.png"/>
- <p>First line of message</p>
- <p>Second line of message</p>
+ <img src="icon.png"/>
+ <p>First line of message</p>
+ <p>Second line of message</p>
</div>
<script>
- /* Open notification */
- notification.open();
+ /* Open notification */
+ notification.open();
</script>
</pre>
<p>To create a ticker notification with an icon using the jQuery API (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker">
- <img src="icon.png"/>
- <p>First line of message</p>
- <p>Second line of message</p>
+ <img src="icon.png"/>
+ <p>First line of message</p>
+ <p>Second line of message</p>
</div>
<script>
- /* Open component using jQuery notation */
- $("#notification").notification("open")
+ /* Open component using jQuery notation */
+ $("#notification").notification("open")
</script>
</pre>
<p>To create a notification with an interval using the TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker" data-interval="4000">
- <img src="icon.png"/>
- <p>I will close in 4* seconds!</p>
- <p>* starts counting from component opening</p>
+ <img src="icon.png"/>
+ <p>I will close in 4* seconds!</p>
+ <p>* starts counting from component opening</p>
</div>
<script>
- /* Get component instance or create new instance if component does not exist */
- var notification = tau.widget.Notification(document.getElementById("notification"));
+ /* Get component instance or create new instance if component does not exist */
+ var notification = tau.widget.Notification(document.getElementById("notification"));
- /* Open notification */
- notification.open();
+ /* Open notification */
+ notification.open();
</script>
</pre>
<p>To create a notification with an interval using the jQuery API (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><div data-role="notification" id="notification" data-type="ticker" data-interval="4000">
- <img src="icon.png"/>
- <p>I will close in 4* seconds!</p>
- <p>* starts counting from component opening</p>
+ <img src="icon.png"/>
+ <p>I will close in 4* seconds!</p>
+ <p>* starts counting from component opening</p>
</div>
<script>
- /* Open component using jQuery notation */
- $("#notification").notification("open")
+ /* Open component using jQuery notation */
+ $("#notification").notification("open")
</script>
</pre>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-type</span></td>
<td class="option">"smallpopup" | "ticker"</td>
<td class="option">null</td>
<td class="option"><p>Time interval in milliseconds after which the notification closes automatically.</p></td>
</tr>
-
+
</tbody>
</table>
</td>
<td><p>Closes the notification on the screen.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-destroy">destroy</a>() </pre>
</td>
<td><p>Removes the component.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the component.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the component.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-icon">icon</a>(string src) </pre>
</td>
<td><p>Creates an icon or changes an existing icon to a new one.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Displays the notification on the screen.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">Notification <a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes the notification and resets its interval, if specified.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">Array <a href="#method-text">text</a>(string text0, string text1) </pre>
</td>
<td><p>Gets or sets the notification text.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-close">close</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">close() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="ticker">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
- notification.close();
+ var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
+ notification.close();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="ticker">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- $("#notificationSelector").notification("close");
+ $("#notificationSelector").notification("close");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-destroy">destroy</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">destroy() </pre>
</div>
-
+
<div class="description">
<p>The method returns the component back to its pre-initialization state.</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<script>
- var notification = tau.widget.Notification(document.getElementById("notificationSelector")),
- notification.destroy();
+ var notification = tau.widget.Notification(document.getElementById("notificationSelector")),
+ notification.destroy();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<script>
- $("#notificationSelector").notification("destroy");
+ $("#notificationSelector").notification("destroy");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-disable">disable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">disable() </pre>
</div>
-
+
<div class="description">
<p>The method adds the <code>display:none</code> style to the component, preventing the notification from being displayed on the screen.</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notification" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- /* Get component instance or create new instance if component does not exist */
- var notification = tau.widget.Notification(document.getElementById("notification"));
+ /* Get component instance or create new instance if component does not exist */
+ var notification = tau.widget.Notification(document.getElementById("notification"));
- /* Disable component */
- notification.disable();
+ /* Disable component */
+ notification.disable();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notification" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- /* Disable component */
- $("#notification").notification("disable");
+ /* Disable component */
+ $("#notification").notification("disable");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-enable">enable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">enable() </pre>
</div>
-
+
<div class="description">
<p>The method removes the <code>display:none</code> style from the component, allowing the notification to be displayed on the screen.</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notification" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- /* Get component instance or create new instance if component does not exist */
- var notification = tau.widget.Notification(document.getElementById("notification"));
+ /* Get component instance or create new instance if component does not exist */
+ var notification = tau.widget.Notification(document.getElementById("notification"));
- /* Enable component */
- notification.enable();
+ /* Enable component */
+ notification.enable();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notification" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- /* Enable component */
- $("#notification").notification("enable");
+ /* Enable component */
+ $("#notification").notification("enable");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-icon">icon</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">icon(string src) </pre>
</div>
-
+
<div class="description">
<p>The method resets the CSS classes on the image element.</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">src</span></td>
<td>string</td>
<td></td>
<td>URL of the image file to use as the icon.</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
- notification.icon("some-image.png");
+ var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
+ notification.icon("some-image.png");
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- $("#notificationSelector").notification("icon", "some-image.png");
+ $("#notificationSelector").notification("icon", "some-image.png");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-open">open</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">open() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
- notification.open();
+ var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
+ notification.open();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- $("#notificationSelector").notification("open");
+ $("#notificationSelector").notification("open");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-refresh">refresh</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Notification refresh() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
- notification.refresh();
+ var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
+ notification.refresh();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="smallpoup">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- $("#notificationSelector").notification("refresh");
+ $("#notificationSelector").notification("refresh");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-text">text</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Array text(string text0, string text1) </pre>
</div>
-
+
<div class="description">
<p>If no parameters are specified, the method returns the current notification text as an array.</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">text0</span></td>
<td>string</td>
<td></td>
<td>First line of notification text.</td>
</tr>
-
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">text1</span></td>
<td>string</td>
<td></td>
<td>Second line of notification text.</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="ticker">
- <p>Line of message</p>
- <p>Second line of message</p>
+ <p>Line of message</p>
+ <p>Second line of message</p>
</div>
<script>
- var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
- var widgetText = notification.text();
+ var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
+ var widgetText = notification.text();
- alert(widgetText);
- /* Alert "Line of message,Second line of message" */
+ alert(widgetText);
+ /* Alert "Line of message,Second line of message" */
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="ticker">
- <p>Line of message</p>
- <p>Second line of message</p>
+ <p>Line of message</p>
+ <p>Second line of message</p>
</div>
<script>
- var widgetText = $("#notificationSelector").notification("text");
+ var widgetText = $("#notificationSelector").notification("text");
- alert(widgetText);
- /* Alert "Line of message,Second line of message" */
+ alert(widgetText);
+ /* Alert "Line of message,Second line of message" */
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="ticker">
- <p>Line of message</p>
- <p>Second line of message</p>
+ <p>Line of message</p>
+ <p>Second line of message</p>
</div>
<script>
- var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
+ var notification = tau.widget.Notification(document.getElementById("notificationSelector"));
- notification.text("This is a new Notification!", "This is an example");
+ notification.text("This is a new Notification!", "This is an example");
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="notification" id="notificationSelector" data-type="ticker">
- <p>Line of message</p>
+ <p>Line of message</p>
</div>
<script>
- $("#notificationSelector").notification("text", "This is new Notification!", "This is an example");
+ $("#notificationSelector").notification("text", "This is new Notification!", "This is an example");
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
<div id="footer">
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.25044789374805987">Default Selectors</a>
-
-
+
+
</li>
-
+
<li><a href="#manual-constructor0.7840281431563199">Manual Constructor</a>
-
+
</li>
<li><a href="#html-examples0.9146406608633697">HTML Examples</a>
- </li>
+ </li>
<li><a href="#options-for widget0.958138655172661">Options</a>
-
+
</li>
-
+
<li><a href="#events-list">Events</a>
-
+
</li>
-
+
<li><a href="#methods0.09717508149333298">Methods</a>
-
+
</li>
-
+
</ol>
<h2><a id="default-selectors0.25044789374805987"></a>Default Selectors</h2>
<pre class="prettyprint"><div id="progress-bar"></div>
<script>
- var element = document.getElementById("progress-bar"),
- progressBar = tau.widget.ProgressBar(element);
+ var element = document.getElementById("progress-bar"),
+ progressBar = tau.widget.ProgressBar(element);
</script>
</pre>
<pre class="prettyprint"><div id="progress-bar"></div>
<script>
- $("#progress-bar").progressbar();
+ $("#progress-bar").progressbar();
</script>
</pre>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-max</span></td>
<td class="option">number</td>
<td class="option">100</td>
<td class="option">Maximum value of the progress bar.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-min</span></td>
<td class="option">number</td>
<td class="option">0</td>
<td class="option">Minimum value of the progress bar.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-value</span></td>
<td class="option">number</td>
<td class="option">0</td>
<td class="option">Current progress value.</td>
</tr>
-
+
</tbody>
</table>
<th>Event</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">change</span></td>
<td><p>Triggered when the value of component changes.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">complete</span></td>
<td><p>Triggered when the value of component reaches the maximum value.</p></td>
</tr>
-
+
</tbody>
</table>
<ul><li><p>TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><script>
- var element = document.getElementById("progress-bar"),
- progressBar = tau.widget.ProgressBar(element);
+ var element = document.getElementById("progress-bar"),
+ progressBar = tau.widget.ProgressBar(element);
- progressBar.methodName(argument1, argument2, ...);
+ progressBar.methodName(argument1, argument2, ...);
</script>
</pre>
</tr>
</thead>
<tbody>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">ProgressBar <a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes a progress bar.</p></td>
</tr>
-
-
-
-
+
+
+
+
<tr>
<td>
<pre class="intable prettyprint">number <a href="#method-value">value</a>(number? value) </pre>
</td>
<td><p>Gets or sets a value.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-refresh">refresh</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">ProgressBar refresh() </pre>
</div>
-
+
<div class="description">
<p>
-
+
<p>The method rebuilds the DOM structure of the progress bar component. It must be called after you manually change the HTML attributes of the component's DOM structure.</p>
<p>The method is called automatically after any component option is changed.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
prettyprint">
<div id="progress-bar"></div>
<script>
- var element = document.getElementById("progress-bar"),
- progressBarWidget = tau.widget.ProgressBar(element);
+ var element = document.getElementById("progress-bar"),
+ progressBarWidget = tau.widget.ProgressBar(element);
- progressBarWidget.refresh();
+ progressBarWidget.refresh();
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
prettyprint">
<div id="progress-bar"></div>
<script>
- $("#progress-bar").progressbar();
- $("#progress-bar").progressbar("refresh");
+ $("#progress-bar").progressbar();
+ $("#progress-bar").progressbar("refresh");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
-
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-value">value</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">number value(number? value) </pre>
</div>
-
+
<p><span class="version">Since: </span>
2.3
</p>
-
+
<div class="description">
<p>
<p>Returns the progress bar value or sets the value.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">value</span></td>
<td>number</td>
<td></td>
<td>New progress bar value.</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
prettyprint">
<div id="progress-bar"></div>
<script>
- var element = document.getElementById("progress-bar"),
- progressBarWidget = tau.widget.ProgressBar(element),
- /* Returns current value */
- value = progressBarWidget.value();
+ var element = document.getElementById("progress-bar"),
+ progressBarWidget = tau.widget.ProgressBar(element),
+ /* Returns current value */
+ value = progressBarWidget.value();
- progressBarWidget.value(30); /* Sets new value to 30 */
+ progressBarWidget.value(30); /* Sets new value to 30 */
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
prettyprint">
<div id="progress-bar"></div>
<script>
- $("#progress-bar").progressbar();
- /* Returns current value */
- $("#progress-bar").progressbar("value");
+ $("#progress-bar").progressbar();
+ /* Returns current value */
+ $("#progress-bar").progressbar("value");
- /* Sets new value to 30 */
- $("#progress-bar").progressbar("value", 30);
+ /* Sets new value to 30 */
+ $("#progress-bar").progressbar("value", 30);
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.7969826499465853">Default Selectors</a>
</li>
-
+
<li><a href="#manual-constructor0.10807657078839839">Manual Constructor</a>
-
-
+
+
</li>
<li><a href="#html-examples0.10928850574418902">HTML Examples</a>
- </li>
+ </li>
<li><a href="#options-for scrollhandler0.7957050383556634">Options</a>
-
+
</li>
<li><a href="#events-list">Events</a>
-
+
</li>
-
+
<li><a href="#methods-list">Methods</a>
-
+
</li>
-
+
</ol>
<ul><li><p>ScrollHandler need to set after page component created completely because it has dependency for the page component.</p></li></ul>
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- var myPage = document.getElementById("myPage"),
- handlerElement = myPage.querySelector("[data-role=content]");
+ var myPage = document.getElementById("myPage"),
+ handlerElement = myPage.querySelector("[data-role=content]");
- myPage.addEventListener("pageshow", function()
- {
- tau.widget.ScrollHandler(handlerElement);
- });
+ myPage.addEventListener("pageshow", function()
+ {
+ tau.widget.ScrollHandler(handlerElement);
+ });
</script>
</pre>
<p>If the jQuery library is loaded, you can use its method (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- $("#myPage").on("pageshow", function()
- {
- $("#myPage > div[data-role=content]").scrollhandler();
- });
+ $("#myPage").on("pageshow", function()
+ {
+ $("#myPage > div[data-role=content]").scrollhandler();
+ });
</script>
</pre>
<ul><li>To create a scroll view with a scroll handler using <code>data-handler</code> attribute:
<pre class="prettyprint"><div data-role="page">
- <div data-role="content" data-handler="true">
- page content
- </div>
+ <div data-role="content" data-handler="true">
+ page content
+ </div>
</div>
</pre></li>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-direction</span></td>
<td class="option">"x" | "y"</td>
<td class="option">"y"</td>
<td class="option">Direction of the handler.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-handler</span></td>
<td class="option">boolean</td>
<td class="option">true</td>
<td class="option">Sets whether the scroll handler is enabled.</td>
</tr>
-
-
+
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-scroll</span></td>
<td class="option">"x" | "y" | "xy"</td>
<td class="option">"y"</td>
<td class="option">Scrolling direction.</td>
</tr>
-
+
</tbody>
</table>
<ul><li>With the <code>data-handler</code> option
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content" data-handler="true">
- pagecontent
- <div>
+ <div data-role="content" data-handler="true">
+ pagecontent
+ <div>
</div>
</pre></li>
<li>By passing an object to the constructor (<strong>RECOMMENDED</strong>):
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- var myPage = document.getElementById("myPage"),
- handlerElement = myPage.querySelector("[data-role=content]");
+ var myPage = document.getElementById("myPage"),
+ handlerElement = myPage.querySelector("[data-role=content]");
- myPage.addEventListener("pageshow", function()
- {
- tau.widget.ScrollHandler(handlerElement, {"handler": true});
- });
+ myPage.addEventListener("pageshow", function()
+ {
+ tau.widget.ScrollHandler(handlerElement, {"handler": true});
+ });
</script>
</pre></li>
<li>By using the jQuery API (<strong>support for backward compatibility</strong>):
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- $("#myPage").on("pageshow", function()
- {
- $("#myPage > div[data-role=content]").scrollhandler({"handler": true});
- });
+ $("#myPage").on("pageshow", function()
+ {
+ $("#myPage > div[data-role=content]").scrollhandler({"handler": true});
+ });
</script>
</pre></li></ul>
<ul><li>With the <code>data-direction</code> option
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content" data-direction="y" data-handler="true">
- pagecontent
- <div>
+ <div data-role="content" data-direction="y" data-handler="true">
+ pagecontent
+ <div>
</div>
</pre></li>
<li>By passing an object to the constructor (<strong>RECOMMENDED</strong>):
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- var myPage = document.getElementById("myPage"),
- handlerElement = myPage.querySelector("[data-role=content]");
+ var myPage = document.getElementById("myPage"),
+ handlerElement = myPage.querySelector("[data-role=content]");
- myPage.addEventListener("pageshow", function()
- {
- tau.widget.ScrollHandler(handlerElement, {"scroll": "y"});
- });
+ myPage.addEventListener("pageshow", function()
+ {
+ tau.widget.ScrollHandler(handlerElement, {"scroll": "y"});
+ });
</script>
</pre></li>
<li>By using the jQuery API (<strong>support for backward compatibility</strong>):
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- $("#myPage").on("pageshow", function()
- {
- $("#myPage > div[data-role=content]").scrollhandler({"scroll": "y"});
- });
+ $("#myPage").on("pageshow", function()
+ {
+ $("#myPage > div[data-role=content]").scrollhandler({"scroll": "y"});
+ });
</script>
</pre></li></ul>
<ul><li>With the <code>data-scroll</code> option
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content" data-scroll="x" data-handler="true">
- pagecontent
- <div>
+ <div data-role="content" data-scroll="x" data-handler="true">
+ pagecontent
+ <div>
</div>
</pre></li>
<li>By passing an object to the constructor (<strong>RECOMMENDED</strong>):
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- var myPage = document.getElementById("myPage"),
- handlerElement = myPage.querySelector("[data-role=content]");
+ var myPage = document.getElementById("myPage"),
+ handlerElement = myPage.querySelector("[data-role=content]");
- myPage.addEventListener("pageshow", function()
- {
- tau.widget.ScrollHandler(handlerElement, {"scroll": "x"});
- });
+ myPage.addEventListener("pageshow", function()
+ {
+ tau.widget.ScrollHandler(handlerElement, {"scroll": "x"});
+ });
</script>
</pre></li>
<li>By using the jQuery API (<strong>support for backward compatibility</strong>):
<pre class="prettyprint"><div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- $("#myPage").on("pageshow", function()
- {
- $("#myPage > div[data-role=content]").scrollhandler({"scroll": "x"});
- });
+ $("#myPage").on("pageshow", function()
+ {
+ $("#myPage > div[data-role=content]").scrollhandler({"scroll": "x"});
+ });
</script>
</pre></li></ul>
</td>
<td><p>Enables or disables the handler.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-enableHandler">enableHandler</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">boolean enableHandler(boolean enable) </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">enable</span></td>
<td>boolean</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- var myPage = document.getElementById("myPage"),
- handlerElement = myPage.querySelector("[data-role=content]"),
- scrollhandler;
-
- myPage.addEventListener("pageshow", function()
- {
- tau.widget.ScrollHandler(handlerElement);
- scrollhandler.enableHandler(true);
- });
+ var myPage = document.getElementById("myPage"),
+ handlerElement = myPage.querySelector("[data-role=content]"),
+ scrollhandler;
+
+ myPage.addEventListener("pageshow", function()
+ {
+ tau.widget.ScrollHandler(handlerElement);
+ scrollhandler.enableHandler(true);
+ });
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="page" id="myPage">
- <div data-role="content">
- pagecontent
- <div>
+ <div data-role="content">
+ pagecontent
+ <div>
</div>
<script>
- #("#myPage > div[data-role=content]").scrollhandler("enableHandler", true);
+ #("#myPage > div[data-role=content]").scrollhandler("enableHandler", true);
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
+
+
+
+
</dl>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.5337990545667708">Default Selectors</a>
-
+
</li>
-
+
<li><a href="#manual-constructor0.7136435771826655">Manual Constructor</a>
-
+
</li>
-
+
<li><a href="#html-examples0.6614409978501499">HTML Examples</a>
</li>
-
-
+
+
<li><a href="#options-list">Options</a>
-
+
</li>
<li><a href="#methods0.952881425851956">Methods</a>
-
+
</li>
-
+
</ol>
<p>To manually create a search bar component, use the component constructor from the <code>tau</code> namespace (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><div data-role="page" id="search-bar-page">
- <div data-role="header">
- <label for="search-bar">Search Input:</label>
- <input name="search" id="search-bar"/>
- </div>
- <div data-role="content" id="search-bar-content">
- <ul data-role="listview">
- <li>Hairston</li>
- <li>Hansbrough</li>
- <li>Allred</li>
- <li>Hanrahan</li>
- <li>Egan</li>
- <li>Dare</li>
- </ul>
- </div>
- <script>
- (function(document)
- {
- var inputElement = document.getElementById("search-bar"),
- contentElement = document.getElementById("search-bar-content"),
- contentChildren = contentElement.getElementsByTagName("li"),
- contentChildrenLength = contentChildren.length,
- pageElement = document.getElementById("search-bar-page"),
- searchBar;
-
- function changeHandle(event)
- {
- var i,
- child,
- childText,
- value = searchBar.value();
-
- for (i = 0; i < contentChildrenLength; i++)
- {
- child = contentChildren.item(i);
- childText = child.textContent.toLowerCase();
- if (!value || ~childText.indexOf(value))
- {
- child.style.display = "block";
- }
- else
- {
- child.style.display = "none";
- }
- }
- }
-
- function createPageHandle()
- {
- searchBar = tau.widget.SearchBar(inputElement, {icon: "call"});
- searchBar.on("change keyup", changeHandle);
- }
-
- pageElement.addEventListener("pagecreate", createPageHandle);
- }(document));
- </script>
+ <div data-role="header">
+ <label for="search-bar">Search Input:</label>
+ <input name="search" id="search-bar"/>
+ </div>
+ <div data-role="content" id="search-bar-content">
+ <ul data-role="listview">
+ <li>Hairston</li>
+ <li>Hansbrough</li>
+ <li>Allred</li>
+ <li>Hanrahan</li>
+ <li>Egan</li>
+ <li>Dare</li>
+ </ul>
+ </div>
+ <script>
+ (function(document)
+ {
+ var inputElement = document.getElementById("search-bar"),
+ contentElement = document.getElementById("search-bar-content"),
+ contentChildren = contentElement.getElementsByTagName("li"),
+ contentChildrenLength = contentChildren.length,
+ pageElement = document.getElementById("search-bar-page"),
+ searchBar;
+
+ function changeHandle(event)
+ {
+ var i,
+ child,
+ childText,
+ value = searchBar.value();
+
+ for (i = 0; i < contentChildrenLength; i++)
+ {
+ child = contentChildren.item(i);
+ childText = child.textContent.toLowerCase();
+ if (!value || ~childText.indexOf(value))
+ {
+ child.style.display = "block";
+ }
+ else
+ {
+ child.style.display = "none";
+ }
+ }
+ }
+
+ function createPageHandle()
+ {
+ searchBar = tau.widget.SearchBar(inputElement, {icon: "call"});
+ searchBar.on("change keyup", changeHandle);
+ }
+
+ pageElement.addEventListener("pagecreate", createPageHandle);
+ }(document));
+ </script>
</div>
</pre>
<pre class="prettyprint"><div data-role="page" id="search-bar-page">
- <div data-role="header">
- <label for="search-bar">Search Input:</label>
- <input name="search" id="search-bar"/>
- </div>
- <div data-role="content" id="search-bar-content">
- <ul data-role="listview">
- <li>Hairston</li>
- <li>Hansbrough</li>
- <li>Allred</li>
- <li>Hanrahan</li>
- <li>Egan</li>
- <li>Dare</li>
- </ul>
- </div>
- <script>
- (function(document)
- {
- var inputElement = document.getElementById("search-bar"),
- contentElement = document.getElementById("search-bar-content"),
- contentChildren = contentElement.getElementsByTagName("li"),
- contentChildrenLength = contentChildren.length,
- pageElement = document.getElementById("search-bar-page");
-
- function changeHandle(event)
- {
- var i,
- child,
- childText,
- value = inputElement.value;
-
- for (i = 0; i < contentChildrenLength; i++)
- {
- child = contentChildren.item(i);
- childText = child.textContent.toLowerCase();
- if (!value || ~childText.indexOf(value))
- {
- child.style.display = "block";
- }
- else
- {
- child.style.display = "none";
- }
- }
- }
-
- function createPageHandle()
- {
- $("#search-bar").searchbar(inputElement, {icon: "call"}).on("change keyup", changeHandle);
- }
-
- $("#search-bar-page").on("pagecreate", createPageHandle);
- }(document));
- </script>
+ <div data-role="header">
+ <label for="search-bar">Search Input:</label>
+ <input name="search" id="search-bar"/>
+ </div>
+ <div data-role="content" id="search-bar-content">
+ <ul data-role="listview">
+ <li>Hairston</li>
+ <li>Hansbrough</li>
+ <li>Allred</li>
+ <li>Hanrahan</li>
+ <li>Egan</li>
+ <li>Dare</li>
+ </ul>
+ </div>
+ <script>
+ (function(document)
+ {
+ var inputElement = document.getElementById("search-bar"),
+ contentElement = document.getElementById("search-bar-content"),
+ contentChildren = contentElement.getElementsByTagName("li"),
+ contentChildrenLength = contentChildren.length,
+ pageElement = document.getElementById("search-bar-page");
+
+ function changeHandle(event)
+ {
+ var i,
+ child,
+ childText,
+ value = inputElement.value;
+
+ for (i = 0; i < contentChildrenLength; i++)
+ {
+ child = contentChildren.item(i);
+ childText = child.textContent.toLowerCase();
+ if (!value || ~childText.indexOf(value))
+ {
+ child.style.display = "block";
+ }
+ else
+ {
+ child.style.display = "none";
+ }
+ }
+ }
+
+ function createPageHandle()
+ {
+ $("#search-bar").searchbar(inputElement, {icon: "call"}).on("change keyup", changeHandle);
+ }
+
+ $("#search-bar-page").on("pagecreate", createPageHandle);
+ }(document));
+ </script>
</div>
</pre>
<p>To create a search bar in the header:</p>
<pre class="prettyprint"><div data-role="page" id="search-bar-page">
- <div data-role="header">
- <label for="search-bar">Search Input:</label>
- <input type="search" name="search" id="search-bar"/>
- </div>
- <div data-role="content" id="search-bar-content">
- <ul data-role="listview">
- <li>Hairston</li>
- <li>Hansbrough</li>
- <li>Allred</li>
- <li>Hanrahan</li>
- <li>Egan</li>
- <li>Dare</li>
- </ul>
- </div>
- <script>
- (function(document)
- {
- var inputElement = document.getElementById("search-bar"),
- contentElement = document.getElementById("search-bar-content"),
- contentChildren = contentElement.getElementsByTagName("li"),
- contentChildrenLength = contentChildren.length;
-
- function changeHandle(event)
- {
- var i,
- child,
- childText,
- value = inputElement.value;
-
- for (i = 0; i < contentChildrenLength; i++)
- {
- child = contentChildren.item(i);
- childText = child.textContent.toLowerCase();
- if (!value || ~childText.indexOf(value))
- {
- child.style.display = "block";
- }
- else
- {
- child.style.display = "none";
- }
- }
- }
-
- inputElement.addEventListener("change", changeHandle);
- inputElement.addEventListener("keyup", changeHandle);
- }(document));
- </script>
+ <div data-role="header">
+ <label for="search-bar">Search Input:</label>
+ <input type="search" name="search" id="search-bar"/>
+ </div>
+ <div data-role="content" id="search-bar-content">
+ <ul data-role="listview">
+ <li>Hairston</li>
+ <li>Hansbrough</li>
+ <li>Allred</li>
+ <li>Hanrahan</li>
+ <li>Egan</li>
+ <li>Dare</li>
+ </ul>
+ </div>
+ <script>
+ (function(document)
+ {
+ var inputElement = document.getElementById("search-bar"),
+ contentElement = document.getElementById("search-bar-content"),
+ contentChildren = contentElement.getElementsByTagName("li"),
+ contentChildrenLength = contentChildren.length;
+
+ function changeHandle(event)
+ {
+ var i,
+ child,
+ childText,
+ value = inputElement.value;
+
+ for (i = 0; i < contentChildrenLength; i++)
+ {
+ child = contentChildren.item(i);
+ childText = child.textContent.toLowerCase();
+ if (!value || ~childText.indexOf(value))
+ {
+ child.style.display = "block";
+ }
+ else
+ {
+ child.style.display = "none";
+ }
+ }
+ }
+
+ inputElement.addEventListener("change", changeHandle);
+ inputElement.addEventListener("keyup", changeHandle);
+ }(document));
+ </script>
</div>
</pre>
<th>Default value</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-cancel-btn</span></td>
<td class="option">boolean</td>
<td class="option">false</td>
<td class="option">Sets whether the cancel button is shown.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-icon</span></td>
<td class="option">string | null</td>
Possible values are the same as in the <a href="../mobile_Button.htm">button component.</a> If the option is not set, the action button is not shown.</td>
</tr>
-
+
</tbody>
</table>
<ul><li><p>TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><script>
- var searchBarElement = document.getElementById('search-bar'),
- searchBar = tau.widget.SearchBar(searchBarElement);
+ var searchBarElement = document.getElementById('search-bar'),
+ searchBar = tau.widget.SearchBar(searchBarElement);
- searchBar.methodName(methodArgument1, methodArgument2, ...);
+ searchBar.methodName(methodArgument1, methodArgument2, ...);
</script>
</pre></li>
<li><p>jQuery API (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><script>
- $(".selector").searchbar('methodName', methodArgument1, methodArgument2, ...);
+ $(".selector").searchbar('methodName', methodArgument1, methodArgument2, ...);
</script>
</pre></li></ul>
</tr>
</thead>
<tbody>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">SearchBar <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the search bar.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">SearchBar <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the search bar.</p></td>
</tr>
-
-
-
-
-
-
+
+
+
+
+
+
<tr>
<td>
<pre class="intable prettyprint">string <a href="#method-value">value</a>(string? value) </pre>
</td>
<td><p>Gets or sets an input text value.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-disable">disable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">SearchBar disable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method sets the disabled attribute for the search bar and changes the look of the search bar to the disabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<script>
- var element = document.getElementById("searchbar"),
- searchBarWidget = tau.widget.SearchBar(element);
- searchBarWidget.disable();
+ var element = document.getElementById("searchbar"),
+ searchBarWidget = tau.widget.SearchBar(element);
+ searchBarWidget.disable();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<script>
- $("#searchbar").searchbar("disable");
+ $("#searchbar").searchbar("disable");
</script>
</pre>
- </div>
+ </div>
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-enable">enable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">SearchBar enable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method removes the disabled attribute from the search bar and changes the look of the search bar to the enabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<script>
- var element = document.getElementById("searchbar"),
- searchBarWidget = tau.widget.SearchBar(element);
- searchBarWidget.enable();
+ var element = document.getElementById("searchbar"),
+ searchBarWidget = tau.widget.SearchBar(element);
+ searchBarWidget.enable();
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<script>
- $("#searchbar").searchbar("enable");
+ $("#searchbar").searchbar("enable");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-value">value</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">string value(string? value) </pre>
</div>
-
+
<p><span class="version">Since: </span>
2.3
</p>
-
+
<div class="description">
<p>
<p>If you call the method with a parameter, it is set as the new input text value. Otherwise, the method returns the input text value.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">value</span></td>
<td>string</td>
<td></td>
<td>New input text value.</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
var searchBarElement = document.getElementById("searchbar"),
- searchBarWidget = tau.widget.SearchBar(searchBarElement),
- value = searchBarWidget.value();
+ searchBarWidget = tau.widget.SearchBar(searchBarElement),
+ value = searchBarWidget.value();
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
prettyprint">
/* Value contains the input text */
$("#searchbar").searchbar("value");
-
+
/* "New text" is the new input value */
-$("#searchbar").searchbar("value", "New text");
+$("#searchbar").searchbar("value", "New text");
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selector">Default Selector</a>
</li>
-
+
<li><a href="#manual-constructor">Manual Constructor</a>
-
+
</li>
<li><a href="#html-examples">HTML Examples</a>
-
+
</li>
-
-
+
+
<li><a href="#options-list">Options</a>
-
+
</li>
-
+
<li><a href="#methods">Methods</a>
-
+
</li>
-
-
-
+
+
+
</ol>
<h2><a id="default-selector"></a>Default Selector</h2>
<p>To manually create a select menu component, use the component constructor:</p>
<pre class="prettyprint"><select id="selectmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
- var element = document.getElementById("selectmenu"),
- widget = tau.widget.SelectMenu(element);
+ var element = document.getElementById("selectmenu"),
+ widget = tau.widget.SelectMenu(element);
</script>
</pre>
<p>The default value of the <code>data-native-menu</code> attribute is <code>true</code> and it creates a native SelectMenu. You can create a custom SelectMenu by setting the attribute to <code>false</code>.</p>
<pre class="prettyprint"><select data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre></li>
<p>When the <code>data-inline</code> attribute is set to <code>true</code>, the select menu width is determined by its text (default is <code>false</code>).</p>
<pre class="prettyprint"><select id="selectmenu" data-native-menu="false" data-inline="true">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre></li>
<p>If you use the <code><option></code> element with the <code>data-placeholder="true"</code> attribute, you can make a default placeholder. The default value of the <code>data-hide-placeholder-menu-items</code> attribute is <code>true</code>, and it hides the <code>data-placeholder</code> option. To keep the option visible, use the <code>data-hide-placeholder-menu-items="false"</code> attribute.</p>
<pre class="prettyprint"><select id="selectmenu" data-native-menu="false" data-hide-placeholder-menu-items="false">
- <option value="choose-one" data-placeholder="true">Choose an option</option>
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="choose-one" data-placeholder="true">Choose an option</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre></li></ul>
<td class="option">true</td>
<td class="option">Sets whether the select menu component is of a native or custom type.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-hide-placeholder-menu-items</span></td>
<td class="option">boolean</td>
<td class="option">true</td>
<td class="option">Hides or reveals the placeholder option in the drop-down list of the select menu.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-inline</span></td>
<td class="option">boolean</td>
<ul><li>TAU API (<strong>RECOMMENDED</strong>):
<pre class="prettyprint">var element = document.getElementById("selectmenu"),
- widget = tau.widget.SelectMenu(element);
+ widget = tau.widget.SelectMenu(element);
widget.methodName(methodArgument1, methodArgument2, ...);
</pre></li>
<pre class="prettyprint">$(".selector").selectmenu("methodName", methodArgument1, methodArgument2, ...);
</pre></li></ul>
-
+
<h3>Summary</h3>
<table class="informaltable">
<thead>
</tr>
</thead>
<tbody>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Opens the select menu.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Closes the select menu.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-open">open</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">open() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<select id="selectmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
- var elSelectMenu = document.getElementById("selectmenu"),
- widget = tau.widget.SelectMenu(elSelectMenu);
- widget.open();
+ var elSelectMenu = document.getElementById("selectmenu"),
+ widget = tau.widget.SelectMenu(elSelectMenu);
+ widget.open();
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-close">close</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">close() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<select id="selectmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
- var elSelectMenu = document.getElementById("selectmenu"),
- widget = tau.widget.SelectMenu(elSelectMenu);
- widget.close();
+ var elSelectMenu = document.getElementById("selectmenu"),
+ widget = tau.widget.SelectMenu(elSelectMenu);
+ widget.close();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
+
+
+
+
</dl>
-
+
<div id="footer">
<hr size="1">
<font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.22067294060252607">Default Selectors</a>
-
+
</li>
<li><a href="#menu-examples0.3870438882149756">Manual Constructor</a></li>
<li><a href="#html-examples0.3870438882149756">HTML Examples</a>
<li><a href="#method-examples">Methods</a></li>
<li><a href="#opening-examples">Opening the Swipe component</a></li>
-
+
</ol>
<h2><a id="default-selectors0.22067294060252607"></a>Default Selectors</h2>
<p>To manually create a swipe component, use the component constructor from the <code>tau</code> namespace (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint">
<div id="swipe">
- <div data-role="swipe-item-cover">
- Cover - swipe to open
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Cover - swipe to open
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ </div>
</div>
<script>
- var swipeElement = document.getElementById("swipe"),
- swipe = tau.widget.Swipe(swipeElement);
+ var swipeElement = document.getElementById("swipe"),
+ swipe = tau.widget.Swipe(swipeElement);
</script>
</pre>
<pre class="prettyprint">
<div id="swipe">
- <div data-role="swipe-item-cover">
- Cover - swipe to open
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Cover - swipe to open
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ </div>
</div>
<script>
- var swipe = $("#swipe").swipe();
+ var swipe = $("#swipe").swipe();
</script>
</pre>
<pre class="prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Cover - swipe to open
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Cover - swipe to open
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ </div>
</div>
</pre>
<pre class="prettyprint">
var swipeElement = document.getElementById("swipe"),
- swipe = tau.widget.Swipe(swipeElement);
+ swipe = tau.widget.Swipe(swipeElement);
swipe.methodName(methodArgument1, methodArgument2, ...);
</pre></li>
</tr>
</thead>
<tbody>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Runs opening animations.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">boolean <a href="#method-opened">opened</a>() </pre>
</td>
<td><p>Checks whether a swipe element is opened.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Runs closing animations.</p></td>
</tr>
-
-
-
+
+
+
</tbody>
</table>
<dl>
-
-
-
-
+
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-open">open</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">open() </pre>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Swipe
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- <div data-role="button" data-inline="true">Second item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Swipe
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ <div data-role="button" data-inline="true">Second item</div>
+ </div>
</div>
<script>
- var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
- swipeWidget.open();
+ var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
+ swipeWidget.open();
<script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Swipe
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- <div data-role="button" data-inline="true">Second item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Swipe
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ <div data-role="button" data-inline="true">Second item</div>
+ </div>
</div>
<script>
- $("#swipe").swipe("open");
+ $("#swipe").swipe("open");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-opened">opened</span></b></code></dt>
<dd>
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Swipe
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- <div data-role="button" data-inline="true">Second item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Swipe
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ <div data-role="button" data-inline="true">Second item</div>
+ </div>
</div>
<script>
- var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
- isOpened = swipeWidget.opened();
+ var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
+ isOpened = swipeWidget.opened();
<script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Swipe
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- <div data-role="button" data-inline="true">Second item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Swipe
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ <div data-role="button" data-inline="true">Second item</div>
+ </div>
</div>
<script>
- var isOpened = $("#swipe").swipe("opened");
+ var isOpened = $("#swipe").swipe("opened");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-close">close</span></b></code></dt>
<dd>
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Swipe
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- <div data-role="button" data-inline="true">Second item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Swipe
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ <div data-role="button" data-inline="true">Second item</div>
+ </div>
</div>
<script>
- var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
- swipeWidget.close();
+ var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
+ swipeWidget.close();
<script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Swipe
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- <div data-role="button" data-inline="true">Second item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Swipe
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ <div data-role="button" data-inline="true">Second item</div>
+ </div>
</div>
<script>
- $("#swipe").swipe("close");
+ $("#swipe").swipe("close");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
-
+
+
+
+
+
</dl>
<ul><li>Open by swiping over an element:
<pre class="prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Cover - swipe to open
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Cover - swipe to open
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ </div>
</div>
</pre></li>
<li>Open manually by using the <code>open</code> method with the TAU API (<strong>RECOMMENDED</strong>):
<pre class="prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Cover - swipe to open
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Cover - swipe to open
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ </div>
</div>
<script>
- var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
- swipeWidget.open();
+ var swipeWidget = tau.widget.Swipe(document.getElementById("swipe"));
+ swipeWidget.open();
<script>
</pre></li>
<li>Open manually by using the jQuery API (<strong>support for backward compatibility</strong>):
<pre class="prettyprint">
<div id="swipe" data-role="swipe">
- <div data-role="swipe-item-cover">
- Cover - swipe to open
- </div>
- <div data-role="swipe-item">
- <div data-role="button" data-inline="true">First item</div>
- </div>
+ <div data-role="swipe-item-cover">
+ Cover - swipe to open
+ </div>
+ <div data-role="swipe-item">
+ <div data-role="button" data-inline="true">First item</div>
+ </div>
</div>
<script>
- $("#swipe").swipe("open");
+ $("#swipe").swipe("open");
<script>
</pre></li></ul>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.14516900992020965">Default Selectors</a>
-
+
</li>
-
+
<li><a href="#manual-constructor0.69354601460509">Manual Constructor</a>
-
+
</li>
<li><a href="#options">Options</a>
<li><a href="#multi">Creating a Tab Bar with MultiPages</a>
</li>
-
+
</ol>
<p>To manually create a tab bar component, use the component constructor from the <code>tau</code> namespace (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint"><div data-role="page" id="tab-bar-page">
- <div data-role="header">
- <div id="ready-for-tab-bar">
- <ul>
- <li><a href="#">Tabbar1</a></li>
- <li><a href="#">Tabbar2</a></li>
- <li><a href="#">Tabbar3</a></li>
- </ul>
- </div>
- </div>
- <div data-role="content">
- Content
- </div>
+ <div data-role="header">
+ <div id="ready-for-tab-bar">
+ <ul>
+ <li><a href="#">Tabbar1</a></li>
+ <li><a href="#">Tabbar2</a></li>
+ <li><a href="#">Tabbar3</a></li>
+ </ul>
+ </div>
+ </div>
+ <div data-role="content">
+ Content
+ </div>
</div>
<script>
- (function(document)
- {
- var pageElement = document.getElementById("tab-bar-page"),
- tabBarElement = document.getElementById("ready-for-tab-bar"),
- tabBar;
-
- function createPageHandle()
- {
- tabBar = tau.widget.TabBar(tabBarElement);
- }
-
- pageElement.addEventListener("pagecreate", createPageHandle);
- }(document));
+ (function(document)
+ {
+ var pageElement = document.getElementById("tab-bar-page"),
+ tabBarElement = document.getElementById("ready-for-tab-bar"),
+ tabBar;
+
+ function createPageHandle()
+ {
+ tabBar = tau.widget.TabBar(tabBarElement);
+ }
+
+ pageElement.addEventListener("pagecreate", createPageHandle);
+ }(document));
</script>
</pre>
<p>If the jQuery library is loaded, you can use its method (<strong>support for backward compatibility</strong>):</p>
<pre class="prettyprint"><div data-role="page" id="ab-bar-page">
- <div data-role="header">
- <div id="ready-for-tab-bar">
- <ul>
- <li><a href="#">Tabbar1</a></li>
- <li><a href="#">Tabbar2</a></li>
- <li><a href="#">Tabbar3</a></li>
- </ul>
- </div>
- </div>
- <div data-role="content">
- Content
- </div>
+ <div data-role="header">
+ <div id="ready-for-tab-bar">
+ <ul>
+ <li><a href="#">Tabbar1</a></li>
+ <li><a href="#">Tabbar2</a></li>
+ <li><a href="#">Tabbar3</a></li>
+ </ul>
+ </div>
+ </div>
+ <div data-role="content">
+ Content
+ </div>
</div>
<script>
- (function(document)
- {
- function createPageHandle()
- {
- $("#ready-for-tab-bar").tabbar();
- }
-
- $("#tab-bar-page").on("pagecreate", createPageHandle);
- }(document));
+ (function(document)
+ {
+ function createPageHandle()
+ {
+ $("#ready-for-tab-bar").tabbar();
+ }
+
+ $("#tab-bar-page").on("pagecreate", createPageHandle);
+ }(document));
</script>
</pre>
<ul><li>To create a simple tab bar in the header:
<pre class="prettyprint"><div data-role="page">
- <div data-role="header">
- <div data-role="tabbar">
- <ul>
- <li><a href="#">Tabbar1</a></li>
- <li><a href="#">Tabbar2</a></li>
- <li><a href="#">Tabbar3</a></li>
- </ul>
- </div>
- </div>
- <div data-role="content">
- Content
- </div>
+ <div data-role="header">
+ <div data-role="tabbar">
+ <ul>
+ <li><a href="#">Tabbar1</a></li>
+ <li><a href="#">Tabbar2</a></li>
+ <li><a href="#">Tabbar3</a></li>
+ </ul>
+ </div>
+ </div>
+ <div data-role="content">
+ Content
+ </div>
</div>
</pre></li>
<li>To create a simple tab bar in the footer:
<pre class="prettyprint"><div data-role="page">
- <div data-role="content">
- Content
- </div>
- <div data-role="footer">
- <div data-role="tabbar">
- <ul>
- <li><a href="#">Tabbar1</a></li>
- <li><a href="#">Tabbar2</a></li>
- <li><a href="#">Tabbar3</a></li>
- </ul>
- </div>
- </div>
+ <div data-role="content">
+ Content
+ </div>
+ <div data-role="footer">
+ <div data-role="tabbar">
+ <ul>
+ <li><a href="#">Tabbar1</a></li>
+ <li><a href="#">Tabbar2</a></li>
+ <li><a href="#">Tabbar3</a></li>
+ </ul>
+ </div>
+ </div>
</div>
</pre></li></ul>
<p>To create a tab bar for multiple pages (where clicking a tab changes the entire page), the <code>data-auto-change</code> option must be <code>"false"</code> and you must use the <code>"ui-btn-active"</code> class for each tab:
<pre class="prettyprint"><div class="ui-page" id="first">
- <div class="ui-header">
- <div class="ui-tabbar" data-auto-change="false">
- <ul>
- <li><a href="#first" class="ui-btn-active">First</a></li>
- <li><a href="#second">Second</a></li>
- <li><a href="#third">Third</a></li>
- </ul>
- </div>
- </div>
- <div class="ui-content">
- First page
- </div>
+ <div class="ui-header">
+ <div class="ui-tabbar" data-auto-change="false">
+ <ul>
+ <li><a href="#first" class="ui-btn-active">First</a></li>
+ <li><a href="#second">Second</a></li>
+ <li><a href="#third">Third</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="ui-content">
+ First page
+ </div>
</div>
<div class="ui-page" id="second">
- <div class="ui-header">
- <div class="ui-tabbar" data-auto-change="false">
- <ul>
- <li><a href="#first">First</a></li>
- <li><a href="#second" class="ui-btn-active">Second</a></li>
- <li><a href="#third">Third</a></li>
- </ul>
- </div>
- </div>
- <div class="ui-content">
- Second page
- </div>
+ <div class="ui-header">
+ <div class="ui-tabbar" data-auto-change="false">
+ <ul>
+ <li><a href="#first">First</a></li>
+ <li><a href="#second" class="ui-btn-active">Second</a></li>
+ <li><a href="#third">Third</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="ui-content">
+ Second page
+ </div>
</div>
<div class="ui-page" id="third">
- <div class="ui-header">
- <div class="ui-tabbar" data-auto-change="false">
- <ul>
- <li><a href="#first">First</a></li>
- <li><a href="#second">Second</a></li>
- <li><a href="#third" class="ui-btn-active">Third</a></li>
- </ul>
- </div>
- </div>
- <div class="ui-content">
- Third page
- </div>
+ <div class="ui-header">
+ <div class="ui-tabbar" data-auto-change="false">
+ <ul>
+ <li><a href="#first">First</a></li>
+ <li><a href="#second">Second</a></li>
+ <li><a href="#third" class="ui-btn-active">Third</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="ui-content">
+ Third page
+ </div>
</div>
</pre>
<h2>Table of Contents</h2>
<ol class="toc">
-
-
-
+
+
+
<li><a href="#manual-constructor0.8876081134658307">Manual Constructor</a>
-
-
+
+
</li>
<li><a href="#html-examples0.6324649443849921">HTML Examples</a>
-
+
</li>
<li><a href="#options-for tokentextarea widget0.2150889951735735">Options</a>
-
+
</li>
-
+
<li><a href="#methods0.8635833316948265">Methods</a>
-
+
</li>
-
+
</ol>
<h2>Default Selectors</h2>
<pre class="prettyprint"><div id="ns-tokentextarea"><div>
<script>
- var token = tau.widget.Tokentextarea(document.getElementById('ns-tokentextarea'));
+ var token = tau.widget.Tokentextarea(document.getElementById('ns-tokentextarea'));
</script>
</pre>
<pre class="prettyprint"><div id="ns-tokentextarea"><div>
<script>
- $("#ns-tokentextarea").tokentextarea();
+ $("#ns-tokentextarea").tokentextarea();
</script>
</pre>
<td class="option">"+ {0}"</td>
<td class="option">Manages the message format.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-label</span></td>
<td class="option">string</td>
<td class="option">null</td>
<td class="option">Sets a URL at the anchor button.</td>
</tr>
-
+
</tbody>
</table>
<p>You can use the <code>option</code> method to get and set custom options for the token text area.</p>
<pre class="prettyprint"><script>
- var elementToken = document.getElementById("ns-tokentextarea"),
- tokentextarea = tau.widget.TokenTextarea(elementToken);
+ var elementToken = document.getElementById("ns-tokentextarea"),
+ tokentextarea = tau.widget.TokenTextarea(elementToken);
- /* Get the label */
- tokentextarea.option("label");
+ /* Get the label */
+ tokentextarea.option("label");
- /* Set the label */
- tokentextarea.option("label", "e-mail To:");
+ /* Set the label */
+ tokentextarea.option("label", "e-mail To:");
- /* Get the link */
- tokentextarea.option("link");
+ /* Get the link */
+ tokentextarea.option("link");
- /* Set the link */
- tokentextarea.option("link", "favorites.html");
+ /* Set the link */
+ tokentextarea.option("link", "favorites.html");
- /* Get the message format */
- tokentextarea.option("description");
+ /* Get the message format */
+ tokentextarea.option("description");
- /* Set the message format */
- tokentextarea.option("description", "bar + {0}");
+ /* Set the message format */
+ tokentextarea.option("description", "bar + {0}");
</script>
</pre>
<ul><li><p>TAU API (<strong>RECOMMENDED</strong>):</p>
<pre class="prettyprint">var elementToken = document.getElementById("ns-tokentext"),
- tokentextarea = tau.widget.Tokentextarea(elementToken);
+ tokentextarea = tau.widget.Tokentextarea(elementToken);
tokentextarea.methodName(methodArgument1, methodArgument2, ...);
</pre></li>
</tr>
</thead>
<tbody>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-add">add</a>(string messages, number blockIndex) </pre>
<td><p>Adds a new token text area component button with specified text in the place of the index.</p></td>
</tr>
-
+
<tr>
<td>
<pre class="intable prettyprint">Tokentextarea <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the token text area.</p></td>
</tr>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint">Tokentextarea <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the token text area.</p></td>
- </tr>
-
+ </tr>
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-focusIn">focusIn</a>() </pre>
</td>
<td><p>Ungroups the elements and sets a focus to the input.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-focusOut">focusOut</a>() </pre>
</td>
<td><p>Groups elements and hides the input.</p></td>
</tr>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
<tr>
<td>
<pre class="intable prettyprint">string <a href="#method-inputText">inputText</a>(string text) </pre>
</td>
<td><p>Manages the component input box text.</p></td>
</tr>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
<tr>
<td>
<pre class="intable prettyprint">number <a href="#method-length">length</a>() </pre>
</td>
<td><p>Returns the block count.</p></td>
</tr>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-remove">remove</a>(number blockIndex) </pre>
</td>
<td><p>Deletes a token text area component button at the specified index position. If no parameter is defined, all token text area component buttons are deleted.</p></td>
- </tr>
+ </tr>
<tr>
<td>
</td>
<td><p>Selects the token text area button based on its index value.<br />If a parameter is set, the token text area button matching the index value is selected.<br />If a token text area button is selected and the parameter is not set, the method returns the string of the selected button. If no button is selected, the method returns <code>null</code>.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-add">add</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">add(string messages, number blockIndex) </pre>
</div>
-
+
<div class="description">
<p>
<p>If the index is not set, the token is inserted at the end.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">messages</span></td>
<td>string</td>
<td></td>
<td></td>
</tr>
-
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">blockIndex</span></td>
<td>number</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- tokenWidget.add("foobar");
+ var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ tokenWidget.add("foobar");
</script>
</pre>
</div>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- $("#ns-tokentext").tokentextarea("add", "foobar");
+ $("#ns-tokentext").tokentextarea("add", "foobar");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
-
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-disable">disable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Tokentextarea disable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method adds the disabled attribute on the token text area component and changes the look of the component to the disabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
prettyprint">
<div data-role="tokentexarea" id="ns-tokentext"></div>
<script>
- var elementToken = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- elementToken.disable();
+ var elementToken = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ elementToken.disable();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- $("#ns-tokentext").tokentextarea("disable");
+ $("#ns-tokentext").tokentextarea("disable");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-enable">enable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Tokentextarea enable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method removes the disabled attribute from the token text area component and changes the look of the component to the enabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="example">
<span class="example"><p>Code
example (TAU API <strong>RECOMMENDED</strong>):</p><p></p></span>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- var elementToken = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- elementToken.enable();
+ var elementToken = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ elementToken.enable();
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- $("#ns-tokentext").tokentextarea("enable");
+ $("#ns-tokentext").tokentextarea("enable");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-focusIn">focusIn</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">focusIn() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<div data-role="tokentextarea"
- data-label="Send to: "
- id="ns-tokentext">
+ data-label="Send to: "
+ id="ns-tokentext">
</div>
<script>
- var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- tokenWidget.focusIn(0);
+ var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ tokenWidget.focusIn(0);
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="tokentextarea"
- data-label="Send to: "
- id="ns-tokentext">
+ data-label="Send to: "
+ id="ns-tokentext">
</div>
<script>
- $("#ns-tokentext").tokentextarea("focusIn");
+ $("#ns-tokentext").tokentextarea("focusIn");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-focusOut">focusOut</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">focusOut() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<div data-role="tokentextarea"
- data-label="Send to: "
- id="ns-tokentext">
+ data-label="Send to: "
+ id="ns-tokentext">
</div>
<script>
- var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- tokenWidget.focusOut(0);
+ var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ tokenWidget.focusOut(0);
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="tokentextarea"
- data-label="Send to: "
- id="ns-tokentext">
+ data-label="Send to: "
+ id="ns-tokentext">
</div>
<script>
- $("#ns-tokentext").tokentextarea("focusOut");
+ $("#ns-tokentext").tokentextarea("focusOut");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-inputText">inputText</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">string inputText(string text) </pre>
</div>
-
+
<div class="description">
<p>
<p>If no parameter is set, the method gets the input box text. If a parameter is set, the parameter text is set in the input box.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">text</span></td>
<td>string</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- /* Set the text in the input box */
- tokenWidget.inputText("foobar");
+ /* Set the text in the input box */
+ tokenWidget.inputText("foobar");
- /* Get the input box text */
- tokenWidget.inputText();
+ /* Get the input box text */
+ tokenWidget.inputText();
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- /* Set the text in the input box */
- $("#ns-tokentext").tokentextarea("inputText", "foobar");
+ /* Set the text in the input box */
+ $("#ns-tokentext").tokentextarea("inputText", "foobar");
- /* Get the input box text */
- $("#ns-tokentext").tokentextarea("inputText");
+ /* Get the input box text */
+ $("#ns-tokentext").tokentextarea("inputText");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-length">length</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">number length() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method retrieves the number of buttons in the token text area component.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- tokenWidget.length();
+ var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ tokenWidget.length();
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- $("#ns-tokentext").tokentextarea("length");
+ $("#ns-tokentext").tokentextarea("length");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-remove">remove</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">remove(number blockIndex) </pre>
</div>
-
-
+
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">blockIndex</span></td>
<td>number</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<div data-role="tokentextarea"
- data-label="Send to: "
- id="ns-tokentext">
+ data-label="Send to: "
+ id="ns-tokentext">
</div>
<script>
- var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- tokenWidget.remove(1);
+ var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ tokenWidget.remove(1);
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<div data-role="tokentextarea"
- data-label="Send to: "
- id="ns-tokentext">
+ data-label="Send to: "
+ id="ns-tokentext">
</div>
<script>
- $("#ns-tokentext").tokentextarea("remove", 1);
+ $("#ns-tokentext").tokentextarea("remove", 1);
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-select">select</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">?string select(number blockIndex) </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">blockIndex</span></td>
<td>number</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- /* Select first block */
- var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
- tokenWidget.add("text 1");
- tokenWidget.add("text 2");
- tokenWidget.select(0);
-
- /* Get string from selected block */
- tokenWidget.select();
+ /* Select first block */
+ var tokenWidget = tau.widget.TokenTextarea(document.getElementById("ns-tokentext"));
+ tokenWidget.add("text 1");
+ tokenWidget.add("text 2");
+ tokenWidget.select(0);
+
+ /* Get string from selected block */
+ tokenWidget.select();
</script>
</pre>
- </div>
+ </div>
<div class="example">
<span class="example"><p>Code
example (jQuery API <strong>support for backward compatibility</strong>):</p><p></p></span>
prettyprint">
<div data-role="tokentextarea" id="ns-tokentext"></div>
<script>
- /* Select first block */
- $("#ns-tokentext").tokentextarea("add", "text 1");
- $("#ns-tokentext").tokentextarea("add", "text 2");
- $("#ns-tokentext").tokentextarea("select", "0");
+ /* Select first block */
+ $("#ns-tokentext").tokentextarea("add", "text 1");
+ $("#ns-tokentext").tokentextarea("add", "text 2");
+ $("#ns-tokentext").tokentextarea("select", "0");
- /* Get string from selected block */
- $("#ns-tokentext").tokentextarea("select");
+ /* Get string from selected block */
+ $("#ns-tokentext").tokentextarea("select");
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
+
+
+
+
</dl>
<pre class="prettyprint"><div id="button"></div>
<script>
- var buttonElement = document.getElementById("button"),
- button = tau.widget.Button(buttonElement);
+ var buttonElement = document.getElementById("button"),
+ button = tau.widget.Button(buttonElement);
</script>
</pre>
<td class="option">null</td>
<td class="option">Icon type.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-iconpos</span></td>
<td class="option">"left" | "right" | "top" | "bottom" | "notext" | null</td>
<td class="option">Position of the icon.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-inline</span></td>
<td class="option">boolean</td>
<td class="option">null</td>
<td class="option">Style of the button.</td>
</tr>
-
+
</tbody>
</table>
<pre class="prettyprint"><div id="button" class="ui-btn"></div>
<script>
- var buttonElement = document.getElementById("button"),
- button = tau.widget.Button(buttonElement);
-
- /*
- button.methodName(methodArgument1, methodArgument2, ...);
- For example:
- */
- button.value("text");
+ var buttonElement = document.getElementById("button"),
+ button = tau.widget.Button(buttonElement);
+
+ /*
+ button.methodName(methodArgument1, methodArgument2, ...);
+ For example:
+ */
+ button.value("text");
</script>
</pre>
</tr>
</thead>
<tbody>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint">Button <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the button.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">Button <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the button.</p></td>
</tr>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint">Button <a href="#method-refresh">refresh</a>() </pre>
</td>
<td><p>Refreshes a button markup.</p></td>
</tr>
-
-
-
-
+
+
+
+
<tr>
<td>
<pre class="intable prettyprint">string <a href="#method-value">value</a>(string? value) </pre>
</td>
<td><p>Gets or sets a value.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-disable">disable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Button disable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method sets the disabled attribute for the button and changes the look of the button to the disabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
prettyprint">
<div class="ui-btn" id="button"></div>
<script>
- var element = document.getElementById("button"),
- buttonWidget = tau.widget.Button(element);
- buttonWidget.disable();
+ var element = document.getElementById("button"),
+ buttonWidget = tau.widget.Button(element);
+ buttonWidget.disable();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-enable">enable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Button enable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method removes the disabled attribute from the button and changes the look of the button to the enabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
prettyprint">
<div class="ui-btn" id="button"></div>
<script>
- var element = document.getElementById("button"),
- buttonWidget = tau.widget.Button(element);
- buttonWidget.enable();
+ var element = document.getElementById("button"),
+ buttonWidget = tau.widget.Button(element);
+ buttonWidget.enable();
</script>
</pre>
</div>
</dd>
-
-
-
-
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-refresh">refresh</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Button refresh() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method rebuilds the DOM structure of the button component. It must be called after you manually change the HTML attributes of the component's DOM structure.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
prettyprint">
<div class="ui-btn" id="button"></div>
<script>
- var element = document.getElementById("button"),
- buttonWidget = tau.widget.Button(element);
- buttonWidget.refresh();
+ var element = document.getElementById("button"),
+ buttonWidget = tau.widget.Button(element);
+ buttonWidget.refresh();
</script>
</pre>
</div>
</dd>
-
-
-
-
-
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-value">value</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">string value(string? value) </pre>
</div>
-
+
<p><span class="version">Since: </span>
2.3
</p>
-
+
<div class="description">
<p>
<p>The method returns the inner text of the button or sets the text of the button.</p>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">value</span></td>
<td>string</td>
<td></td>
<td>Text to set for the button.</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
prettyprint">
<div class="ui-btn" id="button"></div>
<script>
- var element = document.getElementById("button"),
- buttonWidget = tau.widget.Button(element),
- /* Value contains inner text of button */
- value = buttonWidget.value();
+ var element = document.getElementById("button"),
+ buttonWidget = tau.widget.Button(element),
+ /* Value contains inner text of button */
+ value = buttonWidget.value();
- /* "New text" will be text of button */
- buttonWidget.value("New text");
+ /* "New text" will be text of button */
+ buttonWidget.value("New text");
</script>
</pre>
</div>
</dd>
-
-
+
+
</dl>
<div id="footer">
<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
<label for="checkbox-1">Normal</label>
<script>
- var element = document.getElementById("checkbox-1"),
- checkboxWidget = tau.widget.Checkbox(element);
- checkboxWidget.disable();
+ var element = document.getElementById("checkbox-1"),
+ checkboxWidget = tau.widget.Checkbox(element);
+ checkboxWidget.disable();
</script>
</pre>
</div>
<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
<label for="checkbox-1">Normal</label>
<script>
- var element = document.getElementById("checkbox-1"),
- checkboxWidget = tau.widget.Checkbox(element);
- checkboxWidget.enable();
+ var element = document.getElementById("checkbox-1"),
+ checkboxWidget = tau.widget.Checkbox(element);
+ checkboxWidget.enable();
</script>
</pre>
</div>
<input type="checkbox" name="checkbox-1" id="checkbox-1"/>
<label for="checkbox-1">Normal</label>
<script>
- var element = document.getElementById("checkbox-1"),
- checkboxWidget = tau.widget.Checkbox(element);
+ var element = document.getElementById("checkbox-1"),
+ checkboxWidget = tau.widget.Checkbox(element);
- /* Set value to checkbox element */
- checkboxWidget.value("checkbox-value");
- /* Return checked checkbox element */
- console.log(checkboxWidget.value());
+ /* Set value to checkbox element */
+ checkboxWidget.value("checkbox-value");
+ /* Return checked checkbox element */
+ console.log(checkboxWidget.value());
</script>
</pre>
</div>
<p>The constructor requires an <code>HTMLElement</code> parameter to create the component, and you can get it with the <code>document.getElementById()</code> method. The constructor can also take a second parameter, which is an object defining the configuration options for the component.</p>
<pre class="prettyprint">
<ul class="ui-colored-list" id="coloredlist">
- <li class="ui-li-static">Item</li>
- <li class="ui-li-static">Item</li>
- <li class="ui-li-static">Item</li>
+ <li class="ui-li-static">Item</li>
+ <li class="ui-li-static">Item</li>
+ <li class="ui-li-static">Item</li>
</ul>
<script>
- var elColoredList = document.getElementById("coloredlist"),
- coloredList = tau.widget.ColoredListview(elColoredList);
+ var elColoredList = document.getElementById("coloredlist"),
+ coloredList = tau.widget.ColoredListview(elColoredList);
</script>
</pre>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selector0.8635590926278383">Default Selector</a></li>
-
+
<li><a href="#html-examples0.06990464706905186">HTML Examples</a></li>
<li><a href="#drawer-options0.0814934759400785">Options</a></li>
<p>To create a drawer using the <code>class</code> attribute, use the following code:</p>
<pre class="prettyprint"><div class="ui-drawer" data-position="left" id="leftdrawer">
- <ul class="ui-listview">
- <li class="ui-drawer-main-list"><a href="#">List item 1</a></li>
- <li class="ui-drawer-main-list"><a href="#">List item 2</a></li>
- <li class="ui-drawer-sub-list"><a href="#">Sub item 1</a></li>
- </ul>
+ <ul class="ui-listview">
+ <li class="ui-drawer-main-list"><a href="#">List item 1</a></li>
+ <li class="ui-drawer-main-list"><a href="#">List item 2</a></li>
+ <li class="ui-drawer-sub-list"><a href="#">Sub item 1</a></li>
+ </ul>
</div>
</pre>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-duration</span></td>
<td class="option">number</td>
<td class="option">300</td>
<td class="option">Drawer duration in milliseconds.</td>
- </tr>
+ </tr>
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-position</span></td>
<td class="option">string</td>
<td class="option">"left"</td>
<td class="option">Drawer position.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-width</span></td>
<td class="option">number</td>
<td class="option">240</td>
<td class="option">Drawer width in pixels.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-close-on-click</span></td>
<td class="option">boolean</td>
</tr>
</thead>
<tbody>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Closes the drawer.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-isOpen">isOpen</a>() </pre>
</td>
<td><p>Opens the drawer.</p></td>
</tr>
-
-
-
-
+
+
+
+
</tbody>
</table>
<dl>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-close">close</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">close() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<div class="ui-drawer" data-position="left" id="leftdrawer">
- <ul class="ui-listview">
- <li class="ui-drawer-main-list"><a href="#">List item 1</a></li>
- <li class="ui-drawer-main-list"><a href="#">List item 2</a></li>
- <li class="ui-drawer-sub-list"><a href="#">Sub item 1</a></li>
- </ul>
+ <ul class="ui-listview">
+ <li class="ui-drawer-main-list"><a href="#">List item 1</a></li>
+ <li class="ui-drawer-main-list"><a href="#">List item 2</a></li>
+ <li class="ui-drawer-sub-list"><a href="#">Sub item 1</a></li>
+ </ul>
</div>
<script>
- var drawerElement = document.getElementById("leftdrawer"),
- drawer = tau.widget.Drawer(drawerElement);
- drawer.close();
+ var drawerElement = document.getElementById("leftdrawer"),
+ drawer = tau.widget.Drawer(drawerElement);
+ drawer.close();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-isOpen">isOpen</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">isOpen() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
boolean value
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<div class="ui-drawer" data-position="left" id="leftdrawer">
- <ul class="ui-listview">
- <li class="ui-drawer-main-list"><a href="#">List item 1</a></li>
- <li class="ui-drawer-main-list"><a href="#">List item 2</a></li>
- <li class="ui-drawer-sub-list"><a href="#">Sub item 1</a></li>
- </ul>
+ <ul class="ui-listview">
+ <li class="ui-drawer-main-list"><a href="#">List item 1</a></li>
+ <li class="ui-drawer-main-list"><a href="#">List item 2</a></li>
+ <li class="ui-drawer-sub-list"><a href="#">Sub item 1</a></li>
+ </ul>
</div>
<script>
- var drawerElement = document.getElementById("leftdrawer"),
- drawer = tau.widget.Drawer(drawerElement),
- isOpen = drawer.isOpen();
+ var drawerElement = document.getElementById("leftdrawer"),
+ drawer = tau.widget.Drawer(drawerElement),
+ isOpen = drawer.isOpen();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-open">open</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">open() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No return value
-
+
</div>
<div class="example">
<span class="example"><p>Code
<pre name="code" class="examplecode
prettyprint">
<div class="ui-drawer" data-position="left" id="leftdrawer">
- <ul class="ui-listview">
- <li class="ui-drawer-main-list"><a href="#">List item 1</a></li>
- <li class="ui-drawer-main-list"><a href="#">List item 2</a></li>
- <li class="ui-drawer-sub-list"><a href="#">Sub item 1</a></li>
- </ul>
+ <ul class="ui-listview">
+ <li class="ui-drawer-main-list"><a href="#">List item 1</a></li>
+ <li class="ui-drawer-main-list"><a href="#">List item 2</a></li>
+ <li class="ui-drawer-sub-list"><a href="#">Sub item 1</a></li>
+ </ul>
</div>
<script>
- var drawerElement = document.getElementById("leftdrawer"),
- drawer = tau.widget.Drawer(drawerElement);
- drawer.open();
+ var drawerElement = document.getElementById("leftdrawer"),
+ drawer = tau.widget.Drawer(drawerElement);
+ drawer.open();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
-
+
+
+
+
</dl>
<pre class="prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
- var element = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(element);
+ var element = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(element);
</script>
</pre>
<pre class="prettyprint">
<select data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre>
<pre class="prettyprint">
<select id="dropdownmenu" data-native-menu="false" data-inline="true">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre>
<p>If you use <code><option></code> with data-placeholder="true" attribute, you can make a default placeholder. </p>
<pre class="prettyprint">
<select id="dropdownmenu" data-native-menu="false" data-hide-placeholder-menu-items="false">
- <option value="choose-one" data-placeholder="true">Choose an option</option>
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="choose-one" data-placeholder="true">Choose an option</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
</pre>
<pre name="code" class="examplecode
prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
- var elDropdownMenu = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(elDropdownMenu);
+ var elDropdownMenu = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(elDropdownMenu);
- widget.open();
+ widget.open();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
- var elDropdownMenu = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(elDropdownMenu);
+ var elDropdownMenu = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(elDropdownMenu);
- widget.close();
+ widget.close();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
- var elDropdownMenu = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(elDropdownMenu);
+ var elDropdownMenu = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(elDropdownMenu);
- widget.enable();
+ widget.enable();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<select id="dropdownmenu" data-native-menu="false">
- <option value="1">Item1</option>
- <option value="2">Item2</option>
- <option value="3">Item3</option>
- <option value="4">Item4</option>
+ <option value="1">Item1</option>
+ <option value="2">Item2</option>
+ <option value="3">Item3</option>
+ <option value="4">Item4</option>
</select>
<script>
- var elDropdownMenu = document.getElementById("dropdownmenu"),
- widget = tau.widget.DropdownMenu(elDropdownMenu);
+ var elDropdownMenu = document.getElementById("dropdownmenu"),
+ widget = tau.widget.DropdownMenu(elDropdownMenu);
- widget.disable();
+ widget.disable();
</script>
</pre>
</div>
<p>The constructor requires an <code>HTMLElement</code> parameter to create the component, and you can get it with the <code>document.getElementById()</code> method. The constructor can also take a second parameter, which is an object defining the configuration options for the component.</p>
<pre class="prettyprint"><script>
- var expandableEl = document.getElementById("expandable"),
- expandableWidget = tau.widget.Expandable(expandableEl, {collapsed: false});
+ var expandableEl = document.getElementById("expandable"),
+ expandableWidget = tau.widget.Expandable(expandableEl, {collapsed: false});
</script>
</pre>
<p>To create a expandable <code>div</code> element using the <code>class</code> attribute:</p>
<pre class="prettyprint"><div id="expandable-test" class="ui-expandable" data-collapsed="false">
- <h1>Expandable head</h1>
- <div>Content</div>
+ <h1>Expandable head</h1>
+ <div>Content</div>
</div>
</pre></li>
<li>
<p>To create a expandable list using the <code>class</code> attribute:</p>
<pre class="prettyprint">
<ul class="ui-listview">
- <li class="ui-expandable" data-collapsed="false">
- <h2>Expandable head</h2>
- <!--Sub list in expandable li-->
- <ul class="ui-listview">
- <li>sub list item1</li>
- <li>sub list item2</li>
- </ul>
- </li>
- <!--List item in 1st depth-->
- <li>other list item</li>
- <li>other list item</li>
+ <li class="ui-expandable" data-collapsed="false">
+ <h2>Expandable head</h2>
+ <!--Sub list in expandable li-->
+ <ul class="ui-listview">
+ <li>sub list item1</li>
+ <li>sub list item2</li>
+ </ul>
+ </li>
+ <!--List item in 1st depth-->
+ <li>other list item</li>
+ <li>other list item</li>
</ul>
</pre></li></ul>
<p>To call a method on the component, please refer following:</p>
<pre class="prettyprint">var expandableElement = document.getElementById("expandable"),
- expandableWidget = tau.widget.Expandable(expandableElement);
+ expandableWidget = tau.widget.Expandable(expandableElement);
expandableWidget.methodName(methodArgument1, methodArgument2, ...);
</pre>
<pre name="code" class="examplecode
prettyprint">
<div id="expandable" class="ui-expandable">
- <h6>Expandable head</h6>
- <div>Content</div>
+ <h6>Expandable head</h6>
+ <div>Content</div>
</div>
<script>
- var expandableWidget = tau.widget.Expandable(document.getElementById("expandable"));
- expandableWidget.disable();
+ var expandableWidget = tau.widget.Expandable(document.getElementById("expandable"));
+ expandableWidget.disable();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<div id="expandable" class="ui-expandable">
- <h6>Expandable head</h6>
- <div>Content</div>
+ <h6>Expandable head</h6>
+ <div>Content</div>
</div>
<script>
- var expandableWidget = tau.widget.Expandable(document.getElementById("expandable"));
- expandableWidget.enable();
+ var expandableWidget = tau.widget.Expandable(document.getElementById("expandable"));
+ expandableWidget.enable();
</script>
</pre>
</div>
</dd>
-
+
</dl>
<p>The constructor requires an <code>HTMLElement</code> parameter to create the component, and you can get it with the <code>document.getElementById()</code> method. The constructor can also take a second parameter, which is an object defining the configuration options for the component.</p>
<pre class="prettyprint">
<div class="ui-floatingactions" id="floating">
- <button class="ui-floatingactions-item" data-icon="floating-add"/>
- <button class="ui-floatingactions-item" data-icon="floating-search"/>
+ <button class="ui-floatingactions-item" data-icon="floating-add"/>
+ <button class="ui-floatingactions-item" data-icon="floating-search"/>
</div>
<script>
- var elFloatingActions = document.getElementById("floating"),
- flaotingActions = tau.widget.FloatingActions(elFloatingActions);
+ var elFloatingActions = document.getElementById("floating"),
+ flaotingActions = tau.widget.FloatingActions(elFloatingActions);
</script>
</pre>
<p>The constructor requires an <code>HTMLElement</code> parameter to create the component, and you can get it with the <code>document.getElementById()</code> method. The constructor can also take a second parameter, which is an object defining the configuration options for the component.</p>
<pre class="prettyprint">
<ul id="gridview" class="ui-gridview">
- <li class="ui-gridview-item">
- <img class="ui-gridview-image" src="images/1.jpg"/>
- <div class="ui-gridview-handler"></div>
- </li>
- <li class="ui-gridview-item">
- <img class="ui-gridview-image" src="images/2.jpg"/>
- <div class="ui-gridview-handler"></div>
- </li>
- <li class="ui-gridview-item">
- <img class="ui-gridview-image" src="images/3.jpg"/>
- <div class="ui-gridview-handler"></div>
- </li>
- <li class="ui-gridview-item">
- <img class="ui-gridview-image" src="images/4.jpg"/>
- <div class="ui-gridview-handler"></div>
- </li>
+ <li class="ui-gridview-item">
+ <img class="ui-gridview-image" src="images/1.jpg"/>
+ <div class="ui-gridview-handler"></div>
+ </li>
+ <li class="ui-gridview-item">
+ <img class="ui-gridview-image" src="images/2.jpg"/>
+ <div class="ui-gridview-handler"></div>
+ </li>
+ <li class="ui-gridview-item">
+ <img class="ui-gridview-image" src="images/3.jpg"/>
+ <div class="ui-gridview-handler"></div>
+ </li>
+ <li class="ui-gridview-item">
+ <img class="ui-gridview-image" src="images/4.jpg"/>
+ <div class="ui-gridview-handler"></div>
+ </li>
</ul>
<script>
- var elGridView = document.getElementById("gridview"),
- gridView = tau.widget.GridView(elGridView);
+ var elGridView = document.getElementById("gridview"),
+ gridView = tau.widget.GridView(elGridView);
</script>
</pre>
<pre name="code" class="examplecode
prettyprint">
<script>
- var elGridView = document.getElementById("gridview"),
- gridView = tau.widget.GridView(elGridView),
- item;
+ var elGridView = document.getElementById("gridview"),
+ gridView = tau.widget.GridView(elGridView),
+ item;
- gridView.addItem(item);
+ gridView.addItem(item);
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<script>
- var elGridView = document.getElementById("gridview"),
- gridView = tau.widget.GridView(elGridView),
- item;
+ var elGridView = document.getElementById("gridview"),
+ gridView = tau.widget.GridView(elGridView),
+ item;
- gridView.removeItem(item);
+ gridView.removeItem(item);
</script>
</pre>
</div>
<pre class="prettyprint">
<div data-role="page" id="indexscrollbarPage">
- <div data-role="indexscrollbar" id="indexscrollbar"></div>
- <div data-role="content">
- <ul data-role="listview" class="ui-listview" id="isbList">
- <li class="ui-group-index">A</li>
- <li class="ui-li-static">Anton</li>
- <li class="ui-li-static">Arabella</li>
- <li class="ui-group-index">B</li>
- <li class="ui-li-static">Barry</li>
- <li class="ui-li-static">Bibi</li>
- </ul>
- </div>
+ <div data-role="indexscrollbar" id="indexscrollbar"></div>
+ <div data-role="content">
+ <ul data-role="listview" class="ui-listview" id="isbList">
+ <li class="ui-group-index">A</li>
+ <li class="ui-li-static">Anton</li>
+ <li class="ui-li-static">Arabella</li>
+ <li class="ui-group-index">B</li>
+ <li class="ui-li-static">Barry</li>
+ <li class="ui-li-static">Bibi</li>
+ </ul>
+ </div>
</div>
<script>
- var isb = tau.widget.IndexScrollbar(document.getElementById("indexscrollbar"));
+ var isb = tau.widget.IndexScrollbar(document.getElementById("indexscrollbar"));
</script>
</pre>
<p>To manually create a list view component, use the component constructor from the <code>tau</code> namespace:</p>
<pre class="prettyprint"><ul id="list">
- <li>Anton</li>
- <li>Arabella</li>
- <li>Barry</li>
- <li>Bill</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li>Barry</li>
+ <li>Bill</li>
</ul>
<script>
- tau.widget.Listview(document.getElementById("list"));
+ tau.widget.Listview(document.getElementById("list"));
</script>
</pre>
<h2><a id="html-example code0.796579651767388"></a>HTML Examples</h2>
<p>To create a list items without an anchor, use class=<code>"ui-li-static"</code>:</p>
-<pre class="prettyprint"><ul class="ui-listview">
- <li class="ui-li-static">list item1</li>
- <li class="ui-li-static">list item2</li>
- <li class="ui-li-static">list item3</li>
- <li class="ui-li-static">list item4</li>
+<pre class="prettyprint"><ul class="ui-listview">
+ <li class="ui-li-static">list item1</li>
+ <li class="ui-li-static">list item2</li>
+ <li class="ui-li-static">list item3</li>
+ <li class="ui-li-static">list item4</li>
</ul>
</pre>
<p>To create a list items with an anchor, use class=<code>"ui-li-anchor"</code>:</p>
-<pre class="prettyprint"><ul class="ui-listview">
- <li class="ui-li-anchor"><a href="page1.html">Page1</a></li>
- <li class="ui-li-anchor"><a href="page2.html">Page2</a></li>
- <li class="ui-li-anchor"><a href="page3.html">Page3</a></li>
- <li class="ui-li-anchor"><a href="page4.html">Page4</a></li>
+<pre class="prettyprint"><ul class="ui-listview">
+ <li class="ui-li-anchor"><a href="page1.html">Page1</a></li>
+ <li class="ui-li-anchor"><a href="page2.html">Page2</a></li>
+ <li class="ui-li-anchor"><a href="page3.html">Page3</a></li>
+ <li class="ui-li-anchor"><a href="page4.html">Page4</a></li>
</ul>
</pre>
<h2><a id="group"></a>Group Index in Listview</h2>
<p>To add Group Index (it was <i>ListDivider</i> in tizen2.3 TAU), just add a class=<code>"ui-group-index"</code>.</p>
-<pre class="prettyprint"><ul class="ui-listview">
- <li class="ui-group-index">group 1</li>
- <li class="ui-li-static">list item1</li>
- <li class="ui-li-static">list item2</li>
- <li class="ui-group-index">group 2</li>
- <li class="ui-li-static">list item1</li>
- <li class="ui-li-static">list item2</li>
+<pre class="prettyprint"><ul class="ui-listview">
+ <li class="ui-group-index">group 1</li>
+ <li class="ui-li-static">list item1</li>
+ <li class="ui-li-static">list item2</li>
+ <li class="ui-group-index">group 2</li>
+ <li class="ui-li-static">list item1</li>
+ <li class="ui-li-static">list item2</li>
</ul>
</pre>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selector">Default Selector</a>
-
+
<li><a href="#html-examples">HTML Examples</a>
</li>
-
+
</li>
<li><a href="#methods-list">Methods</a>
-
+
</li>
-
+
</ol>
<h2><a id="default-selector"></a>Default Selector</h2>
<p>Make the navigation component with the <code>class="ui-navigation"</code> or <code>data-role="navigation"</code> attribute. For semantic understanding, use the <code>nav</code> element.</p>
<pre class="prettyprint"><div class="ui-page">
- <div class="ui-header" data-position="fixed">
- <h1>title</h1>
- <nav class="ui-navigation" id="navigation"></nav>
- </div>
- <div class="ui-content"></div>
+ <div class="ui-header" data-position="fixed">
+ <h1>title</h1>
+ <nav class="ui-navigation" id="navigation"></nav>
+ </div>
+ <div class="ui-content"></div>
</div>
</pre>
</tbody>
</table>
<h4>HTML example with PanelChanger</h4>
-<pre class="prettyprint"><div id="panelPage" class="ui-page">
- <div class="ui-header" data-position="fixed">
- <h1>Navigation</h1>
- <nav id="navigation" class="ui-navigation">
- </nav>
- </div>
- <div class="ui-content">
- <div id="panelChanger" class="ui-panel-changer">
- <div id="mainpanel" class="ui-panel">
- <a href="#panel2">Go Panel 2</a>
- </div>
- </div>
- </div>
- <script src="./panel.js"></script>
+<pre class="prettyprint"><div id="panelPage" class="ui-page">
+ <div class="ui-header" data-position="fixed">
+ <h1>Navigation</h1>
+ <nav id="navigation" class="ui-navigation">
+ </nav>
+ </div>
+ <div class="ui-content">
+ <div id="panelChanger" class="ui-panel-changer">
+ <div id="mainpanel" class="ui-panel">
+ <a href="#panel2">Go Panel 2</a>
+ </div>
+ </div>
+ </div>
+ <script src="./panel.js"></script>
</div>
<!--panel.html-->
-<div id="panel2" class="ui-panel">
- <div class="ui-content">
- <ul class="ui-listview">
- <li class="ui-li-anchor">
- <a href="#panel3">Go Panel 3</a>
- </li>
- </ul>
- </div>
+<div id="panel2" class="ui-panel">
+ <div class="ui-content">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor">
+ <a href="#panel3">Go Panel 3</a>
+ </li>
+ </ul>
+ </div>
</div>
-<div id="panel3" class="ui-panel">
- <div class="ui-content">
- <ul class="ui-listview">
- <li class="ui-li-anchor">
- <a>Panel3</a>
- </li>
- </ul>
- </div>
+<div id="panel3" class="ui-panel">
+ <div class="ui-content">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor">
+ <a>Panel3</a>
+ </li>
+ </ul>
+ </div>
</div>
</pre>
<h4>JS example with PanelChanger</h4>
/* panel.js */
(function()
{
- var page = document.querySelector("#panelPage"),
- panelChanger = page.querySelector("#panelChanger"),
- panelChangerComponent,
- navigation = page.querySelector("#navigation"),
- navigationComponent,
- navigated = false;
-
- page.addEventListener("pagebeforeshow", function()
- {
- var activePanel = page.querySelector(".ui-panel-active");
- panelChangerComponent = tau.widget.PanelChanger(panelChanger);
- navigationComponent = tau.widget.Navigation(navigation);
- navigationComponent.push(activePanel.id);
- });
- panelChanger.addEventListener("panelchange", function(event)
- {
- var toPanel = event.detail.toPanel,
- direction = event.detail.direction,
- id = toPanel.id;
-
- if (id)
- {
- if (direction === "forward")
- {
- navigationComponent.push(id);
- }
- else
- {
- if (navigated === false)
- {
- navigationComponent.pop();
- }
- else
- {
- navigated = false;
- }
- }
- }
- else
- {
- console.warn("You should insert id value in the each panels")
- }
- });
- navigation.addEventListener("navigate", function(event)
- {
- var id = event.detail.id;
- navigated = true;
- panelChangerComponent.changePanel("#" + id, "slide-reverse", "back");
- });
+ var page = document.querySelector("#panelPage"),
+ panelChanger = page.querySelector("#panelChanger"),
+ panelChangerComponent,
+ navigation = page.querySelector("#navigation"),
+ navigationComponent,
+ navigated = false;
+
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var activePanel = page.querySelector(".ui-panel-active");
+ panelChangerComponent = tau.widget.PanelChanger(panelChanger);
+ navigationComponent = tau.widget.Navigation(navigation);
+ navigationComponent.push(activePanel.id);
+ });
+ panelChanger.addEventListener("panelchange", function(event)
+ {
+ var toPanel = event.detail.toPanel,
+ direction = event.detail.direction,
+ id = toPanel.id;
+
+ if (id)
+ {
+ if (direction === "forward")
+ {
+ navigationComponent.push(id);
+ }
+ else
+ {
+ if (navigated === false)
+ {
+ navigationComponent.pop();
+ }
+ else
+ {
+ navigated = false;
+ }
+ }
+ }
+ else
+ {
+ console.warn("You should insert id value in the each panels")
+ }
+ });
+ navigation.addEventListener("navigate", function(event)
+ {
+ var id = event.detail.id;
+ navigated = true;
+ panelChangerComponent.changePanel("#" + id, "slide-reverse", "back");
+ });
})();
</pre>
</tr>
</thead>
<tbody>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-create">create</a>() </pre>
</td>
<td><p>Pop last child of navigation.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method"><code><b><span class="methodName"
id="method-create">create</span><i><span style="color:red"> :DEPRECATED since 2.4</span></i></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">create() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
</dd>
-
-
+
+
</dl>
<dl>
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
- prettyprint"><div class="ui-header" data-position="fixed">
- <h1>Navigation</h1>
- <nav id="navigation" class="ui-navigation">
- </nav>
+ prettyprint"><div class="ui-header" data-position="fixed">
+ <h1>Navigation</h1>
+ <nav id="navigation" class="ui-navigation">
+ </nav>
</div>
-<div class="ui-content">
- <div id="panelChanger" class="ui-panel-changer">
- <div id="mainpanel" class="ui-panel" style="background-color:#ffff4f">
- <a href="./panel.html#panel2">Go Panel 2</a>
- </div>
- </div>
+<div class="ui-content">
+ <div id="panelChanger" class="ui-panel-changer">
+ <div id="mainpanel" class="ui-panel" style="background-color:#ffff4f">
+ <a href="./panel.html#panel2">Go Panel 2</a>
+ </div>
+ </div>
</div>
<script>
- var navigation = page.querySelector("#navigation"),
- activePanel = page.querySelector(".ui-panel-active"),
- navigationComponent = tau.widget.Navigation(navigation);
- navigationComponent.push(activePanel.id);
+ var navigation = page.querySelector("#navigation"),
+ activePanel = page.querySelector(".ui-panel-active"),
+ navigationComponent = tau.widget.Navigation(navigation);
+ navigationComponent.push(activePanel.id);
</script></pre>
</div>
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
-<pre name="code" class="examplecode prettyprint"><div class="ui-header" data-position="fixed">
- <h1>Navigation</h1>
- <nav id="navigation" class="ui-navigation">
- </nav>
+<pre name="code" class="examplecode prettyprint"><div class="ui-header" data-position="fixed">
+ <h1>Navigation</h1>
+ <nav id="navigation" class="ui-navigation">
+ </nav>
</div>
<script>
- var navigation = page.querySelector("#navigation"),
- navigationComponent = tau.widget.Navigation(navigation);
-
- navigationComponent.pop();
+ var navigation = page.querySelector("#navigation"),
+ navigationComponent = tau.widget.Navigation(navigation);
+
+ navigationComponent.pop();
</script>
</pre>
</div>
</dl>
-
+
<div id="footer">
<hr size="1">
<pre class="prettyprint">
var elPageIndicator = document.getElementById("pageIndicator"),
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5});
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5});
</pre>
<p>Constructor has two require parameter <strong>element</strong> which are base <strong>HTMLElement</strong> to create component. We recommend get this element by method <em>document.getElementById</em>.</p>
<p>To use page indicator with section changer component</p>
<pre class="prettyprint">
<div class="ui-content">
- <div class="ui-page-indicator" id="pageIndicator" data-number-of-pages="4" style="bottom: 0;"></div>
- <div id="hsectionchanger" class="ui-section-changer">
- <!--Section changer has only one child-->
- <div>
- <section class="ui-section-active">
- <ul class="ui-listview">
- <li class="ui-li-static">List</li>
- </ul>
- </section>
- <section>
- <ul class="ui-listview">
- <li class="ui-li-static">List</li>
- </ul>
- </section>
- <section>
- <ul class="ui-listview">
- <li class="ui-li-static">List</li>
- </ul>
- </section>
- <section>
- <ul class="ui-listview">
- <li class="ui-li-static">List</li>
- </ul>
- </section>
- </div>
- </div>
+ <div class="ui-page-indicator" id="pageIndicator" data-number-of-pages="4" style="bottom: 0;"></div>
+ <div id="hsectionchanger" class="ui-section-changer">
+ <!--Section changer has only one child-->
+ <div>
+ <section class="ui-section-active">
+ <ul class="ui-listview">
+ <li class="ui-li-static">List</li>
+ </ul>
+ </section>
+ <section>
+ <ul class="ui-listview">
+ <li class="ui-li-static">List</li>
+ </ul>
+ </section>
+ <section>
+ <ul class="ui-listview">
+ <li class="ui-li-static">List</li>
+ </ul>
+ </section>
+ <section>
+ <ul class="ui-listview">
+ <li class="ui-li-static">List</li>
+ </ul>
+ </section>
+ </div>
+ </div>
</div>
<script>
- var sectionChanger = document.getElementById("hsectionchanger"),
- elPageIndicator = document.getElementById("pageIndicator"),
- pageIndicator;
- pageIndicator = tau.widget.PageIndicator(elPageIndicator);
- sectionChanger.addEventListener("sectionchange", function(e)
- {
- pageIndicator.setActive(e.detail.active);
- }, false);
+ var sectionChanger = document.getElementById("hsectionchanger"),
+ elPageIndicator = document.getElementById("pageIndicator"),
+ pageIndicator;
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator);
+ sectionChanger.addEventListener("sectionchange", function(e)
+ {
+ pageIndicator.setActive(e.detail.active);
+ }, false);
</script>
</pre>
</li></ul>
<pre class="prettyprint">
var elPanelChanger = document.getElementById("panelchanger"),
- panelChanger = tau.widget.PanelChanger(elPanelChanger);
+ panelChanger = tau.widget.PanelChanger(elPanelChanger);
</pre>
<h2><a id="html-examples"></a>HTML Examples</h2>
<p>Panels in another HTML file panel.html</p>
<pre class="prettyprint">
<div id="panel2" class="ui-panel">
- <div class="ui-content">
- <ul class="ui-listview">
- <li class="ui-li-anchor">
- <a href="#panel3">Go Panel 3</a>
- </li>
- </ul>
- </div>
+ <div class="ui-content">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor">
+ <a href="#panel3">Go Panel 3</a>
+ </li>
+ </ul>
+ </div>
</div>
<div id="panel3" class="ui-panel">
- <div class="ui-content">
- <ul class="ui-listview">
- <li class="ui-li-anchor">
- <a>Panel3</a>
- </li>
- </ul>
- </div>
+ <div class="ui-content">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor">
+ <a>Panel3</a>
+ </li>
+ </ul>
+ </div>
</div>
</pre>
</li>
<p>Panel changer and main panel in your HTML file</p>
<pre class="prettyprint">
<div id="panelChanger" class="ui-panel-changer">
- <div id="mainpanel" class="ui-panel">
- <ul class="ui-listview">
- <li class="ui-li-anchor">
- <a href="./panel.html#panel2">Go Panel 2</a>
- </li>
- </ul>
- </div>
+ <div id="mainpanel" class="ui-panel">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor">
+ <a href="./panel.html#panel2">Go Panel 2</a>
+ </li>
+ </ul>
+ </div>
</div>
</pre>
</li>
</tr>
</thead>
<tbody>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-changePanel">changePanel</a>(String address, String animationType, String direction) </pre>
</td>
<td><p>Change panel method</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method"><code><b><span class="methodName"
id="method-changePanel">changePanel</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">changePanel(String address, String animationType, String direction) </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Type</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">address</span></td>
<td>String</td>
<td>path of a panel to be changed</td>
</tr>
-
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">animationType</span></td>
<td>String</td>
<td>animation type of panel changing</td>
</tr>
-
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">direction</span></td>
<td>String</td>
<td>represent panel history goes forward or backward.</td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
+
</dl>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.8939050626941025">Default Selectors</a>
-
+
</li>
-
-
+
+
<li><a href="#manual-constructor0.5366392943542451">Manual Constructor</a>
-
+
</li>
-
+
<li><a href="#html-examples0.8655443852767348">HTML Examples</a>
-
+
</li>
<li><a href="#popup-ctxpopup">Popup / ContextPopup</a>
</li>
<li><a href="#options-list">Options</a>
-
+
</li>
<li><a href="#events-list">Events</a>
-
+
</li>
<li><a href="#managing-popup">Managing a Popup</a>
-
+
</li>
-
+
</ol>
<h2><a id="default-selectors0.8939050626941025"></a>Default Selectors</h2>
<p>To manually create a button component, use the component constructor from the <code>tau</code> namespace:</p>
<pre class="prettyprint"><div id="popup">
- <p>This is not a popup yet. But when TAU namespace calls me as widget, I will be popup.</p>
+ <p>This is not a popup yet. But when TAU namespace calls me as widget, I will be popup.</p>
</div>
<script>
- var popupElement = document.getElementById("popup"),
- popup = tau.widget.Popup(popupElement);
+ var popupElement = document.getElementById("popup"),
+ popup = tau.widget.Popup(popupElement);
</script>
</pre>
<h3>Basic structure of Popup</h3>
<p>As basically, popup has <code>class="ui-popup-header"</code> as Header, <code>class="ui-popup-content"</code> as body and <code>class="ui-popup-footer"</code> as button area. Here is simple example:</p>
-<pre class="prettyprint"><div id="1btn_popup" class="ui-popup">
- <div class="ui-popup-header">Popup Header</div>
- <div class="ui-popup-content popup-content-padding">
- Lorem ipsum dolor sit amet,
- consectetur adiptiscing elit, sed
- doei usmod tempore sit ipsum
- </div>
- <div class="ui-popup-footer">
- <a class="ui-btn" data-rel="back" data-inline="true">Cancel</a>
- </div>
+<pre class="prettyprint"><div id="1btn_popup" class="ui-popup">
+ <div class="ui-popup-header">Popup Header</div>
+ <div class="ui-popup-content popup-content-padding">
+ Lorem ipsum dolor sit amet,
+ consectetur adiptiscing elit, sed
+ doei usmod tempore sit ipsum
+ </div>
+ <div class="ui-popup-footer">
+ <a class="ui-btn" data-rel="back" data-inline="true">Cancel</a>
+ </div>
</div>
</pre>
<h3>Context Popup</h3>
<p>Context popup(ctxpopup) has very simple structure. It does not need header or footer. So, just put content in <code><div></code> area. Please refer this example: </p>
-<pre class="prettyprint"><div id="ctxpopup_vertical_basic" class="ui-popup" data-overlay="false">
- <ul class="ui-listview">
- <li class="ui-li-anchor"><a href="#" data-rel="back">Copy</a></li>
- <li class="ui-li-anchor"><a href="#" data-rel="back">Cut</a></li>
- <li class="ui-li-anchor"><a href="#" data-rel="back">Paste</a></li>
- <li class="ui-li-anchor"><a href="#" data-rel="back">Clipboard</a></li>
- </ul>
+<pre class="prettyprint"><div id="ctxpopup_vertical_basic" class="ui-popup" data-overlay="false">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor"><a href="#" data-rel="back">Copy</a></li>
+ <li class="ui-li-anchor"><a href="#" data-rel="back">Cut</a></li>
+ <li class="ui-li-anchor"><a href="#" data-rel="back">Paste</a></li>
+ <li class="ui-li-anchor"><a href="#" data-rel="back">Clipboard</a></li>
+ </ul>
</div>
</pre>
<h3>Toast Popup</h3>
<p>If you want to show popup as toast, please add <code>"ui-popup-toast"</code> class with <code>"ui-popup"</code></p>
-<pre class="prettyprint"><div id="popup_toast" data-role="popup" class="ui-popup ui-popup-toast">
- <div class="ui-popup-content">
- Toast popup text Toast popup text
- </div>
+<pre class="prettyprint"><div id="popup_toast" data-role="popup" class="ui-popup ui-popup-toast">
+ <div class="ui-popup-content">
+ Toast popup text Toast popup text
+ </div>
</div>
</pre>
<p>There's one different factor between popup and context popup. It is <code>data-position-to</code> options of popup opener element.</p>
<h3>Open Popup as window popup</h3>
<p>When element has <code>data-position-to="window"</code>, it opens window popup(as known as normal popup window).</p>
-<pre class="prettyprint"><div data-role="page" class="ui-page" id="demo-page">
- <div class="ui-content">
- <ul class="ui-listview">
- <li class="ui-li-anchor"><a href="#1btn_popup" data-inline="true" data-rel="popup" data-position-to="window">1btn popup</a></li>
- </ul>
-
- <div id="1btn_popup" class="ui-popup">
- <div class="ui-popup-header">Popup Header</div>
- <div class="ui-popup-content popup-content-padding">
- Lorem ipsum dolor sit amet,
- consectetur adiptiscing elit, sed
- doei usmod tempore sit ipsum
- </div>
- <div class="ui-popup-footer">
- <a class="ui-btn" data-rel="back" data-inline="true">Cancel</a>
- </div>
- </div>
- </div>
+<pre class="prettyprint"><div data-role="page" class="ui-page" id="demo-page">
+ <div class="ui-content">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor"><a href="#1btn_popup" data-inline="true" data-rel="popup" data-position-to="window">1btn popup</a></li>
+ </ul>
+
+ <div id="1btn_popup" class="ui-popup">
+ <div class="ui-popup-header">Popup Header</div>
+ <div class="ui-popup-content popup-content-padding">
+ Lorem ipsum dolor sit amet,
+ consectetur adiptiscing elit, sed
+ doei usmod tempore sit ipsum
+ </div>
+ <div class="ui-popup-footer">
+ <a class="ui-btn" data-rel="back" data-inline="true">Cancel</a>
+ </div>
+ </div>
+ </div>
</div>
</pre>
<h3>Open Popup as context popup</h3>
<p>When element has <code>data-position-to="origin"</code>, it opens context popup.<br>
In mobile profile, default value is "origin" and if popup has no option about <code>data-position-to</code>, it opened as context popup.</p>
-<pre class="prettyprint"><div data-role="page" class="ui-page" id="demo-page">
- <div class="ui-content">
- <ul class="ui-listview">
- <li class="ui-li-anchor"><a href="#ctxpopup_vertical_basic" data-inline="true" data-rel="popup">Vertical Basic</a></li>
- </ul>
-
- <div id="ctxpopup_vertical_basic" class="ui-popup" data-overlay="false">
- <ul class="ui-listview">
- <li class="ui-li-anchor"><a href="#" data-rel="back">Copy</a></li>
- <li class="ui-li-anchor"><a href="#" data-rel="back">Cut</a></li>
- <li class="ui-li-anchor"><a href="#" data-rel="back">Paste</a></li>
- <li class="ui-li-anchor"><a href="#" data-rel="back">Clipboard</a></li>
- </ul>
- </div>
- </div>
+<pre class="prettyprint"><div data-role="page" class="ui-page" id="demo-page">
+ <div class="ui-content">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor"><a href="#ctxpopup_vertical_basic" data-inline="true" data-rel="popup">Vertical Basic</a></li>
+ </ul>
+
+ <div id="ctxpopup_vertical_basic" class="ui-popup" data-overlay="false">
+ <ul class="ui-listview">
+ <li class="ui-li-anchor"><a href="#" data-rel="back">Copy</a></li>
+ <li class="ui-li-anchor"><a href="#" data-rel="back">Cut</a></li>
+ <li class="ui-li-anchor"><a href="#" data-rel="back">Paste</a></li>
+ <li class="ui-li-anchor"><a href="#" data-rel="back">Clipboard</a></li>
+ </ul>
+ </div>
+ </div>
</div>
</pre>
<td class="option">["bottom","top", "right", "left"]</td>
<td class="option"><span style="color:red;"><i>DEPRECATED since 2.4</i></span></td>
</tr>
-
+
</tbody>
</table>
<pre class="prettyprint"><!--Popup HTML code-->
<div id="popup" data-role="popup">
- <p>This is a completely basic popup, no options set.</p>
+ <p>This is a completely basic popup, no options set.</p>
</div>
<script>
- /* Use popup events */
- var popup = document.getElementById("popup");
- popup.addEventListener("popupafteropen", function()
- {
- /* Implement code for popupafteropen event */
- });
+ /* Use popup events */
+ var popup = document.getElementById("popup");
+ popup.addEventListener("popupafteropen", function()
+ {
+ /* Implement code for popupafteropen event */
+ });
</script>
</pre>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">popupafteropen</span></td>
<td><p>Triggered when process of opening a popup is completed.<br />The event is triggered when the popup has completely appeared on the screen and all associated animations have completed.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">beforeposition</span></td>
<td><p>Triggered before a popup computes the coordinates where it appears.<br />The event is triggered before the popup starts the opening animations and calculates the coordinates. Handling this event gives an opportunity to modify the content of the popup before it appears on the screen.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">popupafterclose</span></td>
<td><p>Triggered when the process of closing a popup is completed.<br />The event is triggered when the popup has completely disappeared from the screen and all associated animations have completed.</p></td>
</tr>
-
+
</tbody>
</table>
<pre class="prettyprint"><!--Definition of link, which opens popup with popup id-->
<a href="#popup">Click to open popup</a>
<div id="popup" data-role="popup">
- <p>This is a completely basic popup, no options set.</p>
+ <p>This is a completely basic popup, no options set.</p>
</div>
</pre>
</li>
<p>To open a popup with the "popup" <code>id</code> property, the <code>tau</code> namespace can be used.:</p>
<pre class="prettyprint"><div id="popup">
- <p>This is a completely basic popup, no options set.</p>
+ <p>This is a completely basic popup, no options set.</p>
</div>
<script>
- var popupElement = document.getElementById("popup"),
- popup = tau.widget.Popup(popupElement);
- popup.open();
+ var popupElement = document.getElementById("popup"),
+ popup = tau.widget.Popup(popupElement);
+ popup.open();
</script>
</pre>
<p>With the TAU API, you can open a popup anywhere:</p>
<pre class="prettyprint"><div id="popup">
- <p>This is a completely basic popup, no options set.</p>
+ <p>This is a completely basic popup, no options set.</p>
</div>
<script>
- tau.openPopup("#popup");
+ tau.openPopup("#popup");
</script>
</pre></li></ul>
<p>If the link inside the popup has the <code>data-rel="back"</code> property, the popup is closed after clicking on it.<br>
The selector, which causes closing on click, can be changed by setting the <code>closeLinkSelector</code> option in the popup: </p>
-<pre class="prettyprint"><div id="1btn_popup" class="ui-popup">
- <div class="ui-popup-header">Popup Header</div>
- <div class="ui-popup-content popup-content-padding">
- Lorem ipsum dolor sit amet,
- consectetur adiptiscing elit, sed
- doei usmod tempore sit ipsum
- </div>
- <div class="ui-popup-footer">
- <a class="ui-btn" data-rel="back" data-inline="true">Cancel</a>
- </div>
+<pre class="prettyprint"><div id="1btn_popup" class="ui-popup">
+ <div class="ui-popup-header">Popup Header</div>
+ <div class="ui-popup-content popup-content-padding">
+ Lorem ipsum dolor sit amet,
+ consectetur adiptiscing elit, sed
+ doei usmod tempore sit ipsum
+ </div>
+ <div class="ui-popup-footer">
+ <a class="ui-btn" data-rel="back" data-inline="true">Cancel</a>
+ </div>
</div>
</pre>
<pre class="prettyprint"><a href="#popup" data-position-to="window">Click to open popup</a>
<div id="popup" data-role="popup">
- <p>This is a completely basic popup, no options set.</p>
+ <p>This is a completely basic popup, no options set.</p>
</div>
<script>
- var popupElement = document.getElementById("popup"),
- popup = tau.widget.Popup(popupElement);
- /* Close popup after opening */
- popupElement.addEventListener("popupafteropen", function()
- {
- popup.close();
- });
+ var popupElement = document.getElementById("popup"),
+ popup = tau.widget.Popup(popupElement);
+ /* Close popup after opening */
+ popupElement.addEventListener("popupafteropen", function()
+ {
+ popup.close();
+ });
</script>
</pre>
<p>With the TAU API, you can close a popup anywhere:</p>
<pre class="prettyprint"><div id="popup">
- <p>This is a completely basic popup, no options set.</p>
+ <p>This is a completely basic popup, no options set.</p>
</div>
<script>
- tau.closePopup();
+ tau.closePopup();
</script>
</pre></li></ul>
-
+
<div id="footer">
<hr size="1">
<h4>bar type</h4>
<pre class="prettyprint">
-<div class="ui-progress" data-type="bar"></div>
+<div class="ui-progress" data-type="bar"></div>
</pre>
<h4>activitybar type</h4>
<pre class="prettyprint">
-<div class="ui-progress" data-type="activitybar"></div>
+<div class="ui-progress" data-type="activitybar"></div>
</pre>
<h4>circle type</h4>
<pre class="prettyprint">
-<div class="ui-progress" data-type="circle"></div>
+<div class="ui-progress" data-type="circle"></div>
</pre>
<h4>activitycircle type</h4>
<pre class="prettyprint">
-<div class="ui-progress" data-type="activitycircle"></div>
+<div class="ui-progress" data-type="activitycircle"></div>
</pre>
<p>To manually create a progress component, use the component constructor from the <code>tau</code> namespace:</p>
-<pre class="prettyprint"><div id="progress"></div>
+<pre class="prettyprint"><div id="progress"></div>
<script>
- var element = document.getElementById("progress"),
- progress = tau.widget.Progress(element, {type : "progressbar"});
+ var element = document.getElementById("progress"),
+ progress = tau.widget.Progress(element, {type : "progressbar"});
</script>
</pre>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-type</span></td>
<td class="option">"bar" | "circle" |<br>
<td class="option">Sets size of progress component.<br>
(It used only with "circle" and "activitycircle" type)</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-value</span></td>
<td class="option">Number</td>
<pre class="prettyprint"><div id="progress"></div>
<script>
- var element = document.getElementById("progress"),
- progress = tau.widget.Progress(element);
-
- /*
- progress.methodName(argument1, argument2, ...);
- For example:
- */
- progress.refresh();
+ var element = document.getElementById("progress"),
+ progress = tau.widget.Progress(element);
+
+ /*
+ progress.methodName(argument1, argument2, ...);
+ For example:
+ */
+ progress.refresh();
</script>
</pre>
</td>
<td><p>Refreshes the Progress DOM.</p></td>
</tr>
-
+
</tbody>
</table>
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint"><script>
- var element = document.getElementById("progress"),
- progress = tau.widget.Progress(element),
- originValue;
+ var element = document.getElementById("progress"),
+ progress = tau.widget.Progress(element),
+ originValue;
- /* Get the origin value of progress */
- originValue = progress.value();
- console.log(originValue);
+ /* Get the origin value of progress */
+ originValue = progress.value();
+ console.log(originValue);
- /* Set the value of progress to 70 */
- progress.value(70);
+ /* Set the value of progress to 70 */
+ progress.value(70);
</script>
</pre>
</div>
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint"><script>
- var element = document.getElementById("progress"),
- progress = tau.widget.Progress(element),
- type;
+ var element = document.getElementById("progress"),
+ progress = tau.widget.Progress(element),
+ type;
- progress.option("value", 50);
- /* After change option, call refresh method */
- progress.refresh();
+ progress.option("value", 50);
+ /* After change option, call refresh method */
+ progress.refresh();
- /* Get type option value */
- type = progress.option("type");
- console.log(type);
+ /* Get type option value */
+ type = progress.option("type");
+ console.log(type);
</script>
</pre>
</div>
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint"><script>
- var element = document.getElementById("progress"),
- progress = tau.widget.Progress(element);
+ var element = document.getElementById("progress"),
+ progress = tau.widget.Progress(element);
- /* Change DOM dynamically or change option */
- progress.refresh();
+ /* Change DOM dynamically or change option */
+ progress.refresh();
</script>
</pre>
</div>
<input type="radio" name="radio-1" id="radio-1"/>
<label for="radio-1">Normal</label>
<script>
- var element = document.getElementById("radio-1"),
- radioWidget = tau.widget.Radio(element);
- radioWidget.disable();
+ var element = document.getElementById("radio-1"),
+ radioWidget = tau.widget.Radio(element);
+ radioWidget.disable();
</script>
</pre>
</div>
<input type="radio" name="radio-1" id="radio-1"/>
<label for="radio-1">Normal</label>
<script>
- var element = document.getElementById("radio-1"),
- radioWidget = tau.widget.Radio(element);
- radioWidget.enable();
+ var element = document.getElementById("radio-1"),
+ radioWidget = tau.widget.Radio(element);
+ radioWidget.enable();
</script>
</pre>
</div>
<input type="radio" name="radio-1" id="radio-1"/>
<label for="radio-1">Normal</label>
<script>
- var element = document.getElementById("radio-1"),
- radioWidget = tau.widget.Radio(element);
+ var element = document.getElementById("radio-1"),
+ radioWidget = tau.widget.Radio(element);
- /* Set value to radio element */
- radioWidget.value("radio-value");
- /* Return checked radio element */
- console.log(radioWidget.value());
+ /* Set value to radio element */
+ radioWidget.value("radio-value");
+ /* Return checked radio element */
+ console.log(radioWidget.value());
</script>
</pre>
</div>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.5337990545667708">Default Selectors</a>
-
+
</li>
-
+
<li><a href="#manual-constructor0.7136435771826655">Manual Constructor</a>
-
+
</li>
<li><a href="#methods0.952881425851956">Methods</a>
-
+
</li>
-
+
</ol>
<input type="search" id="search-test"/>
<script>
var searchEl = document.getElementById("search-test"),
- searchWidget = tau.widget.SearchInput(searchEl);
+ searchWidget = tau.widget.SearchInput(searchEl);
</script>
</pre>
<p>To call a method on the component, please refer the following:</p>
<pre class="prettyprint"><script>
- var searchInputElement = document.getElementById('search-test'),
- searchInput = tau.widget.SearcnInput(searchInputElement);
+ var searchInputElement = document.getElementById('search-test'),
+ searchInput = tau.widget.SearcnInput(searchInputElement);
- searchInput.methodName(methodArgument1, methodArgument2, ...);
+ searchInput.methodName(methodArgument1, methodArgument2, ...);
</script>
</pre>
<div class="synopsis">
<pre class="signature prettyprint">disable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method sets the disabled attribute for the search input and changes the look of the search input to the disabled state.</p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tbody>
</table>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
<script>
- var element = document.getElementById("searchinput"),
- searchInputWidget = tau.widget.SearchInput(element);
+ var element = document.getElementById("searchinput"),
+ searchInputWidget = tau.widget.SearchInput(element);
- searchInputWidget.disable();
+ searchInputWidget.disable();
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<script>
- var element = document.getElementById("searchinput"),
- searchInputWidget = tau.widget.SearchInput(element);
+ var element = document.getElementById("searchinput"),
+ searchInputWidget = tau.widget.SearchInput(element);
- searchInputWidget.enable();
+ searchInputWidget.enable();
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="../styles.css" rel="StyleSheet" type="text/css">
<link href="../snippet.css" rel="StyleSheet" type="text/css">
- <title>Section Changer</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ <title>Section Changer</title>
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Section Changer</h1>
<p>To create a simple SectionChanger with Header.</p>
<pre class="prettyprint"><div id="hasSectionchangerPage" class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">SectionChanger</h2>
- </header>
- <div class="ui-section-changer" id="sectionchanger">
- <div>
- <section>
- <h3>LEFT1 PAGE</h3>
- </section>
- <section class="ui-section-active">
- <h3>MAIN PAGE</h3>
- </section>
- <section>
- <h3>RIGHT1 PAGE</h3>
- </section>
- </div>
- </div>
+ <header class="ui-header">
+ <h2 class="ui-title">SectionChanger</h2>
+ </header>
+ <div class="ui-section-changer" id="sectionchanger">
+ <div>
+ <section>
+ <h3>LEFT1 PAGE</h3>
+ </section>
+ <section class="ui-section-active">
+ <h3>MAIN PAGE</h3>
+ </section>
+ <section>
+ <h3>RIGHT1 PAGE</h3>
+ </section>
+ </div>
+ </div>
</div>
</pre>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">sectionchange</span></td>
<td><p>Triggered when the section is changed.</p></td>
</tr>
-
+
</tbody>
</table>
<p>To use the <span style="font-family: Courier New,Courier,monospace">sectionchange</span> event, use the following code:</p>
<pre class="prettyprint">
-(function()
+(function()
{
- var changer = document.getElementById("sectionchanger");
- changer.addEventListener("sectionchange", function(evt)
- {
- console.debug(evt.detail.active + " section is active.");
- });
+ var changer = document.getElementById("sectionchanger");
+ changer.addEventListener("sectionchange", function(evt)
+ {
+ console.debug(evt.detail.active + " section is active.");
+ });
})();
</pre>
prettyprint">
<div id="sectionChanger"></div>
<script>
- var element = document.getElementById("sectionChanger"),
- sectionChangerWidget = tau.widget.SectionChanger(element);
+ var element = document.getElementById("sectionChanger"),
+ sectionChangerWidget = tau.widget.SectionChanger(element);
- sectionChangerWidget.setActiveSection(2);
+ sectionChangerWidget.setActiveSection(2);
</script>
</pre>
</div>
</div>
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
<div class="example">
<span class="example"><p>Code
prettyprint">
<div id="sectionChanger"></div>
<script>
- var element = document.getElementById("sectionChanger"),
- sectionChangerWidget = tau.widget.SectionChanger(element),
- activeSectionIndex;
+ var element = document.getElementById("sectionChanger"),
+ sectionChangerWidget = tau.widget.SectionChanger(element),
+ activeSectionIndex;
- activeSectionIndex = sectionChangerWidget.getActiveSectionIndex();
+ activeSectionIndex = sectionChangerWidget.getActiveSectionIndex();
</script>
</pre>
</div>
prettyprint">
<div id="sectionChanger"></div>
<script>
- var element = document.getElementById("sectionChanger"),
- sectionChangerWidget = tau.widget.SectionChanger(element);
+ var element = document.getElementById("sectionChanger"),
+ sectionChangerWidget = tau.widget.SectionChanger(element);
- /* Do some DOM changes dynamically */
+ /* Do some DOM changes dynamically */
- sectionChangerWidget.refresh();
+ sectionChangerWidget.refresh();
</script>
</pre>
</div>
</dl>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.42985791829414666">Default Selectors</a>
-
+
</li>
-
+
<li><a href="#manual-constructor0.6728984923101962">Manual Constructor</a>
-
+
</li>
-
+
<li><a href="#html-examples0.5146947458852082">HTML Examples</a>
</li>
-
+
<li><a href="#options-list">Options</a>
-
+
</li>
<li><a href="#methods0.2250751326791942">Methods</a>
-
+
</li>
-
+
</ol>
<h2><a id="default-selectors0.42985791829414666"></a>Default Selectors</h2>
<pre class="prettyprint"><input id="slider"/>
<script>
- var sliderElement = document.getElementById("slider"),
- slider = tau.widget.Slider(sliderElement);
+ var sliderElement = document.getElementById("slider"),
+ slider = tau.widget.Slider(sliderElement);
</script>
</pre>
<p>To call a method on the component, use one of the existing APIs:</p>
-<pre class="prettyprint"><input id="slider" type="range" name="slider" value="60" min="0" max="100"/>
+<pre class="prettyprint"><input id="slider" type="range" name="slider" value="60" min="0" max="100"/>
<script>
- var slider = document.getElementById("slider"),
- slider = tau.widget.Slider(slider);
-
- /*
- slider.methodName(methodArgument1, methodArgument2, ...);
- For example:
- */
- var value = slider.value(5);
+ var slider = document.getElementById("slider"),
+ slider = tau.widget.Slider(slider);
+
+ /*
+ slider.methodName(methodArgument1, methodArgument2, ...);
+ For example:
+ */
+ var value = slider.value(5);
</script>
</pre>
</tr>
</thead>
<tbody>
-
+
<tr>
<td>
<pre class="intable prettyprint">Slider <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the slider.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">Slider <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the slider.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
</td>
<td><p>Refreshes a slider markup.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">string <a href="#method-value">value</a>() </pre>
</td>
<td><p>Gets or sets a value.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-disable">disable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Slider disable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method sets the disabled attribute for the slider and changes the look of the slider to the disabled state.</p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
prettyprint">
<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10"/>
<script>
- var slider = document.getElementById("mySlider1"),
- sliderWidget = tau.widget.Slider(slider);
- sliderWidget.disable();
+ var slider = document.getElementById("mySlider1"),
+ sliderWidget = tau.widget.Slider(slider);
+ sliderWidget.disable();
</script>
</pre>
</div>
<div class="synopsis">
<pre class="signature prettyprint">Slider enable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method removes the disabled attribute from the slider and changes the look of the slider to the enabled state.</p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</table>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example :</p><p></p></span>
prettyprint">
<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10"/>
<script>
- var slider = document.getElementById("mySlider1"),
- sliderWidget = tau.widget.Slider(slider);
- sliderWidget.enable();
+ var slider = document.getElementById("mySlider1"),
+ sliderWidget = tau.widget.Slider(slider);
+ sliderWidget.enable();
</script>
</pre>
</div>
<div class="synopsis">
<pre class="signature prettyprint">Slider refresh() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method rebuilds the DOM structure of the slider component. It must be called after you manually change the HTML attributes of the component's DOM structure.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example :</p><p></p></span>
prettyprint">
<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10"/>
<script>
- var slider = document.getElementById("mySlider1"),
- sliderWidget = tau.widget.Slider(slider);
- sliderWidget.refresh();
+ var slider = document.getElementById("mySlider1"),
+ sliderWidget = tau.widget.Slider(slider);
+ sliderWidget.refresh();
</script>
</pre>
</div>
</dd>
-
+
<dt class="method" id="addidp28072"><code><b><span class="methodName"
id="method-value">value</span></b></code></dt>
<div class="synopsis">
<pre class="signature prettyprint">string value() </pre>
</div>
-
+
<p><span class="version">Since: </span>
2.3
</p>
-
+
<div class="description">
<p>
<p>The method returns the element value or sets the element value.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example :</p><p></p></span>
prettyprint">
<input id="mySlider1" name="mySlider1" data-popup='false' type="range" value="5" min="0" max="10"/>
<script>
- var slider = document.getElementById("mySlider1"),
- sliderWidget = tau.widget.Slider(slider);
- /* Value contains index of select tag */
- value = sliderWidget.value();
- /* Sets the index for the slider */
- sliderWidget.value("1");
+ var slider = document.getElementById("mySlider1"),
+ sliderWidget = tau.widget.Slider(slider);
+ /* Value contains index of select tag */
+ value = sliderWidget.value();
+ /* Sets the index for the slider */
+ sliderWidget.value("1");
</script>
</pre>
</div>
</dd>
-
-
+
+
</dl>
<h4><a id="tabbar"></a>Using tabbar in Tabs component</h4>
<p>To use Tabs component, it need tabbar as child.<br>
When define tabbar in HTML, just add <code>class="ui-tabbar"</code>. Please refer following code:</p>
-<pre class="prettyprint"><div class="ui-page">
- <div class="ui-tabs">
- <div class="ui-tabbar">
- <ul>
- <li class="ui-li-anchor"><a href="#" class="ui-tab-active">Tab1</a></li>
- <li class="ui-li-anchor"><a href="#">Tab2</a></li>
- <li class="ui-li-anchor"><a href="#">Tab3</a></li>
- <li class="ui-li-anchor"><a href="#">Tab4</a></li>
- </ul>
- </div>
- </div>
+<pre class="prettyprint"><div class="ui-page">
+ <div class="ui-tabs">
+ <div class="ui-tabbar">
+ <ul>
+ <li class="ui-li-anchor"><a href="#" class="ui-tab-active">Tab1</a></li>
+ <li class="ui-li-anchor"><a href="#">Tab2</a></li>
+ <li class="ui-li-anchor"><a href="#">Tab3</a></li>
+ <li class="ui-li-anchor"><a href="#">Tab4</a></li>
+ </ul>
+ </div>
+ </div>
</div>
</pre>
<h4>Using tabbar and SectionChanger in Tabs component</h4>
-<pre class="prettyprint"><div class="ui-page">
- <div class="ui-tabs">
- <div class="ui-tabbar">
- <ul>
- <li class="ui-li-anchor"><a href="#" class="ui-tab-active">Tab1</a></li>
- <li class="ui-li-anchor"><a href="#">Tab2</a></li>
- <li class="ui-li-anchor"><a href="#">Tab3</a></li>
- <li class="ui-li-anchor"><a href="#">Tab4</a></li>
- </ul>
- </div>
- <div class="ui-section-changer" id="sectionChanger">
- <div>
- <section class="ui-section-active">
- Section1
- </section>
- <section>
- Section 2
- </section>
- <section>
- Section 3
- </section>
- <section>
- Section 4
- </section>
- </div>
- </div>
- </div>
+<pre class="prettyprint"><div class="ui-page">
+ <div class="ui-tabs">
+ <div class="ui-tabbar">
+ <ul>
+ <li class="ui-li-anchor"><a href="#" class="ui-tab-active">Tab1</a></li>
+ <li class="ui-li-anchor"><a href="#">Tab2</a></li>
+ <li class="ui-li-anchor"><a href="#">Tab3</a></li>
+ <li class="ui-li-anchor"><a href="#">Tab4</a></li>
+ </ul>
+ </div>
+ <div class="ui-section-changer" id="sectionChanger">
+ <div>
+ <section class="ui-section-active">
+ Section1
+ </section>
+ <section>
+ Section 2
+ </section>
+ <section>
+ Section 3
+ </section>
+ <section>
+ Section 4
+ </section>
+ </div>
+ </div>
+ </div>
</div>
</pre>
<pre class="prettyprint">
<script>
- var tabsElement = document.getElementById("tabs"),
- tabs;
- tabs = tau.widget.Tabs(tabsElement);
+ var tabsElement = document.getElementById("tabs"),
+ tabs;
+ tabs = tau.widget.Tabs(tabsElement);
</script>
</pre>
</div>
</dd>
</dl>
-
+
<div id="footer">
<hr size="1">
<font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a
<pre class="prettyprint">
<script>
- var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
+ var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
</script>
</pre>
<pre class="prettyprint">
var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
textEnveloper.methodName(methodArgument1, methodArgument2, ...);
</pre>
<pre name="code" class="examplecode
prettyprint">
<script>
- var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
+ var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
- textEnveloper.add("hello");
+ textEnveloper.add("hello");
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<script>
- var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
+ var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement);
- textEnveloper.remove(1);
+ textEnveloper.remove(1);
</script>
</pre>
</div>
<pre name="code" class="examplecode
prettyprint">
<script>
- var textEnveloperElement = document.getElementById("textenveloper"),
- textEnveloper = tau.component.TextEnveloper(textEnveloperElement),
- textTokenLength;
-
- textEnveloper.add("hello1");
- textEnveloper.add("hello2");
- /* textTokenLength will be 2 */
- textTokenLength = textEnveloper.length();
+ var textEnveloperElement = document.getElementById("textenveloper"),
+ textEnveloper = tau.component.TextEnveloper(textEnveloperElement),
+ textTokenLength;
+
+ textEnveloper.add("hello1");
+ textEnveloper.add("hello2");
+ /* textTokenLength will be 2 */
+ textTokenLength = textEnveloper.length();
</script>
</pre>
</div>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.465151343960315">Default selectors</a></li>
<li><a href="#html-examples0.4583768437150866">HTML Examples</a></li>
-
+
<li><a href="#options-list">Options</a></li>
-
+
<li><a href="#methods-list">Methods</a></li>
</ol>
<h4><a id='create-simple text input on input element0.7723784036934376'></a>Create simple text input on INPUT element with clear button</h4>
-<pre class="prettyprint"><label for="texttype">Text Input:</label>
-<input type="text" name="texttype" id="texttype" placeholder="Input text here" data-clear-btn="true"/>
+<pre class="prettyprint"><label for="texttype">Text Input:</label>
+<input type="text" name="texttype" id="texttype" placeholder="Input text here" data-clear-btn="true"/>
</pre>
<h4><a id='create-simple text input on textarea element0.9774331215303391'></a>Create simple text input on TEXTAREA element</h4>
-<pre class="prettyprint"><label for="textarea">Text Area:</label>
-<textarea type="text" name="textarea" id="textarea" placeholder="Input text here"></textarea>
+<pre class="prettyprint"><label for="textarea">Text Area:</label>
+<textarea type="text" name="textarea" id="textarea" placeholder="Input text here"></textarea>
</pre>
<td class="option">false</td>
<td class="option">option indicates that the clear button will be shown</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-text-line</span></td>
<td class="option">boolean</td>
<td class="option">true</td>
<td class="option">option indicates that the text underline will be shown</td>
</tr>
-
+
</tbody>
</table>
</tr>
</thead>
<tbody>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint">TextInput <a href="#method-enable">enable</a>() </pre>
</td>
<td><p>Enables the TextInput</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">TextInput <a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the TextInput</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method"><code><b><span class="methodName"
id="method-enable">enable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">TextInput enable() </pre>
</div>
-
+
<div class="description">
<p>
<p>Method removes disabled attribute on input and changes look of input to enabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
- prettyprint"><input type="text" name="texttype" id="texttype"/>
+ prettyprint"><input type="text" name="texttype" id="texttype"/>
<script>
- var inputElement = document.getElementById("texttype"),
- textInputWidget = tau.widget.TextInput();
+ var inputElement = document.getElementById("texttype"),
+ textInputWidget = tau.widget.TextInput();
- textInputWidget.enable();
+ textInputWidget.enable();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-disable">disable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">TextInput disable() </pre>
</div>
-
+
<div class="description">
<p>
<p>Method adds disabled attribute on input and changes look of input to disable state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
- prettyprint"><input type="text" name="texttype" id="texttype"/>
+ prettyprint"><input type="text" name="texttype" id="texttype"/>
<script>
- var inputElement = document.getElementById("texttype"),
- textInputWidget = tau.widget.TextInput();
+ var inputElement = document.getElementById("texttype"),
+ textInputWidget = tau.widget.TextInput();
- textInputWidget.disable();
+ textInputWidget.disable();
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
-
+
<div id="footer">
<hr size="1">
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors">Default Selectors</a>
-
+
</li>
<li><a href="#html-examples">HTML Example</a>
</li>
-
+
<li><a href="#manual-constructor">Manual Constructor</a>
-
+
</li>
-
+
<li><a href="#methods-list">Methods</a>
-
+
</li>
-
+
</ol>
<p>Following example shows how to create toggle switch in multiple way:</p>
<h4>ToggleSwitch with input tag</h4>
<pre class="prettyprint">
-<input type="checkbox" name="toggle-1" id="toggle-1" class="ui-toggleswitch"/>
+<input type="checkbox" name="toggle-1" id="toggle-1" class="ui-toggleswitch"/>
-<!--Disabled toggle switch-->
-<input type="checkbox" name="toggle-2" id="toggle-2" class="ui-toggleswitch" disabled />
+<!--Disabled toggle switch-->
+<input type="checkbox" name="toggle-2" id="toggle-2" class="ui-toggleswitch" disabled />
</pre>
<h4>ToggleSwitch with select tag</h4>
<pre class="prettyprint">
-<select name="flip-1" id="flip-1" class="ui-toggleswitch">
- <option value="off"></option>
- <option value="on"></option>
+<select name="flip-1" id="flip-1" class="ui-toggleswitch">
+ <option value="off"></option>
+ <option value="on"></option>
</select>
</pre>
<p>To manually create a toggle switch component, use the component constructor from the <strong>tau</strong> namespace:</p>
<pre class="prettyprint">
-<input type="checkbox" name="toggle-1" id="toggle-1" class="ui-toggleswitch"/>
+<input type="checkbox" name="toggle-1" id="toggle-1" class="ui-toggleswitch"/>
<script>
- var toggleComponent = tau.widget.ToggleSwitch(document.getElementById("toggle-1"));
+ var toggleComponent = tau.widget.ToggleSwitch(document.getElementById("toggle-1"));
</script>
</pre>
</tr>
</thead>
<tbody>
-
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-disable">disable</a>() </pre>
</td>
<td><p>Disables the toggle switch.</p></td>
- </tr>
-
+ </tr>
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-enable">enable</a>() </pre>
<pre class="intable prettyprint"><a href="#method-value">value</a>() </pre>
</td>
<td><p>Gets toggleswitch state value.</p></td>
- </tr>
-
+ </tr>
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method"><code><b><span class="methodName"
id="method-disable">disable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">ToggleSwitch disable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method sets disabled attribute on for the toggle switch and changes the look of the toggle switch to the disabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<select name="flip-1" id="flip-1" class="ui-toggleswitch">
- <option value="off"></option>
- <option value="on"></option>
+<select name="flip-1" id="flip-1" class="ui-toggleswitch">
+ <option value="off"></option>
+ <option value="on"></option>
</select>
<script>
- var toggle = document.getElementById("flip-11"),
- toggleWidget = tau.widget.ToggleSwitch(toggle);
- toggleWidget.disable();
+ var toggle = document.getElementById("flip-11"),
+ toggleWidget = tau.widget.ToggleSwitch(toggle);
+ toggleWidget.disable();
</script>
</pre>
</div>
-
-
-
- </dd>
-
-
-
-
+
+
+
+ </dd>
+
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-enable">enable</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">ToggleSwitch enable() </pre>
</div>
-
+
<div class="description">
<p>
<p>The method removes the disabled attribute from the toggle switch and changes the look of the toggle switch to the enabled state.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<select name="flip-1" id="flip-1" class="ui-toggleswitch">
- <option value="off"></option>
- <option value="on"></option>
+<select name="flip-1" id="flip-1" class="ui-toggleswitch">
+ <option value="off"></option>
+ <option value="on"></option>
</select>
<script>
- var toggle = document.getElementById("flip-11"),
- toggleWidget = tau.widget.ToggleSwitch(toggle);
- toggleWidget.enable();
+ var toggle = document.getElementById("flip-11"),
+ toggleWidget = tau.widget.ToggleSwitch(toggle);
+ toggleWidget.enable();
</script>
</pre>
</div>
-
+
</dd>
-
+
<dt class="method"><code><b><span class="methodName"
id="method-value">value</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">Number value() </pre>
</div>
-
+
<p><span class="version">Since: </span>
2.3
</p>
-
+
<div class="description">
<p>
<p>This method returns the element value. For ToggleSwitch, when toggle switch has 'on' state, it returns 1. Otherwise, it returns 0.</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode
prettyprint">
-<select name="flip-1" id="flip-1" class="ui-toggleswitch">
- <option value="off"></option>
- <option value="on"></option>
+<select name="flip-1" id="flip-1" class="ui-toggleswitch">
+ <option value="off"></option>
+ <option value="on"></option>
</select>
<script>
- var toggle = document.getElementById("flip-11"),
- toggleWidget = tau.widget.ToggleSwitch(toggle),
- toggleState = toggleWidget.value();
- console.log(toggleState);
+ var toggle = document.getElementById("flip-11"),
+ toggleWidget = tau.widget.ToggleSwitch(toggle),
+ toggleState = toggleWidget.value();
+ console.log(toggleState);
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
-
+
<div id="footer">
<th>UI component</th>
<th>Description</th>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_Autodividers.htm">Autodividers</a></td>
<td>Autodividers component extension automatically creates dividers for a list view component.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_Checkboxradio.htm">Checkbox Radio</a></td>
<td>Checkbox radio component changes the default browser checkboxes and radio buttons to a form more adapted to the mobile environment.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_Collapsible.htm">Collapsible</a></td>
<td>Collapsible component allows you to expand or collapse content when tapped.</td>
<td><a href="deprecated/mobile_Controlgroup.htm">Control Group</a></td>
<td>Control group component improves the styling of multiple buttons by grouping them into a single block.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_Datetimepicker.htm">Date-time Picker</a></td>
<td>Date-time picker component shows a control that the user can use to enter date and time values.</td>
<td><a href="deprecated/mobile_Gallery.htm">Gallery</a></td>
<td>Gallery component shows images in a gallery on the screen.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_ListDivider.htm">List Divider</a></td>
<td>List divider component creates a list separator, which can be used for grouping list items.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_MultimediaView.htm">Multimedia View</a></td>
<td>Multimedia view component displays the audio and video player.</td>
<td><a href="deprecated/mobile_Notification.htm">Notification</a></td>
<td>Notification component shows a pop-up on the screen to provide notifications.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_ProgressBar.htm">Progress Bar</a></td>
<td>Progress bar component shows a control that indicates the progress percentage of an on-going operation.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_ScrollHandler.htm">Scroll Handler</a></td>
<td>Scroll Handler component is an extension for the scroll view component, and adds a scroll button that looks like a handle.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_SearchBar.htm">Search Bar</a></td>
<td>Search bar component is used to search for page content.</td>
<td><a href="deprecated/mobile_TabBar.htm">Tab Bar</a></td>
<td>Tab bar component shows an unordered list of buttons on the screen wrapped together in a single group.</td>
</tr>
-
+
<tr>
<td><a href="deprecated/mobile_Tokentextarea.htm">Token Text Area</a></td>
<td>Token text area component changes a text item to a button.</td>
</tr>
-
+
</tbody>
</table>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
- <head>
+ <head>
<script type="text/javascript" src="../snippet.js"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
- <title>Button</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ <title>Button</title>
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Button</h1>
<p>To use the icon button, add this class to the <span style="font-family: Courier New,Courier,monospace">button</span> element. To insert a custom icon, use the following code:</p>
<pre class="prettyprint">
<div class="ui-grid-row">
- <button type="button" class="ui-btn ui-btn-icon"
- style="background-image: url(images/00_icon_back_ef.png);">
- Button Icon
- </button>
+ <button type="button" class="ui-btn ui-btn-icon"
+ style="background-image: url(images/00_icon_back_ef.png);">
+ Button Icon
+ </button>
</div>
</pre><p>The Tizen wearable Web UI framework does not provide styles for an icon with text.</p>
</td>
<ul><li><p>For columns:</p>
<pre class="prettyprint">
<div class="ui-grid-col-3" style="height:76px">
- <button type="button" class="ui-btn">Button Circle</button>
- <a href="#" class="ui-btn ui-color-red">A Button Circle</a>
- <input type="button" class="ui-btn ui-color-orange" value="Input Button Circle"/>
+ <button type="button" class="ui-btn">Button Circle</button>
+ <a href="#" class="ui-btn ui-color-red">A Button Circle</a>
+ <input type="button" class="ui-btn ui-color-orange" value="Input Button Circle"/>
</div>
</pre></li>
<li><p>For rows:</p>
<pre class="prettyprint">
<div class="ui-grid-row">
- <button type="button" class="ui-btn">Button Circle</button>
- <a href="#" class="ui-btn ui-color-red">A Button Circle</a>
- <input type="button" class="ui-btn ui-color-orange" value="Input Button Circle"/>
+ <button type="button" class="ui-btn">Button Circle</button>
+ <a href="#" class="ui-btn ui-color-red">A Button Circle</a>
+ <input type="button" class="ui-btn ui-color-orange" value="Input Button Circle"/>
</div>
</pre></li></ul>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
- <title>Checkbox and Radio Button</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ <title>Checkbox and Radio Button</title>
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Checkbox and Radio Button</h1>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#html-example">HTML Examples</a>
<ol class="toc">
<li><a href="#html-example-list">Using checkbox/radio in Listview</a></li>
-
+
</ol>
<p>To add a checkbox or radio button to a list, use the following code:</p>
<pre class="prettyprint">
<ul class="ui-listview">
- <li class="li-has-radio">
- <label>
- Radio checked
- <input type="radio" name="radioset" checked="checked"/>
- </label>
- </li>
- <li class="li-has-radio">
- <label>
- Radio button
- <input type="radio" name="radioset"/>
- </label>
- </li>
- </label>
- </li>
- <li class="li-has-radio disabled">
- <label>
- Radio disabled
- <input type="radio" name="radioset" disabled="disabled"/>
- </label>
- </li>
+ <li class="li-has-radio">
+ <label>
+ Radio checked
+ <input type="radio" name="radioset" checked="checked"/>
+ </label>
+ </li>
+ <li class="li-has-radio">
+ <label>
+ Radio button
+ <input type="radio" name="radioset"/>
+ </label>
+ </li>
+ </label>
+ </li>
+ <li class="li-has-radio disabled">
+ <label>
+ Radio disabled
+ <input type="radio" name="radioset" disabled="disabled"/>
+ </label>
+ </li>
</ul>
</pre>
<p>Use the following code in the <span style="font-family: Courier New,Courier,monospace">style.css</span> file of your application to support a wide label tap area:</p>
<pre class="prettyprint">
-.ui-listview li input[type="checkbox"]:not(.ui-switch-input),
+.ui-listview li input[type="checkbox"]:not(.ui-switch-input),
.ui-listview li input[type="radio"]
{
- position: absolute;
- right: 30px;
- top: 0px;
- margin-top: 25px;
+ position: absolute;
+ right: 30px;
+ top: 0px;
+ margin-top: 25px;
}
-.ui-listview li.li-has-checkbox label,
+.ui-listview li.li-has-checkbox label,
.ui-listview li.li-has-radio label
{
- display: block;
- padding: 31.5px 94px 31.5px 40px;
- margin: -30px -8px -21px -38px;
+ display: block;
+ padding: 31.5px 94px 31.5px 40px;
+ margin: -30px -8px -21px -38px;
}
</pre>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<pre class="prettyprint">
<div class="ui-page" id="pageCircleProgressBar">
- <header class="ui-header"></header>
- <div class="ui-content">
- <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
- </div>
+ <header class="ui-header"></header>
+ <div class="ui-content">
+ <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
+ </div>
</div>
<script>
- (function()
- {
- var page = document.getElementById("pageCircleProgressBar"),
- progressBar = document.getElementById("circleprogress"),
- progressBarWidget;
-
- page.addEventListener("pageshow", function()
- {
- /* Make Circle Progressbar object */
- progressBarWidget = new tau.widget.CircleProgressBar(progressBar);
- });
-
- page.addEventListener("pagehide", function()
- {
- /* Release object */
- progressBarWidget.destroy();
- });
- }());
+ (function()
+ {
+ var page = document.getElementById("pageCircleProgressBar"),
+ progressBar = document.getElementById("circleprogress"),
+ progressBarWidget;
+
+ page.addEventListener("pageshow", function()
+ {
+ /* Make Circle Progressbar object */
+ progressBarWidget = new tau.widget.CircleProgressBar(progressBar);
+ });
+
+ page.addEventListener("pagehide", function()
+ {
+ /* Release object */
+ progressBarWidget.destroy();
+ });
+ }());
</script>
</pre>
</p>
<pre class="prettyprint">
<div class="ui-page" id="pageCircleProgressBar">
- <header class="ui-header"></header>
- <div class="ui-content"></div>
- <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
+ <header class="ui-header"></header>
+ <div class="ui-content"></div>
+ <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
</div>
<script>
- (function()
- {
- var page = document.getElementById("pageCircleProgressBar"),
- progressBar = document.getElementById("circleprogress"),
- progressBarWidget;
-
- page.addEventListener("pageshow", function()
- {
- /* Make Circle Progressbar object */
- progressBarWidget = new tau.widget.CircleProgressBar(progressBar, {size: "full"});
- });
-
- page.addEventListener("pagehide", function()
- {
- /* Release object */
- progressBarWidget.destroy();
- });
- }());
+ (function()
+ {
+ var page = document.getElementById("pageCircleProgressBar"),
+ progressBar = document.getElementById("circleprogress"),
+ progressBarWidget;
+
+ page.addEventListener("pageshow", function()
+ {
+ /* Make Circle Progressbar object */
+ progressBarWidget = new tau.widget.CircleProgressBar(progressBar, {size: "full"});
+ });
+
+ page.addEventListener("pagehide", function()
+ {
+ /* Release object */
+ progressBarWidget.destroy();
+ });
+ }());
</script>
</pre>
<pre class="prettyprint">
progressBar.addEventListener("progresschange", function()
{
- /* Do something when the value of progress changes */
- console.log(progressBarWidget.value());
+ /* Do something when the value of progress changes */
+ console.log(progressBarWidget.value());
});
</pre>
<td class="option">null</td>
<td class="option">Sets the class name of CircleProgressBar container.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">size</span></td>
<td class="option">number | "full" | "large" | "medium" | "small"</td>
<td class="option">"medium"</td>
<td class="option">Sets the size of CircleProgressBar.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">thickness</span></td>
<td class="option">number</td>
<td class="option">null</td>
<td class="option">Sets the border width of CircleProgressBar.</td>
</tr>
-
+
</tbody>
</table>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">progresschange</span></td>
<td><p>Triggered when the section is changed.</p></td>
</tr>
-
+
</tbody>
</table>
</tr>
</thead>
<tbody>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint">string <a href="#method-value">value</a>() </pre>
</td>
<td><p>Get or Set value of the widget</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method"><code><b><span class="methodName"
id="method-value">value</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">string value() </pre>
</div>
-
+
<p><span class="version">Since: </span>
2.3
</p>
-
+
<div class="description">
<p>
<p>Return element value or set the value</p>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
<pre name="code" class="examplecode prettyprint">
<div class="ui-page" id="pageCircleProgressBar">
- <header class="ui-header">
- <h2 class="ui-title">Circle Progress Bar</h2>
- </header>
- <div class="ui-content content-padding">Circle Progress Bar
- <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
- </div>
+ <header class="ui-header">
+ <h2 class="ui-title">Circle Progress Bar</h2>
+ </header>
+ <div class="ui-content content-padding">Circle Progress Bar
+ <progress class="ui-circle-progress" id="circleprogress" max="20" value="2"></progress>
+ </div>
</div>
<script>
- var page = document.getElementById("pageCircleProgressBar");
-
- page.addEventListener("pageshow", function()
- {
- var progressbar = document.getElementById("circleprogress"),
- progressbarWidget = tau.widget.CircleProgressBar(progressbar),
- /* Return value in progress tag */
- value = progressbarWidget.value();
- /* Set the value for the progress */
- progressbarWidget.value("15");
- });
+ var page = document.getElementById("pageCircleProgressBar");
+
+ page.addEventListener("pageshow", function()
+ {
+ var progressbar = document.getElementById("circleprogress"),
+ progressbarWidget = tau.widget.CircleProgressBar(progressbar),
+ /* Return value in progress tag */
+ value = progressbarWidget.value();
+ /* Set the value for the progress */
+ progressbarWidget.value("15");
+ });
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
<div id="footer">
<p>For manual creation of circular index scroll bar, you can use constructor from <strong>tau</strong> namespace:</p>
<pre class="prettyprint">var circularindexElement = document.getElementById('circularindexscrollbar'),
- circularindexscrollbar = tau.widget.CircularIndexScrollbar(circularindexElement, {index: "A,B,C"});
+ circularindexscrollbar = tau.widget.CircularIndexScrollbar(circularindexElement, {index: "A,B,C"});
</pre>
<p>Constructor has one require parameter <strong>element</strong> which are base <strong>HTMLElement</strong> to create component. We recommend get this element by method <em>document.getElementById</em>.</p>
<pre class="prettyprint">
<div id="indexscrollbar" class="ui-circularindexscrollbar"
- data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"></div>
+ data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"></div>
<script>
- (function()
- {
- var elem = document.getElementById("indexscrollbar");
- tau.widget.CircularIndexScrollbar(elem);
- elem.addEventListener("select", function(event)
- {
- var index = event.detail.index;
- /* Print selected index */
- console.log(index);
- });
- }());
+ (function()
+ {
+ var elem = document.getElementById("indexscrollbar");
+ tau.widget.CircularIndexScrollbar(elem);
+ elem.addEventListener("select", function(event)
+ {
+ var index = event.detail.index;
+ /* Print selected index */
+ console.log(index);
+ });
+ }());
</script>
</pre>
<pre class="prettyprint">
<div id="pageIndexScrollbar" class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">CircularIndexScrollbar</h2>
- </header>
- <div id="indexscrollbar" class="ui-circularindexscrollbar"></div>
- <section class="ui-content">
- <ul class="ui-listview" id="list1">
- <li class="li-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li>Art</li>
- <li class="li-divider">B</li>
- <li>Barry</li>
- <li>Bibi</li>
- <li>Billy</li>
- <li>Bob</li>
- <li class="li-divider">D</li>
- <li>Daisy</li>
- <li>Derek</li>
- <li>Desmond</li>
- </ul>
- </section>
+ <header class="ui-header">
+ <h2 class="ui-title">CircularIndexScrollbar</h2>
+ </header>
+ <div id="indexscrollbar" class="ui-circularindexscrollbar"></div>
+ <section class="ui-content">
+ <ul class="ui-listview" id="list1">
+ <li class="li-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li>Art</li>
+ <li class="li-divider">B</li>
+ <li>Barry</li>
+ <li>Bibi</li>
+ <li>Billy</li>
+ <li>Bob</li>
+ <li class="li-divider">D</li>
+ <li>Daisy</li>
+ <li>Derek</li>
+ <li>Desmond</li>
+ </ul>
+ </section>
</div>
<script>
- (function()
- {
- var page = document.getElementById("pageIndexScrollbar"),
- indexScrollbar;
-
- page.addEventListener("pageshow", function(ev)
- {
- var indexScrollbarElement = document.getElementById("indexscrollbar"),
- listviewElement = document.getElementById("list1"), /* List */
- listDividers = listviewElement.getElementsByClassName("li-divider"), /* List dividers */
- dividers = {}, /* Collection of list dividers */
- indices = [], /* Index list */
- scroller,
- divider,
- i, idx;
-
- /* For all list dividers, */
- for (i = 0; i < listDividers.length; i++)
- {
- /* Add the list divider elements to the collection */
- divider = listDividers[i];
- idx = divider.innerText;
- dividers[idx] = divider;
-
- /* Add the index to the index list */
- indices.push(idx);
- }
-
- scroller = tau.util.selectors.getScrollableParent(listviewElement);
-
- /* Create CircularIndexScrollbar */
- indexScrollbar = new tau.widget.CircularIndexScrollbar(indexScrollbarElement, {index: indices});
-
- /* Add SnapListview item "selected" event handler */
- /* You should update the information for current index */
- listviewElement.addEventListener("selected", function(ev)
- {
- var indexValue = ev.target.textContent[0];
- indexScrollbar.value(indexValue);
- });
-
- /* Add IndexScrollbar index "select" event handler */
- indexScrollbarElement.addEventListener("select", function(ev)
- {
- var divider,
- idx = ev.detail.index;
-
- divider = dividers[idx];
- if (divider && scroller)
- {
- /* Scroll to the li-divider element */
- scroller.scrollTop = divider.offsetTop - scroller.offsetTop;
- }
- });
- });
-
- page.addEventListener("pagehide", function(ev)
- {
- indexScrollbar.destroy();
- });
- }());
+ (function()
+ {
+ var page = document.getElementById("pageIndexScrollbar"),
+ indexScrollbar;
+
+ page.addEventListener("pageshow", function(ev)
+ {
+ var indexScrollbarElement = document.getElementById("indexscrollbar"),
+ listviewElement = document.getElementById("list1"), /* List */
+ listDividers = listviewElement.getElementsByClassName("li-divider"), /* List dividers */
+ dividers = {}, /* Collection of list dividers */
+ indices = [], /* Index list */
+ scroller,
+ divider,
+ i, idx;
+
+ /* For all list dividers, */
+ for (i = 0; i < listDividers.length; i++)
+ {
+ /* Add the list divider elements to the collection */
+ divider = listDividers[i];
+ idx = divider.innerText;
+ dividers[idx] = divider;
+
+ /* Add the index to the index list */
+ indices.push(idx);
+ }
+
+ scroller = tau.util.selectors.getScrollableParent(listviewElement);
+
+ /* Create CircularIndexScrollbar */
+ indexScrollbar = new tau.widget.CircularIndexScrollbar(indexScrollbarElement, {index: indices});
+
+ /* Add SnapListview item "selected" event handler */
+ /* You should update the information for current index */
+ listviewElement.addEventListener("selected", function(ev)
+ {
+ var indexValue = ev.target.textContent[0];
+ indexScrollbar.value(indexValue);
+ });
+
+ /* Add IndexScrollbar index "select" event handler */
+ indexScrollbarElement.addEventListener("select", function(ev)
+ {
+ var divider,
+ idx = ev.detail.index;
+
+ divider = dividers[idx];
+ if (divider && scroller)
+ {
+ /* Scroll to the li-divider element */
+ scroller.scrollTop = divider.offsetTop - scroller.offsetTop;
+ }
+ });
+ });
+
+ page.addEventListener("pagehide", function(ev)
+ {
+ indexScrollbar.destroy();
+ });
+ }());
</script>
</pre>
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p><p></p></span>
prettyprint">
<div id="circularindexscrollbar"></div>
<script>
- var circularindexElement = document.getElementById("circularindexscrollbar"),
- circularIndexScrollbar = tau.widget.CircularIndexScrollbar(circularindexElement),
- /* Return current index value */
- value = circularIndexScrollbar.value();
- /* Set the index value */
- circularIndexScrollbar.value("C");
+ var circularindexElement = document.getElementById("circularindexscrollbar"),
+ circularIndexScrollbar = tau.widget.CircularIndexScrollbar(circularindexElement),
+ /* Return current index value */
+ value = circularIndexScrollbar.value();
+ /* Set the index value */
+ circularIndexScrollbar.value("C");
</script>
</pre>
</div>
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
<title>Wearable UI Components</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Wearable UI Components</h1>
</tbody>
</table>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#html-examples0.5723640653304756">How to create Drawer</a>
-
+
</li>
<li><a href="#options-list">Options</a></li>
<li><a href="#options-example">HTML Example with Options</a></li>
<li><a href="#drawer-state0.013524989364668727">Drawer state</a>
-
+
</li>
-
+
<li><a href="#methods-list">Methods</a>
-
+
<ol class="toc">
-
+
<li><a href="#method-setDragHandler">setDragHandler</a>
</li>
-
+
<li><a href="#method-transition">transition</a>
</li>
-
+
<li><a href="#method-open">open</a>
</li>
-
+
<li><a href="#method-close">close</a>
</li>
-
+
<li><a href="#method-getState">getState</a>
</li>
-
+
</ol>
-
+
</li>
-
+
</ol>
<h2><a id='html-examples0.5723640653304756'></a>How to create Drawer</h2>
<h3>HTML</h3>
<pre class="prettyprint">
<div id="moreoptionsPage" class="ui-page">
- <header class="ui-header ui-has-more">
- <h2 class="ui-title">Drawer</h2>
- <button class="ui-more ui-icon-overflow">Drawer</button>
- </header>
- <div class="ui-content content-padding">
- Drawer
- </div>
-
- <!--Circle Profile-->
- <div id="moreoptionsDrawer" class="ui-drawer" data-drawer-target="#moretionsPage" data-position="right"
- data-enable="true" data-drag-edge="1">
- <div id="moreoptionsSectionChanger" class="ui-section-changer">
- <div>
- <seciont>
- <button class="option-button">1</button>
- </seciont>
- <seciont>
- <button class="option-button">2</button>
- </seciont>
- <seciont>
- <button class="option-button">3</button>
- </seciont>
- </div>
- </div>
- </div>
+ <header class="ui-header ui-has-more">
+ <h2 class="ui-title">Drawer</h2>
+ <button class="ui-more ui-icon-overflow">Drawer</button>
+ </header>
+ <div class="ui-content content-padding">
+ Drawer
+ </div>
+
+ <!--Circle Profile-->
+ <div id="moreoptionsDrawer" class="ui-drawer" data-drawer-target="#moretionsPage" data-position="right"
+ data-enable="true" data-drag-edge="1">
+ <div id="moreoptionsSectionChanger" class="ui-section-changer">
+ <div>
+ <seciont>
+ <button class="option-button">1</button>
+ </seciont>
+ <seciont>
+ <button class="option-button">2</button>
+ </seciont>
+ <seciont>
+ <button class="option-button">3</button>
+ </seciont>
+ </div>
+ </div>
+ </div>
</div>
</pre>
<pre class="prettyprint">
(function()
{
- var page = document.querySelector("#moreoptionsPage"),
- popup = page.querySelector("#moreoptionsPopup"),
- drawer = page.querySelector("#moreoptionsDrawer"),
- handler = page.querySelector(".ui-more");
+ var page = document.querySelector("#moreoptionsPage"),
+ popup = page.querySelector("#moreoptionsPopup"),
+ drawer = page.querySelector("#moreoptionsDrawer"),
+ handler = page.querySelector(".ui-more");
- page.addEventListener("pagebeforeshow", function()
- {
- var popupWidget;
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var popupWidget;
- tau.helper.DrawerMoreStyle.create(drawer, {handler: ".ui-more",});
- });
+ tau.helper.DrawerMoreStyle.create(drawer, {handler: ".ui-more",});
+ });
})();</pre>
<h3>CSS</h3>
<pre class="prettyprint">
#moreoptionsDrawer
{
- display: none;
+ display: none;
}
@media all and (-tizen-geometric-shape: circle)
{
- #moreoptionsDrawer
- {
- display: block;
- background-color: rgba(255, 255, 255, 0.1);
- border-radius: 100%;
- }
- #moreoptionsPopup
- {
- display: none;
- }
- .sections,
- .options
- {
- text-align: center;
- }
- .option-button
- {
- width: 158px;
- height: 158px;
- background-color: #a4a4a4;
- position: relative;
- left: 50%;
- transform: translate3d(-50%, -50%, 0);
- top: 50%;
- border-radius: 50%;
- border: none;
- text-align: center;
- line-height: 158px;
- -webkit-appearance: none;
- }
+ #moreoptionsDrawer
+ {
+ display: block;
+ background-color: rgba(255, 255, 255, 0.1);
+ border-radius: 100%;
+ }
+ #moreoptionsPopup
+ {
+ display: none;
+ }
+ .sections,
+ .options
+ {
+ text-align: center;
+ }
+ .option-button
+ {
+ width: 158px;
+ height: 158px;
+ background-color: #a4a4a4;
+ position: relative;
+ left: 50%;
+ transform: translate3d(-50%, -50%, 0);
+ top: 50%;
+ border-radius: 50%;
+ border: none;
+ text-align: center;
+ line-height: 158px;
+ -webkit-appearance: none;
+ }
}
</pre>
</tr>
</thead>
<tbody>
-
-
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-setDragHandler">setDragHandler</a>(Element element) </pre>
</td>
<td><p>Set Drawer drag handler.<br />If developer use handler, drag event is bound at handler only.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-transition">transition</a>(Integer position) </pre>
</td>
<td><p>Transition Drawer.<br />This method use only positive integer number.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-open">open</a>() </pre>
</td>
<td><p>Open Drawer.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-close">close</a>() </pre>
</td>
<td><p>Close Drawer.</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint">String <a href="#method-getState">getState</a>() </pre>
</td>
<td><p>Get state of Drawer.</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
+
+
<dt class="method"><code><b><span class="methodName"
id="method-setDragHandler">setDragHandler</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">setDragHandler(Element element) </pre>
</div>
-
+
<div class="description">
<p>
<h5>Running example in pure JavaScript:</h5>
<!--Drawer handlers-->
<a id="leftDrawerHandler" href="#leftDrawer" class="drawer-handler">Left Handler</a>
<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
- data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
- var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
- drawer.setDragHandler(handler);
+ drawer.setDragHandler(handler);
</script></pre>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">element</span></td>
<td>Element</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-transition">transition</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">transition(Integer position) </pre>
</div>
-
+
<div class="description">
<p>
<h5>Running example in pure JavaScript:</h5>
<pre class="prettyprint">
<a id="leftDrawerHandler" href="#leftDrawer" class="drawer-handler">Left Handler</a>
<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
- data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
- var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
- drawer.Transition(60);
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
+ drawer.Transition(60);
</script></pre>
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">position</span></td>
<td>Integer</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-open">open</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">open() </pre>
</div>
-
+
<div class="description">
<p>
<h5>Running example in pure JavaScript:</h5>
<pre class="prettyprint">
<!--Drawer handlers-->
<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
- data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
- var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
- drawer.open();
+ drawer.open();
</script></pre>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-close">close</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">close() </pre>
</div>
-
+
<div class="description">
<p>
<h5>Running example in pure JavaScript:</h5>
<pre class="prettyprint">
<!--Drawer handlers-->
<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
- data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
- var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href"));
- drawer.close();
+ drawer.close();
</script></pre>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-getState">getState</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">String getState() </pre>
</div>
-
+
<div class="description">
<p>
<h5>Running example in pure JavaScript:</h5>
<pre class="prettyprint">
<!--Drawer handlers-->
<div id="leftDrawer" class="ui-drawer" data-drawer-target="#drawerSinglePage" data-position="left"
- data-enable="true" data-drag-edge="1">
- <header class="ui-header">
- <h2 class="ui-title">Left Drawer</h2>
- </header>
- <div id="leftClose" class="ui-content">
- <p>Click Close</p>
- </div>
+ data-enable="true" data-drag-edge="1">
+ <header class="ui-header">
+ <h2 class="ui-title">Left Drawer</h2>
+ </header>
+ <div id="leftClose" class="ui-content">
+ <p>Click Close</p>
+ </div>
</div>
<script>
- var handler = document.getElementById("leftDrawerHandler"),
- drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href")),
- state;
+ var handler = document.getElementById("leftDrawerHandler"),
+ drawer = tau.widget.Drawer(document.querySelector(handler.getAttribute("href")),
+ state;
- state = drawer.getState();
+ state = drawer.getState();
</script></pre>
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
-
+
</dd>
-
-
+
+
</dl>
-
+
<div id="footer">
<hr size="1">
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#manual-constructor0.6990520032122731">How to create index scroll bar</a>
-
+
</li>
-
+
<li><a href="#options-list">Options</a>
-
+
</li>
-
+
<li><a href="#events-list">Events</a>
-
+
</li>
-
+
</ol>
<p>For manual creation of Index Scroll Bar, you can use constructor from <strong>tau</strong> namespace:</p>
<pre class="prettyprint">
var indexElement = document.getElementById('indexscrollbar'),
- indexscrollbar = tau.widget.IndexScrollbar(indexElement);
+ indexscrollbar = tau.widget.IndexScrollbar(indexElement);
</pre>
<p>To add an index scroll bar component to the application, use the following code:</p>
<pre class="prettyprint">
-<div id="foo" class="ui-indexscrollbar"
- data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"></div>
+<div id="foo" class="ui-indexscrollbar"
+ data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"></div>
<script>
- (function()
- {
- var elem = document.getElementById("foo");
- tau.IndexScrollbar(elem);
- elem.addEventListener("select", function(ev)
- {
- var index=ev.detail.index;
- console.log(index);
- });
- }());
+ (function()
+ {
+ var elem = document.getElementById("foo");
+ tau.IndexScrollbar(elem);
+ elem.addEventListener("select", function(ev)
+ {
+ var index=ev.detail.index;
+ console.log(index);
+ });
+ }());
</script>
</pre>
<p>In the following example, the list scrolls to the position of the list item defined using the <span style="font-family: Courier New,Courier,monospace">li-divider</span> class, selected by the index scroll bar:</p>
<pre class="prettyprint">
<div id="pageIndexScrollbar" class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">IndexScrollbar</h2>
- </header>
- <section class="ui-content">
- <div style="overflow-y:scroll;">
- <div id="indexscrollbar1"
- class="ui-indexscrollbar"
- data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z">
- </div>
- <ul class="ui-listview" id="list1">
- <li class="li-divider">A</li>
- <li>Anton</li>
- <li>Arabella</li>
- <li>Art</li>
- <li class="li-divider">B</li>
- <li>Barry</li>
- <li>Bibi</li>
- <li>Billy</li>
- <li>Bob</li>
- <li class="li-divider">D</li>
- <li>Daisy</li>
- <li>Derek</li>
- <li>Desmond</li>
- </ul>
- </div>
- </section>
- <script>
- (function()
- {
- var page = document.getElementById("pageIndexScrollbar"),
- isb;
- page.addEventListener("pagecreate", function(ev)
- {
- var elem = document.getElementById("indexscrollbar1"), /* Index scroll bar element */
- elList = document.getElementById("list1"), /* List element */
- elDividers = elList.getElementsByClassName("li-divider"), /* List items (dividers) */
- elScroller = elList.parentElement, /* List's parent item (overflow-y:scroll) */
- dividers = {}, /* Collection of list dividers */
- indices = [], /* List of index */
- elDivider,
- i, idx;
-
- /* For all list dividers */
- for (i = 0; i < elDividers.length; i++)
- {
- /* Add the list divider elements to the collection */
- elDivider = elDividers[i]; /* li element having the li-divider class */
- idx = elDivider.innerText; /* Get a text (index value) */
- dividers[idx] = elDivider; /* Remember the element */
-
- /* Add the index to the index list */
- indices.push(idx);
- }
-
- /*
- Change the data-index attribute to the index scroll bar element
- before initializing index scroll bar component
- */
- elem.setAttribute("data-index", indices.join(","));
-
- /* Create index scroll bar */
- isb = tau.IndexScrollbar(elem);
-
- /* Bind the select callback */
- elem.addEventListener("select", function(ev)
- {
- var elDivider,
- idx = ev.detail.index;
- elDivider = dividers[idx];
- if (elDivider)
- {
- /* Scroll to the li-divider element */
- elScroller.scrollTop = elDivider.offsetTop - elScroller.offsetTop;
- }
- });
- });
- /* Destroy index scroll bar when page is hidden */
- page.addEventListener("pagehide", function(ev)
- {
- isb.destroy();
- });
- }());
- </script>
+ <header class="ui-header">
+ <h2 class="ui-title">IndexScrollbar</h2>
+ </header>
+ <section class="ui-content">
+ <div style="overflow-y:scroll;">
+ <div id="indexscrollbar1"
+ class="ui-indexscrollbar"
+ data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z">
+ </div>
+ <ul class="ui-listview" id="list1">
+ <li class="li-divider">A</li>
+ <li>Anton</li>
+ <li>Arabella</li>
+ <li>Art</li>
+ <li class="li-divider">B</li>
+ <li>Barry</li>
+ <li>Bibi</li>
+ <li>Billy</li>
+ <li>Bob</li>
+ <li class="li-divider">D</li>
+ <li>Daisy</li>
+ <li>Derek</li>
+ <li>Desmond</li>
+ </ul>
+ </div>
+ </section>
+ <script>
+ (function()
+ {
+ var page = document.getElementById("pageIndexScrollbar"),
+ isb;
+ page.addEventListener("pagecreate", function(ev)
+ {
+ var elem = document.getElementById("indexscrollbar1"), /* Index scroll bar element */
+ elList = document.getElementById("list1"), /* List element */
+ elDividers = elList.getElementsByClassName("li-divider"), /* List items (dividers) */
+ elScroller = elList.parentElement, /* List's parent item (overflow-y:scroll) */
+ dividers = {}, /* Collection of list dividers */
+ indices = [], /* List of index */
+ elDivider,
+ i, idx;
+
+ /* For all list dividers */
+ for (i = 0; i < elDividers.length; i++)
+ {
+ /* Add the list divider elements to the collection */
+ elDivider = elDividers[i]; /* li element having the li-divider class */
+ idx = elDivider.innerText; /* Get a text (index value) */
+ dividers[idx] = elDivider; /* Remember the element */
+
+ /* Add the index to the index list */
+ indices.push(idx);
+ }
+
+ /*
+ Change the data-index attribute to the index scroll bar element
+ before initializing index scroll bar component
+ */
+ elem.setAttribute("data-index", indices.join(","));
+
+ /* Create index scroll bar */
+ isb = tau.IndexScrollbar(elem);
+
+ /* Bind the select callback */
+ elem.addEventListener("select", function(ev)
+ {
+ var elDivider,
+ idx = ev.detail.index;
+ elDivider = dividers[idx];
+ if (elDivider)
+ {
+ /* Scroll to the li-divider element */
+ elScroller.scrollTop = elDivider.offsetTop - elScroller.offsetTop;
+ }
+ });
+ });
+ /* Destroy index scroll bar when page is hidden */
+ page.addEventListener("pagehide", function(ev)
+ {
+ isb.destroy();
+ });
+ }());
+ </script>
</div>
</pre>
<pre class="prettyprint">
<div id="indexscrollbar2" class="ui-indexscrollbar"
- data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z">
+ data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z">
</div>
<ul class="ui-listview" id="ibar2_list2;>
- <li>Anton</li><li>Arabella</li><li>Art</li>
- <li>Barry</li><li>Bibi</li><li>Billy</li><li>Bob</li>
- <li>Carry</li><li>Cibi</li>
- <li>Daisy</li><li>Derek</li><li>Desmond</li>
+ <li>Anton</li><li>Arabella</li><li>Art</li>
+ <li>Barry</li><li>Bibi</li><li>Billy</li><li>Bob</li>
+ <li>Carry</li><li>Cibi</li>
+ <li>Daisy</li><li>Derek</li><li>Desmond</li>
</ul>
<script>
- (function()
- {
- var page = document.getElementById("pageIndexScrollbar2");
- isb,
- index = [],
- supIndex = {},
- elIndex = {};
- page.addEventListener("pageshow", function(ev)
- {
- var elisb = document.getElementById("indexscrollbar2"),
- elList = document.getElementById("ibar2_list2"), /* List element */
- elItems = elList.children,
- elScroller = elList.parentElement, /* Scroller (overflow-y:hidden) */
- indexData = getIndexData(
- {
- array: elItems,
- getTextValue: function(array, i) {return array[i].innerText;}
- });
-
- function getIndexData(options)
- {
- var array = options.array,
- getTextValue = options.getTextValue,
- item,
- text,
- firstIndex = [],
- secondIndex = {},
- keyItem = {},
- c1 = null, c2 = null,
- i;
-
- for (i = 0; i < array.length; i++)
- {
- item = array[i];
- text = getTextValue(array, i);
- if (text.length > 0)
- {
- if (!c1 || c1 !== text[0])
- {
- /* New c1 */
- c1 = text[0];
- firstIndex.push(c1);
- keyItem[c1] = item;
- secondIndex[c1] = [];
- c2 = text[1];
- if (c2)
- {
- secondIndex[c1].push(c2);
- }
- else
- {
- c2 = '';
- }
- keyItem[c1+c2] = item;
- }
- else
- {
- /* Existing c1 */
- if (c2 !== text[1])
- {
- c2 = text[1];
- secondIndex[c1].push(c2);
- keyItem[c1+c2] = item;
- }
- }
- }
- }
- return
- {
- firstIndex: firstIndex,
- secondIndex: secondIndex,
- keyItem: keyItem
- };
- }
- /* Update the data-index attribute to the index scroll bar element, with the index list above */
- elisb.setAttribute("data-index", indexData.firstIndex);
- /* Create index scroll bar */
- isb = new tau.IndexScrollbar(elisb,
- {
- index: indexData.firstIndex, supplementaryIndex: function(firstIndex)
- {
- return indexData.secondIndex[firstIndex];
- }
- });
- /* Bind the select callback */
- elisb.addEventListener("select", function(ev)
- {
- var el,
- index = ev.detail.index;
- el = indexData.keyItem[index];
- if (el)
- {
- /* Scroll to the li-divider element */
- elScroller.scrollTop = el.offsetTop - elScroller.offsetTop;
- }
- });
- });
- /* Destroy index scroll bar when page is hidden */
- page.addEventListener("pagehide", function(ev)
- {
- isb.destroy();
- index.length = 0;
- supIndex = {};
- elIndex = {};
- });
- }());
+ (function()
+ {
+ var page = document.getElementById("pageIndexScrollbar2");
+ isb,
+ index = [],
+ supIndex = {},
+ elIndex = {};
+ page.addEventListener("pageshow", function(ev)
+ {
+ var elisb = document.getElementById("indexscrollbar2"),
+ elList = document.getElementById("ibar2_list2"), /* List element */
+ elItems = elList.children,
+ elScroller = elList.parentElement, /* Scroller (overflow-y:hidden) */
+ indexData = getIndexData(
+ {
+ array: elItems,
+ getTextValue: function(array, i) {return array[i].innerText;}
+ });
+
+ function getIndexData(options)
+ {
+ var array = options.array,
+ getTextValue = options.getTextValue,
+ item,
+ text,
+ firstIndex = [],
+ secondIndex = {},
+ keyItem = {},
+ c1 = null, c2 = null,
+ i;
+
+ for (i = 0; i < array.length; i++)
+ {
+ item = array[i];
+ text = getTextValue(array, i);
+ if (text.length > 0)
+ {
+ if (!c1 || c1 !== text[0])
+ {
+ /* New c1 */
+ c1 = text[0];
+ firstIndex.push(c1);
+ keyItem[c1] = item;
+ secondIndex[c1] = [];
+ c2 = text[1];
+ if (c2)
+ {
+ secondIndex[c1].push(c2);
+ }
+ else
+ {
+ c2 = '';
+ }
+ keyItem[c1+c2] = item;
+ }
+ else
+ {
+ /* Existing c1 */
+ if (c2 !== text[1])
+ {
+ c2 = text[1];
+ secondIndex[c1].push(c2);
+ keyItem[c1+c2] = item;
+ }
+ }
+ }
+ }
+ return
+ {
+ firstIndex: firstIndex,
+ secondIndex: secondIndex,
+ keyItem: keyItem
+ };
+ }
+ /* Update the data-index attribute to the index scroll bar element, with the index list above */
+ elisb.setAttribute("data-index", indexData.firstIndex);
+ /* Create index scroll bar */
+ isb = new tau.IndexScrollbar(elisb,
+ {
+ index: indexData.firstIndex, supplementaryIndex: function(firstIndex)
+ {
+ return indexData.secondIndex[firstIndex];
+ }
+ });
+ /* Bind the select callback */
+ elisb.addEventListener("select", function(ev)
+ {
+ var el,
+ index = ev.detail.index;
+ el = indexData.keyItem[index];
+ if (el)
+ {
+ /* Scroll to the li-divider element */
+ elScroller.scrollTop = el.offsetTop - elScroller.offsetTop;
+ }
+ });
+ });
+ /* Destroy index scroll bar when page is hidden */
+ page.addEventListener("pagehide", function(ev)
+ {
+ isb.destroy();
+ index.length = 0;
+ supIndex = {};
+ elIndex = {};
+ });
+ }());
</script>
</pre>
<td class="option">","</td>
<td class="option">delimiter in index</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">index</span></td>
<td class="option">string | Array</td>
<td class="option">null</td>
<td class="option">set 2depth index</td>
</tr>
-
+
</tbody>
</table>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="event"><span style="font-family: Courier New,Courier,monospace">select</span></td>
<td><p>Event triggered after select index by user<p>This event has "detail" object and there is "index" property in the "detail"<p>
detail.index provides information for selected index.</td>
</tr>
-
+
</tbody>
</table>
-
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
+
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
</body>
</html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
- <title>List</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ <title>List</title>
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>List</h1>
<li>List with basic items
<p>You can add a basic list component as follows:</p>
<pre class="prettyprint"><ul class="ui-listview">
- <li>1line</li>
- <li>2line</li>
- <li>3line</li>
- <li>4line</li>
- <li>5line</li>
+ <li>1line</li>
+ <li>2line</li>
+ <li>3line</li>
+ <li>4line</li>
+ <li>5line</li>
</ul>
</pre>
</li>
<li>List with link items
<p>You can add a list component with a link and press effect that allows the user to click each list item as follows:</p>
<pre class="prettyprint"><ul class="ui-listview">
- <li>
- <a href="#">1line</a>
- </li>
- <li>
- <a href="#">2line</a>
- </li>
- <li>
- <a href="#">3line</a>
- </li>
- <li>
- <a href="#">4line</a>
- </li>
- <li>
- <a href="#">5line</a>
- </li>
+ <li>
+ <a href="#">1line</a>
+ </li>
+ <li>
+ <a href="#">2line</a>
+ </li>
+ <li>
+ <a href="#">3line</a>
+ </li>
+ <li>
+ <a href="#">4line</a>
+ </li>
+ <li>
+ <a href="#">5line</a>
+ </li>
</ul>
</pre>
</li>
</ul>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#make-marquee element0.013777208048850298">How to Create Marquee</a>
-
+
</li>
-
+
<li><a href="#options-list">Options</a>
-
+
</li>
<li><a href="#events-list">Events</a></li>
-
+
<li><a href="#methods-list">Methods</a>
-
+
<ol class="toc">
<li><a href="#method-start">start</a>
</li>
<li><a href="#method-stop">stop</a>
</li>
-
+
<li><a href="#method-reset">reset</a>
</li>
-
+
</ol>
-
+
</li>
-
+
</ol>
<h2><a id='make-marquee element0.013777208048850298'></a>How to Create Marquee</h2>
<pre class="prettyprint">
<div class="ui-page ui-page-active" id="marqueePage" >
- <header class="ui-header">
- <h2 class="ui-title">Marquee</h2>
- </header>
- <div class="ui-content">
- <ul class="ui-listview">
- <li><div class="ui-marquee" id="marquee">Marquee code sample</div></li>
- </ul>
- </div>
+ <header class="ui-header">
+ <h2 class="ui-title">Marquee</h2>
+ </header>
+ <div class="ui-content">
+ <ul class="ui-listview">
+ <li><div class="ui-marquee" id="marquee">Marquee code sample</div></li>
+ </ul>
+ </div>
</div>
<script>
- var page = document.querySelector("#marqueePage");
+ var page = document.querySelector("#marqueePage");
- page.addEventListener("pagebeforeshow", function()
- {
- var marqueeEl = document.getElementById("marquee"),
- marqueeWidget = new tau.widget.Marquee(marqueeEl, {marqueeStyle: "scroll", delay: "3"});
- });
+ page.addEventListener("pagebeforeshow", function()
+ {
+ var marqueeEl = document.getElementById("marquee"),
+ marqueeWidget = new tau.widget.Marquee(marqueeEl, {marqueeStyle: "scroll", delay: "3"});
+ });
</script>
</pre>
<td class="option">60</td>
<td class="option">Sets the speed(px/sec) for the marquee</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">timingFunction</span></td>
<td class="option">"linear" | "ease" | "ease-in" | "ease-out" | "cubic-bezier(n,n,n,n)"</td>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">marqueestart</span></td>
<td><p>Triggered when marquee animation started.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">marqueeend</span></td>
<td><p>Triggered when marquee animation ended.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">marqueestopped</span></td>
<td><p>Triggered when marquee animation stopped.</p></td>
</tr>
-
+
</tbody>
</table>
<pre name="code" class="examplecode
prettyprint">
<div class="ui-marquee" id="marquee">
- <p>MarqueeTEST TEST message TEST for marquee</p>
+ <p>MarqueeTEST TEST message TEST for marquee</p>
</div>
<script>
- var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
- marqueeWidget.start();
+ var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
+ marqueeWidget.start();
</script>
</pre>
</div>
<div class="synopsis">
<pre class="signature prettyprint">stop() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p></span>
<pre name="code" class="examplecode
prettyprint">
<div class="ui-marquee" id="marquee">
- <p>MarqueeTEST TEST message TEST for marquee</p>
+ <p>MarqueeTEST TEST message TEST for marquee</p>
</div>
<script>
- var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
- marqueeWidget.stop();
+ var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
+ marqueeWidget.stop();
</script>
</pre>
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-reset">reset</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">reset() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
<div class="example">
<span class="example"><p>Code
example:</p></span>
<pre name="code" class="examplecode
prettyprint">
<div class="ui-marquee" id="marquee">
- <p>MarqueeTEST TEST message TEST for marquee</p>
+ <p>MarqueeTEST TEST message TEST for marquee</p>
</div>
<script>
- var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
- marqueeWidget.reset();
+ var marqueeWidget = tau.widget.Marquee(document.getElementById("marquee"));
+ marqueeWidget.reset();
</script>
</pre>
</div>
-
+
</dd>
-
-
+
+
</dl>
-
+
<div id="footer">
<hr size="1">
<pre class="prettyprint">
var elPageIndicator = document.getElementById("pageindicator"),
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages : 5});
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages : 5});
</pre>
<p>Constructor has two require parameter <strong>element</strong> which are base <strong>HTMLElement</strong> to create component. We recommend get this element by method <em>document.getElementById</em>. Second parameter is <strong>options</strong> and it is a object with options for component. numberOfPages means the number of pages to be linked and it is mandatory.</p>
<pre class="prettyprint">
<div id="pageIndicator" class="ui-page-indicator"></div>
<script>
- var elPageIndicator = document.getElementById("pageIndicator"),
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5}),
- index = 1;
- pageIndicator.setActive(index);
+ var elPageIndicator = document.getElementById("pageIndicator"),
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5}),
+ index = 1;
+ pageIndicator.setActive(index);
</script>
</pre>
<pre class="prettyprint">
<div id="pageIndicatorPage" class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">Page Indicator</h2>
- </header>
- <div id="pageIndicator" class="ui-page-indicator"></div>
- <div id="hsectionchanger" class="ui-content">
- <div>
- <section class="ui-section-active" style="text-align:center" >
- <h3> Page1 of 5</h3>
- </section>
- <section style="text-align:center">
- <h3> Page2 of 5</h3>
- </section>
- <section style="text-align:center">
- <h3> Page3 of 5</h3>
- </section>
- <section style="text-align:center">
- <h3> Page4 of 5</h3>
- </section>
- <section style="text-align:center">
- <h3> Page5 of 5</h3>
- </section>
- </div>
- </div>
- <script>
- (function()
- {
- var self = this,
- page = document.getElementById("pageIndicatorPage"),
- changer = document.getElementById("hsectionchanger"),
- sectionChanger,
- elPageIndicator = document.getElementById("pageIndicator"),
- pageIndicator,
- pageIndicatorHandler;
-
- page.addEventListener("pagebeforeshow", function()
- {
- /* Create PageIndicator */
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5});
- pageIndicator.setActive(0);
-
- sectionChanger = new tau.widget.SectionChanger(changer,
- {
- circular: true,
- orientation: "horizontal",
- useBouncingEffect: true
- });
- });
-
- page.addEventListener("pagehide", function()
- {
- sectionChanger.destroy();
- pageIndicator.destroy();
- });
-
- /* Indicator setting handler */
- pageIndicatorHandler = function(e)
- {
- pageIndicator.setActive(e.detail.active);
- };
-
- /* Bind the callback */
- changer.addEventListener("sectionchange", pageIndicatorHandler, false);
- })();
- </script>
+ <header class="ui-header">
+ <h2 class="ui-title">Page Indicator</h2>
+ </header>
+ <div id="pageIndicator" class="ui-page-indicator"></div>
+ <div id="hsectionchanger" class="ui-content">
+ <div>
+ <section class="ui-section-active" style="text-align:center" >
+ <h3> Page1 of 5</h3>
+ </section>
+ <section style="text-align:center">
+ <h3> Page2 of 5</h3>
+ </section>
+ <section style="text-align:center">
+ <h3> Page3 of 5</h3>
+ </section>
+ <section style="text-align:center">
+ <h3> Page4 of 5</h3>
+ </section>
+ <section style="text-align:center">
+ <h3> Page5 of 5</h3>
+ </section>
+ </div>
+ </div>
+ <script>
+ (function()
+ {
+ var self = this,
+ page = document.getElementById("pageIndicatorPage"),
+ changer = document.getElementById("hsectionchanger"),
+ sectionChanger,
+ elPageIndicator = document.getElementById("pageIndicator"),
+ pageIndicator,
+ pageIndicatorHandler;
+
+ page.addEventListener("pagebeforeshow", function()
+ {
+ /* Create PageIndicator */
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5});
+ pageIndicator.setActive(0);
+
+ sectionChanger = new tau.widget.SectionChanger(changer,
+ {
+ circular: true,
+ orientation: "horizontal",
+ useBouncingEffect: true
+ });
+ });
+
+ page.addEventListener("pagehide", function()
+ {
+ sectionChanger.destroy();
+ pageIndicator.destroy();
+ });
+
+ /* Indicator setting handler */
+ pageIndicatorHandler = function(e)
+ {
+ pageIndicator.setActive(e.detail.active);
+ };
+
+ /* Bind the callback */
+ changer.addEventListener("sectionchange", pageIndicatorHandler, false);
+ })();
+ </script>
</div>
</pre>
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
<title>Popup</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Popup</h1>
<tr>
<td><p><span style="font-family: Courier New,Courier,monospace">ui-popup-toast</span></p></td>
<td><p>Defines the element as a toast popup (small popup).</p></td>
- </tr>
+ </tr>
</tbody>
</table>
<td>Basic popup with header, content, and footer</td>
<td><pre class="prettyprint">
<div id="popup" class="ui-popup">
- <div class="ui-popup-header">Power saving mode</div>
- <div class="ui-popup-content">
- Turning on Power
- saving mode will
- limit the maximum
- power
- </div>
- <div class="ui-popup-footer">
- <button id="cancel" class="ui-btn">Cancel</button>
- </div>
+ <div class="ui-popup-header">Power saving mode</div>
+ <div class="ui-popup-content">
+ Turning on Power
+ saving mode will
+ limit the maximum
+ power
+ </div>
+ <div class="ui-popup-footer">
+ <button id="cancel" class="ui-btn">Cancel</button>
+ </div>
</div>
</pre></td>
</tr>
<td>Popup with 2 buttons in the footer</td>
<td><pre class="prettyprint">
<div id="2btnPopup" class="ui-popup">
- <div class="ui-popup-header">Delete</div>
- <div class="ui-popup-content">
- Delete the image?
- </div>
- <div class="ui-popup-footer ui-grid-col-2">
- <button id="2btnPopup-cancel" class="ui-btn">Cancel</button>
- <button id="2btnPopup-ok" class="ui-btn">OK</button>
- </div>
+ <div class="ui-popup-header">Delete</div>
+ <div class="ui-popup-content">
+ Delete the image?
+ </div>
+ <div class="ui-popup-footer ui-grid-col-2">
+ <button id="2btnPopup-cancel" class="ui-btn">Cancel</button>
+ <button id="2btnPopup-ok" class="ui-btn">OK</button>
+ </div>
</div></pre></td>
</tr>
<tr>
<td>Popup with checkbox and radio button lists</td>
<td><pre class="prettyprint">
<div id="listBoxPopup" class="ui-popup">
- <div class="ui-popup-header">When?</div>
- <div class="ui-popup-content" style="height:243px; overflow-y:scroll">
- <ul class="ui-listview">
- <li>
- <label for="check-1" class="ui-popup-checkbox-label">Yesterday</label>
- <input type="checkbox" name="checkset" id="check-1"/>
- </li>
- <li>
- <label for="check-2" class="ui-popup-checkbox-label">Today</label>
- <input type="checkbox" name="checkset" id="check-2"/>
- </li>
- <li>
- <label for="check-3" class="ui-popup-checkbox-label">Tomorrow</label>
- <input type="checkbox" name="checkset" id="check-3"/>
- </li>
- </ul>
- <ul class="ui-listview">
- <li>
- <label for="radio-1" class="ui-popup-radio-label">Mandatory</label>
- <input type="radio" name="radioset" id="radio-1"/>
- </li>
- <li>
- <label for="radio-2" class="ui-popup-radio-label">Optional</label>
- <input type="radio" name="radioset" id="radio-2"/>
- </li>
- </ul>
- </div>
- <div class="ui-popup-footer">
- <button id="listBoxPopup-close" class="ui-btn">Close</button>
- </div>
+ <div class="ui-popup-header">When?</div>
+ <div class="ui-popup-content" style="height:243px; overflow-y:scroll">
+ <ul class="ui-listview">
+ <li>
+ <label for="check-1" class="ui-popup-checkbox-label">Yesterday</label>
+ <input type="checkbox" name="checkset" id="check-1"/>
+ </li>
+ <li>
+ <label for="check-2" class="ui-popup-checkbox-label">Today</label>
+ <input type="checkbox" name="checkset" id="check-2"/>
+ </li>
+ <li>
+ <label for="check-3" class="ui-popup-checkbox-label">Tomorrow</label>
+ <input type="checkbox" name="checkset" id="check-3"/>
+ </li>
+ </ul>
+ <ul class="ui-listview">
+ <li>
+ <label for="radio-1" class="ui-popup-radio-label">Mandatory</label>
+ <input type="radio" name="radioset" id="radio-1"/>
+ </li>
+ <li>
+ <label for="radio-2" class="ui-popup-radio-label">Optional</label>
+ <input type="radio" name="radioset" id="radio-2"/>
+ </li>
+ </ul>
+ </div>
+ <div class="ui-popup-footer">
+ <button id="listBoxPopup-close" class="ui-btn">Close</button>
+ </div>
</div></pre></td>
</tr>
<tr>
<td>Popup with no header and footer</td>
<td><pre class="prettyprint">
<div id="listNoTitleNoBtnPopup" class="ui-popup">
- <div class="ui-popup-content" style="height:294px; overflow-y:scroll">
- <ul class="ui-listview">
- <li><a href="">Ringtones 1</a></li>
- <li><a href="">Ringtones 2</a></li>
- <li><a href="">Ringtones 3</a></li>
- </ul>
- </div>
+ <div class="ui-popup-content" style="height:294px; overflow-y:scroll">
+ <ul class="ui-listview">
+ <li><a href="">Ringtones 1</a></li>
+ <li><a href="">Ringtones 2</a></li>
+ <li><a href="">Ringtones 3</a></li>
+ </ul>
+ </div>
</div></pre></td>
</tr>
<tr>
<td>Toast popup</td>
<td><pre class="prettyprint">
<div id="PopupToast" class="ui-popup ui-popup-toast">
- <div class="ui-popup-content">Saving contacts to the SIM card</div>
+ <div class="ui-popup-content">Saving contacts to the SIM card</div>
</div>
</pre></td>
</tr>
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
<!--HTML code-->
<div id="1btnPopup" class="ui-popup">
- <div class="ui-popup-header">Power saving mode</div>
- <div class="ui-popup-content"></div>
- <div class="ui-popup-footer">
- <button id="1btnPopup-cancel" class="ui-btn">Cancel</button>
- </div>
+ <div class="ui-popup-header">Power saving mode</div>
+ <div class="ui-popup-content"></div>
+ <div class="ui-popup-footer">
+ <button id="1btnPopup-cancel" class="ui-btn">Cancel</button>
+ </div>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<script>
- /* Popup opens with button click */
- button.addEventListener("click", function(ev)
- {
- tau.openPopup("#1btnPopup");
- });
+ /* Popup opens with button click */
+ button.addEventListener("click", function(ev)
+ {
+ tau.openPopup("#1btnPopup");
+ });
- /* Popup closes with Cancel button click */
- document.getElementById('1btnPopup-cancel').addEventListener('click', function(ev)
- {
- tau.closePopup();
- });
+ /* Popup closes with Cancel button click */
+ document.getElementById('1btnPopup-cancel').addEventListener('click', function(ev)
+ {
+ tau.closePopup();
+ });
</script>
</pre></pre>
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
<!--Popup HTML code-->
<div id="popup" class="ui-popup">
- <div class="ui-popup-header"></div>
- <div class="ui-popup-content"></div>
+ <div class="ui-popup-header"></div>
+ <div class="ui-popup-content"></div>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<script>
- /* Use popup events */
- var popup = document.getElementById("popup");
- popup.addEventListener("popupbeforecreate", function(ev)
- {
- /* Implement code for popupbeforecreate event */
- });
+ /* Use popup events */
+ var popup = document.getElementById("popup");
+ popup.addEventListener("popupbeforecreate", function(ev)
+ {
+ /* Implement code for popupbeforecreate event */
+ });
</script>
</pre></pre>
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
<!--Popup HTML code-->
<div id="popup" class="ui-popup">
- <div class="ui-popup-content"></div>
- <div class="ui-popup-footer">
- <div class="ui-btn" id="cancel-btn"></div>
- </div>
+ <div class="ui-popup-content"></div>
+ <div class="ui-popup-footer">
+ <div class="ui-btn" id="cancel-btn"></div>
+ </div>
</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JavaScript code */
<script>
- /* Use popup events */
- var popup = document.getElementById("popup"),
- cancel = document.getElementById("cancel-btn");
+ /* Use popup events */
+ var popup = document.getElementById("popup"),
+ cancel = document.getElementById("cancel-btn");
- openButton.addEventListener("click", function()
- {
- tau.openPopup("#popup");
- });
- popup.addEventListener("popupshow", function()
- {
- console.log("Implement code after popup show completely");
- });
+ openButton.addEventListener("click", function()
+ {
+ tau.openPopup("#popup");
+ });
+ popup.addEventListener("popupshow", function()
+ {
+ console.log("Implement code after popup show completely");
+ });
- cancel.addEventListener("click", function()
- {
- tau.closePopup();
- console.log(window.getComputedStyle(popup).display); /* Block - not closed yet */
- });
- popup.addEventListener("popuphide", function()
- {
- console.log(window.getComputedStyle(popup).display); /* None - closed completely */
- });
+ cancel.addEventListener("click", function()
+ {
+ tau.closePopup();
+ console.log(window.getComputedStyle(popup).display); /* Block - not closed yet */
+ });
+ popup.addEventListener("popuphide", function()
+ {
+ console.log(window.getComputedStyle(popup).display); /* None - closed completely */
+ });
</script>
</pre></pre>
<h2>Popup Transitions</h2>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
<title>Processing</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Processing</h1>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#html-example">HTML Examples</a></li>
-
+
</ol>
<h2 id="html-example">HTML Examples</h2>
<pre class="prettyprint">
<div class="ui-processing"></div>
<div class="ui-processing-text">
- Description about progress
+ Description about progress
</div>
</pre>
<pre class="prettyprint">
<div class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">Processing</h2>
- </header>
- <div class="ui-content content-padding">
- It was a real pleasure for me to finally get to meet you. My colleagues join me in sending you our holiday...
- </div>
- <div class="ui-processing ui-processing-full-size"></div>
+ <header class="ui-header">
+ <h2 class="ui-title">Processing</h2>
+ </header>
+ <div class="ui-content content-padding">
+ It was a real pleasure for me to finally get to meet you. My colleagues join me in sending you our holiday...
+ </div>
+ <div class="ui-processing ui-processing-full-size"></div>
</div>
</pre>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
<title>Progress</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Progress</h1>
<tr>
<td><span style="font-family: Courier New,Courier,monospace">ui-progress-ratio</span></td>
<td>Defines the element as a text <span style="font-family: Courier New,Courier,monospace"><div></span> element with progress ratio.</td>
- </tr>
+ </tr>
</tbody>
</table>
</pre>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
<title>Section Changer</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Section Changer</h1>
<p>To add a section changer component to the application, use the following code:</p>
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
<div id="hasSectionchangerPage" class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">SectionChanger</h2>
- </header>
- <div id="sectionchanger" class="ui-content">
- <!--Section changer has only one child-->
- <div>
- <section>
- <h3>LEFT1 PAGE</h3>
- </section>
- <section class="section-active">
- <h3>MAIN PAGE</h3>
- </section>
- <section>
- <h3>RIGHT1 PAGE</h3>
- </section>
- </div>
- </div>
-</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">(function()
+ <header class="ui-header">
+ <h2 class="ui-title">SectionChanger</h2>
+ </header>
+ <div id="sectionchanger" class="ui-content">
+ <!--Section changer has only one child-->
+ <div>
+ <section>
+ <h3>LEFT1 PAGE</h3>
+ </section>
+ <section class="section-active">
+ <h3>MAIN PAGE</h3>
+ </section>
+ <section>
+ <h3>RIGHT1 PAGE</h3>
+ </section>
+ </div>
+ </div>
+</div></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">(function()
{
- var page = document.getElementById("hasSectionchangerPage"),
- element = document.getElementById("sectionchanger"),
- sectionChanger, idx=1;
-
- page.addEventListener("pageshow", function()
- {
- /* Create the SectionChanger object */
- sectionChanger = tau.widget.SectionChanger(element,
- {
- circular: true,
- orientation: "horizontal",
- useBouncingEffect: true
- });
- });
-
- page.addEventListener("pagehide", function()
- {
- /* Release the object */
- sectionChanger.destroy();
- });
+ var page = document.getElementById("hasSectionchangerPage"),
+ element = document.getElementById("sectionchanger"),
+ sectionChanger, idx=1;
+
+ page.addEventListener("pageshow", function()
+ {
+ /* Create the SectionChanger object */
+ sectionChanger = tau.widget.SectionChanger(element,
+ {
+ circular: true,
+ orientation: "horizontal",
+ useBouncingEffect: true
+ });
+ });
+
+ page.addEventListener("pagehide", function()
+ {
+ /* Release the object */
+ sectionChanger.destroy();
+ });
})();
</pre></pre>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">sectionchange</span></td>
<td><p>Triggered when the section is changed.</p></td>
</tr>
-
+
</tbody>
</table>
<p>To use the <span style="font-family: Courier New,Courier,monospace">sectionchange</span> event, use the following code:</p>
<pre class="prettyprint">
-(function()
+(function()
{
- var changer = document.getElementById("sectionchanger");
- changer.addEventListener("sectionchange", function(evt)
- {
- console.debug(evt.detail.active + " section is active.");
- });
+ var changer = document.getElementById("sectionchanger");
+ changer.addEventListener("sectionchange", function(evt)
+ {
+ console.debug(evt.detail.active + " section is active.");
+ });
})();
</pre>
</div>
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
-
+
+
</div>
</dd>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#html-example0.9038220448419452">How to Create Selector</a>
-
+
</li>
-
+
<li><a href="#options0.08969108131714165">Options</a>
-
+
</li>
-
+
<li><a href="#events-list">Events</a>
-
+
</li>
-
+
<li><a href="#methods-list">Methods</a>
-
+
<ol class="toc">
-
+
<li><a href="#method-changeItem">changeItem</a>
</li>
-
+
<li><a href="#method-addItem">addItem</a>
</li>
-
+
<li><a href="#method-removeItem">removeItem</a>
</li>
-
+
</ol>
-
+
</li>
-
+
</ol>
<h2><a id='html-example0.9038220448419452'>How to Create Selector</a></h2>
<pre class="prettyprint">
<div class="ui-page ui-page-active" id="main">
- <div id="selector" class="ui-selector">
- <div class="ui-item ui-show-icon" data-title="Show"></div>
- <div class="ui-item ui-human-icon" data-title="Human"></div>
- <div class="ui-item ui-delete-icon" data-title="Delete"></div>
- <div class="ui-item ui-show-icon" data-title="Show"></div>
- <div class="ui-item ui-human-icon" data-title="Human"></div>
- <div class="ui-item ui-delete-icon" data-title="Delete"></div>
- <div class="ui-item ui-x-icon" data-title="X Icon"></div>
- <div class="ui-item ui-fail-icon" data-title="Fail"></div>
- <div class="ui-item ui-show-icon" data-title="Show"></div>
- <div class="ui-item ui-human-icon" data-title="Human"></div>
- <div class="ui-item ui-delete-icon" data-title="Delete"></div>
- </div>
+ <div id="selector" class="ui-selector">
+ <div class="ui-item ui-show-icon" data-title="Show"></div>
+ <div class="ui-item ui-human-icon" data-title="Human"></div>
+ <div class="ui-item ui-delete-icon" data-title="Delete"></div>
+ <div class="ui-item ui-show-icon" data-title="Show"></div>
+ <div class="ui-item ui-human-icon" data-title="Human"></div>
+ <div class="ui-item ui-delete-icon" data-title="Delete"></div>
+ <div class="ui-item ui-x-icon" data-title="X Icon"></div>
+ <div class="ui-item ui-fail-icon" data-title="Fail"></div>
+ <div class="ui-item ui-show-icon" data-title="Show"></div>
+ <div class="ui-item ui-human-icon" data-title="Human"></div>
+ <div class="ui-item ui-delete-icon" data-title="Delete"></div>
+ </div>
</div>
</pre>
<pre class="prettyprint">
(function()
{
- var page = document.getElementById("selectorPage"),
- selector = document.getElementById("selector"),
- clickBound;
-
- function onClick(event)
- {
- var activeItem = selector.querySelector(".ui-item-active");
- /* console.log(activeItem.getAttribute("data-title")); */
- }
- page.addEventListener("pagebeforeshow", function()
- {
- clickBound = onClick.bind(null);
- tau.widget.Selector(selector);
- selector.addEventListener("click", clickBound, false);
- });
- page.addEventListener("pagebeforehide", function()
- {
- selector.removeEventListener("click", clickBound, false);
- });
+ var page = document.getElementById("selectorPage"),
+ selector = document.getElementById("selector"),
+ clickBound;
+
+ function onClick(event)
+ {
+ var activeItem = selector.querySelector(".ui-item-active");
+ /* console.log(activeItem.getAttribute("data-title")); */
+ }
+ page.addEventListener("pagebeforeshow", function()
+ {
+ clickBound = onClick.bind(null);
+ tau.widget.Selector(selector);
+ selector.addEventListener("click", clickBound, false);
+ });
+ page.addEventListener("pagebeforehide", function()
+ {
+ selector.removeEventListener("click", clickBound, false);
+ });
})();
</pre>
<th>Default value</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-item-selector</span></td>
<td class="option">String</td>
<td class="option">".ui-item"</td>
<td class="option"><p>Selector item selector that style is css selector.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-item-degree</span></td>
<td class="option">Number</td>
<td class="option">30</td>
<td class="option">The angle between each items.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-item-radius</span></td>
<td class="option">Number</td>
<td class="option">-1</td>
<td class="option">The radius between item and center. Default value is determined by Selector layout.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-indicator-selector</span></td>
<td class="option">String</td>
<td class="option">".ui-selector-indicator"</td>
<td class="option">Selector indicator selector that style is css selector.</td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">data-indicator-arrow-selector</span></td>
<td class="option">String</td>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">selectoritemchange</span></td>
<td><p>Triggered when the active item is changed. Target is active item element.<br />This event has detail information.<br />- layer: Layer element on active item<br />- layerIndex: Layer's index on active item<br />- index: Item index on layer.<br />- title: If Item has 'data-title' attribute, this value is that.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">selectorlayerchange</span></td>
<td><p>Triggered when the active layer is changed. Target is active layer element.<br />This event has detail information.<br />- index: Layer index.</p></td>
</tr>
-
+
</tbody>
</table>
</tbody>
</table>
<dl>
-
+
<dt class="method"><code><b><span class="methodName"
id="method-changeItem">changeItem</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">changeItem(Number index) </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">index</span></td>
<td>Number</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-addItem">addItem</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">addItem(HTMLElement item, Number index) </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">item</span></td>
<td>HTMLElement</td>
<td></td>
<td></td>
</tr>
-
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">index</span></td>
<td>Number</td>
<td>Last index</td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-removeItem">removeItem</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">removeItem(Number index) </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
+
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<table>
<th>Default value</th>
<th>Description</th>
</tr>
-
-
+
+
<tr>
<td><span style="font-family: Courier New,Courier,monospace">index</span></td>
<td>Number</td>
<td></td>
<td></td>
</tr>
-
-
+
+
</tbody>
</table>
</div>
-
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
-
+
+
</dl>
-
+
<div id="footer">
<hr size="1">
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
<title>Slider</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Slider</h1>
<pre class="prettyprint">
<div class="ui-page">
- <header class="ui-header">
- <h2 class="ui-title">Slider</h2>
- </header>
- <div class="ui-content content-padding">
- Slider length can be modified by the width style.
- <input type="range"/>
- </div>
+ <header class="ui-header">
+ <h2 class="ui-title">Slider</h2>
+ </header>
+ <div class="ui-content content-padding">
+ Slider length can be modified by the width style.
+ <input type="range"/>
+ </div>
</div>
</pre>
<p>If you want to modify the width of the slider,please change the length with width style.</p>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#default-selectors0.06779201747849584">How to create SnapListview</a>
-
+
</li>
<li><a href="#default-using0.06779201747849584">Usage of SnapListview</a>
-
+
</li>
-
+
<li><a href="#events-list">Events</a>
-
+
</li>
-
+
</ol>
<h2><a id='default-selectors0.06779201747849584'></a>How to create SnapListview</h2>
<pre class="prettyprint">
<ul class="ui-listview ui-snap-listview" id="snapList">
- <li>1line</li>
- <li>2line</li>
- <li>3line</li>
- <li>4line</li>
- <li>5line</li>
+ <li>1line</li>
+ <li>2line</li>
+ <li>3line</li>
+ <li>4line</li>
+ <li>5line</li>
</ul>
</pre>
<p>In javascript code, you can make your list as SnapListview component as follows:</p>
<pre class="prettyprint">
<script>
- var snapList = document.getElementById("snapList"),
- snapListComponent = tau.widget.SnapListview(snapList);
+ var snapList = document.getElementById("snapList"),
+ snapListComponent = tau.widget.SnapListview(snapList);
</script>
</pre>
<p>When "selected" event triggered, center-positioned list item can be expand with sub text. Also, we can make main text move with Marquee.<br><br>
-TAU supported helper script named SnapListMarqueeStyle. You can use tau.helper.SnapListMarqueeStyle to make your application more nice.</p>
+TAU supported helper script named SnapListMarqueeStyle. You can use tau.helper.SnapListMarqueeStyle to make your application more nice.</p>
<h2><a id="events-list"></a>Events</h2>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">scrollstart</span></td>
<td><p>Triggered when snaplist scoll started.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">scrollend</span></td>
<td><p>Triggered when snaplist scoll ended.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">selected</span></td>
<td><p>Triggered when snaplist detects center-positioned list item.</p></td>
</tr>
-
+
</tbody>
</table>
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
<title>Swipe List</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Swipe List</h1>
<h3>HTML</h3>
<pre class="prettyprint">
<div class="ui-page" id="pageSwipeList">
- <div class="ui-content">
- <!--List items that can be swiped-->
- <ul class="ui-listview ui-swipelist-list">
- <li>Andrew</li>
- <li>Bill</li>
- <li>Christina</li>
- <li>Daniel</li>
- <li>Edward</li>
- <li>Peter</li>
- <li>Sam</li>
- <li>Tom</li>
- </ul>
- <!--Swipe actions-->
- <div class="ui-swipelist">
- <div class="ui-swipelist-left">
- <div class="ui-swipelist-icon"></div>
- <div class="ui-swipelist-text">Calling</div>
- </div>
- <div class="ui-swipelist-right">
- <div class="ui-swipelist-icon"></div>
- <div class="ui-swipelist-text">Message</div>
- </div>
- </div>
- </div>
+ <div class="ui-content">
+ <!--List items that can be swiped-->
+ <ul class="ui-listview ui-swipelist-list">
+ <li>Andrew</li>
+ <li>Bill</li>
+ <li>Christina</li>
+ <li>Daniel</li>
+ <li>Edward</li>
+ <li>Peter</li>
+ <li>Sam</li>
+ <li>Tom</li>
+ </ul>
+ <!--Swipe actions-->
+ <div class="ui-swipelist">
+ <div class="ui-swipelist-left">
+ <div class="ui-swipelist-icon"></div>
+ <div class="ui-swipelist-text">Calling</div>
+ </div>
+ <div class="ui-swipelist-right">
+ <div class="ui-swipelist-icon"></div>
+ <div class="ui-swipelist-text">Message</div>
+ </div>
+ </div>
+ </div>
</div>
</pre>
<pre class="prettyprint">
(function()
{
- var page = document.getElementById("pageSwipeList"),
- listElement = page.getElementsByClassName("ui-swipelist-list")[0],
- swipeList;
- page.addEventListener("pageshow", function()
- {
- /* Make swipe list object */
- swipeList = new tau.widget.SwipeList(listElement,
- {
- swipeTarget: "li",
- swipeElement: ".ui-swipelist"
- });
- });
- page.addEventListener("pagehide", function()
- {
- /* Release object */
- swipeList.destroy();
- });
+ var page = document.getElementById("pageSwipeList"),
+ listElement = page.getElementsByClassName("ui-swipelist-list")[0],
+ swipeList;
+ page.addEventListener("pageshow", function()
+ {
+ /* Make swipe list object */
+ swipeList = new tau.widget.SwipeList(listElement,
+ {
+ swipeTarget: "li",
+ swipeElement: ".ui-swipelist"
+ });
+ });
+ page.addEventListener("pagehide", function()
+ {
+ /* Release object */
+ swipeList.destroy();
+ });
})();
</pre>
<td>String</td>
<td>Swipe right container selector.
<p>The default value is <span style="font-family: Courier New,Courier,monospace">.ui-swipelist-right</span>.</p></td>
- </tr>
+ </tr>
<tr>
<td><span style="font-family: Courier New,Courier,monospace">threshold</span></td>
<td>Number</td>
<td>Define the threshold (in pixels) for the minimum swipe movement which allows the swipe action to appear.
</td>
- </tr>
+ </tr>
<tr>
<td><span style="font-family: Courier New,Courier,monospace">animationThreshold</span></td>
<td>IntNumbereger</td>
<td>String</td>
<td>Define the start color for the left-to-right swipe.
<p>The default value is <span style="font-family: Courier New,Courier,monospace">#62a917</span>.</p></td>
- </tr>
+ </tr>
<tr>
<td><span style="font-family: Courier New,Courier,monospace">ltrEndColor</span></td>
<td>String</td>
<td>String</td>
<td>Define the end color for the right-to-left swipe.
<p>The default value is <span style="font-family: Courier New,Courier,monospace">#58493a</span>.</p></td>
- </tr>
+ </tr>
</tbody>
</table>
<p>To use the swipe list events, use the following code:</p>
<pre class="prettyprint">
-(function()
+(function()
{
- var slist = document.getElementById("swipelist");
- slist.addEventListener("swipelist.left", function(evt)
- {
- /* You can connect your app with a native app (such as phone call or message) using the Device API */
- });
+ var slist = document.getElementById("swipelist");
+ slist.addEventListener("swipelist.left", function(evt)
+ {
+ /* You can connect your app with a native app (such as phone call or message) using the Device API */
+ });
})();
</pre>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<link href="../styles.css" rel="StyleSheet" type="text/css" />
<link href="../snippet.css" rel="StyleSheet" type="text/css" />
<title>Toggle Switch</title>
- </head>
- <body onload="prettyPrint()" id="content">
+ </head>
+ <body onload="prettyPrint()" id="content">
<h1>Toggle Switch</h1>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#html-example">HTML Example</a>
</li>
<h3>Normal size Toggle Switch</h3>
<p>
-To add a toggle switch, you must add the <span style="font-family: Courier New,Courier,monospace">ui-switch</span> class in the <span style="font-family: Courier New,Courier,monospace"><div></span> element. Because toggle switch is dependent on the checkbox component, you must implement the <span style="font-family: Courier New,Courier,monospace">ui-switch-input</span> class in a checkbox <span style="font-family: Courier New,Courier,monospace">input</span> element.</p>
+To add a toggle switch, you must add the <span style="font-family: Courier New,Courier,monospace">ui-switch</span> class in the <span style="font-family: Courier New,Courier,monospace"><div></span> element. Because toggle switch is dependent on the checkbox component, you must implement the <span style="font-family: Courier New,Courier,monospace">ui-switch-input</span> class in a checkbox <span style="font-family: Courier New,Courier,monospace">input</span> element.</p>
<p>To add a toggle switch component to the application, use the following code:</p>
<pre class="prettyprint">
<div class="ui-switch">
- <div class="ui-switch-text">
- Toggle Switch
- </div>
- <label class="ui-toggleswitch">
- <input type="checkbox" class="ui-switch-input"/>
- <div class="ui-switch-activation">
- <div class="ui-switch-inneroffset">
- <div class="ui-switch-handler"></div>
- </div>
- </div>
- </label>
+ <div class="ui-switch-text">
+ Toggle Switch
+ </div>
+ <label class="ui-toggleswitch">
+ <input type="checkbox" class="ui-switch-input"/>
+ <div class="ui-switch-activation">
+ <div class="ui-switch-inneroffset">
+ <div class="ui-switch-handler"></div>
+ </div>
+ </div>
+ </label>
</div></pre>
<p>You can use toggle switch component in list as checkbox/radio. Please refer following code:</p>
<pre class="prettyprint">
<ul class="ui-listview">
- <li class="li-has-toggle">
- <label>
- Toggle 1
- <div class="ui-toggleswitch">
- <input type="checkbox" class="ui-switch-input"/>
- <div class="ui-switch-button"></div>
- </div>
- </label>
- </li>
+ <li class="li-has-toggle">
+ <label>
+ Toggle 1
+ <div class="ui-toggleswitch">
+ <input type="checkbox" class="ui-switch-input"/>
+ <div class="ui-switch-button"></div>
+ </div>
+ </label>
+ </li>
</ul></pre>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
-
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
-
+</script>
+
</body>
</html>
<tr>
<td class="note">This component is supported since <strong>2.3</strong>.</td>
</tr>
-
+
</tbody>
</table>
<h2>Table of Contents</h2>
<ol class="toc">
-
+
<li><a href="#how-to">How to Create ViewSwitcher</a></li>
<li><a href="#events-list">Events</a></li>
<li><a href="#methods-list">Methods</a>
- <ol class="toc">
+ <ol class="toc">
<li><a href="#method-setActiveIndex">setActiveIndex</a>
</li>
-
+
<li><a href="#method-getActiveIndex">getActiveIndex</a>
</li>
-
+
</ol>
-
+
</li>
-
+
</ol>
<h2><a id="how-to"></a>How to Create ViewSwitcher</h2>
<pre class="prettyprint">
<div id="drawerPage" class="ui-page">
- <div id="moreoptionsDrawer" class="ui-drawer">
- <div id="pageIndicator" class="ui-page-indicator"></div>
- <div id="viewSwitcher" class="ui-view-switcher">
- <div class="ui-view custom-view">
- <button class="option-button">1</button>
- </div>
- <div class="ui-view custom-view ui-view-active">
- <button class="option-button">2</button>
- </div>
- <div class="ui-view custom-view">
- <button class="option-button">3</button>
- </div>
- <div class="ui-view custom-view">
- <button class="option-button">4</button>
- </div>
- <div class="ui-view custom-view">
- <button class="option-button">5</button>
- </div>
- </div>
- </div>
+ <div id="moreoptionsDrawer" class="ui-drawer">
+ <div id="pageIndicator" class="ui-page-indicator"></div>
+ <div id="viewSwitcher" class="ui-view-switcher">
+ <div class="ui-view custom-view">
+ <button class="option-button">1</button>
+ </div>
+ <div class="ui-view custom-view ui-view-active">
+ <button class="option-button">2</button>
+ </div>
+ <div class="ui-view custom-view">
+ <button class="option-button">3</button>
+ </div>
+ <div class="ui-view custom-view">
+ <button class="option-button">4</button>
+ </div>
+ <div class="ui-view custom-view">
+ <button class="option-button">5</button>
+ </div>
+ </div>
+ </div>
</div>
</pre>
<pre class="prettyprint">
(function()
{
- var viewSwitcherElement = page.querySelector("#viewSwitcher"),
- viewSwitcher = tau.widget.ViewSwitcher(viewSwitcherElement);
+ var viewSwitcherElement = page.querySelector("#viewSwitcher"),
+ viewSwitcher = tau.widget.ViewSwitcher(viewSwitcherElement);
})();
</pre>
<h2><a id="events-list"></a>Events</h2>
- <h3>Summary</h3>
+ <h3>Summary</h3>
<table>
<tbody>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">viewchange</span></td>
<td><p>This event has been triggered when view was located on change location.
<p>This event has detail information.<br>
- index : {number} This information is active index after view animation.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">viewchangestart</span></td>
<td><p>Triggered when view changing started.</p></td>
</tr>
-
+
<tr>
<td class="option"><span style="font-family: Courier New,Courier,monospace">viewchangeend</span></td>
<td><p>Triggered when view changing ended.</p></td>
</tr>
-
+
</tbody>
</table>
<pre class="prettyprint">
(function()
{
- var viewSwitcherElement = page.querySelector("#viewSwitcher"),
- views = document.querySelectorAll(".ui-view"),
- elPageIndicator = document.querySelector("#pageIndicator");
-
- pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5}),
- viewSwitcherElement.addEventListener("viewchange", function(event)
- {
- var index = event.detail.index;
- if (index < 0 || index > views.length - 1)
- {
- return;
- }
- pageIndicator.setActive(index);
- }, false);
+ var viewSwitcherElement = page.querySelector("#viewSwitcher"),
+ views = document.querySelectorAll(".ui-view"),
+ elPageIndicator = document.querySelector("#pageIndicator");
+
+ pageIndicator = tau.widget.PageIndicator(elPageIndicator, {numberOfPages: 5}),
+ viewSwitcherElement.addEventListener("viewchange", function(event)
+ {
+ var index = event.detail.index;
+ if (index < 0 || index > views.length - 1)
+ {
+ return;
+ }
+ pageIndicator.setActive(index);
+ }, false);
})();
</pre>
<h2><a id="methods-list"></a>Methods</h2>
</tr>
</thead>
<tbody>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-setActiveIndex">setActiveIndex</a>(index) </pre>
</td>
<td><p>Set the active view with index value</p></td>
</tr>
-
-
-
+
+
+
<tr>
<td>
<pre class="intable prettyprint"><a href="#method-getActiveIndex">getActiveIndex</a>() </pre>
</td>
<td><p>Get the active view index</p></td>
</tr>
-
-
+
+
</tbody>
</table>
<dl>
-
-
-
-
+
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-setActiveIndex">setActiveIndex</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">setActiveIndex(index) </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
-
+
+
No Return Value
-
+
</div>
-
+
</dd>
-
-
-
+
+
+
<dt class="method"><code><b><span class="methodName"
id="method-getActiveIndex">getActiveIndex</span></b></code></dt>
<dd>
<div class="synopsis">
<pre class="signature prettyprint">getActiveIndex() </pre>
</div>
-
+
<div class="description">
<p>
-
+
</p>
</div>
-
-
-
+
+
+
<div class="returntype">
<p><span class="return">Return value:</span></p>
-
+
<table>
<tbody>
<tr>
</tr>
</tbody>
</table>
-
+
</div>
-
+
</dd>
-
-
+
+
</dl>
-
+
<div id="footer">
<hr size="1">
<pre class="prettyprint">
<ul id="vlist" class="ui-listview ui-virtuallistview"></ul>
</pre></li>
-
+
<li>Insert a virtual list HTML and JSON (<span style="font-family: Courier New,Courier,monospace">virtuallist-db-demo.js</span>) code:
<pre class="prettyprint"><pre class="prettyprint lang-html" style="border:0px; margin:0px">
<script type="text/javascript" src="virtuallist-db-demo.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="../../lib/tau/js/virtuallist.js"></script></pre><pre class="prettyprint lang-js" style="border:0px; margin:0px">/* JSON DATA example in virtuallist-db-demo.js */
-var JSON_DATA =
+var JSON_DATA =
[
- {NAME:"Abdelnaby, Alaa"},
- {NAME:"Abdul-Aziz, Zaid"},
- {NAME:"Abdul-Jabbar, Kareem"},
- {NAME:"Abdul-Rauf, Mahmoud"},
- {NAME:"Abdul-Wahad, Tariq"}
- /* Other list items */
+ {NAME:"Abdelnaby, Alaa"},
+ {NAME:"Abdul-Aziz, Zaid"},
+ {NAME:"Abdul-Jabbar, Kareem"},
+ {NAME:"Abdul-Rauf, Mahmoud"},
+ {NAME:"Abdul-Wahad, Tariq"}
+ /* Other list items */
]
</pre></pre>
</li>
<pre class="prettyprint">
/* Get HTML element reference */
var elList = document.getElementById("vlist"),
- /* All config options can be found in virtual list reference */
- vlist = tau.widget.VirtualListview(elList,
- {
- dataLength: JSON_DATA.length,
- bufferSize: 40
- });
+ /* All config options can be found in virtual list reference */
+ vlist = tau.widget.VirtualListview(elList,
+ {
+ dataLength: JSON_DATA.length,
+ bufferSize: 40
+ });
/* Update list items */
vlist.setListItemUpdater(function(elListItem, newIndex)
{
- var data = JSON_DATA[newIndex];
- elListItem.innerHTML = '<span class="ui-li-text-main">' + data.NAME + '</span>';
+ var data = JSON_DATA[newIndex];
+ elListItem.innerHTML = '<span class="ui-li-text-main">' + data.NAME + '</span>';
});
</pre>
<p>The <span style="font-family: Courier New,Courier,monospace">listItemUpdater</span> attribute defines how the list element is updated depending on the data row index. If you do not define the attribute in the configuration, you can set the update feature with the <span style="font-family: Courier New,Courier,monospace">setListItemUpdater()</span> method.</p>
-<table class="note">
- <tbody>
- <tr>
- <th class="note">Note</th>
- </tr>
- <tr>
- <td class="note"><p>The virtual list manipulates DOM elements to be more efficient. It does not remove or create list elements before calling the list item update method. It means that the order of the <span style="font-family: Courier New,Courier,monospace"><li></span> elements is volatile, and you must keep the list element clean from custom classes and attributes.</p></td>
- </tr>
- </tbody>
+<table class="note">
+ <tbody>
+ <tr>
+ <th class="note">Note</th>
+ </tr>
+ <tr>
+ <td class="note"><p>The virtual list manipulates DOM elements to be more efficient. It does not remove or create list elements before calling the list item update method. It means that the order of the <span style="font-family: Courier New,Courier,monospace"><li></span> elements is volatile, and you must keep the list element clean from custom classes and attributes.</p></td>
+ </tr>
+ </tbody>
</table>
</li>
<pre class="prettyprint">
page.addEventListener("pagehide", function()
{
- vlist.destroy();
+ vlist.destroy();
});
</pre></li>
</ol>
<td>String</td>
<td>No</td>
<td>Defines the scrolling orientation. The default value is <span style="font-family: Courier New,Courier,monospace">VERTICAL</span>.</p></td>
- </tr>
+ </tr>
<tr>
<td><span style="font-family: Courier New,Courier,monospace">listItemUpdater</span></td>
<td>Method reference</td>
<tr>
<td><span style="font-family: Courier New,Courier,monospace">setListItemUpdater(function)</span></td>
<td>Sets the list item updater function.</td>
- </tr>
+ </tr>
</tbody>
</table>
- <div id="footer">
- <hr size="1" />
- <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
- </div>
+ <div id="footer">
+ <hr size="1" />
+ <font size="1">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</font>
+ </div>
<script type="text/javascript">
var _gaq = _gaq || [];
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<link rel="stylesheet" type="text/css" href="../css/styles.css" />
<link rel="stylesheet" type="text/css" href="../css/snippet.css" />
- <script type="text/javascript" src="../scripts/snippet.js"></script>
+ <script type="text/javascript" src="../scripts/snippet.js"></script>
<script type="text/javascript" src="../scripts/jquery.util.js" charset="utf-8"></script>
<script type="text/javascript" src="../scripts/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../scripts/core.js" charset="utf-8"></script>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">stream</span>:
+<span class="name">stream</span>:
Stream object obtained from getUserMedia. "audio" of MediaStreamOptions dictionary is supported
</li>
<li class="param">
-<span class="name">successCallback</span>:
+<span class="name">successCallback</span>:
The method to invoke when CameraControl object is created successfully.
</li>
<li class="param">
-<span class="name">errorCallback</span>:
+<span class="name">errorCallback</span>:
The method to invoke when an error occurs.
</li>
</ul>
function gotStream(stream)
{
- navigator.tizCamera.createCameraControl(stream, gotCamera, noCamera);
+ navigator.tizCamera.createCameraControl(stream, gotCamera, noCamera);
}
function noStream() {}
function gotCamera(cam)
{
- /* CameraControl */
- camera = cam;
+ /* CameraControl */
+ camera = cam;
}
function noCamera() {}
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">cameraControl</span>:
+<span class="name">cameraControl</span>:
Created camera control.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">error</span>:
+<span class="name">error</span>:
Error that occurred.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">settings</span>:
+<span class="name">settings</span>:
Settings for camera.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to invoke when a new setting is applied successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The method to invoke when setting related error occurs.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">errors</span>:
+<span class="name">errors</span>:
Containing error codes.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">settings</span>:
+<span class="name">settings</span>:
New settings for camera recording.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to invoke when new settings is applied successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The method to invoke when some error occurs.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to invoke when recording is started successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The method to invoke when some error occurs.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to invoke when recording is started successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The method to invoke when en error occurs.
</li>
</ul>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">settings</span>:
+<span class="name">settings</span>:
New settings for photo.
</li>
<li class="param">
-<span class="name">onsuccess</span>:
+<span class="name">onsuccess</span>:
The method to invoke when new settings is applied successfully.
</li>
<li class="param">
-<span class="name">onerror</span>:
+<span class="name">onerror</span>:
The method to invoke when en error occurs.
</li>
</ul>
<ul>
<li class="attribute" id="pictureSizes">
<span class="attrName"><span class="readonly"> readonly
-</span><span class="type">CameraSize[]
+</span><span class="type">CameraSize[]
</span><span class="name">pictureSizes</span></span><div class="brief">
Array containing available picture sizes.
</div>
</li>
<li class="attribute" id="pictureFormats">
<span class="attrName"><span class="readonly"> readonly
-</span><span class="type">DOMString[]
+</span><span class="type">DOMString[]
</span><span class="name">pictureFormats</span></span><div class="brief">
Array containing available picture formats.
</div>
</li>
<li class="attribute" id="recordingFormats">
<span class="attrName"><span class="readonly"> readonly
-</span><span class="type">DOMString[]
+</span><span class="type">DOMString[]
</span><span class="name">recordingFormats</span></span><div class="brief">
Array containing available picture formats.
</div>
<h4>Attributes</h4>
<ul><li class="attribute" id="codes">
<span class="attrName"><span class="readonly"> readonly
-</span><span class="type">unsigned short[]
+</span><span class="type">unsigned short[]
</span><span class="name">codes</span></span><div class="brief">
Error code.
</div>
};</pre>
</div>
<div id="footer">
-<div class="copyright" align="center">
- Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
+<div class="copyright" align="center">
+ Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
</div>
-<script type="text/javascript">
+<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<link rel="stylesheet" type="text/css" href="../css/styles.css" />
<link rel="stylesheet" type="text/css" href="../css/snippet.css" />
- <script type="text/javascript" src="../scripts/snippet.js"></script>
+ <script type="text/javascript" src="../scripts/snippet.js"></script>
<script type="text/javascript" src="../scripts/jquery.util.js" charset="utf-8"></script>
<script type="text/javascript" src="../scripts/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../scripts/core.js" charset="utf-8"></script>
<h1>W3C/HTML5 and Supplementaries API Reference</h1>
-
+
<p>Click the profile you want:</p>
<p><a href="w3c_api_m.html"><img alt="Mobile Web" src="../images/mw_division.png"/></a> <a href="w3c_api_w.html"><img alt="Wearable Web" src="../images/ww_division.png"/></a></p>
<h1>Tizen Mobile Web W3C/HTML5 and Supplementaries API Reference</h3>
</div>
<p>The APIs listed in this category are all part of the W3C specifications. Some of the APIs are stable while others are draft specifications. The draft APIs are subject to change as the W3C specification evolves.</p>
- <p>The W3C APIs are categorized based on the functionality to make it easier to locate specific APIs.
+ <p>The W3C APIs are categorized based on the functionality to make it easier to locate specific APIs.
To learn the Tizen features provided by the W3C/HTML5 and some supplementary APIs, see <a href="../../../org.tizen.guides/html/web/w3c/guides_w3c_w.htm">Guide to W3C/HTML5 and Some Supplementary Features</a> and <a href="../../../org.tizen.training/html/web/w3c/tutorials_w3c_w.htm">W3C/HTML5 and Some Supplementaries Tutorials</a>.</p>
<div><h4 id="dom">DOM, Forms and Styles</h4>
<table width="90%">
</tr>
<tr>
<td id="sceenori" name="screenori"><a href="http://www.w3.org/TR/2012/WD-screen-orientation-20120522">The Screen Orientation API </a></td>
- <td>To provide an interface for web applications to be able to read
- the screen orientation state, to be informed when this state changes
+ <td>To provide an interface for web applications to be able to read
+ the screen orientation state, to be informed when this state changes
and to be able to lock the screen orientation to a specific state</br>
<ul class="xmlconfig">
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Required feature</a>:
</ul>
</br>
<b>*Note: Only the front-facing camera is available in this version (Tizen 2.3 Mobile Profile).</b>
-
+
</td>
<td align="center">ED</td>
</tr>
-->
<div>SpeechSynthesis</div>
<ul class="xmlconfig">
- <li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Required feature</a>:
+ <li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Required feature</a>:
<ul>
<li><code>http://tizen.org/feature/speech.synthesis</code></li>
</ul>
<li><code>http://tizen.org/feature/microphone</code></li>
</ul>
</li>
- </ul>
+ </ul>
</td>
<td align="center">LCWD</td>
</tr>
<td id="directory" name="directory"><a href="http://www.w3.org/TR/2011/WD-file-system-api-20110419">File API: Directories and System</a></td>
<td>API that allows accessing the device file system.</br>
<ul class="xmlconfig">
- <li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege level</a>: Public</br></li>
+ <li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege level</a>: Public</br></li>
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/unlimitedstorage</code></li>
</ul>
</td>
<ul class="xmlconfig">
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege level</a>: Public</br></li>
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/notification</code></li>
- </ul>
+ </ul>
</td>
<td align="center">WD</td>
</tr>
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege level</a>: Public</br></li>
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/location</code></li>
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Required feature</a>: <code>http://tizen.org/feature/location.gps</code></li>
- </ul>
+ </ul>
</td>
<td align="center">PR</td>
</tr>
<td>Provides a way for an element to be displayed in full screen mode programmatically. The method and attribute currently not supported are:
<li><code>requestFullScreenWithKeys</code> of element</li>
<li><code>allowFullScreen</code> of <code>iframe</code> element</li>
- <p><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege Level</a>: Public</br>
- <a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/fullscreen</code> </p>
+ <p><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege Level</a>: Public</br>
+ <a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/fullscreen</code> </p>
</td>
</tr>
<tr>
</tr> -->
</tbody>
</table>
- </div>
+ </div>
</div>
<div id="footer">
<div class="copyright" align="center">
- Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
+ Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
</div>
</div>
</div>
<h1>Tizen Wearable Web W3C/HTML5 and Supplementaries API Reference</h3>
</div>
<p>The APIs listed in this category are all part of the W3C specifications. Some of the APIs are stable while others are draft specifications. The draft APIs are subject to change as the W3C specification evolves.</p>
- <p>The W3C APIs are categorized based on the functionality to make it easier to locate specific APIs.
+ <p>The W3C APIs are categorized based on the functionality to make it easier to locate specific APIs.
To learn the Tizen features provided by the W3C/HTML5 and some supplementary APIs, see <a href="../../../org.tizen.guides/html/web/w3c/guides_w3c_w.htm">Guide to W3C/HTML5 and Some Supplementary Features</a> and <a href="../../../org.tizen.training/html/web/w3c/tutorials_w3c_w.htm">W3C/HTML5 and Some Supplementaries Tutorials</a>.</p>
<div><h4 id="dom">DOM, Forms and Styles</h4>
<table width="90%">
<tbody>
<tr>
<td id="touch" name="touch"><a href="http://www.w3.org/TR/2013/REC-touch-events-20131010/">Touch Events version 1</a></td>
- <td>W3C touch event specification for touch devices.
+ <td>W3C touch event specification for touch devices.
<!--
The method currently not supported is:
<ul>
</tr>
<tr>
<td id="sceenori" name="screenori"><a href="http://www.w3.org/TR/2012/WD-screen-orientation-20120522">The Screen Orientation API </a></td>
- <td>To provide an interface for web applications to be able to read
- the screen orientation state, to be informed when this state changes
+ <td>To provide an interface for web applications to be able to read
+ the screen orientation state, to be informed when this state changes
and to be able to lock the screen orientation to a specific state</br>
<ul class="xmlconfig">
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Required feature</a>:
</ul>
</li>
</ul>
-
+
</td>
<td align="center">ED</td>
</tr>
-->
<div>SpeechSynthesis</div>
<ul class="xmlconfig">
- <li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Required feature</a>:
+ <li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Required feature</a>:
<ul>
<li><code>http://tizen.org/feature/speech.synthesis</code></li>
</ul>
<li><code>http://tizen.org/feature/microphone</code></li>
</ul>
</li>
- </ul>
+ </ul>
</td>
<td align="center">LCWD</td>
</tr>
<td id="directory" name="directory"><a href="http://www.w3.org/TR/2011/WD-file-system-api-20110419">File API: Directories and System</a></td>
<td>API that allows accessing the device file system.</br>
<ul class="xmlconfig">
- <li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege level</a>: Public</br></li>
+ <li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege level</a>: Public</br></li>
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/unlimitedstorage</code></li>
</ul>
</td>
<ul class="xmlconfig">
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege level</a>: Public</br></li>
<li><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/notification</code></li>
- </ul>
+ </ul>
</td>
<td align="center">WD</td>
</tr>
<li><code>http://tizen.org/feature/location.gps</code></li>
</ul>
</li>
- </ul>
+ </ul>
</td>
<td align="center">REC</td>
</tr>
-->
</tbody>
</table>
-
+
<!-- YHM -->
<h4 id="Supplementary">Supplementary</h4>
<td>Provides a way for an element to be displayed in full screen mode programmatically. The method and attribute currently not supported are:
<li><code>requestFullScreenWithKeys</code> of element</li>
<li><code>allowFullScreen</code> of <code>iframe</code> element</li>
- <p><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege Level</a>: Public</br>
- <a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/fullscreen</code> </p>
+ <p><a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege Level</a>: Public</br>
+ <a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/security-and-api-privileges">Privilege</a>: <code>http://tizen.org/privilege/fullscreen</code> </p>
</td>
</tr>
-->
</tr> -->
</tbody>
</table>
- </div>
+ </div>
</div>
<div id="footer">
<div class="copyright" align="center">
- Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
+ Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
</div>
</div>
</div>
};</pre>
</div>
<div id="footer">
-<div class="copyright" align="center">
- Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
+<div class="copyright" align="center">
+ Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
</div>
-<script type="text/javascript">
+<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<link rel="stylesheet" type="text/css" href="css/snippet.css" />
- <script type="text/javascript" src="scripts/snippet.js"></script>
+ <script type="text/javascript" src="scripts/snippet.js"></script>
<script type="text/javascript" src="scripts/jquery.util.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/common.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/core.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/search.js" charset="utf-8"></script>
- <title>Tizen Web API References</title>
+ <title>Tizen Web API References</title>
</head>
<body onload="prettyPrint()" style="overflow: auto;">
<li><a href="../../org.tizen.guides/html/web/guides_w.htm">Tizen Web Tutorials</a></li>
<li><a href="../../org.tizen.training/html/web/tutorials_w.htm">Tizen Web Guides</a></li>
</ul>
- </div>
+ </div>
</div>
-</div>
+</div>
<div id="container"><div id="contents"><div class="content">
- <h1>Tizen Web API References</h1>
- <p>The Tizen Web API specifications for the Tizen mobile and wearable Web profile consist of a collection of existing standards, such as <a href="http://www.w3.org" target="_blank">W3C</a> and <a href="http://www.khronos.org/" target="_blank">Khronos</a>.</p>
- <p>In addition to standards-based APIs, the Tizen mobile Web profile has a specific set of APIs, which provide access to device platform capabilities, enabling a rich Web application development environment. </p>
- <p>The following API references provide descriptions of all the APIs that can be used for creating Tizen Web applications.</p>
-
- <ul>
- <li><a href="device_api/device_api_cover.html">Tizen Web Device API Reference</a> <p>This reference provides the Tizen Web device API specifications.</p></li>
- <li><a href="ui_fw_api/ui_fw_api_cover.htm">Tizen Web UI Framework Reference</a> <p>This reference provides tools, such as widgets, events, effects, and animations, for Web application development.</p></li>
- <li><a href="w3c_api/w3c_api_cover.html">W3C/HTML5 and Supplementaries API Reference</a> <p>This reference provides the Tizen W3C/HTML5 and some supplementary API specifications.</p></li>
-
- </ul>
+ <h1>Tizen Web API References</h1>
+ <p>The Tizen Web API specifications for the Tizen mobile and wearable Web profile consist of a collection of existing standards, such as <a href="http://www.w3.org" target="_blank">W3C</a> and <a href="http://www.khronos.org/" target="_blank">Khronos</a>.</p>
+ <p>In addition to standards-based APIs, the Tizen mobile Web profile has a specific set of APIs, which provide access to device platform capabilities, enabling a rich Web application development environment. </p>
+ <p>The following API references provide descriptions of all the APIs that can be used for creating Tizen Web applications.</p>
+
+ <ul>
+ <li><a href="device_api/device_api_cover.html">Tizen Web Device API Reference</a> <p>This reference provides the Tizen Web device API specifications.</p></li>
+ <li><a href="ui_fw_api/ui_fw_api_cover.htm">Tizen Web UI Framework Reference</a> <p>This reference provides tools, such as widgets, events, effects, and animations, for Web application development.</p></li>
+ <li><a href="w3c_api/w3c_api_cover.html">W3C/HTML5 and Supplementaries API Reference</a> <p>This reference provides the Tizen W3C/HTML5 and some supplementary API specifications.</p></li>
+
+ </ul>
<script type="text/javascript" src="scripts/jquery.zclip.min.js"></script>
<script type="text/javascript" src="scripts/showhide.js"></script>
<div id="footer">
<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
</div>
-
+
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25976949-1']);
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-</script>
+</script>
</body>
</html>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<link rel="stylesheet" type="text/css" href="css/snippet.css" />
- <script type="text/javascript" src="scripts/snippet.js"></script>
+ <script type="text/javascript" src="scripts/snippet.js"></script>
<script type="text/javascript" src="scripts/jquery.util.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/common.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/core.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/search.js" charset="utf-8"></script>
- <title>TITLE</title>
+ <title>TITLE</title>
</head>
<body onload="prettyPrint()" style="overflow: auto;">
<div id="profile">
<p><img alt="Mobile Web" src="images/mobile_s_w.png"/> <img alt="Wearable Web" src="images/wearable_s_w.png"/></p>
</div>
-
+
<div id="toc_border"><div id="toc">
<p class="toc-title">Dependencies</p>
<ul class="toc">
</ul>
<p class="toc-title">Related Info</p>
<ul class="toc">
- <li><a href="../../../org.tizen.guides/html/web/tizen/communication/messaging_w.htm">LINK TO OTHER RELATED MATERIAL (NOT CHILD OR PARENT TOPICS IN TOC)</a></li>
- <li><a href="../../../org.tizen.web.apireference/html/device_api/mobile/tizen/messaging.html">LINKS TO RELATED APIS</a></li>
+ <li><a href="../../../org.tizen.guides/html/web/tizen/communication/messaging_w.htm">LINK TO OTHER RELATED MATERIAL (NOT CHILD OR PARENT TOPICS IN TOC)</a></li>
+ <li><a href="../../../org.tizen.web.apireference/html/device_api/mobile/tizen/messaging.html">LINKS TO RELATED APIS</a></li>
<li><a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/alarm.html">Alarm API for Mobile Web</a></li>
<li><a href="../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/alarm.html">Alarm API for Wearable Web</a></li>
</ul>
</div></div>
-</div>
+</div>
<div id="container"><div id="contents"><div class="content">
<h1>TITLE</h1>
- <p>Normal text, <code>courier font text, mainly file/folder names and method/function/enumerator/attribute names</code></p>
+ <p>Normal text, <code>courier font text, mainly file/folder names and method/function/enumerator/attribute names</code></p>
<p><a href="#example">link to a heading within the topic</a>, <a href="../../../../org.tizen.wearable.web.device.apireference/tizen/application.html#::Application::ApplicationInformation">link to other topics</a>, or <a href="http://www.google.com" target="_blank">link to a URL</a></p>
-
- <ul>
- <li>bullet list</li>
+
+ <ul>
+ <li>bullet list</li>
<li>bullet list
- <ol>
- <li>embedded step list</li>
- <li>embedded step list</li>
+ <ol>
+ <li>embedded step list</li>
+ <li>embedded step list</li>
</ol>
- </li>
+ </li>
</ul>
- <ol>
- <li>step list</li>
+ <ol>
+ <li>step list</li>
<li>step list
- <ol type="a">
- <li>embedded step list</li>
- <li>embedded step list</li>
+ <ol type="a">
+ <li>embedded step list</li>
+ <li>embedded step list</li>
</ol>
- </li>
+ </li>
</ol>
-
-<h2 id="example">Heading</h2>
-
-<h3>Lower Heading</h3>
-
-<h4>Even Lower Heading</h4>
+
+<h2 id="example">Heading</h2>
+
+<h3>Lower Heading</h3>
+
+<h4>Even Lower Heading</h4>
<p><strong>Bold text, used mainly for UI elements, such as button names</strong></p>
<p>The following special characters must be used:</p>
-<p>quotes are written as "</p>
+<p>quotes are written as "</p>
<p>single quote (apostrophe) is written as '</p>
<p>greater than character is written as ></p>
<p>less than character is written as <</p>
<p>ampersand character is written as &</p>
<p>registered trademark is written as ®</p>
<p>trademark is written as ™</p>
-
-<p>The following is a code snippet. The indentations at the beginning of each line are created with special space characters ( ):</p>
-
+
+<p>The following is a code snippet. The indentations at the beginning of each line are created with special space characters ( ):</p>
+
<pre class="prettyprint">
void message_port_cb(int local_port_id, const char *remote_app_id, bundle *message)
{
- char *command = NULL;
- <span class="highlight">To highlight a specific part of the code</span>
- bundle_get_str(message, "command", &command);
- bundle_get_str(message, "data", &data);
-
- dlog_print(DLOG_INFO, LOG_TAG,
- "Message from %s, command: %s data: %s",
- remote_app_id, command, data);
+ char *command = NULL;
+ <span class="highlight">To highlight a specific part of the code</span>
+ bundle_get_str(message, "command", &command);
+ bundle_get_str(message, "data", &data);
+
+ dlog_print(DLOG_INFO, LOG_TAG,
+ "Message from %s, command: %s data: %s",
+ remote_app_id, command, data);
}
</pre>
<td>Text</td>
</tr>
</tbody></table>
-
+
<p align="center"><strong>Figure: FIGURE CAPTION</strong></p>
-<p align="center"><img alt="FIGURE CAPTION" src="images/mobile_s_w.png" /></p>
-
+<p align="center"><img alt="FIGURE CAPTION" src="images/mobile_s_w.png" /></p>
+
<div class="note">
<strong>Note</strong>
NOTE CONTENT
</div>
-
+
<script type="text/javascript" src="scripts/jquery.zclip.min.js"></script>
<script type="text/javascript" src="scripts/showhide.js"></script>
</div></div></div>