Symbian3/PDK/Source/GUID-B7A7E2E8-E727-5A01-8C1B-60679B6AA3D4.dita
changeset 5 f345bda72bc4
parent 1 25a17d01db0c
child 14 578be2adaf3e
equal deleted inserted replaced
4:4816d766a08a 5:f345bda72bc4
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE task
    10 <!DOCTYPE task
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
    12 <task xml:lang="en" id="GUID-B7A7E2E8-E727-5A01-8C1B-60679B6AA3D4"><title>Querying a Single Feature Dynamically Using RFeatureControl </title><shortdesc>How to query a feature using <apiname>RFeatureControl</apiname> 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">
    12 <task id="GUID-B7A7E2E8-E727-5A01-8C1B-60679B6AA3D4" xml:lang="en"><title>Querying
       
    13 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>
       
    14 <context id="GUID-24ACFA53-2065-5F1B-AC5C-475EFEDA1418"><p>To query whether
       
    15 a feature is supported using <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref> dynamically,
       
    16 take the following steps. </p> </context>
       
    17 <steps id="GUID-11086486-E5F7-53BA-949B-AC3CEDFF8E31">
       
    18 <step id="GUID-951C3232-FB38-543C-9262-068A95FEC734"><cmd/>
       
    19 <info>Create an instance of <xref href="GUID-F6AAAC24-4A62-383A-86C6-2E46335C3FD4.dita"><apiname>RFeatureControl</apiname></xref>, </info>
       
    20 <stepxmp><codeblock id="GUID-1DDC06EE-BE90-5073-A8B9-6FA134BAC36A" xml:space="preserve">
    13 // replace &lt;featureUID&gt; with a real Uid ) 
    21 // replace &lt;featureUID&gt; with a real Uid ) 
    14 #include &lt;featurecontrol.h&gt;
    22 #include &lt;featurecontrol.h&gt;
    15 #include &lt;featureinfo.h&gt; // for feature definitions
    23 #include &lt;featureinfo.h&gt; // for feature definitions
    16 CMyClass::MyMethodL()
    24 CMyClass::MyMethodL()
    17      {
    25      {
    18      // Replace KFeatureUidx with real feature Uid.
    26      // Replace KFeatureUidx with real feature Uid.
    19      // Open() must be called before calling any other methods. 
    27      // Open() must be called before calling any other methods. 
    20      // Disconnect is done by calling the Close() method.
    28      // Disconnect is done by calling the Close() method.
    21      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">
    29      RFeatureControl featureControl;</codeblock> </stepxmp>
       
    30 </step>
       
    31 <step id="GUID-982D3E1A-D8BD-5C3E-8A65-D612B8557A78"><cmd/>
       
    32 <info>call its <xref href="GUID-20D0D10F-3401-3F72-8AF6-DC35F6025DC2.dita"><apiname>Open()</apiname></xref> function, </info>
       
    33 <stepxmp><codeblock id="GUID-742E582D-3FEA-5EBA-8DC8-1199F8898ADC" xml:space="preserve">
    22      TInt err = featureControl.Open();
    34      TInt err = featureControl.Open();
    23 </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">
    35 </codeblock> </stepxmp>
       
    36 </step>
       
    37 <step id="GUID-B37DACBC-509C-513D-8885-85C66E51E160"><cmd/>
       
    38 <info>determine the Uid of the feature you wish to query, </info>
       
    39 </step>
       
    40 <step id="GUID-4751F9FF-5E38-5B60-86B9-BCEACBAD5AE4"><cmd/>
       
    41 <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
       
    42 with the Uid of the feature as argument, and </info>
       
    43 <stepxmp><codeblock id="GUID-59921195-92D0-5E6E-8EC6-D619696F40D2" xml:space="preserve">
    24      if ( err == KErrNone )
    44      if ( err == KErrNone )
    25          {
    45          {
    26          // Query single feature status
    46          // Query single feature status
    27           err = control.FeatureSupported( KFeatureUid3 );
    47           err = control.FeatureSupported( KFeatureUid3 );
    28           if( err == KFeatureSupported )
    48           if( err == KFeatureSupported )
    29               {
    49               {
    30               // do something with enabled feature
    50               // do something with enabled feature
    31               }
    51               }
    32 
    52 
    33 </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">
    53 </codeblock> </stepxmp>
       
    54 </step>
       
    55 <step id="GUID-24568770-B737-5D9A-A8DC-84B03D7084BE"><cmd/>
       
    56 <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>
       
    57 <stepxmp><codeblock id="GUID-B76942CA-73B7-51C5-812D-A06AA047CF58" xml:space="preserve">
    34          // Remember to call CloseL after using RFeatureControl.
    58          // Remember to call CloseL after using RFeatureControl.
    35          // It disconnects the Feature Manager server.
    59          // It disconnects the Feature Manager server.
    36          featureControl.Close();  
    60          featureControl.Close();  
    37          }
    61          }
    38 </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
    62 </codeblock> </stepxmp>
    39                 Dynamically Using CFeatureDiscovery</linktext> </link> <link href="GUID-08ED8657-DB96-59AC-9016-602BD5680752.dita"><linktext>Querying a Single Feature
    63 </step>
    40                 Statically Using CFeatureDiscovery</linktext> </link> <link href="GUID-3D50D2DE-A202-5560-80AB-0DBAC332179F.dita"><linktext>Querying a Feature Set Dynamically
    64 </steps>
    41                 Using CFeatureDiscovery</linktext> </link> <link href="GUID-DAC496E8-C8D0-5EC6-9A5D-5F5DA667D083.dita"><linktext>Querying a Feature Set Statically
    65 <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>
    42                 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>
    66 <li id="GUID-32887EB7-EAA6-5B97-83A2-816942705CBE"><p> <xref href="GUID-F276AFA8-5B10-3E72-9A30-6673F6D6B01A.dita"><apiname>KFeatureSupported</apiname></xref> if
       
    67 the feature is supported, </p> </li>
       
    68 <li id="GUID-BF858362-ECF7-581F-BD4F-D3FB0F9494A0"><p> <xref href="GUID-AB8C2C77-E241-36AF-8532-6F7A6E3AA429.dita"><apiname>KFeatureUnsupported</apiname></xref> if
       
    69 the feature is not supported, </p> </li>
       
    70 <li id="GUID-9B42A601-84F0-5F39-8C6C-338F156A1F03"><p> <xref href="GUID-5E653C17-372C-32E1-A1B2-9E69A9991C40.dita"><apiname>KErrNotFound</apiname></xref> if
       
    71 the feature does not exist, </p> </li>
       
    72 <li id="GUID-2491BC9F-4754-5C7D-A63E-97EED1DB725F"><p> <xref href="GUID-51298FCE-7857-39F8-BFAB-49AF5556D0CC.dita"><apiname>KErrNotReady</apiname></xref> if
       
    73 the feature is uninitialised, and </p> </li>
       
    74 <li id="GUID-F0DDBDD7-5E8D-58A0-A7CB-CD989412094E"><p>otherwise returns an
       
    75 error code. </p> </li>
       
    76 </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
       
    77 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>
       
    78 </taskbody><related-links>
       
    79 <link href="GUID-711594BD-9B8E-5E8A-A5A9-6C94F65AF064.dita"><linktext>Querying
       
    80 a Single Feature                 Dynamically Using CFeatureDiscovery</linktext>
       
    81 </link>
       
    82 <link href="GUID-08ED8657-DB96-59AC-9016-602BD5680752.dita"><linktext>Querying
       
    83 a Single Feature                 Statically Using CFeatureDiscovery</linktext>
       
    84 </link>
       
    85 <link href="GUID-3D50D2DE-A202-5560-80AB-0DBAC332179F.dita"><linktext>Querying
       
    86 a Feature Set Dynamically                 Using CFeatureDiscovery</linktext>
       
    87 </link>
       
    88 <link href="GUID-DAC496E8-C8D0-5EC6-9A5D-5F5DA667D083.dita"><linktext>Querying
       
    89 a Feature Set Statically                 Using CFeatureDiscovery</linktext>
       
    90 </link>
       
    91 <link href="GUID-B71AC5E3-8AA8-55AD-916F-9E873926011B.dita"><linktext>Feature Manager
       
    92 Collection Overview</linktext></link>
       
    93 <link href="GUID-1A22E574-831B-5D00-98BD-0DFFA9CC09A0.dita"><linktext>Feature Manager
       
    94 Query Tutorials</linktext></link>
       
    95 </related-links></task>