--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Thu Jul 15 18:59:26 2010 +0300
@@ -22,7 +22,7 @@
#include <e32base.h>
#include <gdi.h>
#include <etel3rdparty.h>
-
+#include <mdccommon.h>
#include <apmstd.h>
#include "thumbnailmanager.h" // TThumbnailFlags
@@ -53,10 +53,10 @@
//actual batch size will vary and will be between min...max batch size values below
//minimum batch size
-const TUint KMInBatchItems = 3;
+const TUint KMInBatchItems = 6;
//maximum batch size
const TUint KMaxBatchItems = 60;
-//Max allowed flush time
+//Max allowed flush time ms
const TUint KMaxFlushDelay = 3000; // 3 sec
//Max allowed flush time on MTP/music collection refresh
const TUint KMaxMTPFlushDelay = 15000; // 15 seconds
@@ -64,7 +64,7 @@
//how many items daemon will query at once from MDS
const TUint KMaxQueryItems = 100;
// max items for PH & AllItems query
-const TUint KMaxQueryItems2 = 100;
+const TUint KMaxQueryBatchSize = 100;
// maximum number of active client side queue requests
const TUint KMaxClientRequests = 2;
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v9.20.7_SA_S60.50_Euro1.sis has changed
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v9.20.8_SA_S60.50_Euro1.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Thu Jul 15 18:59:26 2010 +0300
@@ -17,7 +17,7 @@
&EN
; Header
-#{"Thumbnail Manager"},(0x102830AB), 9, 20, 7, TYPE=SA, RU
+#{"Thumbnail Manager"},(0x102830AB), 9, 20, 8, TYPE=SA, RU
; Localised Vendor name
%{"Nokia"}
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Thu Jul 15 18:59:26 2010 +0300
@@ -17,7 +17,7 @@
&EN
; Header
-#{"ThumbnailManager"},(0x102830AB), 9, 20, 7, TYPE=SA
+#{"ThumbnailManager"},(0x102830AB), 9, 20, 8, TYPE=SA
; Localised Vendor name
%{"Nokia"}
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Thu Jul 15 18:59:26 2010 +0300
@@ -17,7 +17,7 @@
&EN
; Header
-#{"Thumbnail Manager Cenrep"},(0x10202BE9), 9, 20, 7, TYPE=SP
+#{"Thumbnail Manager Cenrep"},(0x10202BE9), 9, 20, 8, TYPE=SP
; Localised Vendor name
%{"Symbian Software Ltd."}
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Thu Jul 15 18:59:26 2010 +0300
@@ -49,6 +49,12 @@
SOURCE tmformatobserver.cpp
SOURCE tmsrproptertyobserver.cpp
+SOURCEPATH ../src
+SOURCE thumbagimageobserver.cpp
+SOURCE thumbagcameraobserver.cpp
+SOURCE thumbagaudioobserver.cpp
+SOURCE thumbagvideoobserver.cpp
+
// Default system include paths for middleware layer modules.
MW_LAYER_SYSTEMINCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagaudioobserver.h Thu Jul 15 18:59:26 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2006-2007 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: Thumbnail Auto Generate Daemon
+ *
+*/
+
+
+#ifndef THUMBAGAUDIOOBSERVER_H
+#define THUMBAGAUDIOOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+#include <mdesession.h>
+
+#include "thumbagprocessor.h"
+#include "tmshutdownobserver.h"
+#include "thumbnaillog.h"
+
+
+/**
+ * ThumbAG daemon.
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CThumbAGAudioObserver ): public CBase,
+ public MMdESessionObserver,
+ public MMdEObjectObserver,
+ public MTMShutdownObserver
+ {
+public:
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGAudioObserver server.
+ */
+ static CThumbAGAudioObserver* NewLC(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGAudioObserver server.
+ */
+ static CThumbAGAudioObserver* NewL(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CThumbAGAudioObserver();
+
+
+public:
+
+ // from MMdESessionObserver
+ void HandleSessionOpened( CMdESession& aSession, TInt aError );
+ void HandleSessionError( CMdESession& aSession, TInt aError );
+
+ // from MMdEObjectObserver
+ void HandleObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray);
+
+ // from MTMShutdownObserver
+ void ShutdownNotification();
+
+protected:
+
+ /**
+ * AddObserversL
+ *
+ * @since S60 v5.0
+ */
+ void AddObserversL();
+
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGAudioObserver instance.
+ */
+ CThumbAGAudioObserver(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
+
+ /**
+ * Callback for reconnect timer
+ *
+ * @since S60 v5.0
+ */
+ static TInt ReconnectCallBack(TAny* aAny);
+
+ void Shutdown();
+
+private:
+
+ // own
+ CTMShutdownObserver* iShutdownObserver;
+ CTMShutdownObserver* iMDSShutdownObserver;
+ CMdESession* iMdESession;
+
+ //not owned
+ CThumbAGProcessor* iProcessor;
+
+ TBool iShutdown;
+
+ // reconnect timer
+ CPeriodic* iReconnect;
+
+ TBool iSessionError;
+
+#ifdef _DEBUG
+ TUint32 iAddCounter;
+ TUint32 iModCounter;
+#endif
+};
+
+#endif // THUMBAGDAEMON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagcameraobserver.h Thu Jul 15 18:59:26 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2006-2007 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: Thumbnail Auto Generate Daemon
+ *
+*/
+
+
+#ifndef THUMBAGCAMERAOBSERVER_H
+#define THUMBAGCAMERAOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+#include <mdesession.h>
+
+#include "thumbagprocessor.h"
+#include "tmshutdownobserver.h"
+#include "thumbnaillog.h"
+
+
+/**
+ * ThumbAG daemon.
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CThumbAGCameraObserver ): public CBase,
+ public MMdESessionObserver,
+ public MMdEObjectObserver,
+ public MTMShutdownObserver
+ {
+public:
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGCameraObserver server.
+ */
+ static CThumbAGCameraObserver* NewLC(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGCameraObserver server.
+ */
+ static CThumbAGCameraObserver* NewL(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CThumbAGCameraObserver();
+
+
+public:
+
+ // from MMdESessionObserver
+ void HandleSessionOpened( CMdESession& aSession, TInt aError );
+ void HandleSessionError( CMdESession& aSession, TInt aError );
+
+ // from MMdEObjectObserver
+ void HandleObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray);
+
+ // from MTMShutdownObserver
+ void ShutdownNotification();
+
+protected:
+
+ /**
+ * AddObserversL
+ *
+ * @since S60 v5.0
+ */
+ void AddObserversL();
+
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGCameraObserver instance.
+ */
+ CThumbAGCameraObserver(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
+
+ /**
+ * Callback for reconnect timer
+ *
+ * @since S60 v5.0
+ */
+ static TInt ReconnectCallBack(TAny* aAny);
+
+private:
+
+ // own
+ CTMShutdownObserver* iShutdownObserver;
+ CTMShutdownObserver* iMDSShutdownObserver;
+ CMdESession* iMdESession;
+ //not owned
+ CThumbAGProcessor* iProcessor;
+
+ TBool iShutdown;
+
+ // reconnect timer
+ CPeriodic* iReconnect;
+
+ TBool iSessionError;
+
+#ifdef _DEBUG
+ TUint32 iAddCounter;
+ TUint32 iModCounter;
+#endif
+};
+
+#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Thu Jul 15 18:59:26 2010 +0300
@@ -27,6 +27,10 @@
#include "thumbagprocessor.h"
#include "tmshutdownobserver.h"
#include "thumbnaillog.h"
+#include "thumbagimageobserver.h"
+#include "thumbagcameraobserver.h"
+#include "thumbagaudioobserver.h"
+#include "thumbagvideoobserver.h"
/**
@@ -177,9 +181,14 @@
#ifdef _DEBUG
TUint32 iAddCounter;
- TUint32 iModCounter;
TUint32 iDelCounter;
#endif
+
+ //observers
+ CThumbAGImageObserver* iImageObserver;
+ CThumbAGCameraObserver* iCameraObserver;
+ CThumbAGAudioObserver* iAudioObserver;
+ CThumbAGVideoObserver* iVideoObserver;
};
#endif // THUMBAGDAEMON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagimageobserver.h Thu Jul 15 18:59:26 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2006-2007 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: Thumbnail Auto Generate Daemon
+ *
+*/
+
+
+#ifndef THUMBAGIMAGEOBSERVER_H
+#define THUMBAGIMAGEOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+#include <mdesession.h>
+
+#include "thumbagprocessor.h"
+#include "thumbnaillog.h"
+#include "tmshutdownobserver.h"
+
+/**
+ * ThumbAG daemon.
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CThumbAGImageObserver ): public CBase,
+ public MMdESessionObserver,
+ public MMdEObjectObserver,
+ public MTMShutdownObserver
+ {
+public:
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGImageObserver server.
+ */
+ static CThumbAGImageObserver* NewLC(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGImageObserver server.
+ */
+ static CThumbAGImageObserver* NewL(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CThumbAGImageObserver();
+
+
+public:
+
+ // from MMdESessionObserver
+ void HandleSessionOpened( CMdESession& aSession, TInt aError );
+ void HandleSessionError( CMdESession& aSession, TInt aError );
+
+ // from MMdEObjectObserver
+ void HandleObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray);
+
+ // from MTMShutdownObserver
+ void ShutdownNotification();
+
+protected:
+
+ /**
+ * AddObserversL
+ *
+ * @since S60 v5.0
+ */
+ void AddObserversL();
+
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGImageObserver instance.
+ */
+ CThumbAGImageObserver(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
+
+ /**
+ * Callback for reconnect timer
+ *
+ * @since S60 v5.0
+ */
+ static TInt ReconnectCallBack(TAny* aAny);
+
+private:
+
+ // own
+ CTMShutdownObserver* iShutdownObserver;
+ CTMShutdownObserver* iMDSShutdownObserver;
+ CMdESession* iMdESession;
+ //not owned
+ CThumbAGProcessor* iProcessor;
+
+ TBool iShutdown;
+
+ // reconnect timer
+ CPeriodic* iReconnect;
+
+ TBool iSessionError;
+
+#ifdef _DEBUG
+ TUint32 iAddCounter;
+ TUint32 iModCounter;
+#endif
+};
+
+#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Thu Jul 15 18:59:26 2010 +0300
@@ -32,10 +32,46 @@
#include "tmactivitymanager.h"
#include "tmformatobserver.h"
#include "tmrpropertyobserver.h"
+#include "thumbnailmanagerconstants.h"
//FORWARD DECLARATIONS
class MMPXCollectionUtility;
+
+enum TThumbnailGenerationItemType
+ {
+ EGenerationItemTypeUnknown,
+ EGenerationItemTypeNotFound,
+ EGenerationItemTypeCamera,
+ EGenerationItemTypeAny,
+ EGenerationItemTypeAudio,
+ EGenerationItemTypeVideo,
+ EGenerationItemTypeImage,
+ EGenerationItemTypeItemCount
+ };
+
+ enum TThumbnailGenerationItemAction
+ {
+ EGenerationItemActionAdd,
+ EGenerationItemActionDelete,
+ EGenerationItemActionModify,
+ EGenerationItemAction2ndAdd,
+ EGenerationItemActionResolveType,
+ EGenerationItemActionCount
+ };
+
+ struct TThumbnailGenerationItem
+ {
+ inline TThumbnailGenerationItem(): iItemId( KErrNotFound ), iItemType(EGenerationItemTypeUnknown), iItemAction(EGenerationItemActionAdd), iPlaceholder(EFalse), iUri(NULL){}
+ inline ~TThumbnailGenerationItem(){delete iUri; iUri = NULL;}
+
+ TItemId iItemId;
+ TThumbnailGenerationItemType iItemType;
+ TThumbnailGenerationItemAction iItemAction;
+ TBool iPlaceholder;
+ HBufC* iUri;
+ };
+
/**
* Processor object for handling thumb generation
*
@@ -119,17 +155,18 @@
* @since S60 v5.0
* @param aMdESession MdE Session
*/
- void SetMdESession( CMdESession* aMdESession );
+ void SetMdESessionL( CMdESession* aMdESession );
/**
* Adds new IDs to queue
*
* @since S60 v5.0
* @param aType TObserverNotificationType
+ * @param TThumbnailGenerationItemType
* @param aIDArray IDs for thumbnail creation
* @param aForce pass ETrue if processor is forced to run without waiting harvesting complete
*/
- void AddToQueueL( TObserverNotificationType aType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
+ void AddToQueueL( TObserverNotificationType aType, TThumbnailGenerationItemType aItemType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
/**
* Calls Thumbnail Manager to create thumbnails
@@ -160,16 +197,17 @@
* QueryL
*
* @since S60 v5.0
- * @param aIDArray Item IDs to query
+ * @param TThumbnailGenerationItemAction
*/
- void QueryL( RArray<TItemId>& aIDArray );
+ void QueryL( TThumbnailGenerationItemAction aType);
/**
* QueryPlaceholdersL
*
* @since S60 v5.0
+ * @param aPresent item should not be present item
*/
- void QueryPlaceholdersL();
+ void QueryPlaceholdersL(const TBool aPresent);
/**
* DeleteAndCancelQuery
@@ -260,14 +298,58 @@
* @since S60 v5.0
* @param aDefine (re)define PS key before setting value
*/
- void UpdatePSValues(const TBool aDefine = EFalse);
+ void UpdatePSValues(const TBool aDefine, const TBool aForce);
/**
* Comparison function for logaritmic use of queue arrays
*
+ * @since S60 S^3
+ */
+ static TInt Compare(const TThumbnailGenerationItem& aLeft, const TThumbnailGenerationItem& aRight);
+
+ /**
+ * Comparison function for logaritmic use of queue arrays
+ *
+ * @since S60 S^3
+ */
+ static TInt CompareId(const TItemId& aLeft, const TItemId& aRight);
+
+ /**
+ * Recalculate item counts
+ *
+ * @since S60 S^3
+ */
+ void UpdateItemCounts();
+
+ /**
+ * Callback for mount timeout
+ *
* @since S60 v5.0
*/
- static TInt Compare(const TItemId& aLeft, const TItemId& aRight);
+ static TInt MountTimerCallBack(TAny* aAny);
+
+ /**
+ * Set item's action from type
+ *
+ * @since S^3
+ */
+ void SetGenerationItemAction( TThumbnailGenerationItem& aGenerationItem, const TThumbnailGenerationItemType aItemType );
+
+ /**
+ * Set item type property from TDedIf
+ * @param aGenerationItem TThumbnailGenerationItem
+ * @param aItemType TThumbnailGenerationItemType
+ * @since S^3
+ */
+ void SetGenerationItemType( TThumbnailGenerationItem& aGenerationItem, const TDefId aDefId );
+
+ /**
+ * Append item to processing queue or update existing
+ * @param aGenerationItem modified TThumbnailGenerationItem
+ * @param aDefId items MDS object definition ID
+ * @since S^3
+ */
+ void AppendProcessingQueue(TThumbnailGenerationItem& item );
private:
@@ -281,20 +363,19 @@
CMdEObjectQuery* iQueryAllItems;
CMdEObjectQuery* iQueryPlaceholders;
- RArray<TItemId> iAddQueue;
- RArray<TItemId> iModifyQueue;
- RPointerArray<HBufC> iRemoveQueue;
+ RArray<TThumbnailGenerationItem> iGenerationQueue;
+ //RPointerArray<HBufC> iRemoveQueue;
RArray<TItemId> iQueryQueue;
- RArray<TItemId> iPlaceholderQueue;
- //not processing queue, used to keep KItemsLeft PS correct
- RArray<TItemId> i2ndRoundGenerateQueue;
- //reference to current processing queue
- RArray<TItemId>* iLastQueue;
//background generation state
// EFalse = 1st round, create only grid size thumbnail for images and videos
// ETrue = 2nds round, create all missing sizes for all media items
TBool i2ndRound;
+
+ // query state
+ // EFalse = normal mode
+ // ETrue = querying unknown items
+ TBool iUnknown;
//MDS query issues
TBool iQueryActive;
@@ -303,7 +384,7 @@
//Processing MDS itens which are modified
TBool iModify;
- TInt iProcessingCount;
+ TUint iProcessingCount;
//MDS harvester's overall state
TBool iHarvesting;
@@ -318,6 +399,7 @@
TBool iMMCHarvestingTemp;
CPeriodic* iPeriodicTimer;
+ CPeriodic* iMountTimer;
//MDS Harvester client
RHarvesterClient iHarvesterClient;
@@ -328,7 +410,7 @@
//2nd phase init after MDE session is open
TBool iInit2;
- // auto create
+ // auto create values from centrep
TBool iAutoImage;
TBool iAutoVideo;
TBool iAutoAudio;
@@ -338,14 +420,16 @@
// controlled by Photos application to run TN generation on foreground
TBool iForegroundRun;
//request pending in TNM side
- TBool iActive;
CTMFormatObserver* iFormatObserver;
+ //formating started
TBool iFormatting;
+ //TNM server session died
TBool iSessionDied;
- TInt iActiveCount;
+ //pending request count
+ TUint iActiveCount;
MMPXCollectionUtility* iCollectionUtility; // own
@@ -355,6 +439,7 @@
//overall status of device
TBool iIdle;
+ //monitors device activity
CTMActivityManager* iActivityManager;
//Observer foreground generation
@@ -367,6 +452,28 @@
TBool iDoQueryAllItems;
TBool iShutdown;
-};
+
+ //item counts
+ TUint32 iModifyItemCount;
+ TUint32 iImageItemCount;
+ TUint32 iVideoItemCount;
+ TUint32 iAudioItemCount;
+ TUint32 iDeleteItemCount;
+ TUint32 iAddItemCount;
+ TUint32 iCameraItemCount;
+ TUint32 iUnknownItemCount;
+ TUint32 i2ndAddItemCount;
+ TUint32 iPlaceholderItemCount;
+
+ //for book keeping previous items left count got from MDS harvester
+ TUint32 iMMCHarvestingItemsLeftTemp;
+ TUint32 iPHHarvestingItemsLeftTemp;
+
+ //MdE object definitons used in query
+ CMdEObjectDef* iImageObjectDef;
+ CMdEObjectDef* iVideoObjectDef;
+ CMdEObjectDef* iAudioObjectDef;
+ TBool iHarvesterActivated;
+ };
#endif // THUMBAGPROCESSOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagvideoobserver.h Thu Jul 15 18:59:26 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2006-2007 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: Thumbnail Auto Generate Daemon
+ *
+*/
+
+
+#ifndef THUMBAGVIDEOBSERVER_H
+#define THUMBAGVIDEOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+#include <mdesession.h>
+
+#include "thumbagprocessor.h"
+#include "thumbnaillog.h"
+#include "tmshutdownobserver.h"
+
+
+/**
+ * ThumbAG daemon.
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CThumbAGVideoObserver ): public CBase,
+ public MMdESessionObserver,
+ public MMdEObjectObserver,
+ public MTMShutdownObserver
+ {
+public:
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGVideoObserver server.
+ */
+ static CThumbAGVideoObserver* NewLC(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Two-phased constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGVideoObserver server.
+ */
+ static CThumbAGVideoObserver* NewL(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Destructor
+ *
+ * @since S60 v5.0
+ */
+ virtual ~CThumbAGVideoObserver();
+
+
+public:
+
+ // from MMdESessionObserver
+ void HandleSessionOpened( CMdESession& aSession, TInt aError );
+ void HandleSessionError( CMdESession& aSession, TInt aError );
+
+ // from MMdEObjectObserver
+ void HandleObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray);
+
+ // from MTMShutdownObserver
+ void ShutdownNotification();
+
+protected:
+
+ /**
+ * AddObserversL
+ *
+ * @since S60 v5.0
+ */
+ void AddObserversL();
+
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v5.0
+ * @return New CThumbAGVideoObserver instance.
+ */
+ CThumbAGVideoObserver(CThumbAGProcessor* aProcessor);
+
+ /**
+ * Symbian 2nd phase constructor can leave.
+ *
+ * @since S60 v5.0
+ */
+ void ConstructL();
+
+ /**
+ * Initilization helper
+ *
+ * @since S60 v5.2
+ */
+ void InitializeL();
+
+ /**
+ * Callback for reconnect timer
+ *
+ * @since S60 v5.0
+ */
+ static TInt ReconnectCallBack(TAny* aAny);
+
+private:
+
+ // own
+ CTMShutdownObserver* iShutdownObserver;
+ CTMShutdownObserver* iMDSShutdownObserver;
+ CMdESession* iMdESession;
+ //not owned
+ CThumbAGProcessor* iProcessor;
+
+ TBool iShutdown;
+
+ // reconnect timer
+ CPeriodic* iReconnect;
+
+ TBool iSessionError;
+
+#ifdef _DEBUG
+ TUint32 iAddCounter;
+ TUint32 iModCounter;
+#endif
+};
+
+#endif // THUMBAGDAEMON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagaudioobserver.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -0,0 +1,348 @@
+/*
+* Copyright (c) 2006-2007 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: Thumbnail Auto Generate Daemon
+*
+*/
+
+
+#include <e32svr.h>
+#include <centralrepository.h>
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mdeobject.h>
+
+#include "thumbagaudioobserver.h"
+#include "thumbnaillog.h"
+#include "thumbnailmanagerconstants.h"
+#include "thumbnailmanagerprivatecrkeys.h"
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CThumbAGAudioObserver* CThumbAGAudioObserver::NewLC(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::NewLC() - begin" );
+
+ CThumbAGAudioObserver* self = new (ELeave) CThumbAGAudioObserver(aProcessor);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CThumbAGAudioObserver* CThumbAGAudioObserver::NewL(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::NewL() - begin" );
+
+ CThumbAGAudioObserver* self = CThumbAGAudioObserver::NewLC(aProcessor);
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGAudioObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGAudioObserver::CThumbAGAudioObserver(CThumbAGProcessor* aProcessor)
+ : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::ConstructL()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::ConstructL() - begin" );
+
+#ifdef _DEBUG
+ iAddCounter = 0;
+ iModCounter = 0;
+#endif
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGAudioObserver::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGAudioObserver
+// ---------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - begin" );
+
+
+ TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - create observers" );
+
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
+ iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
+ // MDS session reconnect timer
+ if (!iReconnect)
+ {
+ iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
+ }
+
+ TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - connect to MDS" );
+
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGAudioObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGAudioObserver::~CThumbAGAudioObserver()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::~CThumbAGAudioObserver() - begin" );
+
+ iShutdown = ETrue;
+
+ Shutdown();
+
+ TN_DEBUG1( "CThumbAGAudioObserver::~CThumbAGAudioObserver() - end" );
+ }
+
+void CThumbAGAudioObserver::Shutdown()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::Shutdown()" );
+
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+
+ if(iReconnect)
+ {
+ iReconnect->Cancel();
+ delete iReconnect;
+ iReconnect = NULL;
+ }
+
+ if (iMdESession)
+ {
+ // 2 observers
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGAudioObserver::HandleSessionOpened
+// -----------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleSessionOpened");
+
+ if (aError == KErrNone)
+ {
+ TRAPD( err, AddObserversL() );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionOpened, AddObserversL error == %d", err );
+ }
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionOpened error == %d", aError );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGAudioObserver::HandleSessionError
+// -----------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionError == %d", aError );
+ if (aError != KErrNone && !iSessionError)
+ {
+ iSessionError = ETrue;
+
+ if (!iShutdown)
+ {
+ if (!iReconnect->IsActive())
+ {
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleSessionError() - reconnect timer started" );
+ }
+ }
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGAudioObserver::HandleObjectNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::HandleObjectNotification( CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray )
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - begin" );
+
+ // no processor or shutting down
+ if ( iShutdown || !iProcessor)
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ if (aType == ENotifyAdd)
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ iAddCounter = aObjectIdArray.Count();
+ }
+ else if (aType == ENotifyModify)
+ {
+ TN_DEBUG2( "CThumbAGAudioObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
+ iModCounter = aObjectIdArray.Count();
+ }
+#endif
+
+ if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - AddToQueueL" );
+
+ // Add event to processing queue by type and enable force run
+ RPointerArray<HBufC> dummyArray;
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAudio, aObjectIdArray, dummyArray, EFalse));
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - error adding to queue" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - bad notification" );
+ }
+
+#ifdef _DEBUG
+ TN_DEBUG3( "CThumbAGAudioObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
+ iModCounter = 0;
+ iAddCounter = 0;
+#endif
+
+ TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGAudioObserver::ShutdownNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::ShutdownNotification()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::ShutdownNotification()" );
+
+ if (!iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::ShutdownNotification() shutdown" );
+ iShutdown = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGAudioObserver::AddObserversL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGAudioObserver::AddObserversL()
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::AddObserversL() - begin" );
+
+ CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& audioDef = defaultNamespace.GetObjectDefL( MdeConstants::Audio::KAudioObject );
+
+ // set observing conditions
+ CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ addCondition->AddObjectConditionL( audioDef );
+ CleanupStack::Pop( addCondition );
+
+ CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ modifyCondition->AddObjectConditionL( audioDef );
+ CleanupStack::Pop( modifyCondition );
+
+ // add observer
+ iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
+
+ // modify observer
+ iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+
+ TN_DEBUG1( "CThumbAGAudioObserver::AddObserversL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGAudioObserver::ReconnectCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGAudioObserver::ReconnectCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGAudioObserver::ReconnectCallBack() - reinitialize");
+
+ CThumbAGAudioObserver* self = static_cast<CThumbAGAudioObserver*>( aAny );
+
+ self->iReconnect->Cancel();
+
+ // reconnect to MDS
+ TRAP_IGNORE( self->InitializeL() );
+
+ TN_DEBUG1( "CThumbAGAudioObserver::ReconnectCallBack() - done");
+
+ return KErrNone;
+ }
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagcameraobserver.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -0,0 +1,340 @@
+/*
+* Copyright (c) 2006-2007 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: Thumbnail Auto Generate Daemon
+*
+*/
+
+
+#include <e32svr.h>
+#include <centralrepository.h>
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mdeobject.h>
+
+#include "thumbagcameraobserver.h"
+#include "thumbnaillog.h"
+#include "thumbnailmanagerconstants.h"
+#include "thumbnailmanagerprivatecrkeys.h"
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CThumbAGCameraObserver* CThumbAGCameraObserver::NewLC(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::NewLC() - begin" );
+
+ CThumbAGCameraObserver* self = new (ELeave) CThumbAGCameraObserver(aProcessor);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CThumbAGCameraObserver* CThumbAGCameraObserver::NewL(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::NewL() - begin" );
+
+ CThumbAGCameraObserver* self = CThumbAGCameraObserver::NewLC(aProcessor);
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGCameraObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGCameraObserver::CThumbAGCameraObserver(CThumbAGProcessor* aProcessor)
+ : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::ConstructL()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - begin" );
+
+#ifdef _DEBUG
+ iAddCounter = 0;
+ iModCounter = 0;
+#endif
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGCameraObserver
+// ---------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - begin" );
+
+
+ TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - create observers" );
+
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
+ iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
+ // MDS session reconnect timer
+ if (!iReconnect)
+ {
+ iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
+ }
+
+ TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - connect to MDS" );
+
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGCameraObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGCameraObserver::~CThumbAGCameraObserver()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - begin" );
+
+ iShutdown = ETrue;
+
+ delete iMDSShutdownObserver;
+ delete iShutdownObserver;
+
+ if(iReconnect)
+ {
+ iReconnect->Cancel();
+ delete iReconnect;
+ iReconnect = NULL;
+ }
+
+ if (iMdESession)
+ {
+ // 2 observers
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::HandleSessionOpened
+// -----------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleSessionOpened");
+
+ if (aError == KErrNone)
+ {
+ TRAPD( err, AddObserversL() );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened, AddObserversL error == %d", err );
+ }
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened error == %d", aError );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::HandleSessionError
+// -----------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionError == %d", aError );
+ if (aError != KErrNone && !iSessionError)
+ {
+ iSessionError = ETrue;
+
+ if (!iShutdown)
+ {
+ if (!iReconnect->IsActive())
+ {
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleSessionError() - reconnect timer started" );
+ }
+ }
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::HandleObjectNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::HandleObjectNotification( CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray )
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - begin" );
+
+ // no processor or shutting down
+ if ( iShutdown || !iProcessor)
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ if (aType == ENotifyAdd)
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ iAddCounter = aObjectIdArray.Count();
+ }
+ else if (aType == ENotifyModify)
+ {
+ TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
+ iModCounter = aObjectIdArray.Count();
+ }
+#endif
+
+ if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - AddToQueueL" );
+
+ // Add event to processing queue by type and enable force run
+ RPointerArray<HBufC> dummyArray;
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeCamera, aObjectIdArray, dummyArray, EFalse));
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - error adding to queue" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - bad notification" );
+ }
+
+#ifdef _DEBUG
+ TN_DEBUG3( "CThumbAGCameraObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
+ iModCounter = 0;
+ iAddCounter = 0;
+#endif
+
+ TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::ShutdownNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::ShutdownNotification()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification()" );
+
+ if (!iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification() shutdown" );
+ iShutdown = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGCameraObserver::AddObserversL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGCameraObserver::AddObserversL()
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - begin" );
+
+ CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
+ CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
+
+ // set observing conditions
+ CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( addCondition );
+
+ CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( modifyCondition );
+
+ // add observer
+ iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
+
+ // modify observer
+ iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+
+ TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGCameraObserver::ReconnectCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGCameraObserver::ReconnectCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - reinitialize");
+
+ CThumbAGCameraObserver* self = static_cast<CThumbAGCameraObserver*>( aAny );
+
+ self->iReconnect->Cancel();
+
+ // reconnect to MDS
+ TRAP_IGNORE( self->InitializeL() );
+
+ TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - done");
+
+ return KErrNone;
+ }
+
+
+// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -80,7 +80,6 @@
#ifdef _DEBUG
iAddCounter = 0;
- iModCounter = 0;
iDelCounter = 0;
#endif
@@ -137,9 +136,7 @@
if(iMdESession)
{
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverWithUriL( *this ) );
TRAP_IGNORE( iMdESession->RemoveObjectPresentObserverL( * this ));
// connect to MDS
@@ -149,6 +146,22 @@
iMdESession = CMdESession::NewL( *this );
iSessionError = EFalse;
+
+ delete iImageObserver;
+ iImageObserver = NULL;
+ iImageObserver = CThumbAGImageObserver::NewL(iProcessor);
+
+ delete iCameraObserver;
+ iCameraObserver = NULL;
+ iCameraObserver = CThumbAGCameraObserver::NewL(iProcessor);
+
+ delete iAudioObserver;
+ iAudioObserver = NULL;
+ iAudioObserver = CThumbAGAudioObserver::NewL(iProcessor);
+
+ delete iVideoObserver;
+ iVideoObserver = NULL;
+ iVideoObserver = CThumbAGVideoObserver::NewL(iProcessor);
}
else
{
@@ -166,7 +179,19 @@
{
TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - begin" );
- iShutdown = ETrue;
+ iShutdown = ETrue;
+
+ delete iImageObserver;
+ iImageObserver = NULL;
+
+ delete iCameraObserver;
+ iCameraObserver = NULL;
+
+ delete iVideoObserver;
+ iVideoObserver = NULL;
+
+ delete iAudioObserver;
+ iAudioObserver = NULL;
delete iMDSShutdownObserver;
delete iShutdownObserver;
@@ -187,9 +212,6 @@
if (iMdESession)
{
- // 2 observers
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
#ifdef MDS_URI_OBSERVER
// remove observer with uri
TRAP_IGNORE( iMdESession->RemoveObjectObserverWithUriL( *this ) );
@@ -262,9 +284,9 @@
if (aError == KErrNone)
{
- iProcessor->SetMdESession(iMdESession);
+ TRAPD(err, iProcessor->SetMdESessionL(iMdESession));
- TRAPD( err, AddObserversL() );
+ TRAP( err, AddObserversL() );
if (err != KErrNone)
{
TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened, AddObserversL error == %d", err );
@@ -287,6 +309,18 @@
{
iSessionError = ETrue;
+ delete iImageObserver;
+ iImageObserver = NULL;
+
+ delete iCameraObserver;
+ iCameraObserver = NULL;
+
+ delete iVideoObserver;
+ iVideoObserver = NULL;
+
+ delete iAudioObserver;
+ iAudioObserver = NULL;
+
// kill processor right away, because it also has MdESession
if(iProcessor)
{
@@ -328,8 +362,9 @@
{
TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - removed");
TInt err(0);
- TRAP(err, iProcessor->AddToQueueL(aType, aObjectIdArray, aObjectUriArray, EFalse));
+ TRAP(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, aObjectUriArray, EFalse));
__ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGDaemon::HandleUriObjectNotification()"), err));
+
err = KErrNone;
}
TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - end" );
@@ -353,37 +388,23 @@
}
#ifdef _DEBUG
- if (aType == ENotifyAdd)
- {
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
- iAddCounter = aObjectIdArray.Count();
- }
- else if (aType == ENotifyModify)
- {
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
- iModCounter = aObjectIdArray.Count();
- }
- else if (aType == ENotifyRemove)
+ if (aType == ENotifyRemove)
{
TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyRemove %d", aObjectIdArray.Count() );
iDelCounter = aObjectIdArray.Count();
}
#endif
- if ( (aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove) &&
- (aObjectIdArray.Count() > 0) )
+ if ( aType == ENotifyRemove && aObjectIdArray.Count() > 0 )
{
TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - AddToQueueL" );
// If delete event, remove IDs from Modify and Add queues
- if ( aType == ENotifyRemove )
- {
- iProcessor->RemoveFromQueues( aObjectIdArray, EFalse);
- }
+ iProcessor->RemoveFromQueues( aObjectIdArray, EFalse);
// Add event to processing queue by type and enable force run
RPointerArray<HBufC> dummyArray;
- TRAPD(err, iProcessor->AddToQueueL(aType, aObjectIdArray, dummyArray, EFalse));
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, dummyArray, EFalse));
if (err != KErrNone)
{
TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - error adding to queue" );
@@ -395,12 +416,8 @@
}
#ifdef _DEBUG
- TN_DEBUG4( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Modify = %d Delete = %d",
- iAddCounter, iModCounter, iDelCounter );
- iModCounter = 0;
+ TN_DEBUG2( "CThumbAGDaemon::IN-COUNTERS---------- Delete = %d", iDelCounter );
iDelCounter = 0;
- iAddCounter = 0;
-
#endif
TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - end" );
@@ -430,10 +447,9 @@
{
// do not force run of these items
RPointerArray<HBufC> dummyArray;
- TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, aObjectIdArray, dummyArray, ETrue));
+ TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, EGenerationItemTypeUnknown, aObjectIdArray, dummyArray, ETrue));
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
-
+ TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd unknown items %d", aObjectIdArray.Count() );
#ifdef _DEBUG
iAddCounter = aObjectIdArray.Count();
if (err != KErrNone)
@@ -465,11 +481,9 @@
}
#ifdef _DEBUG
- TN_DEBUG4( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Modify = %d Delete = %d",
- iAddCounter, iModCounter, iDelCounter );
- iModCounter = 0;
+ TN_DEBUG3( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Delete = %d", iAddCounter, iDelCounter );
iDelCounter = 0;
- iAddCounter = 0;
+ iAddCounter = 0;
#endif
TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - end" );
@@ -498,31 +512,6 @@
{
TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - begin" );
- CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
- CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
- CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject );
- CMdEObjectDef& audioDef = defaultNamespace.GetObjectDefL( MdeConstants::Audio::KAudioObject );
-
- // set observing conditions
- CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorOr );
- addCondition->AddObjectConditionL( imageDef );
- addCondition->AddObjectConditionL( videoDef );
- addCondition->AddObjectConditionL( audioDef );
- CleanupStack::Pop( addCondition );
-
- CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorOr );
- modifyCondition->AddObjectConditionL( imageDef );
- modifyCondition->AddObjectConditionL( videoDef );
- modifyCondition->AddObjectConditionL( audioDef );
- CleanupStack::Pop( modifyCondition );
-
- // add observer
- iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
-
- // modify observer
-#ifdef MDS_MODIFY_OBSERVER
- iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
-#endif
#ifdef MDS_URI_OBSERVER
// remove observer with uri
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagimageobserver.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -0,0 +1,345 @@
+/*
+* Copyright (c) 2006-2007 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: Thumbnail Auto Generate Daemon
+*
+*/
+
+
+#include <e32svr.h>
+#include <centralrepository.h>
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mdeobject.h>
+
+#include "thumbagimageobserver.h"
+#include "thumbnaillog.h"
+#include "thumbnailmanagerconstants.h"
+#include "thumbnailmanagerprivatecrkeys.h"
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CThumbAGImageObserver* CThumbAGImageObserver::NewLC(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::NewLC() - begin" );
+
+ CThumbAGImageObserver* self = new (ELeave) CThumbAGImageObserver(aProcessor);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CThumbAGImageObserver* CThumbAGImageObserver::NewL(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::NewL() - begin" );
+
+ CThumbAGImageObserver* self = CThumbAGImageObserver::NewLC(aProcessor);
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGImageObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGImageObserver::CThumbAGImageObserver(CThumbAGProcessor* aProcessor)
+ : iShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::ConstructL()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::ConstructL() - begin" );
+
+#ifdef _DEBUG
+ iAddCounter = 0;
+ iModCounter = 0;
+#endif
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGImageObserver::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGImageObserver
+// ---------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - begin" );
+
+
+ TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - create observers" );
+
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
+ iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
+ // MDS session reconnect timer
+ if (!iReconnect)
+ {
+ iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
+ }
+
+ TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - connect to MDS" );
+
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGImageObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGImageObserver::~CThumbAGImageObserver()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::~CThumbAGImageObserver() - begin" );
+
+ iShutdown = ETrue;
+
+ delete iMDSShutdownObserver;
+ delete iShutdownObserver;
+
+ if(iReconnect)
+ {
+ iReconnect->Cancel();
+ delete iReconnect;
+ iReconnect = NULL;
+ }
+
+ if (iMdESession)
+ {
+ // 2 observers
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ TN_DEBUG1( "CThumbAGImageObserver::~CThumbAGImageObserver() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGImageObserver::HandleSessionOpened
+// -----------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleSessionOpened");
+
+ if (aError == KErrNone)
+ {
+ TRAPD( err, AddObserversL() );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleSessionOpened, AddObserversL error == %d", err );
+ }
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleSessionOpened error == %d", aError );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGImageObserver::HandleSessionError
+// -----------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleSessionError == %d", aError );
+ if (aError != KErrNone && !iSessionError)
+ {
+ iSessionError = ETrue;
+
+ if (!iShutdown)
+ {
+ if (!iReconnect->IsActive())
+ {
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGImageObserver::HandleSessionError() - reconnect timer started" );
+ }
+ }
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGImageObserver::HandleObjectNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::HandleObjectNotification( CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray )
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - begin" );
+
+ // no processor or shutting down
+ if (iShutdown || !iProcessor)
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ if (aType == ENotifyAdd)
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ iAddCounter = aObjectIdArray.Count();
+ }
+ else if (aType == ENotifyModify)
+ {
+ TN_DEBUG2( "CThumbAGImageObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
+ iModCounter = aObjectIdArray.Count();
+ }
+#endif
+
+ if ( (aType == ENotifyAdd || aType == ENotifyModify) && aObjectIdArray.Count() > 0 )
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - AddToQueueL" );
+
+ // Add event to processing queue by type and enable force run
+ RPointerArray<HBufC> dummyArray;
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeImage, aObjectIdArray, dummyArray, EFalse));
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - error adding to queue" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - bad notification" );
+ }
+
+#ifdef _DEBUG
+ TN_DEBUG3( "CThumbAGImageObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
+ iModCounter = 0;
+ iAddCounter = 0;
+
+#endif
+
+ TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGImageObserver::AddObserversL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::AddObserversL()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::AddObserversL() - begin" );
+
+ CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
+ CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
+ CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
+
+ // set observing conditions
+ CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ addCondition->AddObjectConditionL( imageDef );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( addCondition );
+
+ CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ modifyCondition->AddObjectConditionL( imageDef );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( modifyCondition );
+
+ // add observers
+ iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
+
+ // modify observer
+ iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+
+ TN_DEBUG1( "CThumbAGImageObserver::AddObserversL() - end" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CThumbAGCameraObserver::ShutdownNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGImageObserver::ShutdownNotification()
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::ShutdownNotification()" );
+
+ if (!iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::ShutdownNotification() shutdown" );
+ iShutdown = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGImageObserver::ReconnectCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGImageObserver::ReconnectCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGImageObserver::ReconnectCallBack() - reinitialize");
+
+ CThumbAGImageObserver* self = static_cast<CThumbAGImageObserver*>( aAny );
+
+ self->iReconnect->Cancel();
+
+ // reconnect to MDS
+ TRAP_IGNORE( self->InitializeL() );
+
+ TN_DEBUG1( "CThumbAGImageObserver::ReconnectCallBack() - done");
+
+ return KErrNone;
+ }
+
+
+// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -50,7 +50,8 @@
// CThumbAGProcessor::CThumbAGProcessor()
// ---------------------------------------------------------------------------
//
-CThumbAGProcessor::CThumbAGProcessor(): CActive( CActive::EPriorityStandard )
+CThumbAGProcessor::CThumbAGProcessor(): CActive( CActive::EPriorityStandard ), iMMCHarvestingItemsLeftTemp(0),
+ iPHHarvestingItemsLeftTemp(0)
{
TN_DEBUG1( "CThumbAGProcessor::CThumbAGProcessor() - begin" );
@@ -82,10 +83,11 @@
// set auto create values from cenrep
CheckAutoCreateValuesL();
- iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle);
+ iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+
+ iMountTimer = CPeriodic::NewL(CActive::EPriorityUserInput);
SetForceRun( EFalse );
- iActive = EFalse;
iFormatObserver = CTMFormatObserver::NewL( *this );
@@ -96,7 +98,7 @@
iActivityManager = CTMActivityManager::NewL( this, KBackgroundGenerationIdle);
- UpdatePSValues(ETrue);
+ UpdatePSValues(ETrue, ETrue);
RProperty::Define(KTAGDPSNotification, KMPXHarvesting, RProperty::EInt);
@@ -118,6 +120,20 @@
Cancel();
+ if (iTMSession)
+ {
+ iTMSession->RemoveRequestObserver();
+ delete iTMSession;
+ iTMSession = NULL;
+ }
+
+ if(iMountTimer)
+ {
+ iMountTimer->Cancel();
+ delete iMountTimer;
+ iMountTimer = NULL;
+ }
+
if(iPeriodicTimer)
{
iPeriodicTimer->Cancel();
@@ -177,21 +193,17 @@
iCollectionUtility->Close();
iCollectionUtility = NULL;
}
-
- iAddQueue.Close();
- iModifyQueue.Close();
- iRemoveQueue.ResetAndDestroy();
+
+ for(TInt i=0;i<iGenerationQueue.Count();i++)
+ {
+ delete iGenerationQueue[i].iUri;
+ iGenerationQueue[i].iUri = NULL;
+ }
+
+ iGenerationQueue.Reset();
+ iGenerationQueue.Close();
+
iQueryQueue.Close();
- iPlaceholderQueue.Close();
-
- i2ndRoundGenerateQueue.Close();
-
- if (iTMSession)
- {
- iTMSession->RemoveRequestObserver();
- delete iTMSession;
- iTMSession = NULL;
- }
TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - end" );
}
@@ -204,7 +216,7 @@
{
TN_DEBUG1( "CThumbAGProcessor::Shutdown()" );
iShutdown = ETrue;
- UpdatePSValues();
+ UpdatePSValues(EFalse, EFalse);
}
// -----------------------------------------------------------------------------
@@ -244,13 +256,19 @@
}
// ignore if fails
- iPlaceholderQueue.InsertInOrder(object->Id(), Compare);
+ TThumbnailGenerationItem item;
+ item.iItemId = object->Id();
+ item.iPlaceholder = ETrue;
+
+ SetGenerationItemType( item, object->Def().Id());
+
+ AppendProcessingQueue( item );
}
}
else if(&aQuery == iQueryAllItems)
{
TN_DEBUG2( "CThumbAGProcessor::HandleQueryNewResults - QueryAllItems, %d new", aNewItemCount);
-
+
for(TInt i = aFirstNewItemIndex; i < iQueryAllItems->Count(); i++)
{
const CMdEObject* object = &iQueryAllItems->Result(i);
@@ -259,13 +277,17 @@
{
continue;
}
-
- if (iAddQueue.FindInOrder(object->Id(), Compare) == KErrNotFound &&
- iModifyQueue.FindInOrder(object->Id(), Compare) == KErrNotFound )
- {
- // ignore if fails
- iAddQueue.InsertInOrder(object->Id(), Compare);
- }
+
+ TThumbnailGenerationItem item;
+ item.iItemId = object->Id();
+
+ SetGenerationItemType(item, object->Def().Id());
+
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ item.iPlaceholder = object->Placeholder();
+
+ AppendProcessingQueue( item );
}
}
}
@@ -292,8 +314,6 @@
{
TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - iQueryPlaceholders completed");
- iPlaceholderQueue.Reset();
-
//free query
delete iQueryPlaceholders;
iQueryPlaceholders = NULL;
@@ -331,60 +351,123 @@
{
iProcessingCount = iQuery->Count();
- if(iProcessingCount != iQueryQueue.Count())
+ if(iProcessingCount != iQueryQueue.Count() )
{
TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() some result items missing");
RArray<TItemId> queryQueueDelta;
- TInt itemIndex(KErrNotFound);
-
- //search delta items which were queried, but not found
- for(TInt queryItem =0; queryItem < iQueryQueue.Count();queryItem++)
- {
- TBool found(EFalse);
- for(TInt queryResult = 0; queryResult < iQuery->Count(); queryResult++)
- {
- const CMdEObject* object = &iQuery->Result(queryResult);
-
- if( iQueryQueue[queryItem] == object->Id())
+ //search delta items which were queried, but not found
+ for(TInt queryItem =0; queryItem < iQueryQueue.Count();queryItem++)
+ {
+ TBool found(EFalse);
+ for(TInt queryResult = 0; queryResult < iQuery->Count(); queryResult++)
+ {
+ const CMdEObject* object = &iQuery->Result(queryResult);
+
+ if( iQueryQueue[queryItem] == object->Id())
+ {
+ found = ETrue;
+ break;
+ }
+ }
+
+ if(!found)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() %d missing from query results", iQueryQueue[queryItem] );
+
+ // ignore if fails
+ queryQueueDelta.InsertInOrder(iQueryQueue[queryItem], CompareId);
+ }
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing items found %d", queryQueueDelta.Count());
+ //cleanup from previous queue it item is not found from MDS
+ while(queryQueueDelta.Count())
+ {
+ TThumbnailGenerationItem item;
+ item.iItemId = queryQueueDelta[0];
+ TInt itemIndex = iQueryQueue.FindInOrder(item.iItemId, CompareId);
+
+ if(itemIndex >= 0)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove %d from iQueryQueue", queryQueueDelta[0]);
+ iQueryQueue.Remove( itemIndex );
+
+ //remove from procesing queue
+ itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ if(itemIndex >= 0)
+ {
+
+ if( iUnknown )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() mark %d as EGenerationItemTypeNotFound in iGenerationQueue", queryQueueDelta[0]);
+ //mark to be removed, cleanup is done below
+ iGenerationQueue[itemIndex].iItemType = EGenerationItemTypeNotFound;
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove %d from iGenerationQueue", queryQueueDelta[0]);
+ iGenerationQueue.Remove( itemIndex );
+ }
+ }
+ }
+ queryQueueDelta.Remove(0);
+ }
+ queryQueueDelta.Close();
+ }
+
+ if(iUnknown)
+ {
+ for(TInt i = 0; i < iQuery->Count(); i++)
+ {
+ const CMdEObject* object = &iQuery->Result(i);
+
+ if(!object)
+ {
+ continue;
+ }
+
+ TThumbnailGenerationItem tempItem;
+ tempItem.iItemId = object->Id();
+ TInt itemIndex = iGenerationQueue.FindInOrder(tempItem, Compare);
+
+ if(itemIndex >= 0)
{
- found = ETrue;
- break;
+ TThumbnailGenerationItem& item = iGenerationQueue[itemIndex];
+
+ if(iGenerationQueue[itemIndex].iItemType == EGenerationItemTypeNotFound)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove EGenerationItemTypeNotFound %d item from iGenerationQueue", item.iItemId);
+ iGenerationQueue.Remove(itemIndex);
+ continue;
+ }
+
+ SetGenerationItemType(item, object->Def().Id());
+
+ if(item.iItemType == EGenerationItemTypeUnknown )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove unknown item %d", item.iItemId);
+ iGenerationQueue.Remove(itemIndex);
+ continue;
+ }
+
+ item.iPlaceholder = object->Placeholder();
+
}
}
-
- if(!found)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing from results item %d", iQueryQueue[queryItem] );
-
- // ignore if fails
- queryQueueDelta.InsertInOrder(iQueryQueue[queryItem], Compare);
- }
- }
-
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing items total count %d", queryQueueDelta.Count());
- //cleanup from previous queue it item is not found from MDS
- while(queryQueueDelta.Count())
- {
- itemIndex = iLastQueue->FindInOrder(queryQueueDelta[0], Compare);
-
- if(itemIndex >= 0)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove items %d", iQueryQueue[0]);
- iLastQueue->Remove( itemIndex );
- }
- queryQueueDelta.Remove(0);
- }
- queryQueueDelta.Close();
- }
+
+ iQueryQueue.Reset();
+ iProcessingCount = 0;
+ iUnknown = EFalse;
+ }
// no results, reset query
- if( !iProcessingCount)
+ if( !iProcessingCount )
{
delete iQuery;
iQuery = NULL;
- iProcessingCount = 0;
iModify = EFalse;
}
}
@@ -416,7 +499,7 @@
}
// -----------------------------------------------------------------------------
-// CThumbAGProcessor::ThumbnailReady()
+// CThumbAGProcessor::ThumbnailReady()d
// -----------------------------------------------------------------------------
//
void CThumbAGProcessor::ThumbnailReady( TInt aError, MThumbnailData& /*aThumbnail*/,
@@ -426,12 +509,6 @@
iActiveCount--;
- if(iActiveCount <= 0)
- {
- iActiveCount = 0;
- iActive = EFalse;
- }
-
// TNM server died, delete session
if( aError == KErrServerTerminated )
{
@@ -469,12 +546,6 @@
iActiveCount--;
- if(iActiveCount <= 0)
- {
- iActiveCount = 0;
- iActive = EFalse;
- }
-
ActivateAO();
}
}
@@ -483,7 +554,7 @@
// CThumbAGProcessor::SetMdESession()
// ---------------------------------------------------------------------------
//
-void CThumbAGProcessor::SetMdESession( CMdESession* aMdESession )
+void CThumbAGProcessor::SetMdESessionL( CMdESession* aMdESession )
{
TN_DEBUG1( "CThumbAGProcessor::SetMdESession() - begin" );
@@ -495,14 +566,22 @@
if (err != KErrNone)
{
TN_DEBUG2( "CThumbAGProcessor::SetMdESession() GetDefaultNamespaceDefL() err = %d", err );
+ __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iDefNamespace "), KErrBadHandle));
}
-
- __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iDefNamespace "), KErrBadHandle));
-
- //do async init
- iInit = ETrue;
-
- ActivateAO();
+ else
+ {
+ iImageObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
+ __ASSERT_DEBUG((iImageObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iDefNamespace "), KErrBadHandle));
+ iVideoObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
+ __ASSERT_DEBUG((iVideoObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iVideoObjectDef "), KErrBadHandle));
+ iAudioObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
+ __ASSERT_DEBUG((iAudioObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iAudioObjectDef "), KErrBadHandle));
+
+ //do async init
+ iInit = ETrue;
+
+ ActivateAO();
+ }
}
// ---------------------------------------------------------------------------
@@ -510,11 +589,13 @@
// ---------------------------------------------------------------------------
//
void CThumbAGProcessor::AddToQueueL( TObserverNotificationType aType,
+ TThumbnailGenerationItemType aItemType,
const RArray<TItemId>& aIDArray,
const RPointerArray<HBufC>& aObjectUriArray,
TBool /*aPresent*/ )
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - begin" );
+
// update queues
if (aType == ENotifyAdd)
@@ -523,12 +604,18 @@
for (int i=0; i<aIDArray.Count(); i++)
{
- // do not to append to Add queue if exist already in Add or 2nd Add queue (just processed)
- if (iAddQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound &&
- i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound)
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
+ item.iItemType = aItemType;
+
+ SetGenerationItemAction(item, aItemType);
+
+ if(iPHHarvesting)
{
- User::LeaveIfError(iAddQueue.InsertInOrder(aIDArray[i], Compare));
+ item.iPlaceholder = ETrue;
}
+
+ AppendProcessingQueue( item );
}
}
else if (aType == ENotifyModify)
@@ -540,19 +627,24 @@
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - PH harvesting active, treat like add" );
for (int i=0; i<aIDArray.Count(); i++)
{
- TInt itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare);
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
+ item.iItemType = aItemType;
+
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
if (itemIndex >= 0)
{
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from placeholder queue");
- iPlaceholderQueue.Remove( itemIndex );
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - set as non-placeholder");
+ iGenerationQueue[itemIndex].iPlaceholder = EFalse;
}
-
- if(iAddQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound &&
- i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare) == KErrNotFound)
+ else
{
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append to add queue");
- User::LeaveIfError(iAddQueue.InsertInOrder(aIDArray[i], Compare));
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
+
+ item.iPlaceholder = EFalse;
+ SetGenerationItemAction( item, aItemType );
+ AppendProcessingQueue( item );
}
}
}
@@ -564,75 +656,91 @@
for (int i=0; i<aIDArray.Count(); i++)
{
- itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare);
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
+ item.iItemType = aItemType;
+
+ itemIndex = iGenerationQueue.FindInOrder(item, Compare);
if (itemIndex >= 0)
{
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - placeholder modify, remove from placeholder queue");
- iPlaceholderQueue.Remove( itemIndex );
+ if( iGenerationQueue[itemIndex].iPlaceholder )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - placeholder modify");
+ iGenerationQueue[itemIndex].iPlaceholder = EFalse;
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - real modify");
+ iGenerationQueue[itemIndex].iItemAction = EGenerationItemActionModify;
+ SetForceRun( ETrue );
+ }
}
else
{
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - real modify");
- itemIndex = iAddQueue.FindInOrder(aIDArray[i], Compare);
-
- if (itemIndex >= 0)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from add queue");
- iAddQueue.Remove( itemIndex );
- }
- else
- {
- itemIndex = i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare);
-
- if (itemIndex >= 0)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - remove from 2nd round add queue");
- i2ndRoundGenerateQueue.Remove( itemIndex );
- }
- }
-
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append to modify queue");
- User::LeaveIfError(iModifyQueue.InsertInOrder(aIDArray[i], Compare));
-
- SetForceRun( ETrue );
- }
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
+ SetGenerationItemAction( item, aItemType);
+ item.iPlaceholder = EFalse;
+ AppendProcessingQueue( item );
+ }
}
}
}
- else if (aType == ENotifyRemove)
+ else if (aType == ENotifyRemove && aItemType == EGenerationItemTypeAny)
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove, remove IDs from all queues");
for (int i=0; i<aIDArray.Count(); i++)
{
- // can be removed from Add queue
- TInt itemIndex = iAddQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- iAddQueue.Remove(itemIndex);
- }
-
- // ..and Modify Queue
- itemIndex = iModifyQueue.FindInOrder(aIDArray[i], Compare);
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
+ item.iItemType = aItemType;
+
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
if(itemIndex >= 0)
{
- iModifyQueue.Remove(itemIndex);
+ iGenerationQueue[itemIndex].iItemAction = EGenerationItemActionDelete;
+ delete iGenerationQueue[itemIndex].iUri;
+ iGenerationQueue[itemIndex].iUri = NULL;
+
+ if( aObjectUriArray[i])
+ {
+ iGenerationQueue[itemIndex].iUri = aObjectUriArray[i]->AllocL();
+ }
+ else
+ {
+ //invalid URI remove from processing queue
+ iGenerationQueue.Remove(itemIndex);
+ }
}
- }
-
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove append URIs to remove queue");
- for (int i=0; i<aObjectUriArray.Count(); i++)
- {
- HBufC* temp = aObjectUriArray[i]->AllocL();
- iRemoveQueue.Append( temp );
- TN_DEBUG2( "CThumbAGProcessor::AddToQueueL() - %S", temp);
+ else
+ {
+ TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
+ item.iItemAction = EGenerationItemActionDelete;
+ delete item.iUri;
+ item.iUri = NULL;
+
+ if( aObjectUriArray[i])
+ {
+ item.iUri = aObjectUriArray[i]->AllocL();
+ CleanupStack::PushL( item.iUri );
+ User::LeaveIfError( iGenerationQueue.InsertInOrder(item, Compare) );
+ CleanupStack::Pop();
+ }
+
+ //owned by item
+ item.iUri = NULL;
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::AddToQueueL() - %S", aObjectUriArray[i]);
}
}
#ifdef _DEBUG
else
{
TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - should not come here" );
+ __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbAGProcessor::AddToQueueL()"), KErrArgument));
User::Leave( KErrArgument );
}
#endif
@@ -662,8 +770,8 @@
TInt64 modifiedVal = 0;
CMdEProperty* orientation = NULL;
- CMdEObjectDef& imageObjectDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
- TInt orientErr = aObject->Property( imageObjectDef.GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 );
+
+ TInt orientErr = aObject->Property( iImageObjectDef->GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 );
if (orientErr == KErrNone)
{
@@ -688,6 +796,20 @@
//generate both if needed
TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() EOptimizeForQuality ");
iTMSession->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQuality );
+
+ TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 2nd round add remove from queue", aObject->Id() );
+
+ TThumbnailGenerationItem item;
+ item.iItemId = aObject->Id();
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ if(itemIndex >=0 )
+ {
+ if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemAction2ndAdd)
+ {
+ iGenerationQueue.Remove(itemIndex);
+ }
+ }
}
// 1st roung generation
else
@@ -696,35 +818,29 @@
TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() EOptimizeForQualityWithPreview");
iTMSession->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQualityWithPreview );
- CMdEObjectDef& videoObjectDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
+ // add item to 2nd round queue
+ TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 1st round add/modify, append to 2nd round queue", aObject->Id() );
- // add item to 2nd round queue
- if(iLastQueue == &iAddQueue || iLastQueue == &iModifyQueue)
- {
- TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 1st round add/modify, append to 2nd round queue", aObject->Id() );
- if(i2ndRoundGenerateQueue.FindInOrder(aObject->Id(), Compare) == KErrNotFound)
- {
- // ignore if fails
- i2ndRoundGenerateQueue.InsertInOrder(aObject->Id(), Compare);
- }
- }
+ TThumbnailGenerationItem item;
+ item.iItemId = aObject->Id();
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
- /*CMdEProperty* inDefaultFolder = NULL;
- TBool inDefaultFolderVal(ETrue);
- TInt inDefaultFolderErr = aObject->Property( baseObjDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder ), inDefaultFolder, 0 );
-
- if(inDefaultFolder && inDefaultFolderErr >= 0 )
+ if(itemIndex >=0 )
{
- inDefaultFolderVal = inDefaultFolder->BoolValueL();
- }*/
-
- // Symbian^3 specific
- if( !(( imageObjectDef.Id() == aObject->Def().Id() || videoObjectDef.Id() == aObject->Def().Id())
- /*&& inDefaultFolderVal*/ ) )
- {
- TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round; not image or video in default folder, skip");
- ActivateAO();
- return;
+ if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemActionModify)
+ {
+ iGenerationQueue.Remove(itemIndex);
+ }
+ //change 1st round item for 2nd round processing
+ //2nd round item can be deleted
+ else if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemActionAdd)
+ {
+ iGenerationQueue[itemIndex].iItemAction = EGenerationItemAction2ndAdd;
+ }
+ else
+ {
+ iGenerationQueue.Remove(itemIndex);
+ }
}
}
@@ -736,13 +852,11 @@
TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL, iTMSession error == %d", err );
iSessionDied = ETrue;
- iActive = EFalse;
ActivateAO();
}
else
{
iActiveCount++;
- iActive = ETrue;
}
}
else
@@ -757,7 +871,7 @@
// CThumbAGProcessor::QueryL()
// ---------------------------------------------------------------------------
//
-void CThumbAGProcessor::QueryL( RArray<TItemId>& aIDArray )
+void CThumbAGProcessor::QueryL(/*RArray<TItemId>& aIDArray*/TThumbnailGenerationItemAction aAction )
{
TN_DEBUG1( "CThumbAGProcessor::QueryL() - begin" );
@@ -772,7 +886,6 @@
//reset query queue
iQueryQueue.Reset();
//set reference to current pprocessing queue
- iLastQueue = &aIDArray;
iQueryReady = EFalse;
@@ -784,18 +897,64 @@
}
//move ID from source queue to Query queue
- TInt maxCount = aIDArray.Count();
+ TInt maxCount = iGenerationQueue.Count();
- TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill begin aIDArray == %d, iQueryQueue == %d", aIDArray.Count(), iQueryQueue.Count() );
+ TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill begin iGenerationQueue == %d, iQueryQueue == %d", iGenerationQueue.Count(), iQueryQueue.Count() );
+
- for(TInt i=0; i < KMaxQueryItems && i < maxCount; i++)
+ TInt itemCount(0);
+ for(TInt i=0; itemCount < KMaxQueryItems && i < maxCount; i++)
{
- TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", aIDArray[0] );
- iQueryQueue.InsertInOrder(aIDArray[0], Compare);
- aIDArray.Remove(0);
+ TInt itemIndex(KErrNotFound);
+ switch(aAction)
+ {
+ //1st round items
+ case EGenerationItemActionAdd:
+ if(iGenerationQueue[i].iItemAction == aAction )
+ {
+ itemIndex = i;
+ }
+ break;
+ case EGenerationItemActionModify:
+ if( iGenerationQueue[i].iItemAction == aAction )
+ {
+ itemIndex = i;
+ }
+ break;
+ case EGenerationItemAction2ndAdd:
+ if( iGenerationQueue[i].iItemAction == aAction )
+ {
+ itemIndex = i;
+ }
+ break;
+ //unknown stuff
+ case EGenerationItemActionResolveType:
+ if( iGenerationQueue[i].iItemType == EGenerationItemTypeUnknown )
+ {
+ itemIndex = i;
+ }
+ break;
+ default:
+ break;
+ };
+
+ if( itemIndex >= 0 )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", iGenerationQueue[itemIndex].iItemId );
+ iQueryQueue.InsertInOrder(iGenerationQueue[itemIndex].iItemId, CompareId);
+ itemCount++;
+ }
}
- TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill end aIDArray == %d, iQueryQueue == %d", aIDArray.Count(), iQueryQueue.Count() );
+ if(!itemCount)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::QueryL() - empty query, cancel?!");
+ iQueryActive = EFalse;
+ __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryL() empty! "), KErrNotFound));
+ return;
+ }
+
+ TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill end iGenerationQueue == %d, iQueryQueue == %d", iGenerationQueue.Count(), iQueryQueue.Count() );
CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
iQuery = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
@@ -810,7 +969,7 @@
CleanupStack::Pop( &iQueryQueue );
// add object type conditions
- if (!iModify)
+ if (!(iModify || iUnknown))
{
CMdELogicCondition& objDefCondition = rootCondition.AddLogicConditionL( ELogicConditionOperatorOr );
@@ -842,7 +1001,7 @@
// ---------------------------------------------------------------------------
//
-void CThumbAGProcessor::QueryPlaceholdersL()
+void CThumbAGProcessor::QueryPlaceholdersL(TBool aPresent)
{
TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL" );
@@ -884,17 +1043,17 @@
CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
imagePHObjectCondition.SetPlaceholderOnly( ETrue );
- imagePHObjectCondition.SetNotPresent( ETrue );
+ imagePHObjectCondition.SetNotPresent( aPresent );
CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
videoPHObjectCondition.SetPlaceholderOnly( ETrue );
- videoPHObjectCondition.SetNotPresent( ETrue );
+ videoPHObjectCondition.SetNotPresent( aPresent );
CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
audioPHObjectCondition.SetPlaceholderOnly( ETrue );
- audioPHObjectCondition.SetNotPresent( ETrue );
+ audioPHObjectCondition.SetNotPresent( aPresent );
- iQueryPlaceholders->FindL(KMaxTInt, KMaxQueryItems2);
+ iQueryPlaceholders->FindL(KMaxTInt, KMaxQueryBatchSize);
TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - end" );
}
@@ -928,13 +1087,11 @@
iInit = EFalse;
iInit2 = ETrue;
- iAddQueue.Reset();
- iModifyQueue.Reset();
- iRemoveQueue.ResetAndDestroy();
+ iGenerationQueue.Reset();
iQueryQueue.Reset();
- iPlaceholderQueue.Reset();
- TRAP_IGNORE(QueryPlaceholdersL());
+ //query all not present placeholders
+ TRAP_IGNORE(QueryPlaceholdersL( ETrue ));
//query all items after PH query
iDoQueryAllItems = ETrue;
TN_DEBUG1( "CThumbAGProcessor::RunL() - Initialisation 1 done" );
@@ -954,13 +1111,20 @@
err = iHarvesterClient.Connect();
TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient connect err = %d", err);
- __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
+ __ASSERT_DEBUG((err == KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
if( err == KErrNone )
{
TN_DEBUG1( "CThumbAGProcessor::RunL() add iHarvesterClient observer");
- err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypeMMC | EHEObserverTypePlaceholder, KMaxTInt );
+ err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypeMMC | EHEObserverTypePlaceholder, 20 );
TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient observer err = %d", err);
+
+ if( !err )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::RunL() add iHarvesterClient observer failed");
+ // if we fail observer harvester, fake it
+ iHarvesterActivated = ETrue;
+ }
__ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
}
#endif
@@ -984,7 +1148,6 @@
if (!iTMSession)
{
TN_DEBUG1( "CThumbAGProcessor::RunL() - open TNM session");
- iActive = EFalse;
TRAPD( err, iTMSession = CThumbnailManager::NewL( *this ) );
if (err != KErrNone)
@@ -1001,19 +1164,11 @@
}
// do not run if request is already issued to TNM server even if forced
- if( iActive)
+ if(iActiveCount >= KMaxDaemonRequests)
{
- if(iActiveCount >= KMaxDaemonRequests)
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for previous to complete, abort..." );
- return;
- }
+ TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for previous to complete, abort..." );
+ return;
}
- else
- {
- iActiveCount = 0;
- }
-
//force run can proceed from this point
#ifdef _DEBUG
@@ -1062,7 +1217,9 @@
{
TInt err(KErrNone);
//if force or non forced
- if((iForceRun && iModify ) || (!iForceRun && !iModify ))
+ //if unknown items or mount timer is active, abort processing
+
+ if(((iForceRun && iModify ) || (!iForceRun && !iModify )) && !iUnknownItemCount && !iMountTimer->IsActive())
{
TN_DEBUG1( "CThumbAGProcessor::RunL() - iQueryReady START" );
@@ -1071,21 +1228,16 @@
if ( object )
{
- TInt itemIndex = iLastQueue->FindInOrder(object->Id(), Compare);
- if(itemIndex >= 0)
- {
- iLastQueue->Remove(itemIndex);
- }
-
//process one item at once
//remove item from queryQueue when request is issued
- itemIndex = iQueryQueue.FindInOrder(object->Id(), Compare);
+
+ TInt itemIndex = iQueryQueue.FindInOrder(object->Id(), CompareId);
if(itemIndex >= 0)
{
iQueryQueue.Remove(itemIndex);
}
- TRAP( err, CreateThumbnailsL(object) );
+ TRAP( err, CreateThumbnailsL( object ) );
TN_DEBUG2( "CThumbAGProcessor::RunL(), CreateThumbnailsL error == %d", err );
__ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), CreateThumbnailsL() "), err));
}
@@ -1093,7 +1245,8 @@
//force is coming, but executing non-forced query complete-> cancel old
else
{
- //cancel query and move items back to original processing queue
+ //cancel query
+ TN_DEBUG1( "CThumbAGProcessor::RunL() - cancel processing query" );
DeleteAndCancelQuery( ETrue );
ActivateAO();
return;
@@ -1113,7 +1266,7 @@
else if( iQueryActive )
{
//state mismatch
- if(iForceRun && !iModify)
+ if(iForceRun && !(iModify || iUnknown))
{
//cancel query and move items back to original processing queue
DeleteAndCancelQuery(ETrue);
@@ -1124,10 +1277,20 @@
TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for query to complete, abort..." );
}
}
+ else if ( iUnknownItemCount > 0 )
+ {
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() unknown items in queue");
+
+ i2ndRound = EFalse;
+ iModify = EFalse;
+ iUnknown = ETrue;
+ iQueryActive = ETrue;
+ QueryL( EGenerationItemActionResolveType );
+ }
// no items in query queue, start new
// select queue to process, priority by type
- else if ( iModifyQueue.Count() > 0 )
+ else if ( iModifyItemCount > 0 )
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() update thumbnails");
@@ -1136,54 +1299,77 @@
// query for object info
iQueryActive = ETrue;
iModify = ETrue;
- QueryL( iModifyQueue );
+ iUnknown = EFalse;
+ QueryL( EGenerationItemActionModify );
}
- else if ( iAddQueue.Count() > 0 )
+ else if ( iAddItemCount > 0 )
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() update 1st round thumbnails");
i2ndRound = EFalse;
-
+ iUnknown = EFalse;
// query for object info
iQueryActive = ETrue;
- QueryL( iAddQueue );
+ QueryL( EGenerationItemActionAdd );
}
- else if ( iRemoveQueue.Count() > 0 )
+ else if ( iDeleteItemCount > 0 )
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() delete thumbnails");
-
i2ndRound = EFalse;
-
+ iUnknown = EFalse;
// delete thumbs by URI
__ASSERT_DEBUG((iTMSession), User::Panic(_L("CThumbAGProcessor::RunL() !iTMSession "), KErrBadHandle));
if(iTMSession)
{
- HBufC* uri = iRemoveQueue[0];
- TN_DEBUG2( "void CThumbAGProcessor::RunL() delete %S", uri);
- CThumbnailObjectSource* source = NULL;
- TRAPD(err, source = CThumbnailObjectSource::NewL( *uri, KNullDesC));
-
- if(err == KErrNone)
- {
- iTMSession->DeleteThumbnails( *source );
+ TInt itemIndex(KErrNotFound);
+
+ for(TInt i=0;i<iGenerationQueue.Count() || itemIndex == KErrNotFound;i++)
+ {
+ if(iGenerationQueue[i].iItemAction == EGenerationItemActionDelete)
+ {
+ itemIndex = i;
+ }
}
- iRemoveQueue.Remove( 0 );
- delete source;
- delete uri;
-
- iActiveCount++;
- iActive = ETrue;
+
+ if(itemIndex >= 0)
+ {
+ if(!iGenerationQueue[itemIndex].iUri)
+ {
+ //URI is invalid
+ TN_DEBUG1( "void CThumbAGProcessor::RunL() unable to delete URI inbalid");
+ iGenerationQueue.Remove( itemIndex );
+ ActivateAO();
+ return;
+ }
+
+ TN_DEBUG2( "void CThumbAGProcessor::RunL() delete %S", iGenerationQueue[itemIndex].iUri);
+ CThumbnailObjectSource* source = NULL;
+ TRAPD(err, source = CThumbnailObjectSource::NewL( *iGenerationQueue[itemIndex].iUri, KNullDesC));
+
+ if(err == KErrNone)
+ {
+ iTMSession->DeleteThumbnails( *source );
+ }
+ delete source;
+
+ delete iGenerationQueue[itemIndex].iUri;
+ iGenerationQueue[itemIndex].iUri = NULL;
+ iGenerationQueue.Remove( itemIndex );
+
+ iActiveCount++;
+ }
}
}
- else if( i2ndRoundGenerateQueue.Count() > 0)
+ else if( i2ndAddItemCount > 0)
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() update 2nd round thumbnails");
// query for object info
iQueryActive = ETrue;
i2ndRound = ETrue;
- QueryL( i2ndRoundGenerateQueue );
+ iUnknown = EFalse;
+ QueryL( EGenerationItemAction2ndAdd );
}
TN_DEBUG1( "CThumbAGProcessor::RunL() - end" );
@@ -1212,18 +1398,22 @@
//move remainig IDs in query queue back to original queue
while(iQueryQueue.Count())
{
- if(aRestoreItems && iLastQueue)
+ if(!aRestoreItems )
{
- if(iLastQueue->FindInOrder(iQueryQueue[0], Compare) == KErrNotFound)
+ TThumbnailGenerationItem item;
+ item.iItemId = iQueryQueue[0];
+ TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
+
+ if(itemIndex >= 0)
{
- //ignore if fails
- iLastQueue->InsertInOrder(iQueryQueue[0], Compare);
+ delete iGenerationQueue[itemIndex].iUri;
+ iGenerationQueue[itemIndex].iUri = NULL;
+ iGenerationQueue.Remove(itemIndex);
}
}
iQueryQueue.Remove(0);
}
- iLastQueue = NULL;
-
+
TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() out" );
}
@@ -1239,15 +1429,20 @@
void CThumbAGProcessor::HarvestingUpdated(
HarvesterEventObserverType aHEObserverType,
HarvesterEventState aHarvesterEventState,
- TInt /*aItemsLeft*/ )
+ TInt aItemsLeft )
{
- TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d", aHEObserverType, aHarvesterEventState );
+ TN_DEBUG4( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d, aItemsLeft = %d", aHEObserverType, aHarvesterEventState, aItemsLeft );
- if(iShutdown)
+ if(iShutdown)
{
return;
}
+ if(!iHarvesterActivated)
+ {
+ iHarvesterActivated = ETrue;
+ }
+
#ifdef _DEBUG
if( aHEObserverType == EHEObserverTypePlaceholder)
{
@@ -1257,6 +1452,10 @@
{
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeOverall");
}
+ else if( aHEObserverType == EHEObserverTypeMMC)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeMMC");
+ }
#endif
//placeholder harvesting
@@ -1291,9 +1490,32 @@
else
{
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesting finished");
- TRAP_IGNORE(QueryPlaceholdersL());
+ //query present placeholders
+ TRAP_IGNORE(QueryPlaceholdersL( EFalse ));
+ iDoQueryAllItems = EFalse;
+ iPHHarvestingItemsLeftTemp = 0;
}
}
+
+ //restart mount timout if PH item count is increasing durin MMC harvesting
+ if(iMMCHarvesting && iPHHarvesting && aItemsLeft > iPHHarvestingItemsLeftTemp)
+ {
+ //if items count increasing, restart mount timeout
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- PH count increasing, restart mount timeout");
+
+ if(iMountTimer->IsActive())
+ {
+ iMountTimer->Cancel();
+ }
+
+ iMountTimer->Start( KMountTimeout, KMountTimeout, TCallBack(MountTimerCallBack, this));
+ }
+
+ //we are interestead of only PHs during MMC harvesting
+ if( iMMCHarvesting )
+ {
+ iPHHarvestingItemsLeftTemp = aItemsLeft;
+ }
}
//overall harvesting
else if ( aHEObserverType == EHEObserverTypeOverall)
@@ -1322,7 +1544,7 @@
if( iHarvesting )
{
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesterin started");
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting started");
CancelTimeout();
}
else
@@ -1330,6 +1552,11 @@
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting finished ");
// continue processing if needed
StartTimeout();
+
+ if(iMountTimer->IsActive())
+ {
+ iMountTimer->Cancel();
+ }
}
}
}
@@ -1361,17 +1588,34 @@
if( iMMCHarvesting )
{
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesterin started");
- if(iPreviousItemsLeft != KErrNotReady)
- {
- iPreviousItemsLeft = KErrNotReady;
- RProperty::Set(KTAGDPSNotification, KDaemonProcessing, iPreviousItemsLeft);
- }
+ UpdatePSValues(EFalse, ETrue);
+ iMMCHarvestingItemsLeftTemp = 0;
}
else
{
+ //activate timeout if overall harvesting is not active
+ if(!iHarvesting)
+ {
+ StartTimeout();
+ }
TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesting finished ");
}
}
+
+ //restart mount timout if MMC item count is still increasing
+ if(iMMCHarvesting && aItemsLeft > iMMCHarvestingItemsLeftTemp)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MMC count increasing, restart mount timeout");
+
+ if(iMountTimer->IsActive())
+ {
+ iMountTimer->Cancel();
+ }
+
+ iMountTimer->Start( KMountTimeout, KMountTimeout, TCallBack(MountTimerCallBack, this));
+ }
+
+ iMMCHarvestingItemsLeftTemp = aItemsLeft;
}
TN_DEBUG4( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d iMMCHarvesting == %d ", iHarvesting, iPHHarvesting, iMMCHarvesting);
@@ -1399,6 +1643,7 @@
//
void CThumbAGProcessor::CancelTimeout()
{
+ TN_DEBUG1( "CThumbAGProcessor::CancelTimeout()");
if(iPeriodicTimer->IsActive())
{
iPeriodicTimer->Cancel();
@@ -1417,16 +1662,10 @@
{
TN_DEBUG2( "CThumbAGrocessor::RunError() %d", aError);
- UpdatePSValues();
+ UpdatePSValues(EFalse, EFalse);
iActiveCount--;
- if(iActiveCount <= 0)
- {
- iActiveCount = 0;
- iActive = EFalse;
- }
-
ActivateAO();
// nothing to do
@@ -1439,23 +1678,16 @@
//
void CThumbAGProcessor::ActivateAO()
{
-#ifdef _DEBUG
- TN_DEBUG6( "CThumbAGProcessor::ActivateAO() items in queue Add = %d, Mod = %d, Del = %d, Query = %d, iPlaceholder = %d", iAddQueue.Count(), iModifyQueue.Count(), iRemoveQueue.Count(), iQueryQueue.Count(), iPlaceholderQueue.Count());
- TN_DEBUG2( "CThumbAGProcessor::ActivateAO() items in queue 2nd Add = %d", i2ndRoundGenerateQueue.Count());
- TN_DEBUG3( "CThumbAGProcessor::ActivateAO() iActive = %d, iActiveCount = %d", iActive, iActiveCount);
- TN_DEBUG3( "CThumbAGProcessor::ActivateAO() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting);
- TN_DEBUG4( "CThumbAGProcessor::ActivateAO() iIdle = %d, timer = %d, iForceRun = %d", iIdle, iPeriodicTimer->IsActive(), iForceRun);
- TN_DEBUG4( "CThumbAGProcessor::ActivateAO() iModify = %d, iQueryReady = %d, iProcessingCount = %d", iModify, iQueryReady, iProcessingCount);
-#endif
+ UpdateItemCounts();
if(iFormatting)
{
TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - FORMATTING - DAEMON ON PAUSE");
return;
}
-
+
//check if forced run needs to continue
- if (iModifyQueue.Count())
+ if ( iModifyItemCount || iUnknownItemCount > 0 )
{
SetForceRun( ETrue );
}
@@ -1465,7 +1697,7 @@
SetForceRun( EFalse );
}
- if( !IsActive() && !iShutdown && ((!iActive && !iQueryActive) || iForceRun ))
+ if( !IsActive() && !iShutdown && ((iActiveCount == 0 && !iQueryActive) || iForceRun ))
{
TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - Activated");
SetActive();
@@ -1473,7 +1705,7 @@
User::RequestComplete( statusPtr, KErrNone );
}
- UpdatePSValues();
+ UpdatePSValues(EFalse, EFalse);
}
// ---------------------------------------------------------------------------
@@ -1562,60 +1794,33 @@
{
TN_DEBUG2( "CThumbAGProcessor::RemoveFromQueues() aRemoveFromDelete == %d - begin", aRemoveFromDelete );
- TInt itemIndex = KErrNotFound;
+ TInt itemIndex(KErrNotFound);
for (int i=0; i< aIDArray.Count(); i++)
{
+ TThumbnailGenerationItem item;
+ item.iItemId = aIDArray[i];
TN_DEBUG2( "CThumbAGProcessor::RemoveFromQueues() - %d", aIDArray[i]);
- itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- iPlaceholderQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iPlaceholderQueue" );
- }
-
- itemIndex = iAddQueue.FindInOrder(aIDArray[i], Compare);
+ itemIndex = iGenerationQueue.FindInOrder(item, Compare);
if(itemIndex >= 0)
{
- iAddQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iAddQueue" );
- }
-
- itemIndex = i2ndRoundGenerateQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- i2ndRoundGenerateQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - i2ndRoundGenerateQueue" );
+ delete iGenerationQueue[itemIndex].iUri;
+ iGenerationQueue[itemIndex].iUri = NULL;
+ iGenerationQueue.Remove(itemIndex);
+ TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iGenerationQueue" );
}
-
- itemIndex = iModifyQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- iModifyQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iModifyQueue" );
-
- if( iModifyQueue.Count() == 0)
- {
- SetForceRun( EFalse );
- }
- }
-
- itemIndex = iQueryQueue.FindInOrder(aIDArray[i], Compare);
+
+ itemIndex = iQueryQueue.FindInOrder(aIDArray[i], CompareId);
if(itemIndex >= 0)
{
iQueryQueue.Remove(itemIndex);
TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iQueryQueue" );
}
-
- itemIndex = iPlaceholderQueue.FindInOrder(aIDArray[i], Compare);
- if(itemIndex >= 0)
- {
- iPlaceholderQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iPlaceholderQueue" );
- }
}
+ ActivateAO();
+
TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - end" );
}
@@ -1674,13 +1879,13 @@
CMdELogicCondition& rootCondition = iQueryAllItems->Conditions();
rootCondition.SetOperator( ELogicConditionOperatorOr );
- CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
+ CMdEObjectCondition& imageObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
- CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
+ CMdEObjectCondition& videoObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
- CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
+ CMdEObjectCondition& audioObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
- iQueryAllItems->FindL(KMaxTInt, KMaxQueryItems2);
+ iQueryAllItems->FindL(KMaxTInt, KMaxQueryBatchSize);
TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - end" );
}
@@ -1795,8 +2000,7 @@
{
iIdle = ETrue;
- if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() +
- iQueryQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 )
+ if(iGenerationQueue.Count() > 0 )
{
ActivateAO();
}
@@ -1848,10 +2052,10 @@
// Update KItemsleft PS value if changed
// ---------------------------------------------------------------------------
//
-void CThumbAGProcessor::UpdatePSValues(const TBool aDefine)
+void CThumbAGProcessor::UpdatePSValues(const TBool aDefine, const TBool aForce)
{
- TInt itemsLeft = iModifyQueue.Count() + iAddQueue.Count();
- TBool daemonProcessing = EFalse;
+ TInt itemsLeft(KErrNotReady);
+ TBool daemonProcessing = ETrue;
if(iShutdown)
{
@@ -1859,51 +2063,83 @@
RProperty::Set(KTAGDPSNotification, KItemsleft, 0 );
return;
}
-
- if(itemsLeft + i2ndRoundGenerateQueue.Count() + iRemoveQueue.Count() > 0 )
- {
- daemonProcessing = ETrue;
- }
-
- //adjust items left to containing also items not yet processed but removed from queue under processing
- if((iLastQueue == &iModifyQueue || iLastQueue == &iAddQueue) && !i2ndRound)
- {
- itemsLeft +=iQueryQueue.Count();
- }
-
- //cancel 2nd round generarion when there is items in 1st round queues
- if(itemsLeft && i2ndRound)
- {
- DeleteAndCancelQuery(ETrue);
- i2ndRound = EFalse;
- }
-
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft);
-
+
if(aDefine)
{
- TN_DEBUG1( "CThumbAGProcessor::UpdatePSValues() define");
- RProperty::Define(KTAGDPSNotification, KDaemonProcessing, RProperty::EInt);
- RProperty::Set(KTAGDPSNotification, KDaemonProcessing, 0);
- daemonProcessing = EFalse;
- RProperty::Define(KTAGDPSNotification, KItemsleft, RProperty::EInt);
- RProperty::Set(KTAGDPSNotification, KItemsleft, 0);
- iPreviousItemsLeft = 0;
+ TInt ret = RProperty::Define(KTAGDPSNotification, KDaemonProcessing, RProperty::EInt);
+
+ if( ret != KErrNone )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() define KDaemonProcessing ret = %d", ret);
+ }
+
+ ret = RProperty::Define(KTAGDPSNotification, KItemsleft, RProperty::EInt);
+
+ if( ret != KErrNone )
+ {
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() define KItemsleft ret = %d", ret);
+ }
}
- if( daemonProcessing != iPreviousDaemonProcessing)
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KDaemonProcessing == %d", daemonProcessing);
- iPreviousDaemonProcessing = daemonProcessing;
- RProperty::Set(KTAGDPSNotification, KDaemonProcessing, daemonProcessing);
- }
+ // set itemsleft = KErrNotReady (-18) and daemonProcessing = ETrue if
+ // - key is initalized
+ // - mount timer is pending
+ // - harvester observer is not yet activated
+ // - single unknown item exists in processing queue
+ // - forced
+ if( iMountTimer->IsActive() || aForce || aDefine || iUnknownItemCount
+ || !iHarvesterActivated )
+ {
+ daemonProcessing = ETrue;
+ itemsLeft = KErrNotReady;
+ }
+ else
+ {
+ itemsLeft = iAddItemCount + iModifyItemCount;
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft);
+
+ //cancel 2nd round generarion when there is items in 1st round queues
+ if(iAddItemCount && i2ndRound)
+ {
+ DeleteAndCancelQuery(ETrue);
+ i2ndRound = EFalse;
+ }
- if( itemsLeft != iPreviousItemsLeft)
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KItemsleft == %d", itemsLeft);
- iPreviousItemsLeft = itemsLeft;
- RProperty::Set(KTAGDPSNotification, KItemsleft, itemsLeft );
- }
+ if( iGenerationQueue.Count() )
+ {
+ daemonProcessing = ETrue;
+ }
+ else
+ {
+ daemonProcessing = EFalse;
+ }
+
+ if( daemonProcessing != iPreviousDaemonProcessing)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KDaemonProcessing == %d", daemonProcessing);
+ iPreviousDaemonProcessing = daemonProcessing;
+ TInt ret = RProperty::Set(KTAGDPSNotification, KDaemonProcessing, daemonProcessing);
+
+ if(ret != KErrNone )
+ {
+ TN_DEBUG3( "CThumbAGProcessor::UpdatePSValues() set KDaemonProcessing %d failed %d", daemonProcessing, ret);
+ }
+ }
+
+ if( itemsLeft != iPreviousItemsLeft)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KItemsleft == %d", itemsLeft);
+ iPreviousItemsLeft = itemsLeft;
+ TInt ret = RProperty::Set(KTAGDPSNotification, KItemsleft, itemsLeft );
+
+ if(ret != KErrNone )
+ {
+ TN_DEBUG3( "CThumbAGProcessor::UpdatePSValues() set KItemsleft %d failed %d", itemsLeft, ret);
+ }
+ }
+
}
// ---------------------------------------------------------------------------
@@ -1911,10 +2147,208 @@
// Comparison function for logaritmic use of queue arrays
// ---------------------------------------------------------------------------
//
-TInt CThumbAGProcessor::Compare(const TItemId& aLeft, const TItemId& aRight)
+
+TInt CThumbAGProcessor::Compare(const TThumbnailGenerationItem& aLeft, const TThumbnailGenerationItem& aRight)
+ {
+ return (aLeft.iItemId - aRight.iItemId);
+ }
+
+TInt CThumbAGProcessor::CompareId(const TItemId& aLeft, const TItemId& aRight)
{
return (aLeft - aRight);
}
+void CThumbAGProcessor::UpdateItemCounts()
+ {
+ TN_DEBUG1( "CThumbAGProcessor::UpdateItemCounts()");
+ iModifyItemCount = 0;
+ iDeleteItemCount = 0;
+ iAddItemCount = 0;
+ iUnknownItemCount = 0;
+ i2ndAddItemCount = 0;
+ iPlaceholderItemCount=0;
+ iCameraItemCount =0;
+ iImageItemCount=0;
+ iVideoItemCount=0;
+ iAudioItemCount=0;
+
+ for(TInt i=0; i < iGenerationQueue.Count(); i++)
+ {
+ TThumbnailGenerationItem& item = iGenerationQueue[i];
+
+ if(item.iItemAction == EGenerationItemActionModify)
+ {
+ iModifyItemCount++;
+ }
+
+ if(item.iItemAction == EGenerationItemActionDelete)
+ {
+ iDeleteItemCount++;
+ }
+
+ if(item.iItemType == EGenerationItemTypeUnknown)
+ {
+ iUnknownItemCount++;
+ }
+ if(item.iItemAction == EGenerationItemAction2ndAdd)
+ {
+ i2ndAddItemCount++;
+ }
+ if(item.iPlaceholder)
+ {
+ iPlaceholderItemCount++;
+ }
+ if(item.iItemType == EGenerationItemTypeCamera)
+ {
+ iCameraItemCount++;
+ }
+ if(item.iItemAction == EGenerationItemActionAdd )
+ {
+ iAddItemCount++;
+ }
+ if(item.iItemType == EGenerationItemTypeAudio)
+ {
+ iAudioItemCount++;
+ }
+ if(item.iItemType == EGenerationItemTypeVideo)
+ {
+ iVideoItemCount++;
+ }
+ if(item.iItemType == EGenerationItemTypeImage)
+ {
+ iImageItemCount++;
+ }
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iActiveCount = %d",
+ iActiveCount);
+ TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iPreviousItemsLeft = %d",
+ iPreviousItemsLeft);
+ TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iHarvesting == %d, iMMCHarvesting == %d, iPHHarvesting == %d, iMPXHarvesting == %d",
+ iHarvesting, iMMCHarvesting, iPHHarvesting, iMPXHarvesting);
+ TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iIdle = %d, iForegroundRun = %d, timer = %d, iForceRun = %d",
+ iIdle, iForegroundRun, iPeriodicTimer->IsActive(), iForceRun);
+ TN_DEBUG4( "CThumbAGProcessor::UpdateItemCounts() iModify = %d, iQueryReady = %d, iProcessingCount = %d",
+ iModify, iQueryReady, iProcessingCount);
+ TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iMountTimer = %d", iMountTimer->IsActive());
+ TN_DEBUG3( "CThumbAGProcessor::UpdateItemCounts() iGenerationQueue = %d, iQueryQueue = %d",
+ iGenerationQueue.Count(), iQueryQueue.Count());
+ TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iAddItemCount=%d, i2ndAddItemCount=%d, iModifyItemCount=%d, iDeleteItemCount=%d",
+ iAddItemCount, i2ndAddItemCount, iModifyItemCount, iDeleteItemCount );
+ TN_DEBUG3( "CThumbAGProcessor::UpdateItemCounts() iUnknownItemCount=%d, iPlaceholderItemCount=%d",
+ iUnknownItemCount, iPlaceholderItemCount);
+ TN_DEBUG4( "CThumbAGProcessor::UpdateItemCounts() iAudioItemCount=%d, iVideoItemCount=%d, iImageItemCount=%d",
+ iAudioItemCount, iVideoItemCount, iImageItemCount);
+ TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iCameraItemCount=%d", iCameraItemCount);
+
+ //compress queues when empty
+ if(!iGenerationQueue.Count())
+ {
+ iGenerationQueue.Compress();
+ }
+
+ if(!iQueryQueue.Count())
+ {
+ iQueryQueue.Compress();
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::MountTimerCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGProcessor::MountTimerCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::MountTimerCallBack()");
+ CThumbAGProcessor* self = static_cast<CThumbAGProcessor*>( aAny );
+
+ self->iMountTimer->Cancel();
+
+ //activate timeout if overall or mmc harvestig is not active
+ if(!self->iHarvesting && !self->iMMCHarvesting )
+ {
+ self->ActivateAO();
+ }
+
+ return KErrNone; // Return value ignored by CPeriodic
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::SetGenerationItemAction()
+// ---------------------------------------------------------------------------
+//
+void CThumbAGProcessor::SetGenerationItemAction( TThumbnailGenerationItem& aGenerationItem, TThumbnailGenerationItemType aItemType )
+ {
+ switch( aItemType )
+ {
+ case EGenerationItemTypeAudio:
+ aGenerationItem.iItemAction = EGenerationItemAction2ndAdd;
+ break;
+ case EGenerationItemTypeCamera:
+ aGenerationItem.iItemAction = EGenerationItemAction2ndAdd;
+ aGenerationItem.iPlaceholder = ETrue;
+ break;
+ case EGenerationItemTypeImage:
+ aGenerationItem.iItemAction = EGenerationItemActionAdd;
+ break;
+ case EGenerationItemTypeVideo:
+ //S^3 EGenerationItemActionAdd
+ //S^4 EGenerationItemAction2ndAdd
+ aGenerationItem.iItemAction = EGenerationItemActionAdd;
+ break;
+ default:
+ aGenerationItem.iItemAction = EGenerationItemActionResolveType;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGProcessor::SetGenerationItemType()
+// ---------------------------------------------------------------------------
+//
+void CThumbAGProcessor::SetGenerationItemType( TThumbnailGenerationItem& aGenerationItem, const TDefId aDefId )
+ {
+ if(aDefId == iImageObjectDef->Id())
+ {
+ aGenerationItem.iItemType = EGenerationItemTypeImage;
+ }
+ else if(aDefId == iAudioObjectDef->Id())
+ {
+ aGenerationItem.iItemType = EGenerationItemTypeAudio;
+ }
+ else if(aDefId == iVideoObjectDef->Id())
+ {
+ aGenerationItem.iItemType = EGenerationItemTypeVideo;
+ }
+ else
+ {
+ aGenerationItem.iItemType = EGenerationItemTypeUnknown;
+ }
+
+ SetGenerationItemAction( aGenerationItem, aGenerationItem.iItemType );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CThumbAGProcessor::AppendProcessingQueue()
+// -----------------------------------------------------------------------------
+//
+void CThumbAGProcessor::AppendProcessingQueue( TThumbnailGenerationItem& item )
+ {
+
+ TInt itemIndex = iGenerationQueue.FindInOrder( item, Compare );
+
+ if(itemIndex >= 0)
+ {
+ iGenerationQueue[itemIndex].iPlaceholder = item.iPlaceholder;
+ iGenerationQueue[itemIndex].iItemType = item.iItemType;
+ iGenerationQueue[itemIndex].iItemAction = item.iItemAction;
+ }
+ else
+ {
+ iGenerationQueue.InsertInOrder(item, Compare);
+ }
+ }
+
// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagvideoobserver.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -0,0 +1,343 @@
+/*
+* Copyright (c) 2006-2007 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: Thumbnail Auto Generate Daemon
+*
+*/
+
+
+#include <e32svr.h>
+#include <centralrepository.h>
+
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mdeobject.h>
+
+#include "thumbagvideoobserver.h"
+#include "thumbnaillog.h"
+#include "thumbnailmanagerconstants.h"
+#include "thumbnailmanagerprivatecrkeys.h"
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CThumbAGVideoObserver* CThumbAGVideoObserver::NewLC(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::NewLC() - begin" );
+
+ CThumbAGVideoObserver* self = new (ELeave) CThumbAGVideoObserver(aProcessor);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CThumbAGVideoObserver* CThumbAGVideoObserver::NewL(CThumbAGProcessor* aProcessor)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::NewL() - begin" );
+
+ CThumbAGVideoObserver* self = CThumbAGVideoObserver::NewLC(aProcessor);
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGVideoObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGVideoObserver::CThumbAGVideoObserver(CThumbAGProcessor* aProcessor)
+ : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::ConstructL()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - begin" );
+
+#ifdef _DEBUG
+ iAddCounter = 0;
+ iModCounter = 0;
+#endif
+
+ InitializeL();
+
+ TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGVideoObserver
+// ---------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::InitializeL()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - begin" );
+
+
+ TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - create observers" );
+
+ // create shutdown observer
+ if(iMDSShutdownObserver)
+ {
+ delete iMDSShutdownObserver;
+ iMDSShutdownObserver = NULL;
+ }
+ iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
+
+ if(iShutdownObserver)
+ {
+ delete iShutdownObserver;
+ iShutdownObserver = NULL;
+ }
+ iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
+ iShutdown = EFalse;
+
+ // MDS session reconnect timer
+ if (!iReconnect)
+ {
+ iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
+ }
+
+ TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - connect to MDS" );
+
+ if(iMdESession)
+ {
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ // connect to MDS
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
+
+ TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// ~CThumbAGVideoObserver
+// ---------------------------------------------------------------------------
+//
+CThumbAGVideoObserver::~CThumbAGVideoObserver()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - begin" );
+
+ iShutdown = ETrue;
+
+ delete iMDSShutdownObserver;
+ delete iShutdownObserver;
+
+ if(iReconnect)
+ {
+ iReconnect->Cancel();
+ delete iReconnect;
+ iReconnect = NULL;
+ }
+
+ if (iMdESession)
+ {
+ // 2 observers
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
+
+ delete iMdESession;
+ iMdESession = NULL;
+ }
+
+ TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGVideoObserver::HandleSessionOpened
+// -----------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleSessionOpened");
+
+ if (aError == KErrNone)
+ {
+ TRAPD( err, AddObserversL() );
+ if (err != KErrNone)
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened, AddObserversL error == %d", err );
+ }
+ }
+ else
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened error == %d", aError );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGVideoObserver::HandleSessionError
+// -----------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionError == %d", aError );
+ if (aError != KErrNone && !iSessionError)
+ {
+ iSessionError = ETrue;
+
+ if (!iShutdown)
+ {
+ if (!iReconnect->IsActive())
+ {
+ iReconnect->Start( KMdEReconnect, KMdEReconnect,
+ TCallBack(ReconnectCallBack, this));
+
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleSessionError() - reconnect timer started" );
+ }
+ }
+
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGVideoObserver::HandleObjectNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::HandleObjectNotification( CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray )
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - begin" );
+
+ // no processor or shutting down
+ if ( iShutdown || !iProcessor)
+ {
+ return;
+ }
+
+#ifdef _DEBUG
+ if (aType == ENotifyAdd)
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
+ iAddCounter = aObjectIdArray.Count();
+ }
+ else if (aType == ENotifyModify)
+ {
+ TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
+ iModCounter = aObjectIdArray.Count();
+ }
+#endif
+
+ if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - AddToQueueL" );
+
+ // Add event to processing queue by type and enable force run
+ RPointerArray<HBufC> dummyArray;
+ TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeVideo, aObjectIdArray, dummyArray, EFalse));
+ if (err != KErrNone)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - error adding to queue" );
+ }
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - bad notification" );
+ }
+
+#ifdef _DEBUG
+ TN_DEBUG3( "CThumbAGVideoObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
+ iModCounter = 0;
+ iAddCounter = 0;
+#endif
+
+ TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - end" );
+ }
+
+// -----------------------------------------------------------------------------
+// CThumbAGVideoObserver::ShutdownNotification
+// -----------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::ShutdownNotification()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification()" );
+
+ if (!iShutdown)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification() shutdown" );
+ iShutdown = ETrue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGVideoObserver::AddObserversL
+// ---------------------------------------------------------------------------
+//
+void CThumbAGVideoObserver::AddObserversL()
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - begin" );
+
+ CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
+ CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
+ CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
+ CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject );
+
+ // set observing conditions
+ CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ addCondition->AddObjectConditionL( videoDef );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( addCondition );
+
+ CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
+ modifyCondition->AddObjectConditionL( videoDef );
+ addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
+ CleanupStack::Pop( modifyCondition );
+
+ // add observer
+ iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
+
+ // modify observer
+ iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
+
+ TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - end" );
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbAGVideoObserver::ReconnectCallBack()
+// ---------------------------------------------------------------------------
+//
+TInt CThumbAGVideoObserver::ReconnectCallBack(TAny* aAny)
+ {
+ TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - reinitialize");
+
+ CThumbAGVideoObserver* self = static_cast<CThumbAGVideoObserver*>( aAny );
+
+ self->iReconnect->Cancel();
+
+ // reconnect to MDS
+ TRAP_IGNORE( self->InitializeL() );
+
+ TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - done");
+
+ return KErrNone;
+ }
+
+
+// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -69,6 +69,7 @@
}
delete iMimeTypeList;
+ iMimeTypeList = NULL;
TN_DEBUG1( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - end" );
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -205,9 +205,13 @@
CThumbnailObjectSource::~CThumbnailObjectSource()
{
delete iUri;
+ iUri = NULL;
delete iMimeType;
+ iMimeType = NULL;
delete iBuffer;
+ iBuffer = NULL;
delete iBitmap;
+ iBitmap = NULL;
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestqueue.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestqueue.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -166,6 +166,11 @@
iRequests.Remove( i );
}
}
+
+ if(!iRequests.Count())
+ {
+ iRequests.Compress();
+ }
TN_DEBUG3( "CThumbnailRequestQueue::RemoveCompleted() end - requests: %d, active requests: %d",
iRequests.Count(), iActiveRequests );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Thu Jul 15 18:59:26 2010 +0300
@@ -130,6 +130,10 @@
_LIT8 ( KGetInfoRowID, "SELECT MAX (ThumbnailInfo.rowID) FROM ThumbnailInfo" );
_LIT8 ( KGetDataRowID, "SELECT MAX (ThumbnailInfoData.rowID) FROM ThumbnailInfoData" );
+// counts
+_LIT8 ( KGetInfoCount, "SELECT COUNT(*) FROM ThumbnailInfo" );
+_LIT8 ( KGetInfoDataCount, "SELECT COUNT(*) FROM ThumbnailInfoData" );
+
// flush
_LIT8( KThumbnailMoveFromTempInfoToMainTable, "INSERT INTO ThumbnailInfo SELECT * FROM TempThumbnailInfo;");
_LIT8( KThumbnailMoveFromTempDataToMainTable, "INSERT INTO ThumbnailInfoData SELECT * FROM TempThumbnailInfoData;");
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -285,8 +285,11 @@
iUnmountedDrives.Close();
delete iFetchedChecker;
+ iFetchedChecker = NULL;
delete iShutdownObserver;
+ iShutdownObserver = NULL;
delete iProcessor;
+ iProcessor = NULL;
if(iReconnect)
{
@@ -306,7 +309,9 @@
iUnmountObservers.ResetAndDestroy();
delete iMMCObserver;
+ iMMCObserver = NULL;
delete iFormatObserver;
+ iFormatObserver = NULL;
THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
@@ -320,11 +325,13 @@
}
delete iScaler;
+ iScaler = NULL;
iBitmapPool.Close();
iFbsSession.Disconnect();
iRecognizer.Close();
iPluginInfoArray.ResetAndDestroy();
delete iCenrep;
+ iCenrep = NULL;
iFs.Close();
REComSession::FinalClose();
}
@@ -439,8 +446,7 @@
TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );
- // clean-up bitmap pool
-
+ // clean-up bitmap pool
THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
// const pointer to a non-const object
@@ -457,8 +463,8 @@
TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
}
- ref = bpiter.NextValue();
+ ref = bpiter.NextValue();
}
if ( iSessionCount <= 0 )
@@ -796,7 +802,7 @@
// -----------------------------------------------------------------------------
-// CThumbnailServer::GetProviderL()
+// CThumbnailServer::PreLoadProviders()
// -----------------------------------------------------------------------------
//
void CThumbnailServer::PreLoadProviders( )
@@ -806,7 +812,7 @@
for(TInt i=0; i< iPluginInfoArray.Count(); i++)
{
- TRAP(err, GetProviderL( iPluginInfoArray[i]->ImplementationUid()));
+ TRAP(err, GetProviderL( iPluginInfoArray[i]->ImplementationUid()));
}
}
@@ -829,20 +835,17 @@
// -----------------------------------------------------------------------------
//
TInt CThumbnailServer::DequeTask( const TThumbnailServerRequestId& aRequestId )
- {
-
+ {
TInt error = iProcessor->RemoveTask( aRequestId );
- // clean-up bitmap pool
-
+ // clean-up bitmap pool
THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
// const pointer to a non-const object
const TThumbnailBitmapRef* ref = bpiter.NextValue();
while ( ref )
- {
-
+ {
TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId );
if ( ref->iSession == aRequestId.iSession &&
@@ -852,10 +855,10 @@
bpiter.RemoveCurrent();
TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d",
- iBitmapPool.Count());
+ iBitmapPool.Count());
}
- ref = bpiter.NextValue();
+ ref = bpiter.NextValue();
}
return error;
@@ -1162,6 +1165,10 @@
// ignore errors
TRAP_IGNORE( StoreForDriveL( drive ));
+
+ TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft == %d", KErrNotReady);
+ RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady );
+
TInt index = iUnmountedDrives.Find( drive );
if(index >= KErrNone)
@@ -1766,7 +1773,7 @@
// ---------------------------------------------------------------------------
-// CThumbnailServer::ReconnectCallBack()
+// CThumbnailServer::UnmountCallBack()
// ---------------------------------------------------------------------------
//
TInt CThumbnailServer::UnmountCallBack(TAny* aAny)
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -55,6 +55,10 @@
CThumbnailServerSession::~CThumbnailServerSession()
{
Server()->DropSession(this);
+ delete iBitmap;
+ iBitmap = NULL;
+ delete iBuffer;
+ iBuffer = NULL;
}
@@ -1383,12 +1387,20 @@
TInt CThumbnailServerSession::ConvertSqlErrToE32Err( TInt aReason )
{
TN_DEBUG2("CThumbnailServerSession::ConvertSqlErrToE32Err(%d)", aReason);
- TInt e32Err;
+ TInt e32Err(aReason);
+
if ( aReason >= - 144 )
// magic: [-1..-144] is E32 error range
{
// E32 error value or non-negative value
- e32Err = aReason;
+ switch ( aReason )
+ {
+ case KErrServerTerminated:
+ e32Err = KErrCorrupt;
+ break;
+ default:
+ e32Err = aReason;
+ }
}
else
{
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -548,13 +548,15 @@
TInt column = 0;
TInt rowStatus = 0;
TInt64 inforows = -1;
+ TInt64 infocount = -1;
TInt64 datarows = -1;
+ TInt64 datacount = -1;
TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID );
if(ret < 0)
{
stmt.Close();
- TN_DEBUG1( "CThumbnailStore::CheckRowIDs() failed 1 %d");
+ TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoRowID failed %d");
return KErrNotSupported;
}
rowStatus = stmt.Next();
@@ -572,14 +574,39 @@
TPtrC errorMsg2 = iDatabase.LastErrorMessage();
TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
#endif
- return ret;
+ return KErrNotSupported;
+ }
+
+ ret = stmt.Prepare( iDatabase, KGetInfoCount );
+ if(ret < 0)
+ {
+ stmt.Close();
+ TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoCount failed %d");
+ return KErrNotSupported;
+ }
+ rowStatus = stmt.Next();
+
+ if ( rowStatus == KSqlAtRow)
+ {
+ infocount = stmt.ColumnInt64( column );
+ }
+
+ stmt.Close();
+
+ if(rowStatus < 0)
+ {
+#ifdef _DEBUG
+ TPtrC errorMsg2 = iDatabase.LastErrorMessage();
+ TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
+#endif
+ return KErrNotSupported;
}
ret = stmt.Prepare( iDatabase, KGetDataRowID );
if(ret < 0)
{
stmt.Close();
- TN_DEBUG1( "CThumbnailStore::CheckRowIDs() failed 2");
+ TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed");
return KErrNotSupported;
}
rowStatus = stmt.Next();
@@ -597,10 +624,40 @@
TPtrC errorMsg2 = iDatabase.LastErrorMessage();
TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
#endif
- return ret;
+ return KErrNotSupported;
+ }
+
+ ret = stmt.Prepare( iDatabase, KGetInfoDataCount );
+ if(ret < 0)
+ {
+ stmt.Close();
+ TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoDataCount failed %d");
+ return KErrNotSupported;
+ }
+ rowStatus = stmt.Next();
+
+ if ( rowStatus == KSqlAtRow)
+ {
+ datacount = stmt.ColumnInt64( column );
}
+
+ stmt.Close();
+
+ if(rowStatus < 0)
+ {
+#ifdef _DEBUG
+ TPtrC errorMsg2 = iDatabase.LastErrorMessage();
+ TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
+#endif
+ return KErrNotSupported;
+ }
+
+ TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows );
+ TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - infocount %Ld", infocount );
+ TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows );
+ TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datacount %Ld", datacount );
- if( inforows != datarows)
+ if( inforows != datarows || datacount != infocount)
{
TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" );
return KErrNotSupported;
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -211,7 +211,6 @@
void CThumbnailTask::ResetMessageData()
{
iMessage = RMessage2();
- iRequestId = TThumbnailServerRequestId();
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp Thu Jul 15 18:59:26 2010 +0300
@@ -183,6 +183,11 @@
TaskComplete(NULL);
}
+ if(!iTasks.Count())
+ {
+ iTasks.Compress();
+ }
+
TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - remaining task count: %d", iTasks.Count());
return res;