Symbian3/SDK/Source/GUID-BD9CBBE8-9389-50F9-98B1-0A07F7E2891C.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 concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-BD9CBBE8-9389-50F9-98B1-0A07F7E2891C"><title>How to Wait for the Write Buffer to Empty: Tutorial</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This tutorial shows how to wait for the device driver to transmit data when a write request has previously been terminated early. </p> <p>The tutorial <xref href="GUID-294EF1C3-E7EC-5B93-B4F4-ECA50DD6993F.dita">How to Terminate Write Requests Early</xref> shows how the <xref href="GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF.dita#GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF/GUID-8FB1FC0F-EF29-3EE9-BD4B-359CE42F3796"><apiname>RComm::Write</apiname></xref> API can return early. </p> <p>To wait for the buffer to be empty, call <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> in one of two ways: </p> <ul><li id="GUID-92DCE453-6E78-57DA-BAC3-CC62645B359F"><p>sending an empty descriptor: </p> <codeblock id="GUID-9A469B13-EEEF-5465-92E4-B271801408C5" xml:space="preserve">outputBuffer.Zero();
commPort.Write (requeststatus,outputBuffer);</codeblock> </li> <li id="GUID-982A2F50-B25B-55F2-BEB2-FEB3ABE13080"><p>sending a descriptor with an optional length parameter of zero: </p> <codeblock id="GUID-013C9C10-2F2E-5574-BA1B-F27219B99226" xml:space="preserve">commPort.Write (requeststatus,outputBuffer,0);</codeblock> </li> </ul> <p>The state of the <codeph>KConfigWriteBufferedComplete</codeph> bit has no effect when the above methods are used. </p> <p>This is a useful feature that enables something like a file transfer of a series of blocks to be sent efficiently making use of early completion, while still being able to guarantee through the method above that all the data has actually cleared the transmitter at end of the transfer. </p> </conbody></concept>