Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: msvapi.h
Link against: msgs.lib

Class CMsvOperation

CMsvOperation

Support

Supported from 5.0

Description

Defines an interface for use by objects which control asynchronous commands in the messaging system.

Such objects are returned by CMsvEntry and User Interface MTM functions that complete asynchronously. The interface allows clients to:

The client only needs to understand the CMsvOperation interface, not the concrete implementation used.

In pre-Unicode versions this class had the import library mcld.lib.

Writing derived classes:

As the base class interface for User Interface MTMs, CBaseUiMtm, defines functions that return CMsvOperation objects for control of asynchronous operations, implementers of these MTM components are required to provide suitable derived classes. For example, if CBaseUiMtm::EditL() is implemented to provide message editing, a CMsvOperation -derived class would be provided that completes when the editing operation is complete.

Concrete derived classes must provide implementations of the pure virtual DoCancel() and RunL() functions defined by CActive. DoCancel() should be provided in the normal way to cancel the operation. RunL() should, in addition to any other required functionality, always end by signalling the client that the operation is complete with a suitable completion code.

In pre-Unicode versions this class had the import library mcld.lib.

Derivation

CActiveThe core class of the active object abstraction
CBaseBase class for all classes to be instantiated on the heap
CMsvOperationDefines an interface for use by objects which control asynchronous commands in the messaging system

Defined in CMsvOperation:
CMsvOperation(), FinalProgress(), Id(), Mtm(), ProgressL(), Service(), iMsvSession, iMtm, iObserverRequestStatus, iService, ~CMsvOperation()

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()


Constructor & destructor


CMsvOperation()

CMsvOperation(CMsvSession& aSession, TInt aPriority, TRequestStatus& aObserverRequestStatus);

Description

Called by MTM implementers from the derived class constructor. CMsvOperation-derived objects are not created by message client applications.

The constructor uses the CMsvSession object to obtain a ID for the operation. This ID can be accessed by clients through Id().

aPriority is the priority used by the active object. Typically, this is EPriorityStandard.

aObserverRequestStatus is the asynchronous status object of an active object provided by the caller. The derived class is required to signal the caller through this when the operation completes. It is stored by the constructor in the iObserverRequestStatus member.

Parameters

CMsvSession& aSession

Session object

TInt aPriority

Active object priority

TRequestStatus& aObserverRequestStatus

Request status of operation observer


~CMsvOperation()

~CMsvOperation();

Description

Destructor.

This base class function takes no action. Derived classes should implement a destructor to do the clean up tasks that they require. Minimally, they should call Cancel() to cancel any outstanding request.

[Top]


Progress reporting


ProgressL()

virtual const TDesC8& ProgressL()=0;

Description

Gets information on the progress of the operation.

All operations on local entries share the same progress information format, which defined by TMsvLocalOperationProgress.

For MTM-specific operations, progress information can be extracted by calling CBaseUiMtm::GetProgress() or displayed by CBaseUiMtm::DisplayProgressSummary() on the appropriate User Interface MTM.

Requirements:

Derived classes should implement this function so that the client can check on the progress of the operation. The function should share an understanding of the format of the buffer with the implementations of CBaseUiMtm::GetProgress() and CBaseUiMtm::DisplayProgressSummary() in the User Interface MTM. The arguments of CBaseUiMtm::GetProgress() show some information that should be included where appropriate.

Return value

const TDesC8&

Descriptor holding progress information. The maximum buffer size should be KMsvProgressBufferLength (defined in msvipc.h).

Leave codes

KErrNotReady

The operation has not yet been started: it has been queued for execution in the Message Server


FinalProgress()

virtual const TDesC8& FinalProgress();

Support

Supported from 5.1

Description

Gets information about a completed operation.

Unlike ProgressL(), this is guaranteed to provide status information reflecting the outcome of a completed operation.

Requirements:

The default implementation of this function returns the result from ProgressL(). If the operation is active or ProgressL() leaves, a panic occurs.

A derived class should implement the function to meet the requirement to provide appropriate final status information. Typically, on active object completion, it will store progress information in a private member, and return that stored information from this function.

Return value

TDesC8&

Descriptor holding progress information

[Top]


Accessors


Id()

TMsvOp Id() const;

Description

Gets the operation ID.

This ID is unique within a Message Server session. The ID allows the client to keep track of different operations.

Return value

TMsvOp

The ID of the operation


Mtm()

TUid Mtm() const;

Support

Withdrawn in 6.0

Description

Gets the UID of the MTM associated with the operation.

This UID can be used to determine the appropriate method of getting information from a progress descriptor.

If the operation is not associated with a service, it returns KUidMsvLocalServiceMtm.

Return value

TUid

The UID of the MTM associated with the operation

See also:


Mtm()

virtual TUid Mtm() const;

Support

Supported from 6.0

Description

Gets the UID of the MTM associated with the operation.

This UID can be used to determine the appropriate method of getting information from a progress descriptor.

The default implementation returns iMtm.

Return value

TUid

The UID of the MTM associated with the operation

See also:


Service()

TMsvId Service() const;

Description

Gets the ID of the service that is associated with this operation.

If the operation is not associated with a service, the function returns KMsvLocalServiceIndexEntryId.

Return value

TMsvId

ID of the service associated with the operation

[Top]


Protected member data


iService

protected: TMsvId iService

Description

The ID of the service that is associated with this operation.

Usually, the derived class constructor will contain a suitable argument to allow the caller to set this.

See also:


iMtm

protected: TUid iMtm

Description

The UID of the MTM associated with the operation.

The appropriate value should be set by the derived class constructor.

See also:


iObserverRequestStatus

protected: TRequestStatus& iObserverRequestStatus

Description

Request status of the operation observer.

This is the aObserverRequestStatus passed in the constructor.


iMsvSession

protected: CMsvSession& iMsvSession

Description

Message Server session used by object. This is set by the constructor.