Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: c32comm.h
Link against: c32.lib

Class RCommServ

RCommServ

Support

Supported from 5.0

Description

Represents a session with the comms server. Functions are provided for connection to the server and for loading and unloading different comms modules, and services for finding out the name and numbers of the available ports.

Derivation

RCommServRepresents a session with the comms server
RHandleBaseHandle to an object
RSessionBaseClient-side handle to a session with a server

Defined in RCommServ:
Connect(), GetPortInfo(), LoadCommModule(), NumPorts(), RCommServ(), UnloadCommModule(), Version()

Inherited from RHandleBase:
Close(), Duplicate(), Handle(), SetHandle()

Inherited from RSessionBase:
Attach(), CreateSession(), EAutoAttach, EExplicitAttach, Send(), SendReceive(), SetRetry(), Share(), TAttachMode


Constructor


RCommServ()

RCommServ();

Description

Default constructor.

[Top]


Services provided


Connect()

TInt Connect();

Description

Connects a client process to the comms server.

As with any server, the connection should be closed after use. RHandleBase provides the necessary Close() function, which should be called when the server session is no longer required.

Return value

TInt

System-wide error code


Version()

TVersion Version() const;

Description

Gets the version number.

Return value

Tversion

Version number


LoadCommModule()

TInt LoadCommModule(const TDesC &aFileName);

Description

Loads a comms module.

Note:

Parameters

const TDesC &aFileName

Name of the module to load

Return value

TInt

System-wide error code


UnloadCommModule()

TInt UnloadCommModule(const TDesC &aName);

Description

Unloads a comms module  — for instance, if switching from RS232 to infra-red operation.

There is no need to unload a comms module when the connection to the server is closed, as this is done automatically.

Parameters

const TDesC &aFileName

Name of the module to unload

Return value

TInt

System-wide error code


NumPorts()

TInt NumPorts(TInt& aNum);

Description

Gets how many comms module (CSYs) are loaded.

Parameters

TInt& aNum

On return, holds the number of loaded CSYs

Return value

TInt

System-wide error code


GetPortInfo()

TInt GetPortInfo(const TDesC &aName,TSerialInfo &aInfo);
TInt GetPortInfo(TInt aIndex, TDes &aModuleName, TSerialInfo &aInfo);

Description

Gets information about the serial ports that are available. It is overloaded and can be called in two versions.

The first obtains the port information for a comms module specified by name (for example, COMM for RS232). The second version is similar, but allows you to specify the comms modules by an index number from 0. This allows you to enumerate through the loaded comms modules. You can obtain the current number of loaded comms modules by calling NumPorts().

Parameters

const TDesC &aName

The name of the comms module

TSerialInfo &aInfo

On return, contains information about the ports available, including the high and low unit numbers and their name.

TInt aIndex

Index number of the comms module from 0.

TDes &aModuleName

On return, contains the name of the comms module referred to byaIndex

Return value

TInt

System-wide error code