Symbian3/PDK/Source/GUID-31E9F790-8A47-588C-A515-D2C8CD367ADE.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     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-31E9F790-8A47-588C-A515-D2C8CD367ADE" xml:lang="en"><title>How
       
    13 to Terminate Read Requests Early: Tutorial</title><shortdesc>This tutorial explains how to terminate a read request. topic. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    14 <context><p>This tutorial assumes a knowledge of the <xref href="GUID-934AEB9C-77EA-5F50-BB84-2446DDD432C8.dita">How
       
    15 to transfer data:  Tutorial</xref> topic.</p><p>An application that must respond
       
    16 quickly can set termination charactes  that are expected in the data. The
       
    17 read requests complete if any termination characters appear in the data.</p><p>If
       
    18 an application needs to respond quickly to the content of the data that is
       
    19 received, the application can set termination characters. If any termination
       
    20 characters are set, the Serial Communications Server inspects the data during
       
    21 a read request. If the Serial Communications Server detects a termination
       
    22 character during a read request, the Serial Communicatoins Server completes
       
    23 the request with the data. </p> <p>For example, an application that is reading
       
    24 lines of text can set the termination character to the line end character. </p> </context>
       
    25 <steps id="GUID-D81B578F-B7DA-5B12-93FB-8A89D552E0B6">
       
    26 <step id="GUID-3FCA89C0-2E9A-52DA-B6D1-EB3522381606"><cmd/>
       
    27 <info>Create an object of type <xref href="GUID-BF099B27-4E8A-3765-A6A8-DB88DB4F4F2E.dita"><apiname>TCommConfig</apiname></xref>. </info>
       
    28 </step>
       
    29 <step id="GUID-30F3B132-DADB-5F4B-8709-6EAA19E6AD13"><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
       
    30 the <codeph>aConfig</codeph> parameter set to the <codeph>TCommConfig</codeph> object. </cmd>
       
    31 <info>The <codeph>TCommConfig</codeph> object now contains the port settings. </info>
       
    32 </step>
       
    33 <step id="GUID-59D4C184-805F-5847-AB28-9466FA184D05"><cmd/>
       
    34 <info>Set the <codeph>iTerminator</codeph> array in the <codeph>TCommconfig</codeph> object
       
    35 to the terminator characters. The <codeph>iTerminator</codeph> array can contain
       
    36 four characters. If less than four characters are required, set the characters
       
    37 from index 0 of the array. </info>
       
    38 </step>
       
    39 <step id="GUID-FEA59CB4-BBED-5265-AA4A-7B9DAB220A80"><cmd/>
       
    40 <info>Set the <codeph>iTerminatorCount</codeph> field in the <codeph>TCommconfig</codeph> object
       
    41 to the number of characters set in the <codeph>iTerminator</codeph> array. </info>
       
    42 </step>
       
    43 <step id="GUID-8D23744E-8BB7-5931-A375-B2B0ECF17141"><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-481805B3-02BC-5AEC-AC94-07E3D4BF8373" xml:space="preserve">TCommConfig portSettings;
       
    48 commPort.Config (portSettings);
       
    49 portSettings ().iTerminator[0] = 10;     // LF char
       
    50 portSettings ().iTerminatorCount = 1;    // so that we terminate a read when each line feed arrives
       
    51 User::LeaveIfError (commPort.SetConfig(portSettings));
       
    52 </codeblock> </example>
       
    53 </taskbody></task>