Symbian3/SDK/Source/GUID-0CDA8FCA-AABE-5988-9467-30AA1AECCC90.dita
changeset 7 51a74ef9ed63
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE task
       
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
       
    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; 
       
    44 
       
    45 // Add a declaration like this for each specific version you need.
       
    46 // In this example, the major version number, the minor version number
       
    47 // and the build number are all 1.
       
    48 #define KCDVersion1_1 TVersion(1,1,1) 
       
    49 
       
    50 using namespace CommsDat;
       
    51 
       
    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">...
       
    58 // for the version 1.1.1 defined in step 1
       
    59 CMDBSession* iDb = CMDBSession::NewL(KCDVersion1_1); 
       
    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">...
       
    72 iDb-&gt;SetAttributeMask(ECDHidden); 
       
    73 ...</codeblock> </stepxmp>
       
    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>