williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2: // All rights reserved.
williamr@2: // This component and the accompanying materials are made available
williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2: // which accompanies this distribution, and is available
williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2: //
williamr@2: // Initial Contributors:
williamr@2: // Nokia Corporation - initial contribution.
williamr@2: //
williamr@2: // Contributors:
williamr@2: //
williamr@2: // Description:
williamr@2: //
williamr@2: 
williamr@2: 
williamr@2: 
williamr@2: /**
williamr@2:  @file
williamr@2:  @publishedPartner
williamr@2:  @released
williamr@2: */
williamr@2: 
williamr@2: #ifndef __CPUSHHANDLERBASE_H__
williamr@2: #define __CPUSHHANDLERBASE_H__
williamr@2: 
williamr@2: // System includes
williamr@2: #include <e32base.h>
williamr@2: 
williamr@2: // Forward class declarations
williamr@2: class CPushMessage;
williamr@2: class CPluginKiller;
williamr@2: class MWapPushLog;
williamr@2: class MConnManObserver;
williamr@2: 
williamr@2: /** ECom interface UID for WAP Push Application plug-ins. */
williamr@2: const TUid KUidPushHandlerBase = { 0x101F3E5A };
williamr@2: 
williamr@2: /** 
williamr@2: Abstract base class for WAP Push Application plugins.
williamr@2: 
williamr@2: A WAP Push Application plugin is implemented as an ECom plug-in object that 
williamr@2: derives from this interface. Each plugin specifies in its ECom IMPLEMENTATION_INFO 
williamr@2: default_data field the Push Application IDs that it should handle. When the 
williamr@2: WAP Push Framework receives a push message, it examines the message's Application 
williamr@2: ID, and loads the appropriate plug-in to handle the message with HandleMessageL().
williamr@2: 
williamr@2: A plug-in can handle multiple Application IDs. Application IDs can be specified 
williamr@2: as URNs or WINA (http://www.wapforum.org/wina/push-app-id.htm) values. For 
williamr@2: example, a plug-in to handle MMS would set its default_data to "x-wap-application:mms.ua||0x00000004".
williamr@2: 
williamr@2: A plug-in must destroy itself when it is has finished handling the message. 
williamr@2: The framework supplies a CPluginKiller object that the plug-in calls to do 
williamr@2: this. 
williamr@2: 
williamr@2: @publishedPartner
williamr@2: @released
williamr@2: */
williamr@2: class CPushHandlerBase : public CActive
williamr@2: 	{
williamr@2: public:	// Methods
williamr@2: 
williamr@2: 	inline static CPushHandlerBase* NewL(const TDesC& aMatchData);
williamr@2: 
williamr@2: 	inline static CPushHandlerBase* NewL(const TDesC& aMatchData, const TUid& aInterfaceUid);
williamr@2: 
williamr@2: 	inline virtual ~CPushHandlerBase();
williamr@2: 
williamr@2: 	//Async. Functions
williamr@2: 	/** 
williamr@2: 	Handles a push message asynchronously.
williamr@2: 	
williamr@2: 	Implementations should store the passed aStatus using SetConfirmationStatus(), 
williamr@2: 	and when handling is complete, complete it with SignalConfirmationStatus().
williamr@2: 	
williamr@2: 	@param aPushMsg 
williamr@2: 	Push message. Ownership of the message is passed to the object.
williamr@2: 	
williamr@2: 	@param aStatus 
williamr@2: 	Asynchronous status word 
williamr@2: 	*/
williamr@2: 	virtual void HandleMessageL(CPushMessage* aPushMsg,TRequestStatus& aStatus) =0;
williamr@2: 
williamr@2: 	/** 
williamr@2: 	Cancels an outstanding HandleMessageL() call. 
williamr@2: 	*/
williamr@2: 	virtual void CancelHandleMessage() =0;
williamr@2: 
williamr@2: 	//Sync. Functions
williamr@2: 	/** 
williamr@2: 	Handles a push message synchronously.
williamr@2: 	
williamr@2: 	@param aPushMsg 
williamr@2: 	Push message. Ownership of the message is passed to the object. 
williamr@2: 	*/
williamr@2: 	virtual void HandleMessageL(CPushMessage* aPushMsg) =0;
williamr@2: 
williamr@2: 	inline void SetLogger(MWapPushLog& aLog);
williamr@2: 
williamr@2: 	inline void SetKiller(CPluginKiller& aPluginKiller);
williamr@2: 
williamr@2: 	inline void SetManager(MConnManObserver& aManager);
williamr@2: 
williamr@2: protected:	// Methods
williamr@2: 
williamr@2: 	CPushHandlerBase();
williamr@2: 
williamr@2: 	void SetConfirmationStatus(TRequestStatus& aStatus);
williamr@2: 
williamr@2: 	void SignalConfirmationStatus(TInt aErr);
williamr@2: 
williamr@2: protected:	// Attributes
williamr@2: 
williamr@2: 	/** Plugin killer utility object. */
williamr@2: 	CPluginKiller*		iPluginKiller;
williamr@2: 
williamr@2: 	/** Log interface. */
williamr@2: 	MWapPushLog*		iLog;
williamr@2: 
williamr@2:     /** connection manager */
williamr@2: 	MConnManObserver*	iManager;
williamr@2: 
williamr@2: 	/** HandleMessageL() asynchronous status word. */
williamr@2: 	TRequestStatus*		iConfirmStatus;
williamr@2: 
williamr@2: private:	// Attributes
williamr@2: 
williamr@2: 	/** A unique UID used in interface destruction */
williamr@2: 	TUid	iDtor_ID_Key;
williamr@2: 
williamr@2: private:	// BC-proofing
williamr@2: 
williamr@2: 	/** Reserved for future expansion */
williamr@2: 	virtual void CPushHandlerBase_Reserved1() =0;		
williamr@2: 
williamr@2: 	/** Reserved for future expansion */
williamr@2: 	virtual void CPushHandlerBase_Reserved2() =0;		
williamr@2: 
williamr@2: 	/** Reserved for future expansion */
williamr@2: 	TAny*		iCPushHandlerBase_Reserved;
williamr@2: 
williamr@2: 	};
williamr@2: 
williamr@2: #include <push/cpushhandlerbase.inl>
williamr@2: 
williamr@2: #endif    // __PUSHBASEHAND_H__