Add guide for SensorHardwareInfo 35/94235/3
authorPawel Wasowski <p.wasowski2@partner.samsung.com>
Mon, 17 Oct 2016 10:46:43 +0000 (12:46 +0200)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Fri, 28 Oct 2016 09:10:48 +0000 (12:10 +0300)
PS3: [LB] Reviewed

Change-Id: I217cfc01bc7487cb37d60c34328b452951a55869
Signed-off-by: Pawel Wasowski <p.wasowski2@partner.samsung.com>
org.tizen.guides/html/web/sensors/device_sensors_w.htm

index 0b00113..479930b 100644 (file)
@@ -29,6 +29,7 @@
         <ul class="toc">
             <li><a href="#manage">Managing Sensors</a></li>
             <li><a href="#receive">Receiving Notifications on Sensor Data Changes</a></li>
+            <li><a href="#hw-information">Obtaining Sensor Hardware Information</a></li>
         </ul>
         <p class="toc-title">Related Info</p>
         <ul class="toc">
@@ -59,6 +60,8 @@
 <p>You can <a href="#manage">enable the sensor, read sensor data, and disable the sensor</a>.</p></li>
 <li>Receiving notifications
 <p>You can <a href="#receive">receive notifications on sensor data changes</a>.</p></li>
+<li>Obtaining sensor hardware information 
+<p>You can <a href="#hw-information">retrieve information about the technical limits of the sensor</a>.</p></li>
 </ul>
 <p>The supported sensor types and their capabilities are listed in the following table.</p>
 
 <ul>
  <li><a href="#manage">Managing Sensors</a><p>Check, whether the sensor is supported, enable the sensor, read sensor data, and disable the sensor.</p></li>
  <li><a href="#receive">Receiving Notifications on Sensor Data Changes</a><p>Register an event handler to receive notifications on sensor data changes.</p></li>
+ <li><a href="#hw-information">Obtaining Sensor Hardware Information</a><p>Retrieve information about the technical limits of the sensor.</p></li>
 </ul>
 
 <h2>Task in Mobile Applications</h2>   
@@ -195,7 +199,7 @@ proximitySensor.stop();
           
                 <h2 id="receive" name="receive">Receiving Notifications on Sensor Data Changes</h2>
 
-<p>Learning how to register a change event handler for sensor data enables your application to react to changes without the need to check current values constantly.</p>
+<p>Learning how to register a change event handler for sensor data enables your application to react to changes without the need to check current values constantly:</p>
 
 <ol>
 
@@ -264,6 +268,42 @@ lightSensor.unsetChangeListener();
 </li>
 </ol>
   
+<h2 id="hw-information" name="hw-information">Obtaining Sensor Hardware Information</h2>
+
+<p>Learning how to retrieve information about the sensor hardware enables your application to know the sensor&#39;s technical limits:</p>
+
+<ol>
+
+<li>Define a success callback for handling a <span style="font-family: Courier New,Courier,monospace">SensorHardwareInfo</span> object (in <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html#SensorHardwareInfo">mobile</a> and <a href="../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html#SensorHardwareInfo">wearable</a> applications). You can also define an optional error callback.
+<pre class="prettyprint">
+function onsuccessCB(hwInfo)
+{
+&nbsp;&nbsp;&nbsp;console.log(&quot;name: &quot; + hwInfo.name);
+&nbsp;&nbsp;&nbsp;console.log(&quot;type: &quot; + hwInfo.type);
+&nbsp;&nbsp;&nbsp;console.log(&quot;vendor: &quot; + hwInfo.vendor);
+&nbsp;&nbsp;&nbsp;console.log(&quot;minValue: &quot; + hwInfo.minValue);
+&nbsp;&nbsp;&nbsp;console.log(&quot;maxValue: &quot; + hwInfo.maxValue);
+&nbsp;&nbsp;&nbsp;console.log(&quot;resolution: &quot; + hwInfo.resolution);
+&nbsp;&nbsp;&nbsp;console.log(&quot;minInterval: &quot; + hwInfo.minInterval);
+&nbsp;&nbsp;&nbsp;console.log(&quot;maxBatchCount: &quot; + hwInfo.maxBatchCount);
+}
+
+function onerrorCB(error)
+{
+&nbsp;&nbsp;&nbsp;console.log(&quot;An error occurred: &quot; + error.message);
+}
+</pre>
+</li>
+
+<li>Call the <span style="font-family: Courier New,Courier,monospace">getSensorHardwareInfo()</span> method of an existing <span style="font-family: Courier New,Courier,monospace">Sensor</span> object to obtain its hardware information as the <span style="font-family: Courier New,Courier,monospace">SensorHardwareInfo</span> object:
+<pre class="prettyprint">
+var proximitySensor = tizen.sensorservice.getDefaultSensor(&quot;PROXIMITY&quot;);
+
+proximitySensor.getSensorHardwareInfo(onsuccessCB, onerrorCB);
+</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>