sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #ifndef __LOGVIEWWINDOWFETCHER_H__
sl@0: #define __LOGVIEWWINDOWFETCHER_H__
sl@0: 
sl@0: // System includes
sl@0: #include <e32base.h>
sl@0: 
sl@0: // User includes
sl@0: #include <logwrap.h>
sl@0: #include "LogCliServShared.h"
sl@0: #include <logviewchangeobserver.h>
sl@0: 
sl@0: // Classes referenced
sl@0: class RLogSession;
sl@0: 
sl@0: 
sl@0: /////////////////////////////////////////////////////////////////////////////////////////
sl@0: // -----> MLogViewWindowFetcherObserver (header)
sl@0: /////////////////////////////////////////////////////////////////////////////////////////
sl@0: class MLogViewWindowFetcherObserver
sl@0: /**
sl@0: @internalComponent
sl@0: */
sl@0: 	{
sl@0: public:
sl@0: 	virtual void HandleFetchedWindowItemL(TInt aItemIndex, CLogEvent* aEvent) = 0;
sl@0: 	};
sl@0: 
sl@0: 
sl@0: /////////////////////////////////////////////////////////////////////////////////////////
sl@0: // -----> CLogViewWindowFetcher (header)
sl@0: /////////////////////////////////////////////////////////////////////////////////////////
sl@0: NONSHARABLE_CLASS(CLogViewWindowFetcher) : public CActive
sl@0: /**
sl@0: @internalComponent
sl@0: */
sl@0: 	{
sl@0: public:
sl@0: 	CLogViewWindowFetcher(RLogSession& aSession, TLogViewId aViewId, MLogViewWindowFetcherObserver& aObserver, TInt aPriority);
sl@0: 	~CLogViewWindowFetcher();
sl@0: 	void ConstructL();
sl@0: 
sl@0: public:
sl@0: 
sl@0: 	/**
sl@0: 	 * Fetch the specified window.
sl@0: 	 */
sl@0: 	void PrepareToFetchWindowL(const TLogWindowAndCursor& aRequestedWindow);
sl@0: 
sl@0: 	/**
sl@0: 	 * Start the asynchronous fetch
sl@0: 	 */
sl@0: 	void Start(TRequestStatus& aObserver);
sl@0: 
sl@0: 	/**
sl@0: 	 * Cancel any fetch operation but without notifying the observer
sl@0: 	 */
sl@0: 	void SilentCancel();
sl@0: 
sl@0: 	/**
sl@0: 	 * Access the window & cursor for the requested window
sl@0: 	 */
sl@0: 	inline const TLogWindowAndCursor& RequestedWindow() const;
sl@0: 
sl@0: private:
sl@0: 	void Fetch(const TLogWindow& aWindow);
sl@0: 	void CompleteObserver(TInt aError);
sl@0: 
sl@0: private: // FROM CActive
sl@0: 	void RunL();
sl@0: 	void DoCancel();
sl@0: 	TInt RunError(TInt aError);
sl@0: 
sl@0: private:
sl@0: 	RLogSession& iSession;
sl@0: 	const TLogViewId iViewId;
sl@0: 	MLogViewWindowFetcherObserver& iObserver;
sl@0: 
sl@0: private:
sl@0: 	TLogWindowAndCursor iRequestedWindow;
sl@0: 	//
sl@0: 	TRequestStatus* iObserverRequestStatus;
sl@0: 	CBufBase* iBuffer;
sl@0: 	TPtr8 iBufferPointer;
sl@0: 	TPckgBuf<TLogTransferWindow> iFetchWindowData;
sl@0: 	TPckgBuf<TLogClientServerData> iData;
sl@0: 	TLogWindowAndCursor iWindowReq;
sl@0: 	};
sl@0: 
sl@0: 
sl@0: /////////////////////////////////////////////////////////////////////////////////////////
sl@0: // -----> CLogViewWindowFetcher (inline)
sl@0: /////////////////////////////////////////////////////////////////////////////////////////
sl@0: inline const TLogWindowAndCursor& CLogViewWindowFetcher::RequestedWindow() const
sl@0: 	{
sl@0: 	return iRequestedWindow;
sl@0: 	}
sl@0: 
sl@0: #endif