Symbian3/SDK/Source/GUID-44FDDA27-1A5D-42B5-8DE0-D9E88EB75C93.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-44FDDA27-1A5D-42B5-8DE0-D9E88EB75C93" xml:lang="en"><title>Querying
       
    13 for Sensor Channels</title><shortdesc>You can retrieve a list of sensor channels that are available for
       
    14 a particular sensor type. Once you get the list of sensor channels that are
       
    15 active, you can perform any required operations such as configuring sensor
       
    16 channel properties, controlling sensor channels and so on.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    17 <steps id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-8-1-9-1-1-6-1-4-1-4-1-4-1-3-1">
       
    18 <step id="GUID-EE1655E2-D4C4-4593-A0E1-BD1DFACB0351"><cmd>Create an instance
       
    19 of <codeph>TSensrvChannelInfo</codeph> and set the required channel type as
       
    20 the search criteria. For example, to query for all double tapping channels
       
    21 provided by accelerometer sensor, set the channel type as <codeph>KSensrvChannelTypeIdAccelerometerDoubleTappingData</codeph>.</cmd>
       
    22 <stepxmp><codeblock xml:space="preserve">TSensrvChannelInfo channelInfo;
       
    23 channelInfo.iChannelType = KSensrvChannelTypeIdAccelerometerDoubleTappingData;</codeblock></stepxmp>
       
    24 </step>
       
    25 <step id="GUID-176936C5-17FE-49A6-A0A7-0E76EB69C5E8"><cmd>Create an instance
       
    26 of <codeph>CSensrvChannelFinder</codeph> class and use the <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> function
       
    27 to query for available sensor channels.</cmd>
       
    28 <stepxmp><codeblock xml:space="preserve">CSensrvChannelFinder* finder = CSensrvChannelFinder::NewL();
       
    29 finder-&gt;FindChannelsL(channelList, searchParameters);</codeblock></stepxmp>
       
    30 </step>
       
    31 <step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-8-1-9-1-1-6-1-4-1-4-1-4-1-3-1-3"><cmd>Create an instance
       
    32 of <codeph>RSensrvChannelInfoList</codeph> to store the list of sensor channels.</cmd>
       
    33 <stepxmp><codeblock xml:space="preserve">RSensrvChannelInfoList channelInfoList;</codeblock></stepxmp>
       
    34 </step>
       
    35 </steps>
       
    36 <result id="GUID-F26EFE38-DF01-4531-89AD-191049E31F36">       <p>The <parmname>channelInfoList</parmname> contains
       
    37 all the double tapping channels that are found. If several matching channels
       
    38 are found, you can select the required channel by examining the content of
       
    39 channel information objects inside <parmname>channelInfoList</parmname>.</p> 
       
    40    </result>
       
    41 <example><p>This following code shows how to find double tapping channels
       
    42 for accelerometer sensor:</p><codeblock xml:space="preserve">.....
       
    43 ......
       
    44 /Construct a channel finder.
       
    45     CSensrvChannelFinder* channelFinder;
       
    46     channelFinder = CSensrvChannelFinder::NewL();
       
    47     CleanupStack::PushL( channelFinder );
       
    48     
       
    49     // to store list of found channels.
       
    50     RSensrvChannelInfoList channelInfoList;
       
    51 
       
    52     //Create and fill channel search criteria.
       
    53     //In this example double tapping channel is searched.
       
    54     TSensrvChannelInfo channelInfo;
       
    55     channelInfo.iChannelType = KSensrvChannelTypeIdAccelerometerDoubleTappingData;
       
    56 
       
    57     //Find the double tapping channel
       
    58     channelFinder-&gt;FindChannelsL( channelInfoList, channelInfo );
       
    59 
       
    60     CleanupStack::PopAndDestroy( channelFinder ); // finder not needed any more
       
    61 
       
    62     if( channelInfoList.Count() != 1 )
       
    63         {
       
    64         //The device does not support double tapping channel or
       
    65         //there are several double tapping channels.
       
    66         }
       
    67     else
       
    68         {
       
    69         //double tapping channel found 
       
    70         }
       
    71 .....
       
    72 ....
       
    73 </codeblock></example>
       
    74 </taskbody></task>