diff -r 000000000000 -r ccd0fd43f247 harvesterplugins/media/mediautils/inc/mdeobjectqueuemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/mediautils/inc/mdeobjectqueuemanager.h Mon Apr 19 14:40:05 2010 +0300 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2010 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: MDE object queuemanager for indexing scheduling + * +*/ + + +#ifndef MDEOBJECTQUEUEMANAGER_H_ +#define MDEOBJECTQUEUEMANAGER_H_ +#include +#include +#include "mediaobjecthandler.h" + +class CMdeObjectQueueManager : public CActive + { +public: + /* + * Construction + * @param MMediaObjectHandler* callback to media object handler dont own + * @return instance of object queue manager + */ + static CMdeObjectQueueManager* NewL(MMediaObjectHandler* ); //For callback + /* + * Construction + * @param MMediaObjectHandler* callback to media object handler dont own + * @return instance of object queue manager + */ + static CMdeObjectQueueManager* NewLC(MMediaObjectHandler* ); + /* + * Destructor + */ + virtual ~CMdeObjectQueueManager(); +public: + /* + * AddMedItemtoQueueL + * @param TItemId aObjId item id to be added to queue + * @param TCPixActionType aActionType CPIX action on item + */ + void AddMdeItemToQueueL( TItemId aObjId, TCPixActionType aActionType); + //From CActive + void RunL(); + void DoCancel(); + TInt RunError(); +private: + /* + * OverWriteOrAddToQueueL add or update item to queue + * @param TItemId aObjId itemd id + * @param TCPixActionType aActionType action cpix + */ + void OverWriteOrAddToQueueL( TItemId aObjId, TCPixActionType aActionType); + /* + * First phase Constructor + * @parm MMediaObjectHandler* media object handler callback + */ + CMdeObjectQueueManager(MMediaObjectHandler* ); + /* + * Second phase constructor + */ + void ConstructL(); +private: + enum TState + { + EStateNone = 0, + EStateWaiting + }; + struct TMdeActionRecord + { + TItemId iObjectId; + TCPixActionType iAction; + TInt iRetryCount; + TMdeActionRecord() + { + iRetryCount = 0; + } + }; +private: + // Queue of documents to be indexed + RArray iJobQueue; + // State machine's state + TState iState; + // Timer which is used to delay indexing messages + RTimer iTimer; //Timer for self activation of AO + MMediaObjectHandler* iMdeObjectHandler; //media object handler + }; + +#endif /* MDEOBJECTQUEUEMANAGER_H_ */