Location:
c32comm.h
Link against: c32.lib
class RCommServ : public RSessionBase;
Represents a session with the serial 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.
Sessions with the serial comms server are not shareable.
Comms modules are also known as "CSY"s due to their ".CSY" extension, derived from the term "Comms SYstem".
This class is not intended for user derivation.
RHandleBase
- A handle to an object
RSessionBase
- Client-side handle to a session with a server
RCommServ
- Represents a session with the serial comms server
Defined in RCommServ
:
Connect()
, CreateThreadInCommProc()
, GetPortInfo()
, GetPortInfo()
, LoadCommModule()
, NumPorts()
, RCommServ()
, UnloadCommModule()
, Version()
, __DbgCheckHeap()
, __DbgFailNext()
, __DbgMarkEnd()
, __DbgMarkHeap()
, __DbgSetTraceMask()
Inherited from RHandleBase
:
Attributes()
,
Close()
,
Duplicate()
,
FullName()
,
Handle()
,
HandleInfo()
,
Name()
,
SetHandle()
,
SetHandleNC()
,
iHandle
Inherited from RSessionBase
:
CreateSession()
,
EAutoAttach
,
EExplicitAttach
,
Open()
,
Send()
,
SendReceive()
,
SetReturnedHandle()
,
ShareAuto()
,
ShareProtected()
,
TAttachMode
Capability: | Illegal |
IMPORT_C TInt Connect();
Connects a client process to the comms server.
Use this function to open a session to the Comms server. Default number of message slots is defined in KDefaultMessageSlots.
Notes:
1. RHandleBase
provides the necessary Close()
function, which should be called when the server session is no longer required. Note that the kernel completes the Close()
function immediately and so RCommServ resources still used by this client may not yet have been released at the time the
Close()
returns. A consequence of this is that an attempt to open a port previously opened for exclusive use in a session that is
still closing might fail. 2. Older versions of Symbian OS specified that a call to "StartC32" was required before a call to
this Connect()
. However, C32 Serial server is now started automatically during device boot so this is not necessary unless the application
is to run in a non-standard GUI environment.
|
Capability: | Illegal |
IMPORT_C TVersion Version() const;
Returns the client side version number.
Use this function to get the version number. The version number may be incremented in future releases of the comms server. If extra features are added in such releases, the version number may be used by application programs as a basis for assessing the capabilities of the comms server. Version-specific functions will be marked as such in the SDK documentation.
|
Capability: | Illegal |
IMPORT_C TInt LoadCommModule(const TDesC &aFileName);
Loads a comms module.
Use this function to load a CSY comms module. These are protocol modules that C32 Serial Server uses to understand how to handle a particular port.
Notes:
1. There is no need for an extension, as ".CSY" is automatically appended by this function.
2. This function only loads CSYs that have been installed correctly into one of the system's /sys/bin directories
3. If the module has already been loaded by another client, this function will increment the reference to the module.
4. It is not an error to load the same module twice or more, although there is no practical application for this ability. On each subsequent load for the same module the reference count is simply incremented. When the session is closed, all module references are removed including references from repeated loading of the same module.
5. There is no limit to the number of modules that can be loaded from within a single session.
With the exception of some hardware configurations, three modules are normally available as standard:
ECUART is used to address appropriate serial ports in RS232 mode. It is normally customised for a device.
IRCOMM drives the infrared port in infrared mode.
BTCOMM drives the Bluetooth emulated serial port.
|
|
IMPORT_C TInt UnloadCommModule(const TDesC &aName);
Remove this client's reference to the named communications module. If this is the last client to reference the communications module, the module is unloaded.
Note:
There is no need to unload a comms module when the connection to the server is closed, as this is done automatically by the C32 Server. For example, the following code will not result in a leak:
_LIT(KCSYName,"ECUART");
RCommServ commSession;
if (commSession.Connect() == KErrNone)
{
TInt ret = commSession.LoadCommModule(KCSYName);
commSession.Close();
}
|
|
Capability: | Illegal |
IMPORT_C TInt NumPorts(TInt &aNum);
Get the number of unique comms modules (CSYs) loaded into C32.
This number includes modules loaded by other sessions.
|
|
Capability: | Illegal |
IMPORT_C TInt GetPortInfo(const TDesC &aName, TSerialInfo &aInfo);
Gets static information about the available serial ports for a particular comms module.
This variant enables the comms module to be specified in Port Prefix format or by filename.
There is no wildcard support.
Notes:
1. This API only returns static information about the available ports as they were when the module loaded, so ports listed as available may actually be in use exclusively by another client at the time of this call.
2. The information returned does not account for any security restrictions on ports, and so does not check whether the client has the capabilities to open all the advertised ports.
|
|
Capability: | Illegal |
IMPORT_C TInt GetPortInfo(TInt aIndex, TDes &aModuleName, TSerialInfo &aInfo);
Gets static information about the available serial ports for a particular comms module.
This variant enables the comms module to be specified by an index number from 0, enabling iteration through the loaded comms
modules. Call NumPorts()
to obtain the current number of loaded comms modules.
Notes:
1. This API only returns static information about the available ports as they were when the module loaded, so ports listed as available may actually be in use exclusively by another client at the time of this call.
2. The information returned does not account for any security restrictions on ports, and so does not check whether the client has the capabilities to open all the advertised ports.
3. If another C32 client unloads a CSY module, the index of each of the remaining modules may change. If a client is attempting
to iterate through all the open modules when this occurs, the iteration may miss a module or receive KErrNotFound unexpectedly.
This behaviour can be detected by observing that the value returned by NumPorts()
changes.
|
|
Capability: | Illegal |
IMPORT_C TInt __DbgMarkHeap();
Sets a heap mark in the comm server
Only valid for Debug builds.
|
Capability: | Illegal |
IMPORT_C TInt __DbgCheckHeap(TInt aCount);
Checks the heap mark in the comm server
Only valid for Debug builds.
|
|
Capability: | Illegal |
IMPORT_C TInt __DbgMarkEnd(TInt aCount);
Sets the heap mark end in the comm server
Only valid for Debug builds.
|
|
Capability: | Illegal |
IMPORT_C TInt __DbgFailNext(TInt aCount);
Emulates a single fail next heap allocation in the comm server. If C32 is running multiple threads the same request is passed to each thread. Each C32 thread will only act on this request if it has not already been configured for heap failures via CMI files.
Only valid for Debug builds.
|
|
Capability: | Illegal |
IMPORT_C TInt __DbgSetTraceMask(TC32Trace aMask);
The functionality of this API has been removed.
Where tracing is required, please refer to the Comms Infrastructure documentation on logging.
|
|
Capability: | CommDD | (Deprecate) |
static IMPORT_C TInt CreateThreadInCommProc(const TDesC &aLibraryName, const TDesC &aThreadName, TThreadFunction aFunction,
TInt aStackSize, TInt aHeapMinSize, TInt aHeapMaxSize);
This functionality has been withdrawn since the introduction of Platform Security.
This API has been replaced with a more secure and controlled model for loading threads into the Comms process, known as the Configurator. The Configurator requires a Comms Provider Module (DLL) to be available that provides the code for the thread to execute, and a configuration file that describes to the Configurator how to manage the Comms Provider Module. Further information on this is only available in documentation libraries that include the Configurator documentation.
|
|