Symbian3/SDK/Source/GUID-4B709839-8EEF-4AD2-9868-9AF0176B1E5B.dita
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE task
       
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
       
    12 <task id="GUID-4B709839-8EEF-4AD2-9868-9AF0176B1E5B" xml:lang="en"><title>Using
       
    13 Sensor Channels APIs</title><shortdesc>The Sensor Channel establishes a data exchange connection between
       
    14 the sensor framework and hardware using the sensor channel APIs.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    15 <steps id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-8-1-9-1-1-6-1-4-1-4-1-3-1">
       
    16 <step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-8-1-9-1-1-6-1-4-1-4-1-3-1-1"><cmd>Include the library <b>SensrvClient.lib</b> in
       
    17 your <b>.mmp</b> file.</cmd>
       
    18 </step>
       
    19 <step id="GUID-4F637EBD-BD56-44FA-A984-E93CC4B2B3B6"><cmd>Include the following
       
    20 header files, as they are required for accessing sensor channels regardless
       
    21 of the channel type: </cmd>
       
    22 <info><ul>
       
    23 <li><p>sensrvchannel.h</p></li>
       
    24 <li><p>sensrvchannelinfo.h</p></li>
       
    25 <li><p>sensrvtypes.h</p></li>
       
    26 <li><p>sensrvchannelfinder.h</p></li>
       
    27 <li><p>sensrvdatalistener.h</p></li>
       
    28 </ul></info>
       
    29 </step>
       
    30 <step id="GUID-F5BC52B6-67DD-4F59-889B-C5DE4C69029B"><cmd>Retrieve details
       
    31 about the required sensor channel. For details. see <xref href="GUID-44FDDA27-1A5D-42B5-8DE0-D9E88EB75C93.dita">Querying
       
    32 for Sensor Channels</xref>.</cmd>
       
    33 </step>
       
    34 <step id="GUID-FBBD3A8B-F240-4DC0-B516-3A51FDD86A88"><cmd>Connect to the sensor
       
    35 by opening a connection with the sensor channel.</cmd>
       
    36 <substeps id="GUID-C9E5B9FC-C637-4DEB-AAAF-E38C6CD9A18A">
       
    37 <substep id="GUID-CA2CFF9C-3168-4060-AC39-8CB6FBA4BCA2"><cmd>Create an instance
       
    38 of <codeph>CSensrvChannel</codeph> and specify the instance of <codeph>TSensrvChannelInfo</codeph> returned
       
    39 by <xref href="GUID-5F108D03-C8A6-3EF9-B103-2E8916633602.dita#GUID-5F108D03-C8A6-3EF9-B103-2E8916633602/GUID-E58BAF1B-57AA-3E85-A4F9-8C6C29043FBD"><apiname>CSensrvChannelFinder::FindChannelsL()</apiname></xref>, as a parameter
       
    40 in the <codeph>NewL()</codeph> constructor.</cmd>
       
    41 <stepxmp><codeblock xml:space="preserve"> CSensrvChannel* sensorChannel;
       
    42  sensorChannel = CSensrvChannel::NewL(channelInfoList[0]);// channelInfoList is
       
    43 //   returned by the CSensrvChannelFinder::FindChannelsL()funtion</codeblock></stepxmp>
       
    44 </substep>
       
    45 <substep id="GUID-30E6033F-E316-4BDB-AF22-2369463DF709"><cmd>Open the sensor
       
    46 channel using <xref href="GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844.dita#GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844/GUID-277A4940-2E5E-3E8E-AB61-552CD2375F3C"><apiname>CSensrvChannel::OpenChannelL()</apiname></xref> function.</cmd>
       
    47 <stepxmp><codeblock xml:space="preserve">channel-&gt;OpenChannelL();</codeblock></stepxmp>
       
    48 </substep>
       
    49 </substeps>
       
    50 </step>
       
    51 <step id="GUID-7A414271-040C-4107-B047-9416747C66A6"><cmd>Perform any of the
       
    52 following operations:</cmd>
       
    53 <info><ul>
       
    54 <li><xref href="GUID-BA0D9DA9-3B54-4964-A4D6-9ADA4DEB7231.dita">Receive data from
       
    55 sensors</xref></li>
       
    56 <li><xref href="GUID-09E44FE5-6BEE-49FF-8BBF-CBB3C066EE10.dita">Listen for channel
       
    57 changes</xref></li>
       
    58 <li><xref href="GUID-83630B57-D842-4B60-8AF0-D2965251DE29.dita">Retrieve channel
       
    59 properties</xref></li>
       
    60 <li><xref href="GUID-0CA7F22E-59D7-4D65-9D6C-735E4E0F0454.dita">Set channel properties</xref></li>
       
    61 <li><xref href="GUID-E93EE459-8CF4-42A1-B06C-E78E56FD25A0.dita">Listen for channel
       
    62 property changes</xref></li>
       
    63 <li><xref href="GUID-60EE22AA-402D-4FC2-9AD1-B3AEF822E8DC.dita">Receive channel
       
    64 data based on conditions</xref></li>
       
    65 </ul></info>
       
    66 </step>
       
    67 <step id="GUID-61840C55-476C-4DC3-A946-A440330B9DE5"><cmd>Close the channel.</cmd>
       
    68 <info><codeblock xml:space="preserve">channel-&gt;CloseChannel();</codeblock><note type="important"> A
       
    69 channel must be closed when not required, as it reduces power consumption
       
    70 of the Symbian device. An open sensor channel keeps the device processor active
       
    71 each time data arrives. Therefore, the processor does not change to idle state
       
    72 even when the device user is not performing any operations on the device.</note></info>
       
    73 </step>
       
    74 </steps>
       
    75 </taskbody></task>