Symbian3/PDK/Source/GUID-B7A7E2E8-E727-5A01-8C1B-60679B6AA3D4.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 14 578be2adaf3e
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?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-B7A7E2E8-E727-5A01-8C1B-60679B6AA3D4" xml:lang="en"><title>Querying
a Single Feature Dynamically Using RFeatureControl </title><shortdesc>How to query a feature using <codeph>RFeatureControl</codeph> dynamically. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context id="GUID-24ACFA53-2065-5F1B-AC5C-475EFEDA1418"><p>To query whether
a feature is supported using <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref> dynamically,
take the following steps. </p> </context>
<steps id="GUID-11086486-E5F7-53BA-949B-AC3CEDFF8E31">
<step id="GUID-951C3232-FB38-543C-9262-068A95FEC734"><cmd/>
<info>Create an instance of <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref>, </info>
<stepxmp><codeblock id="GUID-1DDC06EE-BE90-5073-A8B9-6FA134BAC36A" xml:space="preserve">
// replace &lt;featureUID&gt; with a real Uid ) 
#include &lt;featurecontrol.h&gt;
#include &lt;featureinfo.h&gt; // for feature definitions
CMyClass::MyMethodL()
     {
     // Replace KFeatureUidx with real feature Uid.
     // Open() must be called before calling any other methods. 
     // Disconnect is done by calling the Close() method.
     RFeatureControl featureControl;</codeblock> </stepxmp>
</step>
<step id="GUID-982D3E1A-D8BD-5C3E-8A65-D612B8557A78"><cmd/>
<info>call its <xref href="GUID-20D0D10F-3401-3F72-8AF6-DC35F6025DC2.dita"><apiname>Open()</apiname></xref> function, </info>
<stepxmp><codeblock id="GUID-742E582D-3FEA-5EBA-8DC8-1199F8898ADC" xml:space="preserve">
     TInt err = featureControl.Open();
</codeblock> </stepxmp>
</step>
<step id="GUID-B37DACBC-509C-513D-8885-85C66E51E160"><cmd/>
<info>determine the Uid of the feature you wish to query, </info>
</step>
<step id="GUID-4751F9FF-5E38-5B60-86B9-BCEACBAD5AE4"><cmd/>
<info>call the <xref href="GUID-8394EE7A-ECC4-3E11-85A4-F39FDA25C1E4.dita"><apiname>FeatureSupported()</apiname></xref> function of the <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref> object
with the Uid of the feature as argument, and </info>
<stepxmp><codeblock id="GUID-59921195-92D0-5E6E-8EC6-D619696F40D2" xml:space="preserve">
     if ( err == KErrNone )
         {
         // Query single feature status
          err = control.FeatureSupported( KFeatureUid3 );
          if( err == KFeatureSupported )
              {
              // do something with enabled feature
              }

</codeblock> </stepxmp>
</step>
<step id="GUID-24568770-B737-5D9A-A8DC-84B03D7084BE"><cmd/>
<info>call the <xref href="GUID-01D2AF56-21E1-3FF3-BF86-0C356A1658EF.dita"><apiname>Close()</apiname></xref> function of the <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref> object. </info>
<stepxmp><codeblock id="GUID-B76942CA-73B7-51C5-812D-A06AA047CF58" xml:space="preserve">
         // Remember to call CloseL after using RFeatureControl.
         // It disconnects the Feature Manager server.
         featureControl.Close();  
         }
</codeblock> </stepxmp>
</step>
</steps>
<result id="GUID-130AEFD6-2137-5307-B57C-85B466C35DC6"><p> <xref href="GUID-8394EE7A-ECC4-3E11-85A4-F39FDA25C1E4.dita"><apiname> FeatureSupported()</apiname></xref> returns: </p> <ul>
<li id="GUID-32887EB7-EAA6-5B97-83A2-816942705CBE"><p> <xref href="GUID-F276AFA8-5B10-3E72-9A30-6673F6D6B01A.dita"><apiname>KFeatureSupported</apiname></xref> if
the feature is supported, </p> </li>
<li id="GUID-BF858362-ECF7-581F-BD4F-D3FB0F9494A0"><p> <xref href="GUID-AB8C2C77-E241-36AF-8532-6F7A6E3AA429.dita"><apiname>KFeatureUnsupported</apiname></xref> if
the feature is not supported, </p> </li>
<li id="GUID-9B42A601-84F0-5F39-8C6C-338F156A1F03"><p> <xref href="GUID-5E653C17-372C-32E1-A1B2-9E69A9991C40.dita"><apiname>KErrNotFound</apiname></xref> if
the feature does not exist, </p> </li>
<li id="GUID-2491BC9F-4754-5C7D-A63E-97EED1DB725F"><p> <xref href="GUID-51298FCE-7857-39F8-BFAB-49AF5556D0CC.dita"><apiname>KErrNotReady</apiname></xref> if
the feature is uninitialised, and </p> </li>
<li id="GUID-F0DDBDD7-5E8D-58A0-A7CB-CD989412094E"><p>otherwise returns an
error code. </p> </li>
</ul> <p> <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref> has a deprecated function <xref href="GUID-408D4D7E-FCD1-3ECF-AD62-6DA52E9580F5.dita"><apiname>Connect()</apiname></xref> which
should no longer be used as it has been replaced by the function <xref href="GUID-20D0D10F-3401-3F72-8AF6-DC35F6025DC2.dita"><apiname>Open()</apiname></xref>. </p> </result>
</taskbody><related-links>
<link href="GUID-711594BD-9B8E-5E8A-A5A9-6C94F65AF064.dita"><linktext>Querying
a Single Feature                 Dynamically Using CFeatureDiscovery</linktext>
</link>
<link href="GUID-08ED8657-DB96-59AC-9016-602BD5680752.dita"><linktext>Querying
a Single Feature                 Statically Using CFeatureDiscovery</linktext>
</link>
<link href="GUID-3D50D2DE-A202-5560-80AB-0DBAC332179F.dita"><linktext>Querying
a Feature Set Dynamically                 Using CFeatureDiscovery</linktext>
</link>
<link href="GUID-DAC496E8-C8D0-5EC6-9A5D-5F5DA667D083.dita"><linktext>Querying
a Feature Set Statically                 Using CFeatureDiscovery</linktext>
</link>
<link href="GUID-B71AC5E3-8AA8-55AD-916F-9E873926011B.dita"><linktext>Feature Manager
Collection Overview</linktext></link>
<link href="GUID-1A22E574-831B-5D00-98BD-0DFFA9CC09A0.dita"><linktext>Feature Manager
Query Tutorials</linktext></link>
</related-links></task>