class MMdESessionObserver |
Observer interface for a metadata engine session.
Examples of MdE session usage:
The class that needs a MdE session needs to implement MMdESessionObserver interface to get a notification of completed session opening or an error that has occurred.
class CMdESessionExample : public MMdESessionObserver { void HandleSessionOpened(CMdESession& aSession, TInt aError) ; void HandleSessionError(CMdESession& aSession, TInt aError) ; ...
CMdESession* iMdeSession; };
The session is opened simply by creating an instance of CMdESession.
void CMdESessionExample::OpenSession() { iMdeSession = CMdESession::NewL( *this ); }
void CMdESessionExample::HandleSessionOpened(CMdESession& aSession, TInt aError) { if ( KErrNone != aError ) { // Error occurred when opening session. iMdeSession must be deleted and new // session opened if we wish to use MdE.
delete iMdeSession; iMdeSession = NULL; return; }
// The session was opened successfully. ... }
void CMdESessionError::HandleSessionError(CMdESession& aSession, TInt aError) { // This function is called when an error has occurred in the session by some // external source (e.g. other clients). It s important to notice, that // this method is called when the session has already been opened, not when // error happens during opening. Session can't be used anymore and it must be deleted.
delete iMdeSession; iMdeSession = NULL; }
Public Member Functions | |
---|---|
void | HandleSessionError (CMdESession &, TInt ) |
void | HandleSessionOpened (CMdESession &, TInt ) |
void | HandleSessionError | ( | CMdESession & | aSession, |
TInt | aError | |||
) | [pure virtual] |
Called to notify the observer about errors, which are not a direct consequence of the operations initiated by the client but caused by some external source (e.g., other clients). The error cannot be recovered and all on-going operations initiated by the client have been aborted. Any attempts to continue using the session will cause a panic. The client should close the session immediately and try to open a new session, if it needs to continue using the metadata engine.
CMdESession & aSession | session |
TInt aError | one of the system-wide error codes |
void | HandleSessionOpened | ( | CMdESession & | aSession, |
TInt | aError | |||
) | [pure virtual] |
Called to notify the observer that opening the session has been completed and, if the opening succeeded, the session is ready for use.
CMdESession & aSession | session |
TInt aError | KErrNone, if opening the session succeeded; or one of the system-wide error codes, if opening the session failed |
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.