Symbian3/PDK/Source/GUID-0CDA8FCA-AABE-5988-9467-30AA1AECCC90.dita
changeset 5 f345bda72bc4
parent 3 46218c8b8afa
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-0CDA8FCA-AABE-5988-9467-30AA1AECCC90"><title>Creating and Deleting a Session: Tutorial</title><shortdesc>This tutorial shows you how to create and delete a session with the Comms Database. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> <prereq id="GUID-120922C5-07D1-504F-ABA7-9ECDE4BE5CFA"><p>Before you start, you must understand: </p> <ul><li id="GUID-E663CC7F-6F20-5425-9FDE-39645B22F292"><p>the general concept of the Comms Database </p> </li> <li id="GUID-1E784DD6-CE6B-58B3-BCF6-EE8578A46211"><p>the specific concept of Comms Database Sessions </p> </li> <li id="GUID-60084A0B-78DF-54C1-AEB3-A93415FFE77D"><p>how to write and build application code to run on Symbian OS </p> </li> </ul> </prereq> <context id="GUID-13169F3C-A14A-56F2-9805-315510A1ED6D"><p>You create a session with the Comms Database before you start to read and write the data. You can also set the access attributes for the session. </p> </context> <steps id="GUID-D7867EDD-C29B-573E-AF0C-7BA32B35F9EF"><step id="GUID-E7217733-86F3-5085-B194-049A795AB5B5"><cmd>Include the header files, define namespaces, and declare constants. </cmd> <info>The<filepath>CommsDatTypesV1_1.h</filepath> header file defines the classes and API items that the tool or application requires. This header file includes all other required header files. </info> <info>Define the CommsDat namesapce. </info> <info>Define a <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>TVersion</apiname></xref> set with the version information. </info> <info>The location of this code depends on the structure of the tool or application. </info> <stepxmp><codeblock id="GUID-A73251F7-AF1B-582C-8BA5-28E71CFD3307" xml:space="preserve">#include &lt;CommsDatTypesV1_1.h&gt; 
    12 <task id="GUID-0CDA8FCA-AABE-5988-9467-30AA1AECCC90" xml:lang="en"><title>Creating
       
    13 and Deleting a Session: Tutorial</title><shortdesc>This tutorial shows you how to create and delete a session with
       
    14 the Comms Database. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    15 
       
    16 
       
    17 <prereq id="GUID-120922C5-07D1-504F-ABA7-9ECDE4BE5CFA"><p>Before you start,
       
    18 you must understand: </p> <ul>
       
    19 <li id="GUID-E663CC7F-6F20-5425-9FDE-39645B22F292"><p>the general concept
       
    20 of the Comms Database </p> </li>
       
    21 <li id="GUID-1E784DD6-CE6B-58B3-BCF6-EE8578A46211"><p>the specific concept
       
    22 of Comms Database Sessions </p> </li>
       
    23 <li id="GUID-60084A0B-78DF-54C1-AEB3-A93415FFE77D"><p>how to write and build
       
    24 application code to run on Symbian platform </p> </li>
       
    25 </ul> </prereq>
       
    26 <context id="GUID-13169F3C-A14A-56F2-9805-315510A1ED6D"><p>You create a session
       
    27 with the Comms Database before you start to read and write the data. You can
       
    28 also set the access attributes for the session. </p> </context>
       
    29 <steps id="GUID-D7867EDD-C29B-573E-AF0C-7BA32B35F9EF">
       
    30 <step id="GUID-E7217733-86F3-5085-B194-049A795AB5B5"><cmd>Include the header
       
    31 files, define namespaces, and declare constants. </cmd>
       
    32 
       
    33 <info>The<filepath>CommsDatTypesV1_1.h</filepath> header file defines the
       
    34 classes and API items that the tool or application requires. This header file
       
    35 includes all other required header files. </info>
       
    36 
       
    37 <info>Define the CommsDat namesapce. </info>
       
    38 
       
    39 <info>Define a <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>TVersion</apiname></xref> set with the
       
    40 version information. </info>
       
    41 
       
    42 <info>The location of this code depends on the structure of the tool or application. </info>
       
    43 <stepxmp><codeblock id="GUID-A73251F7-AF1B-582C-8BA5-28E71CFD3307" xml:space="preserve">#include &lt;CommsDatTypesV1_1.h&gt; 
    13 
    44 
    14 // Add a declaration like this for each specific version you need.
    45 // Add a declaration like this for each specific version you need.
    15 // In this example, the major version number, the minor version number
    46 // In this example, the major version number, the minor version number
    16 // and the build number are all 1.
    47 // and the build number are all 1.
    17 #define KCDVersion1_1 TVersion(1,1,1) 
    48 #define KCDVersion1_1 TVersion(1,1,1) 
    18 
    49 
    19 using namespace CommsDat;
    50 using namespace CommsDat;
    20 
    51 
    21 ...</codeblock> </stepxmp> </step> <step id="GUID-68B7A254-9E14-5E1D-8A48-8848F33C3F5E"><cmd>Create the session. </cmd> <info>You select the version of the interface when you create the session. </info> <stepxmp><codeblock id="GUID-69C6C0FE-E5F1-59CE-A8D8-665D5E35CC01" xml:space="preserve">...
    52 ...</codeblock> </stepxmp>
       
    53 </step>
       
    54 <step id="GUID-68B7A254-9E14-5E1D-8A48-8848F33C3F5E"><cmd>Create the session. </cmd>
       
    55 
       
    56 <info>You select the version of the interface when you create the session. </info>
       
    57 <stepxmp><codeblock id="GUID-69C6C0FE-E5F1-59CE-A8D8-665D5E35CC01" xml:space="preserve">...
    22 // for the version 1.1.1 defined in step 1
    58 // for the version 1.1.1 defined in step 1
    23 CMDBSession* iDb = CMDBSession::NewL(KCDVersion1_1); 
    59 CMDBSession* iDb = CMDBSession::NewL(KCDVersion1_1); 
    24 ...</codeblock> </stepxmp> </step> <step id="GUID-75A1BC43-4A18-5CC6-BA43-6B4F33357ADC"><cmd>Set the access attributes for the session. </cmd> <info>This is an optional step. </info> <stepxmp>The following code allows the tool or application to see the elements that are marked as hidden in the Comms Database. The <codeph>ECHidden</codeph> symbol is an enum value of the <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>TCDAttributeFlags</apiname></xref> enum. You can also set the other access attributes, but the hidden attribute is the most common use case. </stepxmp> <stepxmp><codeblock id="GUID-CF73F37B-369C-5FC1-B8D8-79C6A50CA96D" xml:space="preserve">...
    60 ...</codeblock> </stepxmp>
       
    61 </step>
       
    62 <step id="GUID-75A1BC43-4A18-5CC6-BA43-6B4F33357ADC"><cmd>Set the access attributes
       
    63 for the session. </cmd>
       
    64 
       
    65 <info>This is an optional step. </info>
       
    66 <stepxmp>The following code allows the tool or application to see the elements
       
    67 that are marked as hidden in the Comms Database. The <codeph>ECHidden</codeph> symbol
       
    68 is an enum value of the <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>TCDAttributeFlags</apiname></xref> enum.
       
    69 You can also set the other access attributes, but the hidden attribute is
       
    70 the most common use case. </stepxmp>
       
    71 <stepxmp><codeblock id="GUID-CF73F37B-369C-5FC1-B8D8-79C6A50CA96D" xml:space="preserve">...
    25 iDb-&gt;SetAttributeMask(ECDHidden); 
    72 iDb-&gt;SetAttributeMask(ECDHidden); 
    26 ...</codeblock> </stepxmp> </step> <step id="GUID-8AD04100-7ACD-5B93-A0F9-94BFDD5B464C"><cmd>Delete the session object after the tool or application has finished its use of the Comms Database </cmd> <stepxmp><codeblock id="GUID-3674B821-9EFC-523F-8980-0D0EF214094A" xml:space="preserve">...
    73 ...</codeblock> </stepxmp>
    27 delete iDb;</codeblock> </stepxmp> </step> </steps> </taskbody><related-links><link href="GUID-1AFDDD6F-CB99-587D-A0B5-D3F5B27F7135.dita"><linktext>Comms Database concepts</linktext> </link> </related-links></task>
    74 </step>
       
    75 <step id="GUID-8AD04100-7ACD-5B93-A0F9-94BFDD5B464C"><cmd>Delete the session
       
    76 object after the tool or application has finished its use of the Comms Database </cmd>
       
    77 <stepxmp><codeblock id="GUID-3674B821-9EFC-523F-8980-0D0EF214094A" xml:space="preserve">...
       
    78 delete iDb;</codeblock> </stepxmp>
       
    79 </step>
       
    80 </steps>
       
    81 </taskbody><related-links>
       
    82 <link href="GUID-1AFDDD6F-CB99-587D-A0B5-D3F5B27F7135.dita"><linktext>Comms Database
       
    83 concepts</linktext></link>
       
    84 </related-links></task>