org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-B77C2006-879F-4AC6-B7BF-04B25B563A29.html
author Eugene Ostroukhov <eugeneo@symbian.org>
Tue, 20 Apr 2010 17:11:57 -0700
changeset 313 25282116ebcf
parent 229 716254ccbcc0
permissions -rw-r--r--
Eclipse 3.6 M6 support


<!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" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="copyright" content="(C) Copyright 2009"/><meta name="DC.rights.owner" content="(C) Copyright 2009"/><meta name="DC.Type" content="mobileconcept"/><meta name="DC.Title" content="JavaScript Sensor Service API"/><meta name="DC.Relation" scheme="URI" content="GUID-AEB26A58-1DE2-46CB-81EC-6DB3A477B7A3"/><meta name="DC.Relation" scheme="URI" content="GUID-91579EE5-A608-401C-82B4-DCF1723EC7B5"/><meta name="DC.Relation" scheme="URI" content="GUID-7C69DDA4-16F1-4A8F-BDB2-4CB0015B4E81"/><meta name="DC.Relation" scheme="URI" content="GUID-65AAF569-D347-462B-B59A-9D7CA184AB9C"/><meta name="DC.Format" content="XHTML"/><meta name="DC.Identifier" content="GUID-B77C2006-879F-4AC6-B7BF-04B25B563A29"/><title>JavaScript Sensor
Service API </title><script type="text/javascript">
      function initPage() {}
    </script><link href="../PRODUCT_PLUGIN/book.css" rel="stylesheet" type="text/css"/><link href="css/s60/style.css" rel="stylesheet" type="text/css" media="all"/></head><body onload="initPage();"><div class="body"><div class="contentLeft prTxt"><h1 class="pageHeading" id="GUID-B77C2006-879F-4AC6-B7BF-04B25B563A29"><span>JavaScript</span> Sensor
Service API</h1><div>
<p>The <a href="GUID-6FBE64B7-0949-4AAE-B835-52B276540A59.html#GUID-6FBE64B7-0949-4AAE-B835-52B276540A59">Sensor Service</a> API
is supported since <a href="GUID-1A3ECAC1-3F09-4602-A1CD-82164040A664.html#GUID-1A3ECAC1-3F09-4602-A1CD-82164040A664">WRT 1.1</a>.</p>
<p>The Sensor Service API allows <span>widgets</span> to
access data provided by the physical sensors of a device. The data from a
given sensor is mapped to one or more sensor channels, which the API can listen
to. The available sensors depend on the device. The API is integrated into <span>WRT</span> through
the <a href="GUID-571AF37F-1E95-462A-92D2-FEA2E62F1559.html#GUID-571AF37F-1E95-462A-92D2-FEA2E62F1559"><code>device</code></a> object.</p>
<p>For an overview of the service and the API, see section <a href="GUID-6FBE64B7-0949-4AAE-B835-52B276540A59.html#GUID-6FBE64B7-0949-4AAE-B835-52B276540A59">Accessing data from the physical sensors of a device</a>.</p>
<div><h3>Using the Sensor Service API</h3>
<p>To use the Sensor Service API, your <span>widget</span> must
first create <span>a service object for it
using the <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080"><code>device.getServiceObject()</code></a> method</span>.
Use <code>Service.Sensor</code> to identify the service provider and <code>ISensor</code> to
identify the supported interface:</p>

<pre class="codeblock" id="GUID-9F7EE91E-7245-44A9-BFAE-BF043CA4E67D-GENIDd0e64468">var so = device.getServiceObject("Service.Sensor", "ISensor");</pre>
<p>This service object can then be used to access the services provided
by the API:</p>
<ul>
<li><p><a href="GUID-46DB749E-A388-46B2-BB13-A274385CA97C.html#GUID-46DB749E-A388-46B2-BB13-A274385CA97C"><code>ISensor.FindSensorChannel()</code></a></p>
</li>
<li><p><a href="GUID-B4897257-F7BC-4C32-9C6C-A577FDAC5D09.html#GUID-B4897257-F7BC-4C32-9C6C-A577FDAC5D09"><code>ISensor.RegisterForNotification()</code></a></p></li>
<li><p><a href="GUID-3A306F4B-638D-4133-8575-2E269E565B7F.html#GUID-3A306F4B-638D-4133-8575-2E269E565B7F"><code>ISensor.Cancel()</code></a></p>
</li>
<li><p><a href="GUID-C2731B38-6294-419C-B7E2-AFB918F508D4.html#GUID-C2731B38-6294-419C-B7E2-AFB918F508D4"><code>ISensor.GetChannelProperty()</code></a></p>
</li>
</ul>
</div>
<div><h3>Emulator support</h3>
<p>The S60 5th Edition SDK emulator support XML based-simulation for a
few sensors.</p>
</div>
</div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>