Symbian3/SDK/Source/GUID-0CDA8FCA-AABE-5988-9467-30AA1AECCC90.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-0CDA8FCA-AABE-5988-9467-30AA1AECCC90.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,27 @@
+<?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 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; 
+
+// Add a declaration like this for each specific version you need.
+// In this example, the major version number, the minor version number
+// and the build number are all 1.
+#define KCDVersion1_1 TVersion(1,1,1) 
+
+using namespace CommsDat;
+
+...</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">...
+// for the version 1.1.1 defined in step 1
+CMDBSession* iDb = CMDBSession::NewL(KCDVersion1_1); 
+...</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">...
+iDb-&gt;SetAttributeMask(ECDHidden); 
+...</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">...
+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>
\ No newline at end of file