imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h
branchRCL_3
changeset 37 f759b6186ab5
parent 28 ff2fb7658ff7
child 38 2b4b06654caa
equal deleted inserted replaced
28:ff2fb7658ff7 37:f759b6186ab5
    30 #include <e32property.h>
    30 #include <e32property.h>
    31 #include <mpxcollectionobserver.h>
    31 #include <mpxcollectionobserver.h>
    32 #include "tmactivitymanager.h"
    32 #include "tmactivitymanager.h"
    33 #include "tmformatobserver.h"
    33 #include "tmformatobserver.h"
    34 #include "tmrpropertyobserver.h"
    34 #include "tmrpropertyobserver.h"
       
    35 #include "thumbnailmanagerconstants.h"
    35 
    36 
    36 //FORWARD DECLARATIONS
    37 //FORWARD DECLARATIONS
    37 class MMPXCollectionUtility;
    38 class MMPXCollectionUtility;
       
    39 
       
    40 
       
    41 enum TThumbnailGenerationItemType
       
    42       {
       
    43       EGenerationItemTypeUnknown,
       
    44       EGenerationItemTypeNotFound,
       
    45       EGenerationItemTypeCamera,
       
    46       EGenerationItemTypeAny,
       
    47       EGenerationItemTypeAudio,
       
    48       EGenerationItemTypeVideo,
       
    49       EGenerationItemTypeImage,
       
    50       EGenerationItemTypeItemCount
       
    51       };
       
    52 
       
    53   enum TThumbnailGenerationItemAction
       
    54       {
       
    55       EGenerationItemActionAdd,
       
    56       EGenerationItemActionDelete,
       
    57       EGenerationItemActionModify,
       
    58       EGenerationItemAction2ndAdd,
       
    59       EGenerationItemActionResolveType,
       
    60       EGenerationItemActionCount
       
    61       };
       
    62 
       
    63   struct TThumbnailGenerationItem
       
    64       {
       
    65       inline TThumbnailGenerationItem(): iItemId( KErrNotFound ), iItemType(EGenerationItemTypeUnknown), iItemAction(EGenerationItemActionAdd), iPlaceholder(EFalse), iUri(NULL){}
       
    66       inline ~TThumbnailGenerationItem(){delete iUri; iUri = NULL;}
       
    67       
       
    68       TItemId iItemId;
       
    69       TThumbnailGenerationItemType iItemType;
       
    70       TThumbnailGenerationItemAction iItemAction;
       
    71       TBool iPlaceholder;
       
    72       HBufC* iUri;
       
    73       };
    38 
    74 
    39 /**
    75 /**
    40  *  Processor object for handling thumb generation
    76  *  Processor object for handling thumb generation
    41  *
    77  *
    42  *  @since S60 v5.0
    78  *  @since S60 v5.0
   117      * Sets MdE Session
   153      * Sets MdE Session
   118      *
   154      *
   119      * @since S60 v5.0
   155      * @since S60 v5.0
   120      * @param aMdESession MdE Session
   156      * @param aMdESession MdE Session
   121      */
   157      */
   122     void SetMdESession( CMdESession* aMdESession );    
   158     void SetMdESessionL( CMdESession* aMdESession );    
   123     
   159     
   124     /**
   160     /**
   125      * Adds new IDs to queue
   161      * Adds new IDs to queue
   126      *
   162      *
   127      * @since S60 v5.0
   163      * @since S60 v5.0
   128      * @param aType TObserverNotificationType
   164      * @param aType TObserverNotificationType
       
   165 	 * @param TThumbnailGenerationItemType
   129      * @param aIDArray IDs for thumbnail creation
   166      * @param aIDArray IDs for thumbnail creation
   130      * @param aForce pass ETrue if processor is forced to run without waiting harvesting complete
   167      * @param aForce pass ETrue if processor is forced to run without waiting harvesting complete
   131      */
   168      */
   132     void AddToQueueL( TObserverNotificationType aType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
   169     void AddToQueueL( TObserverNotificationType aType, TThumbnailGenerationItemType aItemType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
   133     
   170     
   134     /**
   171     /**
   135      * Calls Thumbnail Manager to create thumbnails
   172      * Calls Thumbnail Manager to create thumbnails
   136      *
   173      *
   137      * @since S60 v5.0
   174      * @since S60 v5.0
   158     
   195     
   159     /**
   196     /**
   160      * QueryL
   197      * QueryL
   161      *
   198      *
   162      * @since S60 v5.0
   199      * @since S60 v5.0
   163      * @param aIDArray Item IDs to query
   200      * @param TThumbnailGenerationItemAction
   164      */
   201      */
   165     void QueryL( RArray<TItemId>& aIDArray );
   202     void QueryL( TThumbnailGenerationItemAction aType);
   166     
   203     
   167 	 /**
   204 	 /**
   168      * QueryPlaceholdersL
   205      * QueryPlaceholdersL
   169      *
   206      *
   170      * @since S60 v5.0
   207      * @since S60 v5.0
   171      */
   208 	 * @param aPresent item should not be present item
   172     void QueryPlaceholdersL();
   209      */
       
   210     void QueryPlaceholdersL(const TBool aPresent);
   173 
   211 
   174    	 /**
   212    	 /**
   175      * DeleteAndCancelQuery
   213      * DeleteAndCancelQuery
   176      *
   214      *
   177      * @since Symbian^3
   215      * @since Symbian^3
   258      * Update KItemsLeft PS value
   296      * Update KItemsLeft PS value
   259      * 
   297      * 
   260      * @since S60 v5.0
   298      * @since S60 v5.0
   261  	 * @param aDefine (re)define PS key before setting value
   299  	 * @param aDefine (re)define PS key before setting value
   262      */
   300      */
   263     void UpdatePSValues(const TBool aDefine = EFalse);
   301     void UpdatePSValues(const TBool aDefine, const TBool aForce);
   264        
   302        
   265     /**
   303     /**
   266      * Comparison function for logaritmic use of queue arrays
   304      * Comparison function for logaritmic use of queue arrays
   267      * 
   305      * 
   268      * @since S60 v5.0
   306      * @since S60 S^3
   269      */
   307      */
   270     static TInt Compare(const TItemId& aLeft, const TItemId& aRight);
   308     static TInt Compare(const TThumbnailGenerationItem& aLeft, const TThumbnailGenerationItem& aRight);
       
   309 	
       
   310 	 /**
       
   311      * Comparison function for logaritmic use of queue arrays
       
   312      * 
       
   313      * @since S60 S^3
       
   314      */
       
   315     static TInt CompareId(const TItemId& aLeft, const TItemId& aRight);
       
   316     
       
   317 	/**
       
   318      * Recalculate item counts
       
   319      * 
       
   320      * @since S60 S^3
       
   321      */
       
   322     void UpdateItemCounts();
       
   323 	
       
   324     /**
       
   325      * Callback for mount timeout
       
   326      *
       
   327      * @since S60 v5.0
       
   328      */
       
   329     static TInt MountTimerCallBack(TAny* aAny);
       
   330     
       
   331 	 /**
       
   332      * Set item's action from type
       
   333      *
       
   334      * @since S^3
       
   335      */
       
   336     void SetGenerationItemAction( TThumbnailGenerationItem& aGenerationItem, const TThumbnailGenerationItemType aItemType );
       
   337 	
       
   338      /**
       
   339      * Set item type property from TDedIf
       
   340      * @param aGenerationItem TThumbnailGenerationItem
       
   341      * @param aItemType TThumbnailGenerationItemType
       
   342      * @since S^3
       
   343      */
       
   344     void SetGenerationItemType( TThumbnailGenerationItem& aGenerationItem, const TDefId aDefId );
       
   345  
       
   346      /**
       
   347      * Append item to processing queue or update existing
       
   348      * @param aGenerationItem modified TThumbnailGenerationItem
       
   349      * @param aDefId items MDS object definition ID
       
   350      * @since S^3
       
   351      */
       
   352     void AppendProcessingQueue(TThumbnailGenerationItem& item );
   271         
   353         
   272 private:
   354 private:
   273     
   355     
   274     // not own
   356     // not own
   275     CMdESession* iMdESession;
   357     CMdESession* iMdESession;
   279     CThumbnailManager* iTMSession;
   361     CThumbnailManager* iTMSession;
   280     CMdEObjectQuery* iQuery;
   362     CMdEObjectQuery* iQuery;
   281     CMdEObjectQuery* iQueryAllItems;
   363     CMdEObjectQuery* iQueryAllItems;
   282     CMdEObjectQuery* iQueryPlaceholders;
   364     CMdEObjectQuery* iQueryPlaceholders;
   283     
   365     
   284     RArray<TItemId> iAddQueue;
   366     RArray<TThumbnailGenerationItem> iGenerationQueue;
   285     RArray<TItemId> iModifyQueue;
   367     //RPointerArray<HBufC> iRemoveQueue;
   286     RPointerArray<HBufC> iRemoveQueue;
       
   287     RArray<TItemId> iQueryQueue;
   368     RArray<TItemId> iQueryQueue;
   288     RArray<TItemId> iPlaceholderQueue;
       
   289     //not processing queue, used to keep KItemsLeft PS correct
       
   290     RArray<TItemId> i2ndRoundGenerateQueue;
       
   291 	//reference to current processing queue
       
   292     RArray<TItemId>* iLastQueue;
       
   293     
   369     
   294 	//background generation state
   370 	//background generation state
   295 	// EFalse = 1st round, create only grid size thumbnail for images and videos
   371 	// EFalse = 1st round, create only grid size thumbnail for images and videos
   296 	// ETrue = 2nds round, create all missing sizes for all media items
   372 	// ETrue = 2nds round, create all missing sizes for all media items
   297     TBool i2ndRound;    
   373     TBool i2ndRound;    
       
   374 	
       
   375 	// query state
       
   376 	// EFalse = normal mode
       
   377 	// ETrue = querying unknown items
       
   378     TBool iUnknown;
   298     
   379     
   299 	//MDS query issues
   380 	//MDS query issues
   300     TBool iQueryActive;
   381     TBool iQueryActive;
   301 	//MDS query complete
   382 	//MDS query complete
   302     TBool iQueryReady;
   383     TBool iQueryReady;
   303     
   384     
   304 	//Processing MDS itens which are modified
   385 	//Processing MDS itens which are modified
   305     TBool iModify;
   386     TBool iModify;
   306     TInt iProcessingCount;
   387     TUint iProcessingCount;
   307 
   388 
   308     //MDS harvester's overall state
   389     //MDS harvester's overall state
   309     TBool iHarvesting;
   390     TBool iHarvesting;
   310     TBool iHarvestingTemp;
   391     TBool iHarvestingTemp;
   311 
   392 
   316     //MDS Harvester's SD card harvesting state
   397     //MDS Harvester's SD card harvesting state
   317     TBool iMMCHarvesting;
   398     TBool iMMCHarvesting;
   318     TBool iMMCHarvestingTemp;
   399     TBool iMMCHarvestingTemp;
   319     
   400     
   320     CPeriodic* iPeriodicTimer;
   401     CPeriodic* iPeriodicTimer;
       
   402     CPeriodic* iMountTimer;
   321 
   403 
   322 	//MDS Harvester client
   404 	//MDS Harvester client
   323     RHarvesterClient iHarvesterClient;
   405     RHarvesterClient iHarvesterClient;
   324 
   406 
   325     //Set when running RunL() first time
   407     //Set when running RunL() first time
   326     TBool iInit;
   408     TBool iInit;
   327     
   409     
   328     //2nd phase init after MDE session is open
   410     //2nd phase init after MDE session is open
   329     TBool iInit2;
   411     TBool iInit2;
   330     
   412     
   331     // auto create
   413     // auto create values from centrep
   332     TBool iAutoImage;
   414     TBool iAutoImage;
   333     TBool iAutoVideo;
   415     TBool iAutoVideo;
   334     TBool iAutoAudio;
   416     TBool iAutoAudio;
   335     
   417     
   336     // in case of modified files force TN update
   418     // in case of modified files force TN update
   337     TBool iForceRun; 
   419     TBool iForceRun; 
   338     // controlled by Photos application to run TN generation on foreground
   420     // controlled by Photos application to run TN generation on foreground
   339     TBool iForegroundRun;
   421     TBool iForegroundRun;
   340 	//request pending in TNM side
   422 	//request pending in TNM side
   341     TBool iActive;
       
   342    
   423    
   343     CTMFormatObserver* iFormatObserver;
   424     CTMFormatObserver* iFormatObserver;
   344    
   425    
       
   426    //formating started
   345     TBool iFormatting;
   427     TBool iFormatting;
       
   428 	//TNM server session died
   346     TBool iSessionDied;
   429     TBool iSessionDied;
   347    
   430    
   348     TInt iActiveCount;
   431    //pending request count
       
   432     TUint iActiveCount;
   349     
   433     
   350     MMPXCollectionUtility* iCollectionUtility; // own
   434     MMPXCollectionUtility* iCollectionUtility; // own
   351     
   435     
   352 	//Flag is MPX harvesting or MTP synchronisation in progress
   436 	//Flag is MPX harvesting or MTP synchronisation in progress
   353     TBool iMPXHarvesting;
   437     TBool iMPXHarvesting;
   354 
   438 
   355     //overall status of device
   439     //overall status of device
   356     TBool iIdle;
   440     TBool iIdle;
   357     
   441     
       
   442 	//monitors device activity
   358     CTMActivityManager* iActivityManager;
   443     CTMActivityManager* iActivityManager;
   359     
   444     
   360 	//Observer foreground generation 
   445 	//Observer foreground generation 
   361     CTMRPropertyObserver* iForegroundGenerationObserver;
   446     CTMRPropertyObserver* iForegroundGenerationObserver;
   362     
   447     
   365     TBool iPreviousDaemonProcessing; 
   450     TBool iPreviousDaemonProcessing; 
   366 	//set ETrue when QueryAllItems needs to be run after placeholder query
   451 	//set ETrue when QueryAllItems needs to be run after placeholder query
   367     TBool iDoQueryAllItems;
   452     TBool iDoQueryAllItems;
   368     
   453     
   369     TBool iShutdown;
   454     TBool iShutdown;
   370 };
   455 	
       
   456 	//item counts
       
   457     TUint32 iModifyItemCount;
       
   458     TUint32 iImageItemCount;
       
   459     TUint32 iVideoItemCount;
       
   460     TUint32 iAudioItemCount;
       
   461     TUint32 iDeleteItemCount;
       
   462     TUint32 iAddItemCount;
       
   463     TUint32 iCameraItemCount;
       
   464     TUint32 iUnknownItemCount;
       
   465     TUint32 i2ndAddItemCount;
       
   466     TUint32 iPlaceholderItemCount;
       
   467     
       
   468     //for book keeping previous items left count got from MDS harvester
       
   469     TUint32 iMMCHarvestingItemsLeftTemp;
       
   470     TUint32 iPHHarvestingItemsLeftTemp;
       
   471     
       
   472 	//MdE object definitons used in query
       
   473     CMdEObjectDef* iImageObjectDef;
       
   474     CMdEObjectDef* iVideoObjectDef;
       
   475     CMdEObjectDef* iAudioObjectDef;
       
   476     TBool iHarvesterActivated;
       
   477   };
   371 
   478 
   372 #endif // THUMBAGPROCESSOR_H
   479 #endif // THUMBAGPROCESSOR_H