Symbian3/SDK/Source/GUID-0CA7F22E-59D7-4D65-9D6C-735E4E0F0454.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-0CA7F22E-59D7-4D65-9D6C-735E4E0F0454" xml:lang="en"><title>Setting
       
    13 Channel Properties</title><shortdesc>The channel properties can be configured using the <codeph>CSensrvChannel::SetProperty()</codeph> function.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    14 <prereq id="GUID-578E2FA5-5265-4AF7-88EC-9BA5C143DDF7">       <p>Before setting
       
    15 channel properties, you must <xref href="GUID-4B709839-8EEF-4AD2-9868-9AF0176B1E5B.dita#GUID-4B709839-8EEF-4AD2-9868-9AF0176B1E5B/GUID-FBBD3A8B-F240-4DC0-B516-3A51FDD86A88">open
       
    16 the sensor channel</xref>.</p>     </prereq>
       
    17 <steps id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-8-1-9-1-1-6-1-4-1-4-1-7-1-3-2">
       
    18 <step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-8-1-9-1-1-6-1-4-1-4-1-7-1-3-2-1"><cmd>Create a <parmname>TSensrvProperty</parmname> property
       
    19 object for setting the <parmname>KSensrvPropIdDataRate</parmname> property
       
    20 using the <parmname>TSensrvProperty(const TSensrvPropertyId,const TInt,const
       
    21 TInt)</parmname> constructor.</cmd>
       
    22 <stepxmp><codeblock xml:space="preserve">...
       
    23 TInt val=2;
       
    24 TSensrvProperty sensrvProperty(KSensrvPropIdDataRate,KSensrvItemIndexNone,val);
       
    25 ...</codeblock></stepxmp>
       
    26 </step>
       
    27 <step id="GUID-3AC7711D-8CBB-427A-BEA1-800539AC1377"><cmd>Set the <parmname>KSensrvPropIdDataRate</parmname> property
       
    28 value by passing the property object that you created to <xref href="GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844.dita#GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844/GUID-B69100DD-522F-3B5A-AC65-DE1950A673F0"><apiname>CSensrvChannel::SetProperty()</apiname></xref>.</cmd>
       
    29 <stepxmp><codeblock xml:space="preserve">...
       
    30 CSensrvChannel* channel;
       
    31 ...
       
    32 TInt ret;
       
    33 ret=channel-&gt;SetProperty(sensrvProperty);
       
    34 ...</codeblock></stepxmp>
       
    35 </step>
       
    36 </steps>
       
    37 <example><p>The following example explains how to set the x-axis of accelerometer
       
    38 channel status from activated to deactivated. </p><p>The axis active property <parmname>KSensrvPropIdAxisActive</parmname> is
       
    39 first retrieved using the <xref href="GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844.dita#GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844/GUID-1E9D960B-23C4-30DF-A184-7E978AC9AC1B"><apiname>CSensrvChannel::GetPropertyL()</apiname></xref> function.
       
    40 If the axis is active, the new <b>deactivated</b> value is set in the retrieved
       
    41 property object. Then the channel is updated with this updated property object
       
    42 by using the <xref href="GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844.dita#GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844/GUID-B69100DD-522F-3B5A-AC65-DE1950A673F0"><apiname>CSensrvChannel::SetProperty()</apiname></xref> function.</p><codeblock xml:space="preserve">TSensrvProperty property;
       
    43     TInt err( KErrNone );
       
    44     TInt axisActive( 0 );
       
    45     iSensorChannel-&gt;GetPropertyL( KSensrvPropIdAxisActive,
       
    46                                   TSensrvAccelerometerAxisData::Index::iAxisX,
       
    47                                   property );
       
    48     property.GetValue( axisActive );
       
    49     if( 1 == axisActive )
       
    50         {
       
    51         property.SetValue( 0 ); // A value other than 1 means that sensor axis is deactivated.
       
    52         err = iSensorChannel-&gt;SetProperty( property );
       
    53         if( KErrNone == err )
       
    54             {
       
    55             //Accelerometer x-axis was successfully deactivated
       
    56             }
       
    57        }
       
    58     else
       
    59         {
       
    60         //Accelerometer x-axis is already inactive
       
    61         }</codeblock></example>
       
    62 <postreq id="GUID-5155648B-6A69-4BF4-A5C2-83A8611F2B22"><p>End the session
       
    63 with the sensor channel using the <xref href="GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844.dita#GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844/GUID-0B8F50A6-2CA1-316A-82AB-AA026005E810"><apiname>CSensrvChannel::CloseChannel()</apiname></xref> function.</p></postreq>
       
    64 </taskbody></task>