Symbian3/SDK/Source/GUID-83630B57-D842-4B60-8AF0-D2965251DE29.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 12:39:03 +0100
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
permissions -rw-r--r--
Week 23 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-83630B57-D842-4B60-8AF0-D2965251DE29" xml:lang="en"><title>Retrieving
Channel Properties</title><shortdesc>A sensor channel is associated with properties such as channel
availability status, data transmission rate, data format and so on. Also,
each field in the data type supplied by a sensor channel can have its own
properties. The channel properties can be retrieved using the <codeph>CSensrvChannel::GetPropertyL()</codeph> and <codeph>CSensrvChannel::GetAllPropertiesL()</codeph> functions.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<prereq id="GUID-91C43F20-A2FA-4A16-AA10-7BE00EC8E4AF">       <p>Before retrieving
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
the sensor channel</xref>.</p>     </prereq>
<context id="GUID-E36A1CB4-6973-42CF-8935-A3C5DEE2CE34"><p>A channel property
is referenced by its property id and an index. The parameters 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> are
listed with their meanings in the following table.</p><table id="GUID-D8B0C588-8648-4CB7-936D-A3CA70E1A49D">
<tgroup cols="2"><colspec colname="col1" colwidth="0.44*"/><colspec colname="col2" colwidth="1.56*"/>
<thead>
<row>
<entry>Parameter</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry>First parameter</entry>
<entry>specifies the id of the property to retrieve.</entry>
</row>
<row>
<entry>Second parameter</entry>
<entry>is an index that specifies the property to be retrieved, if there are
several properties associated with a particular property id.</entry>
</row>
<row>
<entry>Third parameter</entry>
<entry> is a <parmname>TSensrvProperty</parmname> that is passed by reference
and populated by <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>.</entry>
</row>
</tbody>
</tgroup>
</table><p>The following list shows the different possible values of the index
:</p><ul>
<li><p>When the property id is for a simple property, that is, there is only
one property item for the id (for example, <parmname>KSensrvPropIdChannelAccuracy</parmname>),
the second parameter must be specified as <parmname>ESensrvSingleProperty</parmname>.</p></li>
<li><p>When the given property id has an array of <parmname>TSensrvProperty</parmname> items,
the index parameter indicates which item in the array to retrieve. One such
case is when you want to retrieve a property of a particular data field that
is supplied by the channel. For example, if you want to find out if the X
axis of the accelerometer is enabled, you must specify <parmname>KSensrvPropIdAxisActive</parmname> as
the property id, and <parmname>TSensrvAccelerometerAxisData::iAxisX </parmname> as
the index. For details, see <xref href="GUID-8DCBAA05-9741-48C8-A831-966D37FBC05A.dita">Array
Properties</xref>.</p></li>
<li><p>When the given property id has an array of <parmname>TSensrvProperty</parmname> items,
information about the array can be retrieved by specifying <parmname>ESensrvArrayPropertyInfo</parmname> as
the index parameter. For example, when a channel can provide data at discrete
data rates, the information for each data rate is stored in a <parmname>TSensrvProperty</parmname> item.
You can use <parmname>KSensrvPropIdDataRate</parmname> as the property id
and <parmname>ESensrvArrayPropertyInfo</parmname> as the index to retrieve
the property item that contains this information. </p></li>
</ul></context>
<steps id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-10-1-9-1-1-6-1-4-1-4-1-6-1-3-3">
<step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-10-1-9-1-1-6-1-4-1-4-1-6-1-3-3-1"><cmd>Create an instance
of <parmname>TSensrvProperty</parmname>.</cmd>
<stepxmp><codeblock xml:space="preserve">TSensrvProperty property;</codeblock></stepxmp>
<info>           <p>Each channel property is encapsulated by the <parmname>TSensrvProperty</parmname> class.
Therefore, the details of the retrieved property can be accessed using the
functions of the <parmname>TSensrvProperty</parmname> class.</p>  </info>
</step>
<step id="GUID-BB85979A-442C-41AF-B406-C239369C923E"><cmd>Use 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
to retrieve the property item for a particular property id. For example, to
check for the accuracy of a channel, pass the <parmname>KSensrvPropIdChannelAccuracy</parmname> as
a property id.</cmd>
<stepxmp><codeblock xml:space="preserve">...

CSensrvChannel* iSensorChannel;
....
iSensorChannel-&gt;GetPropertyL( KSensrvPropIdChannelAccuracy,
                                  KSensrvItemIndexNone,
                                  property );

....</codeblock></stepxmp>
<info><note> You can retrieve all the properties associated with a particular
sensor channel using the <xref href="GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844.dita#GUID-22DC917F-D833-3531-AB2D-A6E2D52EF844/GUID-ABF67AF4-BAC9-3BA3-B558-9AC1B8E0DFDE"><apiname>CSensrvChannel::GetAllPropertiesL()</apiname></xref> function.</note></info>
</step>
</steps>
<postreq id="GUID-459AF9E3-B0EA-4E8F-81AF-726DA3B0E053"><ul>
<li>End the session 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.</li>
<li>You can set the required channel properties. For details, see <xref href="GUID-0CA7F22E-59D7-4D65-9D6C-735E4E0F0454.dita">Setting
Channel Properties</xref>.</li>
</ul></postreq>
</taskbody></task>