Symbian3/SDK/Source/GUID-294EF1C3-E7EC-5B93-B4F4-ECA50DD6993F.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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-294EF1C3-E7EC-5B93-B4F4-ECA50DD6993F" xml:lang="en"><title>How
to Set when Write Calls Return: Tutorial</title><shortdesc>This tutorial follows on from the tutorial on How to transfer data.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context><p>This tutorial follows on from the <xref href="GUID-934AEB9C-77EA-5F50-BB84-2446DDD432C8.dita">How
to Transfer Data Tutorial</xref>. The <xref href="GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF.dita#GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF/GUID-27B1F841-8478-33E0-A168-11DC468183C0"><apiname>RComm::Write()</apiname></xref> function
can return when the data has been queued in the device driver buffer, or when
the data has been sent by the device driver. 
</p><p>The <xref href="GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF.dita#GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF/GUID-27B1F841-8478-33E0-A168-11DC468183C0"><apiname>RComm::Write()</apiname></xref> API can return in one of two
ways: </p> <ol id="GUID-BC7A5915-ABD9-529C-8443-4F6DB928DE88">
<li id="GUID-A4A9C4A2-CB14-5CDB-A6F7-51A0A75E1656"><p>As soon as the data
has been queued with the device driver. </p> <p>This allows the application
to run while the data is sent so that the application can create the next
block of data to send. </p> </li>
<li id="GUID-386A395E-7C39-598C-9D86-E894816DF838"><p>After the device driver
has sent the data. </p> <p>This is used when the application must wait for
a response from the remote device after the data is sent. </p> </li>
</ol> <p>The default value is dependent on the Serial Device Driver. </p> </context>
<steps id="GUID-AC2224DE-0F1A-5B0F-87AC-6873945BD095">
<step id="GUID-1BEEB97E-E364-56FB-8EFA-F21CA5FC7DB7"><cmd/>
<info>Create an object of type <xref href="GUID-BF099B27-4E8A-3765-A6A8-DB88DB4F4F2E.dita"><apiname>TCommConfig</apiname></xref>. </info>
</step>
<step id="GUID-EFD51188-3862-5534-8DF2-D5D2BBB7D239"><cmd>Call <xref href="GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF.dita#GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF/GUID-4C38E1D8-EC81-36A3-BAA2-4D4FFECFD995"><apiname>RComm::Config()</apiname></xref> with
the <codeph>aConfig</codeph> parameter set to the <codeph>TCommConfig</codeph> object. </cmd>
<info>The <codeph>TCommConfig</codeph> object now contains the port settings. </info>
</step>
<step id="GUID-2C12D5F9-619C-5146-AF31-68C351F1540B"><cmd/>
<info>To set the RComm::Write() API to return early, set the <codeph>KConfigWriteBufferedComplete</codeph> flag
in the <codeph>iHandshake</codeph> field in the <codeph>TCommconfig</codeph> object. </info>
<info>To set the RComm::Write() API to return after the data is sent, clear
the <codeph>KConfigWriteBufferedComplete</codeph> flag in the <codeph>iHandshake</codeph> field
in the <codeph>TCommconfig</codeph> object. </info>
</step>
<step id="GUID-11B0A6EC-F1C3-5B3B-8615-0362EB52B568"><cmd>Call <xref href="GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF.dita#GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF/GUID-732174E9-930F-37D4-AD7C-1434E5731C50"><apiname>RComm::SetConfig()</apiname></xref> with
the <codeph>aConfig</codeph> parameter set to the <codeph>TCommConfig</codeph> object. </cmd>
</step>
</steps>
<example><title>Example</title> <codeblock id="GUID-7F596FB2-0F54-5F76-BA6C-F9B664BE196E" xml:space="preserve">TCommConfig portSettings;
commPort.Config(portSettings);
portSettings().iHandshake |= KConfigWriteBufferedComplete;     // set early complete
User::LeaveIfError (commPort.SetConfig(portSettings));
</codeblock> </example>
</taskbody></task>