class CMsvSession : public CActive |
Represents a channel of communication between a client thread (Client-side MTM, User Interface MTM, or message client application) and the Message Server thread.
The class provides the means by which clients are notified when important Message Server events occur.
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 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.
Protected Member Functions | |
---|---|
CMsvSession ( MMsvSessionObserver &) | |
CMsvSession ( MMsvSessionObserver &, RFs &) | |
CMsvSession ( MMsvSessionObserver &, TInt ) | |
CMsvSession ( MMsvSessionObserver &, RFs &, TInt ) | |
void | CheckDrive () |
void | ConstructAsObserverL () |
void | ConstructL ( TBool ) |
void | DoCancel () |
IMPORT_C TInt | OperationId () |
TInt | RunError ( TInt ) |
void | RunL () |
IMPORT_C RMsvServerSession & | Session () |
Private Member Functions | |
---|---|
void | CleanupEntryDelete () |
void | CreateSessionLogL () |
void | DoHandleNotifyL ( TMsvNotifBuffer &) |
void | DoRunL ( TMsvNotifBuffer &) |
void | GetMessageFolderL () |
void | HandleNotifyL () |
void | Log ( TRefByValue < const TDesC >, ...) |
void | NotifyAllObserversL ( MMsvSessionObserver::TMsvSessionEvent , TAny *, TAny *, TAny *) |
Inherited Enumerations | |
---|---|
CActive:TPriority |
Inherited Attributes | |
---|---|
CActive::iStatus |
CMsvSession | ( | MMsvSessionObserver & | aObserver | ) | [protected] |
MMsvSessionObserver & aObserver |
CMsvSession | ( | MMsvSessionObserver & | aObserver, |
RFs & | aFs | ||
) | [protected] |
MMsvSessionObserver & aObserver | |
RFs & aFs |
CMsvSession | ( | MMsvSessionObserver & | aObserver, |
TInt | aPriority | ||
) | [protected] |
MMsvSessionObserver & aObserver | |
TInt aPriority |
CMsvSession | ( | MMsvSessionObserver & | aObserver, |
RFs & | aFs, | ||
TInt | aPriority | ||
) | [protected] |
MMsvSessionObserver & aObserver | |
RFs & aFs | |
TInt aPriority |
IMPORT_C 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.
MMsvSessionObserver & aObserver | A reference to an observer to be registered for events |
IMPORT_C void | ChangeAttributesL | ( | const CMsvEntrySelection & | aSelection, |
TUint | aSetAttributes, | |||
TUint | aClearAttributes | |||
) |
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:
1. PC synchronisation
2. Visibility flag
3. Read flag
4. In-preparation flag
5. Connected flag
6. New flag
const CMsvEntrySelection & aSelection | The entries to change |
TUint aSetAttributes | A bitmask of the fields to set |
TUint aClearAttributes | A bitmask of the fields to clear |
IMPORT_C CMsvOperation * | ChangeDriveL | ( | TInt | aDrive, |
TRequestStatus & | aStatus | |||
) |
Changes the Message Server current drive to the specified drive.
Progress information is provided by a TMsvIndexLoadProgress object.
If an error occurs, the index is unchanged.
TInt aDrive | The drive to which to move the Message Server index, specified by a TDriveNumber value |
TRequestStatus & aStatus | Asynchronous completion status |
void | CheckDrive | ( | ) | [protected] |
Checks that the current drive matches the one on the server updates it if it doesn't used because sync create might cause the drive to change, which we will be notified about, but the client might try and do something before that notification comes in.
IMPORT_C void | CleanupEntry | ( | TAny * | aPtr | ) | [static] |
Cleans up an entry that has been added to the cleanup stack using CleanupEntryPushL() .
This function defines the clean up function that is called when an entry on the stack needs cleaning up.
TAny * aPtr | Pointer to the current message server session |
IMPORT_C void | CleanupEntryPop | ( | TInt | aCount = 1 | ) |
Pops one or more entries from the entry cleanup stack.
TInt aCount = 1 | The number of entries to pop off the entry cleanup stack |
IMPORT_C void | CleanupEntryPushL | ( | TMsvId | aId | ) |
Pushes the specified entry ID to the entry cleanup stack.
TMsvId aId | The ID of the entry to push onto the entry cleanup stack |
IMPORT_C 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.
IMPORT_C CMsvOperation * | CopyStoreL | ( | const TDriveUnit & | aDrive, |
TRequestStatus & | aStatus | |||
) |
Copies the Message Store to the specified drive.
Progress information is provided by a TMsvCopyProgress object.
If an error occurs, the Message Store is unchanged.
const TDriveUnit & aDrive | The drive to which to copy the Message Store, specified by a TDriveUnit value |
TRequestStatus & aStatus | Asynchronous completion status |
IMPORT_C TInt | DeInstallMtmGroup | ( | const TDesC & | aFullName | ) |
Removes an installed MTM.
It is used by specialised MTM-deinstallation programs.
const TDesC & aFullName | The full path name of the MTM group file |
IMPORT_C void | DecPcSyncCountL | ( | const CMsvEntrySelection & | aSelection | ) |
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.
const CMsvEntrySelection & aSelection | Entries for which to decrease the PC synchronisation index field |
IMPORT_C CMsvOperation * | DeleteStoreL | ( | const TDriveUnit & | aDrive, |
TRequestStatus & | aStatus | |||
) |
Deletes the Message Store to the specified drive.
Progress information is provided by a TMsvDeleteProgress object.
If an error occurs, the Message Store is unchanged.
const TDriveUnit & aDrive | The drive to which to copy the Message Store, specified by a TDriveUnit value |
TRequestStatus & aStatus | Asynchronous completion status |
void | DoCancel | ( | ) | [protected, virtual] |
Implements cancellation of an outstanding request.
This function is called as part of the active object's Cancel() .
It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.
DoCancel() must not wait for event completion; this is handled by Cancel() .
void | DoHandleNotifyL | ( | TMsvNotifBuffer & | aBuffer | ) | [private] |
TMsvNotifBuffer & aBuffer |
void | DoRunL | ( | TMsvNotifBuffer & | aBuffer | ) | [private] |
TMsvNotifBuffer & aBuffer |
IMPORT_C TBool | DriveContainsStoreL | ( | TDriveUnit | aDrive | ) |
TDriveUnit aDrive |
IMPORT_C RFs & | FileSession | ( | ) |
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.
IMPORT_C TBool | GetAndClearIndexCorruptFlagL | ( | ) |
Checks a flag in the message server that is set when the server deletes a corrupt index file. Then clears the flag.
It is intended to allow the message centre UI to check whether a corrupt index has been deleted on startup. If it has the UI may inform the user about the loss of their messages.
IMPORT_C void | GetChildIdsL | ( | TMsvId | aId, |
const CMsvEntryFilter & | aFilter, | |||
CMsvEntrySelection & | aSelection | |||
) |
Gets filtered list of children of a specified message entry.
TMsvId aId | Message entry of which to get children |
const CMsvEntryFilter & aFilter | Filter by which various message entries can be excluded |
CMsvEntrySelection & aSelection | On return, a list of message entry IDs |
IMPORT_C TInt | GetEntry | ( | TMsvId | aId, |
TMsvId & | aService, | |||
TMsvEntry & | aEntry | |||
) |
Gets the index entry for the specified entry ID.
IMPORT_C CMsvEntry * | GetEntryL | ( | TMsvId | aEntId | ) |
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.
TMsvId aEntId | The ID of the entry to access |
IMPORT_C void | GetMtmRequiredCapabilitiesL | ( | TUid | aMtmTypeUid, |
TCapabilitySet & | aCapSet | |||
) | const |
Gets the additional security capabilities required by a given MTM, over and above those required by the message server itself.
TUid aMtmTypeUid | The type UID of the MTM being queried |
TCapabilitySet & aCapSet | A reference to a TCapabilitySet in which the security capabilities will be returned. Any existing capabilities will be removed. |
IMPORT_C void | IncPcSyncCountL | ( | const CMsvEntrySelection & | aSelection | ) |
Increases the PC synchronisation index field for a selection of entries.
const CMsvEntrySelection & aSelection | Entries for which to increase the PC synchronisation index field |
IMPORT_C TInt | InstallMtmGroup | ( | const TDesC & | aFullName | ) |
Installs a new group of MTMs.
It is used by specialised MTM-installation programs.
const TDesC & aFullName | The full path name of the MTM group file |
void | Log | ( | TRefByValue < const TDesC > | aFmt, |
... | ||||
) | [private] |
TRefByValue < const TDesC > aFmt | |
... |
IMPORT_C TBool | MessageStoreDrivePresentL | ( | ) |
Checks to see if the currently selected drive contains the correct mail store.
void | NotifyAllObserversL | ( | MMsvSessionObserver::TMsvSessionEvent | aEvent, |
TAny * | aArg1, | |||
TAny * | aArg2, | |||
TAny * | aArg3 | |||
) | [private] |
MMsvSessionObserver::TMsvSessionEvent aEvent | |
TAny * aArg1 | |
TAny * aArg2 | |
TAny * aArg3 |
IMPORT_C CMsvSession * | OpenAsObserverL | ( | MMsvSessionObserver & | aObserver | ) | [static] |
Creates a session that is used only as an observer.
The session created with this function should only be used to observe events, and not actively use the server. It used for applications such as system monitoring utilities.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
IMPORT_C CMsvSession * | OpenAsObserverL | ( | MMsvSessionObserver & | aObserver, |
RFs & | aFs | |||
) | [static] |
Creates a session that is used only as an observer.
The session created with this function should only be used to observe events, and not actively use the server. It used for applications such as system monitoring utilities.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
RFs & aFs | A connected file server session |
IMPORT_C CMsvSession * | OpenAsObserverL | ( | MMsvSessionObserver & | aObserver, |
TInt | aPriority | |||
) | [static] |
Creates a session that is used only as an observer.
The session created with this function should only be used to observe events, and not actively use the server. It used for applications such as system monitoring utilities. Clients to specify a priority that is tuned to their scheduler.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
TInt aPriority | Active object priority |
IMPORT_C CMsvSession * | OpenAsObserverL | ( | MMsvSessionObserver & | aObserver, |
RFs & | aFs, | |||
TInt | aPriority | |||
) | [static] |
Creates a session that is used only as an observer.
The session created with this function should only be used to observe events, and not actively use the server. It used for applications such as system monitoring utilities. Clients to specify a priority that is tuned to their scheduler.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
RFs & aFs | A connected file server session |
TInt aPriority | Active object priority |
IMPORT_C CMsvSession * | OpenAsyncL | ( | MMsvSessionObserver & | aObserver | ) | [static] |
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.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
IMPORT_C CMsvSession * | OpenAsyncL | ( | MMsvSessionObserver & | aObserver, |
RFs & | aFs | |||
) | [static] |
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.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
RFs & aFs | A connected file server session |
IMPORT_C CMsvSession * | OpenAsyncL | ( | MMsvSessionObserver & | aObserver, |
TInt | aPriority | |||
) | [static] |
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. Clients to specify a priority that is tuned to their scheduler.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
TInt aPriority | Active object priority |
IMPORT_C CMsvSession * | OpenAsyncL | ( | MMsvSessionObserver & | aObserver, |
RFs & | aFs, | |||
TInt | aPriority | |||
) | [static] |
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. Clients to specify a priority that is tuned to their scheduler.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
RFs & aFs | A connected file server session |
TInt aPriority | Active object priority |
IMPORT_C CMsvSession * | OpenSyncL | ( | MMsvSessionObserver & | aObserver | ) | [static] |
Creates a session synchronously.
The session can be used once the function returns.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
IMPORT_C CMsvSession * | OpenSyncL | ( | MMsvSessionObserver & | aObserver, |
RFs & | aFs | |||
) | [static] |
Creates a session synchronously.
The session can be used once the function returns.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
RFs & aFs | A connected file server session |
IMPORT_C CMsvSession * | OpenSyncL | ( | MMsvSessionObserver & | aObserver, |
TInt | aPriority | |||
) | [static] |
Creates a session synchronously.
The session can be used once the function returns. Clients to specify a priority that is tuned to their scheduler.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
TInt aPriority | Active object priority |
IMPORT_C CMsvSession * | OpenSyncL | ( | MMsvSessionObserver & | aObserver, |
RFs & | aFs, | |||
TInt | aPriority | |||
) | [static] |
Creates a session synchronously.
The session can be used once the function returns. Clients to specify a priority that is tuned to their scheduler.
MMsvSessionObserver & aObserver | A reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server. |
RFs & aFs | A connected file server session |
TInt aPriority | Active object priority |
IMPORT_C TInt | OutstandingOperationsL | ( | ) |
Gets the number of outstanding operations.
IMPORT_C 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.
TMsvId aId | The ID of the entry to remove |
IMPORT_C void | RemoveObserver | ( | MMsvSessionObserver & | aObserver | ) |
Deregisters a previously registered observer.
MMsvSessionObserver & aObserver | A reference to an observer to be unregistered for events |
void | RunL | ( | ) | [protected, virtual] |
Handles an active object's request completion event.
A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.
The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.
Before calling this active object's RunL() function, the active scheduler has:
1. decided that this is the highest priority active object with a completed request
2. marked this active object's request as complete (i.e. the request is no longer outstanding)
RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.
Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.
CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD
IMPORT_C TInt | ServiceAccessPointId | ( | TMsvId | aServiceId, |
TUint32 & | aAccessPointId | |||
) |
Get the ID of the access point currently in use by the server side MTM for the given service ID
IMPORT_C 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.
TMsvId aServiceId | The ID of the relevant service |
IMPORT_C 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.
IMPORT_C TInt | SetReceiveEntryEvents | ( | TBool | aReceive | ) |
Sets whether the session's observer should be notified of events related to changes in message server entries.
If the flag is set to true, the session observer will be notified of all events types. If it is set to false, the observer will not be notified of events of types EMsvEntriesCreated, EMsvEntriesChanged, EMsvEntriesDeleted, or EMsvEntriesMoved. (Event types are enumerated in MMsvSessionObserver::TMsvSessionEvent .)
If a session has additional observers, as set through AddObserver(), then the value of this flag is ignored, and the observers receive notification of all events. MMsvSessionObserver::TMsvSessionEvent
TBool aReceive |
IMPORT_C 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.
TMsvId aServiceId | The ID of the service to stop |
IMPORT_C 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.
const CMsvEntrySelection & aSelection | A selection of entries that may be relevant to the operation |
TInt aCommandId | The command ID. The interpretation of the command is MTM-specific. |
const TDesC8 & aParameter | A descriptor containing operation-specific parameters |
TRequestStatus & aStatus | The request status to be completed when the operation has finished |
IMPORT_C void | TransferCommandL | ( | const CMsvEntrySelection & | aSelection, |
TInt | aCommandId, | |||
const TDesC8 & | aParameter, | |||
TDes8 & | aProgress | |||
) |
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.
const CMsvEntrySelection & aSelection | A selection of entries that may be relevant to the operation |
TInt aCommandId | The command ID. The interpretation of the command is MTM-specific. |
const TDesC8 & aParameter | A descriptor containing operation-specific parameters |
TDes8 & aProgress | Progress information returned from the Message Server |
CArrayPtrFlat < MMsvSessionObserver > * | iObservers | [private] |
TBool | iUseSharedFs | [private] |
Specifies whether to use the shared file server session
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.