Symbian3/SDK/Source/GUID-922442FC-D9E0-53BD-B8AD-011A724C96FF.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 task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-922442FC-D9E0-53BD-B8AD-011A724C96FF" xml:lang="en"><title>How
to Detect Infrared Capability and Enable Infrared Mode: Tutorial</title><shortdesc>The Serial Communications Server API includes functionality to
detect and configure an Infrared port. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context><p>These steps show the functionality of the Serial Communications
Server API for Infrared. At the end of these steps, the port is set to Infrared
mode. A port set to Infrared mode may still require further configuration
specific to the Infrared driver. This further configuration is not included
in this tutorial. </p> </context>
<steps id="GUID-44197D73-A8BF-5662-B3BC-341766A7159B">
<step id="GUID-F614BCBB-696E-50F0-8C99-32D8AB7FC306"><cmd>Load the CSY and
open a port.</cmd>
</step>
<step id="GUID-0745F9D1-81E5-5331-B577-4D959B43635B"><cmd>Get the capabilities
of the port by calling <xref href="GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF.dita#GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF/GUID-4A6ECC68-EBC7-3B6C-94AE-9272669F6FF2"><apiname>RComm::Caps()</apiname></xref></cmd>
</step>
<step id="GUID-8911D514-9E2B-55CC-BD74-77BAF1A13F9C"><cmd>Get the Infrared
capabilities by checking the bits in <xref href="GUID-A0BE41DB-1B73-3029-8B84-547D771257EA.dita"><apiname>TCommCaps.iSIR</apiname></xref> with
the three bitmasks <xref href="GUID-E3455500-9903-3B8F-B702-E419BDE5DB4C.dita"><apiname>KCapsSIR115kbps</apiname></xref>, <xref href="GUID-BC1F7C67-E41E-3892-A9C4-3E752DF2AACB.dita"><apiname>KCapsSIR2400bpsOnly</apiname></xref>,
and <xref href="GUID-87867BAD-C91E-388B-A3DE-69AB9598C0EF.dita"><apiname>KCapsSIR4Mbps</apiname></xref>. </cmd>
<info>If any of the bitmasks show the bit as set, then the port has Infrared
capability. </info>
<info>The infra-red characteristic of the port can be determined from the
value <xref href="GUID-4B2001D0-DE8A-3A90-8AF5-6485FA5FE70A.dita"><apiname>TCommCapsV01.iSIRSettings</apiname></xref>. </info>
</step>
<step id="GUID-CA055EB0-A8E5-5F5C-AD91-44F72CAA638C"><cmd>To use the port
as an Infrared port, follow these steps: </cmd>
<substeps id="GUID-F8BE2BA0-7DB1-5813-B291-92B0D640EA9D">
<substep id="GUID-8E02B974-1608-5AB9-808C-89281771712F"><cmd/>
<info>Create an object of type <xref href="GUID-FA42F645-D2A8-384B-9FE6-6495EACFA479.dita"><apiname>TCommConfigV01</apiname></xref>. </info>
</substep>
<substep id="GUID-7596BE64-26E6-5F05-A113-CE9F54C66A8E"><cmd/>
<info>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>TCommConfigV01</codeph> object to get the port configuration. </info>
</substep>
<substep id="GUID-17F5B58E-5B10-519C-A6FA-A57BBE6B9FB1"><cmd/>
<info>Set the <xref href="GUID-4EDA16F3-40B1-3C8A-BD00-C04FF81053BB.dita"><apiname>iSIREnable</apiname></xref> flag in the <codeph>TCommConfigV01</codeph> object. </info>
</substep>
<substep id="GUID-C2ADDCD3-8B01-5E21-948C-E383D4CB4528"><cmd/>
<info>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>TCommConfigV01</codeph> object
as the <codeph>aConfig</codeph> parameter. </info>
<info>The port is now set to Infrared mode. To use Infrared, the Infrared
protocol must be understood so refer to the Infrared plugin section <xref href="GUID-D8E59924-4E17-56AE-8F6B-07749A2FF0B8.dita">IrDA Serial</xref>. </info>
</substep>
</substeps>
</step>
</steps>
<example><title>Example</title> <codeblock id="GUID-F5B75720-86C3-5956-9238-255D46A2C013" xml:space="preserve">TCommCaps ourCapabilities;
User::LeaveIfError(commPort.Caps (ourCapabilities));

 if ((ourCapabilities ().iSIR &amp; KCapsSIR115kbps) ||
(ourCapabilities ().iSIR &amp; KCapsSIR2400bpsOnly) ||
(ourCapabilities ().iSIR &amp; KCapsSIR4Mbps))
{
   // IR is supported, so enable it
   TCommConfig portSettings;
   User::LeaveIfError(commPort.Config (portSettings));

   portSettings ().iSIREnable = ESIREnable;
   User::LeaveIfError (commPort.SetConfig (portSettings));
}</codeblock> </example>
</taskbody><related-links>
<link href="GUID-D8E59924-4E17-56AE-8F6B-07749A2FF0B8.dita"><linktext>IrDA Serial</linktext>
</link>
<link href="GUID-35D49549-1F4D-583F-A45D-9B557A207DD2.dita"><linktext>GlassTerm
-                 glass teletype terminal</linktext></link>
<link href="GUID-397239F9-7EE8-52CF-9B37-328AE307BAA0.dita"><linktext>How to  
              Open a Port with the IrDA Protocol Module: Tutorial</linktext>
</link>
</related-links></task>