Symbian3/PDK/Source/GUID-981C138C-1CF1-5D77-BEB5-81163AC71E44.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-981C138C-1CF1-5D77-BEB5-81163AC71E44" xml:lang="en"><title>Reporting
on all Features on a Device Dynamically Using RFeatureControl </title><shortdesc>How to list all supported features on a device using <codeph>RFeatureControl</codeph> dynamically. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context id="GUID-66CE0C50-75D0-547E-869C-8D0BFEBE0974"><p>To list all supported
features on a device using <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref> dynamically,
take the following steps. </p> </context>
<steps id="GUID-0C573781-0002-500B-A7F4-E44CC688A820">
<step id="GUID-B65FF1CA-5A11-563E-B0A3-9DDD2E555276"><cmd/>
<info>Create an instance of <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref>, </info>
<stepxmp><codeblock id="GUID-0F3730FF-00DC-5FCD-9A0C-CA205082A5B1" 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-A4FEB01F-56A0-595C-85A5-5C2E435BD175"><cmd/>
<info>call its <xref href="GUID-20D0D10F-3401-3F72-8AF6-DC35F6025DC2.dita"><apiname>Open()</apiname></xref> function, </info>
<stepxmp><codeblock id="GUID-61D3CB3F-1760-5747-8F55-6595BAF66AAB" xml:space="preserve">
     TInt err = featureControl.Open();
</codeblock> </stepxmp>
</step>
<step id="GUID-DAFA2032-8535-5F63-AD1B-D83D843FB271"><cmd/>
<info>create an instance of <xref href="GUID-144E257F-A162-3680-B1C5-C28BEAA902BC.dita"><apiname>RFeatureArray</apiname></xref> (an array of <xref href="GUID-80C51259-F2C4-3877-97B4-EC0C85DE93DE.dita"><apiname>TFeatureEntry</apiname></xref> objects), </info>
<stepxmp><codeblock id="GUID-3CAE75C5-A1B6-51B9-AD2C-2E13AE53FD8E" xml:space="preserve">
         // List all supported features.

         // A client owned RFeatureUidArray array which will be filled with 
         // the UIDs of supported features. 
         RFeatureUidArray supportedFeatures;

</codeblock> </stepxmp>
</step>
<step id="GUID-9BD96024-5335-5A54-832A-0A87B293B24A"><cmd/>
<info>call its <xref href="GUID-5647EEB3-56CB-35C9-B9E1-1E348644A27A.dita"><apiname>ListSupportedFeatures()</apiname></xref> function with a
reference to the <xref href="GUID-144E257F-A162-3680-B1C5-C28BEAA902BC.dita"><apiname>RFeatureArray</apiname></xref> as argument, </info>
<stepxmp><codeblock id="GUID-6B1D8B91-76D2-575E-91AE-93727C75FA89" xml:space="preserve">
         // ListSupportedFeatures() returns one of the Symbian error codes.
         err = featureControl.ListSupportedFeatures( supportedFeatures );

         // do something

</codeblock> </stepxmp>
</step>
<step id="GUID-8BF96CBE-BB74-58A3-A63B-8AC32F71D78C"><cmd/>
<info>call its <xref href="GUID-01D2AF56-21E1-3FF3-BF86-0C356A1658EF.dita"><apiname>Close()</apiname></xref> function, </info>
<stepxmp><codeblock id="GUID-C8126829-41FA-50B2-B462-9F92090B5146" xml:space="preserve">
         // Closes the array and frees all memory allocated to the array.
         supportedFeatures.Close();
</codeblock> </stepxmp>
</step>
<step id="GUID-AAB93851-F12D-52A8-BAC5-00B78C09024C"><cmd/>
<info>call the <xref href="GUID-01D2AF56-21E1-3FF3-BF86-0C356A1658EF.dita"><apiname>Close()</apiname></xref> function of the RFeatureArray object. </info>
<stepxmp><codeblock id="GUID-475D7629-1E07-5269-8F11-75756C04FE26" 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-2FDD0EEF-AE71-5078-8A53-2ECB603D30E8"><p> <xref href="GUID-5647EEB3-56CB-35C9-B9E1-1E348644A27A.dita"><apiname> ListSupportedFeatures()</apiname></xref> causes
the passed in array to be filled with the Uids of supported features. It returns: </p> <ul>
<li id="GUID-8B1E55A0-20C0-5C72-93B4-2C1828633192"><p> <xref href="GUID-6CA4F1ED-7947-3087-B618-D35858FAA3BC.dita"><apiname>KErrNone</apiname></xref> if
the <xref href="GUID-144E257F-A162-3680-B1C5-C28BEAA902BC.dita"><apiname>RFeatureArray</apiname></xref> was successfully filled with Uids, </p> </li>
<li id="GUID-AA416C1E-E619-5637-905B-27ADD3A09AD9"><p> <xref href="GUID-E306B54A-1F34-3FB0-B515-90D647B7B822.dita"><apiname>KServerBusy</apiname></xref> if
the call failed because features were being enabled or disabled (so creating
a lock), and </p> </li>
<li id="GUID-0462B50E-A799-562E-9B8E-8EA5C1DD1F8A"><p>otherwise returns an
error code. </p> </li>
</ul> </result>
</taskbody><related-links>
<link href="GUID-BE841768-0F22-5B9D-B783-B02C74E89AFB.dita"><linktext>Reporting
Feature Data for a Single                 Feature Dynamically Using RFeatureControl</linktext>
</link>
<link href="GUID-3C52315A-71CC-52B2-B809-F04E4078338D.dita"><linktext>Reporting
on Several Features                 Dynamically Using RFeatureControl</linktext>
</link>
<link href="GUID-B71AC5E3-8AA8-55AD-916F-9E873926011B.dita"><linktext>Feature Manager
Collection Overview</linktext></link>
<link href="GUID-F2489DE2-18E2-5C5B-A174-49B5B7A64A7C.dita"><linktext>Feature Manager
ReportingTutorials</linktext></link>
</related-links></task>