[HAM] Added guide for gesture recognition 25/123425/6
authorTomasz Marciniak <t.marciniak@samsung.com>
Wed, 5 Apr 2017 11:43:08 +0000 (13:43 +0200)
committerMijin Cho <mijin85.cho@samsung.com>
Tue, 30 May 2017 08:32:55 +0000 (08:32 +0000)
PS4: Reviewed

Change-Id: I5c601e6ee148573106acb443469723f5736b950e
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
org.tizen.guides/html/index.htm
org.tizen.guides/html/web/sensors/ham_gesture_w.htm [new file with mode: 0644]
org.tizen.guides/html/web/sensors/sensors_cover_w.htm
org.tizen.guides/index.xml

index cfeec8b..6e0b33b 100644 (file)
                                                <li><a href="web/sensors/task_sensorball_w.htm" target="content">Task: Sensor Ball</a></li>
                                        </ul>
                                </li>
+                               <li><a href="web/sensors/ham_gesture_w.htm">Gesture Recognition</a></li>
                        </ul>
                </li>
                <li><a href="web/text_input/text_input_cover_w.htm" target="content">Text Input</a>
diff --git a/org.tizen.guides/html/web/sensors/ham_gesture_w.htm b/org.tizen.guides/html/web/sensors/ham_gesture_w.htm
new file mode 100644 (file)
index 0000000..8d9a2ee
--- /dev/null
@@ -0,0 +1,138 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <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/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>Gesture Recognition</title>
+ </head>
+ <body onload="prettyPrint()" style="overflow: auto;">
+
+ <div id="toc-navigation">
+    <div id="profile">
+        <p><img alt="Mobile Web" src="../../images/mobile_s_w_optional.png"/> <img alt="Wearable Web" src="../../images/wearable_s_w_optional.png"/></p>
+    </div>
+
+    <div id="toc_border"><div id="toc">
+        <p class="toc-title">Dependencies</p>
+        <ul class="toc">
+            <li>Tizen 4.0 and Higher for Mobile</li>
+            <li>Tizen 4.0 and Higher for Wearable</li>
+        </ul>
+        <p class="toc-title">Content</p>
+        <ul class="toc">
+            <li><a href="#is_supported">Checking the Gesture Support</a></li>
+            <li><a href="#add_listener">Receiving Notifications on Recognized Gestures</a></li>
+        </ul>
+        <p class="toc-title">Related Info</p>
+        <ul class="toc">
+            <li><a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html">Human Activity Monitor API for Mobile Web</a></li>
+            <li><a href="../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html">Human Activity Monitor API for Wearable Web</a></li>
+        </ul>
+    </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+<h1>Gesture Recogniton</h1>
+
+<p>You can set your application to recognize specific user gestures and react when the user performs them. The various recognizable gestures include, for example, when the user taps, shakes up, or picks up the device, or moves it along an axis.</p>
+<p>This feature is supported in mobile and wearable applications only.</p>
+<p>The main gesture recognition features of the Human Activity Monitor API include:</p>
+
+<ul>
+<li>Checking the gesture support
+<p>You can <a href="#is_supported">check whether a specific gesture type is supported</a> on a device.</p></li>
+<li>Receiving notifications
+<p>You can monitor when a defined gesture type is recognized, and <a href="#add_listener">receive a notification about the gesture</a>.</p></li>
+</ul>
+
+<h2 id="is_supported" name="is_supported">Checking the Gesture Support</h2>
+<p>Some gestures are not supported on all devices because the devices lack the necessary sensors.</p>
+<p>To check whether a specific gesture type is supported on the current device, use the <code>isGestureSupported()</code> method of the <code>HumanActivityMonitorManager</code> interface (in <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html#HumanActivityMonitorManager">mobile</a> and <a href="../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html#HumanActivityMonitorManager">wearable</a> applications):</p>
+
+<pre class="prettyprint">
+try
+{
+   var isSupported = tizen.humanactivitymonitor.isGestureSupported("GESTURE_PICK_UP");
+   console.log("GESTURE_PICK_UP is " + (isSupported ? "supported" : "not supported"));
+}
+catch (error)
+{
+   console.log("Error " + error.name + ": " + error.message);
+}
+</pre>
+
+<h2 id="add_listener" name="add_listener">Receiving Notifications on Recognized Gestures</h2>
+
+<p>Learning how to register a listener for gesture recognition allows you to receive notifications about different gestures the user performs with a device:</p>
+<ol>
+<li>To register a listener, use the <code>addGestureRecognitionListener()</code>  method of the <code>HumanActivityMonitorManager</code> interface (in <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/humanactivitymonitor.html#HumanActivityMonitorManager">mobile</a> and <a href="../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/humanactivitymonitor.html#HumanActivityMonitorManager">wearable</a> applications):
+<pre class="prettyprint">
+var listenerId;
+
+function listener(data)
+{
+   console.log("Received " + data.event + " event on " + new Date(data.timestamp * 1000) + " for "+ data.type + " type");
+}
+
+function errorCallback(error)
+{
+   console.log(error.name + ": " + error.message);
+}
+
+try
+{
+   listenerId = tizen.humanactivitymonitor.addGestureRecognitionListener("GESTURE_SHAKE", listener, errorCallback);
+}
+catch (error)
+{
+   console.log("Error " + error.name + ": " + error.message);
+}
+</pre>
+</li>
+
+<li>To stop receiving the notifications, remove the listener using the <code>removeGestureRecognitionListener()</code> method of the <code>HumanActivityMonitorManager</code> interface with the listener ID:
+
+<pre class="prettyprint">
+try
+{
+   tizen.humanactivitymonitor.removeGestureRecognitionListener(listenerId);
+}
+catch (err)
+{
+   console.log("Exception: " + err.name);
+}
+</pre>
+</li>
+</ol>
+
+<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../scripts/showhide.js"></script>
+
+</div></div></div>
+
+<a class="top sms" href="#"><img src="../../images/btn_top.gif" alt="Go to top" /></a>
+
+<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']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+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>
+
+</body>
+</html>
index f42328e..a44ff99 100644 (file)
@@ -43,6 +43,9 @@
 <li><a href="device_sensors_w.htm">Device Sensors</a>
 
 <p>You can read and manage data from various sensors on the device, and also receive notifications when the sensor data changes. You can access information from various environmental sensors, such as the light and magnetic sensors, and from user-related sensors, such as the heart rate monitor.</p></li>
+
+<li><a href="ham_gesture_w.htm">Gesture Recognition</a>
+<p>You can retrieve information about recognized gestures that the user performs with a device.</p></li>
 </ul>
 
 <script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
index baee6a3..e6bfa1e 100644 (file)
                <topic href="html/web/sensors/device_sensors_w.htm" label="Device Sensors">
                        <topic href="html/web/sensors/task_sensorball_w.htm" label="Task: Sensor Ball"></topic>
                </topic>
+               <topic href="html/web/sensors/ham_gesture_w.htm" label="Gesture Recognition"></topic>
        </topic>
        <topic href="html/web/text_input/text_input_cover_w.htm" label="Text Input">
                <topic href="html/web/text_input/input_method_w.htm" label="IME Application"></topic>