Location:
msvapi.h
Link against:
msgs.lib
CMsvSession
Supported from 5.0
Represents a channel of communication between a client thread (Client-side MTM, User Interface MTM, or message client application) and the Message Server thread.
A single instance of this class exists for each such client thread. The class provides the means by which clients are notified when important Message Server events occur.
In pre-Unicode releases, this class had an import library mcld.lib.
Note the following significant groups of functions:
Creation functions: a message client application must use OpenSyncL()
or OpenASyncL()
to create a session object, before it can instantiate any MTM or CMsvEntry
object. Only a single session should be created within a thread. As Client-side MTM, User Interface MTM, and CMsvEntry
objects are created in the client thread, these use the client session, and do not create their own. Note that to close a session, delete all objects relying on that session, and then the session object itself.
Cleanup functions: CMsvSession
provides the ability to handle the cleanup of entries in the event of a leave occurring, in a very similar manner to the standard EPOC cleanup stack. The difference is that, on a leave, any entries that are on the entry cleanup stack are removed from the Message Server. The implementation uses the standard cleanup stack, so entry push and pop functions should be used in the same order as all other types of push and pop. The functions can be used both by MTM implementations and message client applications.
|
Defined in CMsvSession
:
AddObserverL()
, ChangeAttributesL()
, ChangeDriveL()
, CleanupEntryPop()
, CleanupEntryPushL()
, CloseMessageServer()
, DeInstallMtmGroup()
, DecPcSyncCountL()
, FileSession()
, GetChildIdsL()
, GetEntry()
, GetEntryL()
, IncPcSyncCountL()
, InstallMtmGroup()
, OpenASyncL()
, OpenSyncL()
, OutstandingOperationsL()
, RemoveEntry()
, RemoveObserver()
, ServiceActive()
, ServiceProgress()
, StopService()
, TransferCommandL()
Inherited from CActive
:
Cancel()
,
Deque()
,
DoCancel()
,
EPriorityHigh
,
EPriorityIdle
,
EPriorityLow
,
EPriorityStandard
,
EPriorityUserInput
,
IsActive()
,
IsAdded()
,
Priority()
,
RunError()
,
RunL()
,
SetActive()
,
SetPriority()
,
TPriority
,
iStatus
Inherited from CBase
:
operator new()
static CMsvSession* OpenSyncL(MMsvSessionObserver& aObserver);
Creates a session synchronously.
The session can be used once the function returns.
|
|
|
static CMsvSession* OpenAsyncL(MMsvSessionObserver& aObserver);
Creates a session asynchronously.
The session cannot be used until the passed MMsvSessionObserver
observer has been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady
. If any functions are called before this, they will fail with KErrNotReady
.
|
|
|
void AddObserverL(MMsvSessionObserver& aObserver);
Registers a new session observer.
CMsvSession
objects can call back observer objects that implement the MMsvSessionObserver::HandleSessionEvent()
when certain events occur. Any number of observers can be registered.
For details of when observers are called, see TMsvSessionEvent::TMsvEntryEvent
.
|
|
void RemoveObserver(MMsvSessionObserver& aObserver);
Deregisters a previously registered observer.
|
void ChangeAttributesL(const CMsvEntrySelection& aSelection,
TUint aSetAttributes, TUint aClearAttributes);
Supported from 6.0
Provides a quick way to set or clear multiple fields in a selection of entries.
Fields to change are specified using a bitmask of TMsvAttribute
values. Possible fields that can be changed using this function are:
PC synchronisation
Visibility flag
Read flag
In-preparation flag
Connected flag
New flag
|
CMsvEntry* GetEntryL(TMsvId aId);
Accesses the entry with the specified ID.
If a client is unaware of the entries that exist, it can set aId
to KMsvRootIndexEntryId
to obtain the root entry, from where all other entries can be obtained.
The CMsvEntry
object must be deleted by the client when it is no longer required.
|
|
|
TInt GetEntry(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry);
Supported from 6.0
Gets the index entry for the specified entry ID.
|
|
void GetChildIdsL(TMsvId aId, const CMsvEntryFilter& aFilter, CMsvEntrySelection& aSelection);
Supported from 6.0
Gets filtered list of children of a specified message entry.
|
void RemoveEntry(TMsvId aId);
Deletes the specified entry from the Message Server.
The call is guaranteed not to fail. If the entry cannot be deleted immediately, it will be deleted later. This call should only be used in preference to the normal deleting mechanism when no error reporting is required, typically in a destructor.
|
void CleanupEntryPushL(TMsvId aId);
Pushes the specified entry ID to the entry cleanup stack.
|
|
void CleanupEntryPop(TInt aCount=1);
Pops one or more entries from the entry cleanup stack.
|
TBool ServiceActive(TMsvId aServiceId);
Tests whether a Server-side MTM for a particular service is loaded by the Message Server.
The Server-side MTM does not have to be executing a command — it may be waiting for another command.
|
|
TInt ServiceProgress(TMsvId aServiceId, TDes8& aProgress);
Gets the current progress information from the Server-side MTM for the specified service.
It is typically used by User Interface MTMs. The format of the progress information returned in the aProgress
buffer is MTM-specific.
Calling this function results in the Message Server calling CBaseServerMtm::
Progress()
on the relevant Server-side MTM.
Note that the progress information is independent of which message client application started the current operation.
|
|
TInt StopService(TMsvId aServiceId);
Stops any operations that a Server-side MTM for the specified service is running, and then unloads the Server-side MTM.
The current operation and any queued operations are cancelled.
|
|
void TransferCommandL(const CMsvEntrySelection& aSelection, TInt aCommandId, const TDesC8& aParameter, TDes8& aProgress);
Supported from 5.1
Passes MTM-specific operations synchronously to the associated Server-side MTM by means of the Message Server.
It is typically used in the implementation of CBaseMtm::InvokeSyncFunctionL()
and CBaseMtmUi::InvokeSyncFunctionL()
. It is not used by message client applications. How the passed aSelection
and aParameter
parameters are used is specific to the operation.
Calling this function results in the Message Server calling CBaseServerMtm::StartCommandL()
on the relevant Server-side MTM. If the Server-side MTM is not already loaded, then the Message Server loads it.
|
|
CMsvOperation* TransferCommandL(const CMsvEntrySelection& aSelection, TInt aCommandId, const TDesC8& aParameter, TRequestStatus& aStatus);
Passes MTM-specific operations asynchronously to the associated Server-side MTM by means of the Message Server.
It is typically used in the implementation of CBaseMtm::InvokeSyncFunctionL()/InvokeAsyncFunctionL()
and CBaseMtmUi::InvokeSyncFunctionL()/InvokeAsyncFunctionL()
. It is not used by message client applications. How the passed aSelection
and aParameter
parameters are used is specific to the operation.
Calling this function results in the Message Server calling CBaseServerMtm::StartCommandL()
on the relevant Server-side MTM. If the Server-side MTM is not already loaded, then the Message Server loads it.
The returned CMsvOperation
object completes when the operation is complete.
|
|
|
void CloseMessageServer();
Closes down the Message Server.
Normal clients should not use this function, as it will affect other message clients.
The function results in the session sending a shutdown session notification (TMsvSessionEvent::EMsvCloseSession
) to all current sessions. The Message Server closes when all sessions have been closed.
TInt InstallMtmGroup(const TDesC& aFullName);
Installs a new group of MTMs.
It is used by specialised MTM-installation programs.
|
|
TInt DeInstallMtmGroup(const TDesC& aFullName);
Removes an installed MTM.
It is used by specialised MTM-deinstallation programs.
|
|
CMsvOperation* ChangeDriveL(TInt aDrive, TRequestStatus& aStatus);
Supported from 6.0
Moves the Message Server index to the specified drive.
Progress information is provided by a TMsvIndexLoadProgress
object.
If an error occurs, the index is unchanged.
|
|
|
void DecPcSyncCountL(const CMsvEntrySelection& aSelection);
Supported from 5.1
Decreases the PC synchronisation index field for a selection of entries.
If an entry has its Deleted flag set, and this call causes its PC synchronisation field to become zero, then the entry is permanently deleted.
|
RFs& FileSession();
Supported from 5.1
Allows a Server-side MTM to access the file session handle created by the Message Server.
This is preferable, as more efficient, to creating another handle.
|
void IncPcSyncCountL(const CMsvEntrySelection& aSelection);
Supported from 5.1
Increases the PC synchronisation index field for a selection of entries.
|
TInt OutstandingOperationsL();
Supported from 6.0
Gets the number of outstanding operations.
|