phonebookengines/contactsmodel/cntsrv/inc/CCntMsgHandler.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 09:26:27 +0300
branchRCL_3
changeset 39 a6539d1e8e43
parent 0 e686773b3f54
child 24 0ba2181d7c28
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/**
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/



/**
 @file
 @internalComponent
*/

#ifndef CNTMSGHANDLER_H
#define CNTMSGHANDLER_H

#include <e32base.h>
#include "CCntDbManager.h" // For TCntFileMode
#include "CCntMsgHandlerFptr.h"

class CCntSession;
class CCntServer;
class CCntDbManager;
class CCntPackager;
class CContactViewDef;
class CEventQueue;

/**
The base class for message handler classes. CCntSession class creates
and owns message handler instances.

@internalComponent
*/
class CCntMsgHandler : public CBase
	{
public:
	virtual ~CCntMsgHandler();
	
	/** 
	Overriden by all derived classes. Delegates the incoming op code
	to a message handling method. 
	*/
	virtual TInt HandleMessageL(const RMessage2& aMessage) = 0;	
	
protected:
	CCntMsgHandler(CCntSession& aSession);
	
	// Helper methods.
	void CheckForManagerL();
	CCntServer& Server();
	void ReadL(const RMessage2& aMessage, TInt aParam, TDes& aDes);
	void WriteL(const RMessage2& aMessage, TInt aParam, const TDesC& aDes, TInt aOffset = 0);
	void UnRegisterDatabaseEventObserver();
	MsgHandlerFptr LookupHandlerMethodL(TInt aOpCode, const TInt* aOpCodes, const TInt aOpCodesLength);
	
protected:
	CCntDbManager*&	 iManager;
	CCntPackager& 	 iPackager;
	CContactViewDef*& iView;
	TInt& 			 iTimeOut;
	TUint&	     iSessionId;
	CCntSession& iSession;	
	};
	

#endif