Symbian3/PDK/Source/GUID-BD9CBBE8-9389-50F9-98B1-0A07F7E2891C.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Tue, 30 Mar 2010 11:56:28 +0100
changeset 5 f345bda72bc4
parent 3 46218c8b8afa
child 14 578be2adaf3e
permissions -rw-r--r--
Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"

<?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>