Symbian3/PDK/Source/GUID-31E9F790-8A47-588C-A515-D2C8CD367ADE.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 18:02:22 +0000
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
permissions -rw-r--r--
week 10 bug fix submission (SF PDK version): Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.

<?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-31E9F790-8A47-588C-A515-D2C8CD367ADE" xml:lang="en"><title>How
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>
<context><p>This tutorial assumes a knowledge of the <xref href="GUID-934AEB9C-77EA-5F50-BB84-2446DDD432C8.dita">How
to transfer data:  Tutorial</xref> topic.</p><p>An application that must respond
quickly can set termination charactes  that are expected in the data. The
read requests complete if any termination characters appear in the data.</p><p>If
an application needs to respond quickly to the content of the data that is
received, the application can set termination characters. If any termination
characters are set, the Serial Communications Server inspects the data during
a read request. If the Serial Communications Server detects a termination
character during a read request, the Serial Communicatoins Server completes
the request with the data. </p> <p>For example, an application that is reading
lines of text can set the termination character to the line end character. </p> </context>
<steps id="GUID-D81B578F-B7DA-5B12-93FB-8A89D552E0B6">
<step id="GUID-3FCA89C0-2E9A-52DA-B6D1-EB3522381606"><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-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
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-59D4C184-805F-5847-AB28-9466FA184D05"><cmd/>
<info>Set the <codeph>iTerminator</codeph> array in the <codeph>TCommconfig</codeph> object
to the terminator characters. The <codeph>iTerminator</codeph> array can contain
four characters. If less than four characters are required, set the characters
from index 0 of the array. </info>
</step>
<step id="GUID-FEA59CB4-BBED-5265-AA4A-7B9DAB220A80"><cmd/>
<info>Set the <codeph>iTerminatorCount</codeph> field in the <codeph>TCommconfig</codeph> object
to the number of characters set in the <codeph>iTerminator</codeph> array. </info>
</step>
<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
the <codeph>aConfig</codeph> parameter set to the <codeph>TCommConfig</codeph> object. </cmd>
</step>
</steps>
<example><title>Example</title> <codeblock id="GUID-481805B3-02BC-5AEC-AC94-07E3D4BF8373" xml:space="preserve">TCommConfig portSettings;
commPort.Config (portSettings);
portSettings ().iTerminator[0] = 10;     // LF char
portSettings ().iTerminatorCount = 1;    // so that we terminate a read when each line feed arrives
User::LeaveIfError (commPort.SetConfig(portSettings));
</codeblock> </example>
</taskbody></task>