Symbian3/PDK/Source/GUID-8DCBAA05-9741-48C8-A831-966D37FBC05A.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     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 reference
       
    11   PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
       
    12 <reference id="GUID-8DCBAA05-9741-48C8-A831-966D37FBC05A" xml:lang="en"><title>Array
       
    13 Properties</title><shortdesc>A property that defines multiple discrete values inside one property
       
    14 ID is called an array property.</shortdesc><prolog><metadata><keywords/></metadata></prolog><refbody>
       
    15 <section id="GUID-B38A0885-F52B-44F7-916D-F43530E74BC3">  <p>Array properties
       
    16 can be identified with array index, which can be queried using the <xref href="GUID-FA59DA5D-A9E4-3296-AB90-E445C7949FE9.dita#GUID-FA59DA5D-A9E4-3296-AB90-E445C7949FE9/GUID-2752A152-7821-30E8-AEC7-542F9F362575"><apiname>TSensrvProperty::GetArrayIndex()</apiname></xref> function.</p> 
       
    17    </section>
       
    18 <example><p>The following example shows how to retrieve the current data rate
       
    19 of the channel, for which the data rate is declared as an array property. </p><p>Read
       
    20 the <codeph>KSensrvPropIdDataRate</codeph> property 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.</p><p>If
       
    21 the retrieved property is an array property the result of 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> call
       
    22 is a property with array index <codeph>ESensrvArrayPropertyInfo</codeph>,
       
    23  otherwise the array information index is <codeph>ESensrvSingleProperty</codeph>. </p><p>In
       
    24 case of an array property, the value of the current data rate is in the <codeph>KSensrvPropIdDataRate</codeph> property,
       
    25 for which the array index is the same as the array property's value. </p><codeblock xml:space="preserve">TSensrvProperty property;
       
    26     TInt err( KErrNone );
       
    27     TInt datarate( 0 );
       
    28 
       
    29     iSensorChannel-&gt;GetPropertyL( KSensrvPropIdDataRate,
       
    30                                   KSensrvItemIndexNone,
       
    31                                   property );
       
    32 
       
    33     if( ESensrvArrayPropertyInfo == property.GetArrayIndex() )
       
    34         {
       
    35         //Current data rate in use is in the KSensrvPropIdDataRate property
       
    36         //for which the array index is declared in the array property's value.
       
    37         TInt arrayIndex( 0 );
       
    38         property.GetValue( arrayIndex );
       
    39 
       
    40         iSensorChannel-&gt;GetPropertyL( KSensrvPropIdDataRate,
       
    41                                       KSensrvItemIndexNone,
       
    42                                       arrayIndex,
       
    43                                       property );
       
    44                                       
       
    45         property.GetValue( datarate );
       
    46         }
       
    47     else
       
    48         {
       
    49         //KSensrvPropIdDataRate is a single property and current data rate can be read diretly from it.
       
    50         property.GetValue( datarate );
       
    51         }</codeblock></example>
       
    52 </refbody></reference>