|
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-5D47DBF8-3DFE-5D0B-95B2-63302E91C423" xml:lang="en"><title>How |
|
13 to Open a Port: Tutorial</title><shortdesc>This tutorial shows the basic steps required to open a serial port |
|
14 using the RComm API.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
15 <context><p>If the port is being opened for a console application or similar |
|
16 environment where device drivers are not guaranteed to be started, first load the |
|
17 LDD and PDDs as per the tutorial <xref href="GUID-57A909F3-EAEA-5FE2-B620-E21204794497.dita">How |
|
18 to load the Physical Device Driver and Logical Device Driver: Tutorial</xref></p></context> |
|
19 <steps id="GUID-7C95375B-0469-5B65-96C3-F94C0C4418D1"> |
|
20 <step id="GUID-39496668-DE99-5A5C-AB01-CCB0609757EC"><cmd/> |
|
21 <info>The <xref href="GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF.dita"><apiname>RComm</apiname></xref> is a client of the <xref href="GUID-6B3CA99B-ABF2-32EA-935D-23AE5AE2C306.dita"><apiname>RCommServ</apiname></xref> API, |
|
22 so create a <xref href="GUID-6B3CA99B-ABF2-32EA-935D-23AE5AE2C306.dita"><apiname>RCommServ</apiname></xref> session. </info> |
|
23 </step> |
|
24 <step id="GUID-5C7D946E-C7A7-5482-9A94-E806EEB7DF4F"><cmd/> |
|
25 <info>Call <xref href="GUID-6B3CA99B-ABF2-32EA-935D-23AE5AE2C306.dita#GUID-6B3CA99B-ABF2-32EA-935D-23AE5AE2C306/GUID-F851835B-4585-3C3A-B257-ADAE04CD95AA"><apiname>RCommServ::LoadCommModule()</apiname></xref> with the <codeph>aFileName</codeph> parameter |
|
26 set to a Serial Protocol Module. This requests that the Serial Communications |
|
27 Server use a specific Serial Protocol Module. These Serial Protocol Modules |
|
28 are <filepath>.CSY</filepath> files that let the Serial Communications Server |
|
29 know how the server should manage the port. For example, sample terminal code |
|
30 uses a standard <keyword>RS232</keyword> module called <codeph>ECUART</codeph>, |
|
31 while infra-red code uses a <keyword>IrDA</keyword> module called <codeph>IrCOMM</codeph>. </info> |
|
32 <info>The <filepath>.csy</filepath> file extension is not required in the <codeph>aFileName</codeph> parameter. </info> |
|
33 </step> |
|
34 <step id="GUID-EF3C8BFE-1A2A-5F26-A35E-8C6924C3D699"><cmd/> |
|
35 <info>Call <xref href="GUID-0C42149F-BBEE-3EEC-A932-BECD16682BA0.dita"><apiname>RComm:Open()</apiname></xref> to connect the <xref href="GUID-3B4E8ED5-72F7-3E51-B188-3C1045526DDF.dita"><apiname>RComm</apiname></xref> client |
|
36 to the server and to open the port by name. You must specify the name of the |
|
37 port. The serial port name format is: </info> |
|
38 <stepxmp><codeblock id="GUID-386368CF-113A-5804-B2A5-958E838B639C" xml:space="preserve">[text-string]::[0-255]</codeblock> </stepxmp> |
|
39 <info>The name of the port may not be the same as the name of the Serial Protocol |
|
40 Module. For example, the Infrared Serial Protocol Module is called <filepath>irda.csy</filepath> and |
|
41 the port name is <codeph>IrCOMM</codeph>. </info> |
|
42 </step> |
|
43 </steps> |
|
44 <example><title>Example</title> <codeblock id="GUID-AAF9BB90-7C53-5417-A518-2397945F53DF" xml:space="preserve">RCommServ server; |
|
45 server.Connect (); // step 1 |
|
46 server.LoadCommModule (_L ("ECUART")); // step 2 |
|
47 RComm commPort; |
|
48 commPort.Open (server, _L ("COMM::0"), ECommExclusive); // step 3 |
|
49 </codeblock> </example> |
|
50 </taskbody><related-links> |
|
51 <link href="GUID-35D49549-1F4D-583F-A45D-9B557A207DD2.dita"><linktext>GlassTerm |
|
52 - glass teletype terminal</linktext></link> |
|
53 </related-links></task> |