|
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-294EF1C3-E7EC-5B93-B4F4-ECA50DD6993F" xml:lang="en"><title>How |
|
13 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> |
|
14 <context><p>This tutorial follows on from the <xref href="GUID-934AEB9C-77EA-5F50-BB84-2446DDD432C8.dita">How |
|
15 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 |
|
16 can return when the data has been queued in the device driver buffer, or when |
|
17 the data has been sent by the device driver. |
|
18 </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 |
|
19 ways: </p> <ol id="GUID-BC7A5915-ABD9-529C-8443-4F6DB928DE88"> |
|
20 <li id="GUID-A4A9C4A2-CB14-5CDB-A6F7-51A0A75E1656"><p>As soon as the data |
|
21 has been queued with the device driver. </p> <p>This allows the application |
|
22 to run while the data is sent so that the application can create the next |
|
23 block of data to send. </p> </li> |
|
24 <li id="GUID-386A395E-7C39-598C-9D86-E894816DF838"><p>After the device driver |
|
25 has sent the data. </p> <p>This is used when the application must wait for |
|
26 a response from the remote device after the data is sent. </p> </li> |
|
27 </ol> <p>The default value is dependent on the Serial Device Driver. </p> </context> |
|
28 <steps id="GUID-AC2224DE-0F1A-5B0F-87AC-6873945BD095"> |
|
29 <step id="GUID-1BEEB97E-E364-56FB-8EFA-F21CA5FC7DB7"><cmd/> |
|
30 <info>Create an object of type <xref href="GUID-BF099B27-4E8A-3765-A6A8-DB88DB4F4F2E.dita"><apiname>TCommConfig</apiname></xref>. </info> |
|
31 </step> |
|
32 <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 |
|
33 the <codeph>aConfig</codeph> parameter set to the <codeph>TCommConfig</codeph> object. </cmd> |
|
34 <info>The <codeph>TCommConfig</codeph> object now contains the port settings. </info> |
|
35 </step> |
|
36 <step id="GUID-2C12D5F9-619C-5146-AF31-68C351F1540B"><cmd/> |
|
37 <info>To set the RComm::Write() API to return early, set the <codeph>KConfigWriteBufferedComplete</codeph> flag |
|
38 in the <codeph>iHandshake</codeph> field in the <codeph>TCommconfig</codeph> object. </info> |
|
39 <info>To set the RComm::Write() API to return after the data is sent, clear |
|
40 the <codeph>KConfigWriteBufferedComplete</codeph> flag in the <codeph>iHandshake</codeph> field |
|
41 in the <codeph>TCommconfig</codeph> object. </info> |
|
42 </step> |
|
43 <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 |
|
44 the <codeph>aConfig</codeph> parameter set to the <codeph>TCommConfig</codeph> object. </cmd> |
|
45 </step> |
|
46 </steps> |
|
47 <example><title>Example</title> <codeblock id="GUID-7F596FB2-0F54-5F76-BA6C-F9B664BE196E" xml:space="preserve">TCommConfig portSettings; |
|
48 commPort.Config(portSettings); |
|
49 portSettings().iHandshake |= KConfigWriteBufferedComplete; // set early complete |
|
50 User::LeaveIfError (commPort.SetConfig(portSettings)); |
|
51 </codeblock> </example> |
|
52 </taskbody></task> |