This tutorial shows the basic steps required to open a serial port using the RComm API.
RComm
is a client of the RCommServ
API, so create a RCommServ
session.
RCommServ::LoadCommModule()
with the aFileName
parameter set to a Serial Protocol Module. This
requests that the Serial Communications Server use a specific Serial
Protocol Module. These Serial Protocol Modules are .CSY
files that let the Serial Communications Server know how the server
should manage the port. For example, sample terminal code uses a standard RS232 module called ECUART
, while infra-red
code uses a IrDA module called IrCOMM
.
The .csy
file extension is not required
in the aFileName
parameter.
RComm
client to the server and to open the port by name.
You must specify the name of the port. The serial port name format
is:
[text-string]::[0-255]The name of the port may not be the same as the name of the Serial Protocol Module. For example, the Infrared Serial Protocol Module is called
irda.csy
and the port name is IrCOMM
.
RCommServ server; server.Connect (); // step 1 server.LoadCommModule (_L ("ECUART")); // step 2 RComm commPort; commPort.Open (server, _L ("COMM::0"), ECommExclusive); // step 3